initial commit
[goodguy/history.git] / cinelerra-5.0 / guicast / bcmenu.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 BCMENU_H
23 #define BCMENU_H
24
25
26
27
28 #include "bcmenubar.inc"
29 #include "bcmenuitem.inc"
30 #include "bcmenupopup.inc"
31 #include "bcwindowbase.inc"
32
33
34 // Subscripts for menu images
35 #define MENU_BG 0
36 #define MENU_ITEM_UP 1
37 #define MENU_ITEM_HI 1
38 #define MENU_ITEM_DN 1
39
40
41
42 class BC_Menu
43 {
44 public:
45         BC_Menu(const char *text);
46         virtual ~BC_Menu();
47
48         friend class BC_MenuBar;
49
50 // Called by user to add items
51         int add_item(BC_MenuItem* menuitem);
52 // Remove the item ptr and the object
53         int remove_item(BC_MenuItem* item = 0);
54         int total_menuitems();
55         int set_text(char *text);
56
57 // Called by BC_Menubar
58         int initialize(BC_WindowBase *top_level, BC_MenuBar *menu_bar, int x, int y, int w, int h);
59         int dispatch_button_press();
60         int dispatch_button_release();
61         int dispatch_keypress();
62         int dispatch_motion_event();
63         int dispatch_cursor_leave();
64         int dispatch_translation_event();
65         int deactivate_menu();
66         int activate_menu();
67         int unhighlight();
68         void draw_items();
69
70 private:
71         int draw_title(int flash, int flush);
72 // If this menu is pulled down
73         int active;
74         char text[1024];
75         BC_WindowBase *top_level;
76 // Owner menubar if there is one
77         BC_MenuBar *menu_bar;
78 // Client popup
79         BC_MenuPopup *menu_popup;
80         int highlighted;
81 // Dimensions relative to menubar.
82         int x, y, w, h; 
83 };
84
85
86
87 #endif