fdc8d0b0fb3d4e296e9df5e356fa5bb663c0e4c7
[goodguy/history.git] / cinelerra-5.1 / guicast / bcmenupopup.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  * 
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.
10  * 
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.
15  * 
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
19  * 
20  */
21
22 #ifndef BCMENUPOPUP_H
23 #define BCMENUPOPUP_H
24
25
26
27 #include "arraylist.h"
28 #include "bcmenu.inc"
29 #include "bcmenubar.inc"
30 #include "bcmenuitem.inc"
31 #include "bcpopup.inc"
32 #include "bcpopupmenu.inc"
33 #include "bcwindowbase.inc"
34
35
36 // A window that contains a menu.
37
38
39 class BC_MenuPopup
40 {
41 public:
42         BC_MenuPopup();
43         virtual ~BC_MenuPopup();
44
45         friend class BC_MenuItem;
46         friend class BC_PopupMenu;
47
48         int initialize(BC_WindowBase *top_level, 
49                 BC_MenuBar *menu_bar, 
50                 BC_Menu *menu, 
51                 BC_MenuItem *menu_item, 
52                 BC_PopupMenu *popup_menu);
53         int add_item(BC_MenuItem *item);
54         int del_item(BC_MenuItem* item);
55         int remove_item(BC_MenuItem* item);
56         int total_menuitems();
57
58 // Deactivates all submenus in a downward progression except for the exclude
59         int deactivate_submenus(BC_MenuPopup *exclude = 0);
60         int dispatch_button_press();
61         int dispatch_button_release();
62         int dispatch_key_press();
63         int dispatch_motion_event();
64         int dispatch_cursor_leave();
65         int dispatch_translation_event();
66         int deactivate_menu();
67         int activate_menu(int x, int y, int w, int h, int top_window_coords, int vertical_justify);
68         int get_key_x();
69         int get_w();
70         int draw_items();
71         BC_Popup* get_popup();
72         int cursor_inside();
73 private:
74         int get_dimensions();
75
76         ArrayList<BC_MenuItem *> menu_items;  
77         BC_WindowBase *top_level;
78         BC_MenuItem *menu_item;
79         BC_MenuBar *menu_bar;
80         BC_PopupMenu *popup_menu;
81         BC_Menu *menu;
82 // Dimensions relative to root window
83         int x, y, w, h; 
84 // Horizontal position of hotkey text
85         int key_x;
86 // Popup window that only exists when menu is down.
87         BC_Popup *popup; 
88         int active;
89         int type;
90 // Images for backgrounds
91         BC_Pixmap *window_bg;
92         BC_Pixmap *item_bg[3];
93         BC_Pixmap *check;
94 };
95
96 class BC_SubMenu : public BC_MenuPopup
97 {
98 public:
99         BC_SubMenu();
100         virtual ~BC_SubMenu();
101
102         int add_submenuitem(BC_MenuItem *item);
103 };
104
105
106
107
108 #endif