29 #include <cwidget/generic/util/bool_accumulate.h> 47 std::wstring description;
57 menu_item(
const std::wstring &_title,
const std::string &_binding,
58 const std::wstring &_description);
60 std::wstring get_title()
const {
return title;}
61 std::string get_binding()
const {
return binding;}
62 std::wstring get_description()
const {
return description;}
63 chtype get_hotkey()
const {
return hotkey;}
77 sigc::signal0<bool, util::accumulate_or>
enabled;
89 enum item_types {MENU_ITEM, MENU_SEPARATOR, MENU_END} item_type;
92 const char *
item_name, *item_binding, *item_description;
100 menu_info(item_types type,
const char *name,
const char *binding,
101 const char *description, sigc::slot0<void> slot);
103 menu_info(item_types type,
const char *name,
const char *binding,
104 const char *description, sigc::slot0<void> *slot);
106 menu_info(item_types type,
const char *name,
const char *binding,
107 const char *description, sigc::slot0<void> slot,
110 menu_info(item_types type,
const char *name,
const char *binding,
111 const char *description, sigc::slot0<void> *slot,
117 const menu_info MENU_SEPARATOR(menu_info::MENU_SEPARATOR);
118 const menu_info MENU_END(menu_info::MENU_END);
122 typedef std::vector<menu_item *> itemlist;
129 itemlist::size_type cursorloc;
132 itemlist::size_type startloc;
146 void update_startloc();
149 bool selectable(itemlist::size_type pos);
152 void set_cursor(itemlist::size_type pos);
157 void highlight_current();
165 itemlist::size_type next_selectable(itemlist::size_type pos);
174 itemlist::size_type prev_selectable(itemlist::size_type pos);
182 void sanitize_cursor(
bool forward);
211 bool get_cursorvisible();
212 point get_cursorloc();
215 int height_request(
int width);
221 void move_selection_up();
224 void move_selection_down();
227 void move_selection_top();
230 void move_selection_bottom();
232 virtual bool focus_me();
233 virtual void paint(
const style &st);
234 virtual void dispatch_mouse(
short id,
int x,
int y,
int z, mmask_t bstate);
239 sigc::signal1<void, menu_item *> item_highlighted;
242 sigc::signal0<void> menus_goaway;
245 static void init_bindings();
Provides a simple mechanism for passing in optional slots to a function.
Support for defining and remapping keybindings.