20 #ifndef _MFORMS_MENUBAR_H_
21 #define _MFORMS_MENUBAR_H_
23 #include "base/trackable.h"
46 #ifndef DOXYGEN_SHOULD_SKIP_THIS
50 bool (*create_menu_bar)(MenuBar *item);
51 bool (*create_context_menu)(ContextMenu *item);
53 bool (*create_menu_item)(MenuItem *item,
const std::string &,
const MenuItemType type);
54 void (*set_title)(MenuItem *item,
const std::string&);
55 std::string (*get_title)(MenuItem *item);
56 void (*set_shortcut)(MenuItem *item,
const std::string&);
57 void (*set_enabled)(MenuBase *item, bool);
58 bool (*get_enabled)(MenuBase *item);
59 void (*set_checked)(MenuItem *item, bool);
60 bool (*get_checked)(MenuItem *item);
62 void (*insert_item)(MenuBase *menu,
int index, MenuItem *item);
63 void (*remove_item)(MenuBase *menu, MenuItem *item);
65 void (*popup_menu)(ContextMenu *menu,
int x,
int y);
87 MenuItem *find_item(
const std::string &name);
93 MenuItem *add_item_with_title(
const std::string &title, boost::function<
void ()> action,
const std::string &name=
"");
100 void insert_item(
int index,
MenuItem *item);
103 void set_enabled(
bool flag);
106 virtual void validate();
124 void set_title(
const std::string &title);
125 std::string get_title();
127 void set_shortcut(
const std::string &shortcut);
129 void set_checked(
bool flag);
135 void set_name(
const std::string &name);
140 void set_validator(
const boost::function<
bool ()> &slot);
144 virtual void validate();
163 boost::signals2::signal<void (MenuItem*)>*
signal_will_show() {
return &_signal_will_show; }
165 void set_item_enabled(
const std::string &item_name,
bool flag);
166 void set_item_checked(
const std::string &item_name,
bool flag);
168 void will_show_submenu_from(
MenuItem *item);
187 boost::signals2::signal<void (MenuItem*)>*
signal_will_show() {
return &_signal_will_show; }
189 void set_item_enabled(
const std::string &item_name,
bool flag);
190 void set_item_checked(
const std::string &item_name,
bool flag);
193 void will_show_submenu_from(
MenuItem *item);
195 void popup_at(
int x,
int y);