4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include "bcmenubar.inc"
27 #include "bcmenupopup.inc"
28 #include "bcpixmap.inc"
29 #include "bcpopupmenu.inc"
30 #include "bcwindowbase.inc"
37 BC_MenuItem(const char *text, const char *hotkey_text = "", int hotkey = 0);
38 virtual ~BC_MenuItem();
40 friend class BC_MenuPopup;
43 int add_submenu(BC_SubMenu *submenu);
44 int set_checked(int value);
46 void set_text(const char *text);
48 void set_icon(BC_Pixmap *icon);
49 BC_Pixmap* get_icon();
50 void set_hotkey_text(const char *text);
51 int set_shift(int value = 1);
52 int set_alt(int value = 1);
53 void set_ctrl(int value = 1);
55 virtual int deactivate_submenus(BC_MenuPopup *exclude);
56 virtual int activate_submenu();
57 virtual int handle_event() { return 0; };
58 int dispatch_button_press();
59 int dispatch_button_release(int &redraw);
60 int dispatch_motion_event(int &redraw);
61 int dispatch_translation_event();
62 int dispatch_cursor_leave();
63 int dispatch_key_press();
64 int add_item(BC_MenuItem *item);
65 int initialize(BC_WindowBase *top_level, BC_MenuBar *menu_bar, BC_MenuPopup *menu_popup);
67 BC_WindowBase* get_top_level();
68 BC_PopupMenu* get_popup_menu();
69 BC_SubMenu *get_submenu();
71 void set_enabled(int v);
74 void draw_bar(int bx, int by, int bw);
75 void draw_title_bar();
77 BC_WindowBase *top_level;
79 BC_MenuPopup *menu_popup;
80 // Submenu if this item owns one.
82 // whether the cursor is over or not
84 // whether the cursor is over and the button is down
88 // not drawn if not enabled
94 // Hotkey requires shift
96 // Hotkey requires alt
99 // Character code of hotkey
101 // icon or 0 if there is no icon
103 // y position of this item set during menu activation
105 // height of item is set during menu activation