gltk
0.3
a C++ widget library built on GLUT
|
Test use of ComboBoxText widget.
#include <gltk.hh> using namespace gltk; class ExampleWindow : public Window { public: ExampleWindow() { set_title("ComboBoxText example"); cmb.append("something"); cmb.append("something else"); cmb.append("something or other"); add(cmb); cmb.signal_changed() .connect(sigc::mem_fun(this, & ExampleWindow::on_combo_changed)); show_all_children(); } virtual ~ExampleWindow() {} protected: void on_combo_changed() { std::string text = cmb.get_active_text(); if(!(text.empty())) std::cout << "Combo changed: " << text << std::endl; } ComboBoxText cmb; }; int main(int argc, char *argv[]) { Main kit(argc, argv); ExampleWindow window; Main::run(window); return 0; }