5 #include <F_Text_Display.H>
7 #include <F_Menu_Item.H>
12 class F_Menu : public F_Widget {
14 F_Group <F_Menu_Item *> items;
15 const F_Menu_Item *value_;
16 // int type; // F_HORIZONTAL/F_VERTICAL
17 F_Button_State_t state_;
21 bool handle(F_Event_t &ev);
25 F_Menu(coord_t x, coord_t y, dim_t w, dim_t h,
26 const char *label = 0) : F_Widget(x, y, w + 1, h + 1, label) {
28 state_ = F_BUTTON_NORMAL;
31 ~F_Menu() { clear(); }
32 int size() { return items.size(); }
35 for (int i = 0; i < size(); i++)
38 int add(const char *l, F_Callback *cb = 0, void *d = 0) {
39 F_Menu_Item *mi = new F_Menu_Item(l, cb, d);
40 items.push_back(mi, items.size());
43 return items.size() - 1;
46 void mode(int i, int flags) { items[i]->flags = flags; }
47 const F_Menu_Item *value() const { return value_; }
48 int value(int i) { return items[i]->value(); }
49 void set(int i) { return items[i]->set(); }
50 const char *text() const { return value_ ? value_->text() : 0; }
51 const char *text(int i) { return items[i]->text(); }
52 void callback(int i, F_Callback *cb, void *d = 0) {
53 items[i]->callback(cb, d);
55 friend class F_Menu_Button;