Merge CV, ver=5.1; ops/methods from HV, and interface from CV where possible
[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 remove_item(BC_MenuItem* item /* = 0 */, int recursive);
55         int total_menuitems();
56
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);
67         int get_key_x();
68         int get_w();
69         int draw_items();
70         BC_Popup* get_popup();
71         int cursor_inside();
72 private:
73         int get_dimensions();
74
75         ArrayList<BC_MenuItem *> menu_items;  
76         BC_WindowBase *top_level;
77         BC_MenuItem *menu_item;
78         BC_MenuBar *menu_bar;
79         BC_PopupMenu *popup_menu;
80         BC_Menu *menu;
81 // Dimensions relative to root window
82         int x, y, w, h; 
83 // Horizontal position of hotkey text
84         int key_x;
85 // Popup window that only exists when menu is down.
86         BC_Popup *popup; 
87         int active;
88         int type;
89 // Images for backgrounds
90         BC_Pixmap *window_bg;
91         BC_Pixmap *item_bg[3];
92         BC_Pixmap *check;
93 };
94
95 class BC_SubMenu : public BC_MenuPopup
96 {
97 public:
98         BC_SubMenu();
99         virtual ~BC_SubMenu();
100
101         int add_submenuitem(BC_MenuItem *item);
102 };
103
104
105
106
107 #endif