1 #include <msp/gltk/dropdown.h>
2 #include <msp/strings/format.h>
3 #include "dropdowndemo.h"
8 DropdownDemo::DropdownDemo()
10 set_layout(new GLtk::Layout);
12 GLtk::Dropdown *drp = new GLtk::Dropdown(categories);
13 drp->signal_item_selected.connect(sigc::mem_fun(this, &DropdownDemo::category_selected));
16 categories.append("Arabic numerals");
17 categories.append("Roman numerals");
18 categories.append("Lowercase letters");
19 categories.append("Uppercase letters");
21 GLtk::Widget *prev = drp;
22 drp = new GLtk::Dropdown(values);
25 layout->add_constraint(*drp, GLtk::Layout::BELOW, *prev);
26 layout->add_constraint(*drp, GLtk::Layout::ALIGN_LEFT, *prev);
27 layout->add_constraint(*drp, GLtk::Layout::ALIGN_RIGHT, *prev);
30 void DropdownDemo::category_selected(unsigned i)
35 for(unsigned j=0; j<=26; ++j)
36 values.append(format("%d", j));
40 for(unsigned j=1; j<=26; ++j)
42 string r = string(j/10, 'X');
53 r += string(j%5, 'I');
60 for(unsigned j=0; j<26; ++j)
61 values.append(string(1, 'a'+j));
65 for(unsigned j=0; j<26; ++j)
66 values.append(string(1, 'A'+j));