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
27 #include "arraylist.h"
29 #include "bcmenubar.inc"
30 #include "bcmenuitem.inc"
31 #include "bcpopup.inc"
32 #include "bcpopupmenu.inc"
33 #include "bcwindowbase.inc"
36 // A window that contains a menu.
43 virtual ~BC_MenuPopup();
45 friend class BC_MenuItem;
46 friend class BC_PopupMenu;
48 int initialize(BC_WindowBase *top_level,
51 BC_MenuItem *menu_item,
52 BC_PopupMenu *popup_menu);
53 int add_item(BC_MenuItem *item);
54 int remove_item(BC_MenuItem* item /* = 0 */, int recursive);
55 int total_menuitems();
57 // Deactivates all submenus in a downward progression except for the exclude
58 int deactivate_submenus(BC_MenuPopup *exclude = 0);
59 int dispatch_button_press();
60 int dispatch_button_release();
61 int dispatch_key_press();
62 int dispatch_motion_event();
63 int dispatch_cursor_leave();
64 int dispatch_translation_event();
65 int deactivate_menu();
66 int activate_menu(int x, int y, int w, int h, int top_window_coords, int vertical_justify);
70 BC_Popup* get_popup();
75 ArrayList<BC_MenuItem *> menu_items;
76 BC_WindowBase *top_level;
77 BC_MenuItem *menu_item;
79 BC_PopupMenu *popup_menu;
81 // Dimensions relative to root window
83 // Horizontal position of hotkey text
85 // Popup window that only exists when menu is down.
89 // Images for backgrounds
91 BC_Pixmap *item_bg[3];
95 class BC_SubMenu : public BC_MenuPopup
99 virtual ~BC_SubMenu();
101 int add_submenuitem(BC_MenuItem *item);