00001 #ifndef BCMENU_H 00002 #define BCMENU_H 00003 00004 00005 00006 00007 #include "bcmenubar.inc" 00008 #include "bcmenuitem.inc" 00009 #include "bcmenupopup.inc" 00010 #include "bcwindowbase.inc" 00011 00012 00013 // Subscripts for menu images 00014 #define MENU_BG 0 00015 #define MENU_ITEM_UP 1 00016 #define MENU_ITEM_HI 1 00017 #define MENU_ITEM_DN 1 00018 00019 00020 00021 class BC_Menu 00022 { 00023 public: 00024 BC_Menu(char *text); 00025 virtual ~BC_Menu(); 00026 00027 friend class BC_MenuBar; 00028 00029 // Called by user to add items 00030 int add_item(BC_MenuItem* menuitem); 00031 // Remove the item ptr and the object 00032 int remove_item(BC_MenuItem* item = 0); 00033 int total_menuitems(); 00034 int set_text(char *text); 00035 00036 // Called by BC_Menubar 00037 int initialize(BC_WindowBase *top_level, BC_MenuBar *menu_bar, int x, int y, int w, int h); 00038 int dispatch_button_press(); 00039 int dispatch_button_release(); 00040 int dispatch_keypress(); 00041 int dispatch_motion_event(); 00042 int dispatch_cursor_leave(); 00043 int dispatch_translation_event(); 00044 int deactivate_menu(); 00045 int activate_menu(); 00046 int unhighlight(); 00047 void draw_items(); 00048 00049 private: 00050 int draw_title(); 00051 // If this menu is pulled down 00052 int active; 00053 char text[1024]; 00054 BC_WindowBase *top_level; 00055 // Owner menubar if there is one 00056 BC_MenuBar *menu_bar; 00057 // Client popup 00058 BC_MenuPopup *menu_popup; 00059 int highlighted; 00060 // Dimensions relative to menubar. 00061 int x, y, w, h; 00062 }; 00063 00064 00065 00066 #endif
1.4.4