00001 #ifndef BCMENUITEM_H 00002 #define BCMENUITEM_H 00003 00004 00005 #include "bcmenubar.inc" 00006 #include "bcmenupopup.inc" 00007 #include "bcpixmap.inc" 00008 #include "bcpopupmenu.inc" 00009 #include "bcwindowbase.inc" 00010 00011 00012 00013 class BC_MenuItem 00014 { 00015 public: 00016 BC_MenuItem(char *text, char *hotkey_text = "", int hotkey = 0); 00017 virtual ~BC_MenuItem(); 00018 00019 friend class BC_MenuPopup; 00020 00021 void reset(); 00022 int add_submenu(BC_SubMenu *submenu); 00023 int set_checked(int value); 00024 int get_checked(); 00025 void set_text(char *text); 00026 char* get_text(); 00027 void set_icon(BC_Pixmap *icon); 00028 BC_Pixmap* get_icon(); 00029 void set_hotkey_text(char *text); 00030 int set_shift(int value = 1); 00031 int set_alt(int value = 1); 00032 00033 int deactivate_submenus(BC_MenuPopup *exclude); 00034 int activate_submenu(); 00035 virtual int handle_event() { return 0; }; 00036 int dispatch_button_press(); 00037 int dispatch_button_release(int &redraw); 00038 int dispatch_motion_event(int &redraw); 00039 int dispatch_translation_event(); 00040 int dispatch_cursor_leave(); 00041 int dispatch_key_press(); 00042 int add_item(BC_MenuItem *item); 00043 int initialize(BC_WindowBase *top_level, BC_MenuBar *menu_bar, BC_MenuPopup *menu_popup); 00044 int draw(); 00045 BC_WindowBase* get_top_level(); 00046 BC_PopupMenu* get_popup_menu(); 00047 00048 private: 00049 BC_WindowBase *top_level; 00050 BC_MenuBar *menu_bar; 00051 BC_MenuPopup *menu_popup; 00052 // Submenu if this item owns one. 00053 BC_SubMenu *submenu; 00054 // whether the cursor is over or not 00055 int highlighted; 00056 // whether the cursor is over and the button is down 00057 int down; 00058 // check box 00059 int checked; 00060 // title 00061 char *text; 00062 // text of hotkey 00063 char *hotkey_text; 00064 // Hotkey requires shift 00065 int shift_hotkey; 00066 // Hotkey requires alt 00067 int alt_hotkey; 00068 // Character code of hotkey 00069 int hotkey; 00070 // icon or 0 if there is no icon 00071 BC_Pixmap *icon; 00072 // y position of this item set during menu activation 00073 int y; 00074 // height of item is set during menu activation 00075 int h; 00076 }; 00077 00078 00079 00080 #endif
1.4.4