include/df/menu.hpp

00001 class MenuButton : public Label {
00002   public:
00003     void Draw();
00004     void MouseOver(int, int, int);
00005 };
00006 
00007 struct MenuBarItem {
00008   MenuButton item;
00009   PopupMenu *menu;
00010   uint32 xl;
00011 };
00012 
00013 class MenuBar : public Element {
00014   _PROTECTED_:
00015     List<MenuBarItem*> list;
00016     uint32 xl;  //current xlength
00017     Font *fnt;
00018   public:
00019     MenuBar() {
00020       xl = 0;
00021     }
00022     ~MenuBar();
00023     void Init(Font *fnt);
00024     BOOL Create(int _xpos, int _ypos, int _x, int _y, int _Style, Element *_Parent);
00025     BOOL Add(char *label, PopupMenu *);
00026     //    BOOL Del(uint32 idx);
00027     void Draw();
00028     void Click(int, int, int);
00029     //Show(), Hide()
00030 };
00031 
00032 //13x13 checkmark for PopupMenu
00033 class PopupMenuCheck : public Bitmap {
00034   public:
00035     PopupMenuCheck();
00036 };
00037 
00038 extern PopupMenuCheck PopupMenuCheckImage;
00039 
00040 //16x16 arrow for submenu indication
00041 class PopupMenuArrow : public Bitmap {
00042   public:
00043     PopupMenuArrow();
00044 };
00045 
00046 extern PopupMenuArrow PopupMenuArrowImage;
00047 
00048 struct PopupMenuItem {
00049   uint32 ID;      //user-defined
00050   Bitmap icon1;  //check or user-defined
00051   BOOL icon1show;
00052   MenuButton label;
00053   Bitmap icon2;  //arrow to submenu
00054   PopupMenu *submenu;
00055 };
00056 
00057 class PopupMenu : public Window {
00058   _PROTECTED_:
00059     Thread *This;
00060     SpreadSheetCombo ss;
00061     List<PopupMenuItem*> list;
00062     PopupMenu *Parent;  //if we need to close it
00063     PopupMenu *ActiveChild;
00064     Font *fnt;
00065   public:
00066     void Init(Font *fnt);
00067     BOOL Create(int _xpos, int _ypos, int _x, int _y, int _Style, Element *_Parent);
00068     BOOL Add(char *label, uint32 ID, Bitmap *icon = (Bitmap*)NULL, PopupMenu *_submenu = (PopupMenu *)NULL);  //icon may be NULL, or &PopupMenuCheckImage or &user-defined
00069     //    void AddSeperator();
00070     //    void Del(uint32 idx);
00071     void ShowIcon(uint32 idx);
00072     void HideIcon(uint32 idx);
00073     void ToggleIcon(uint32 idx);
00074     void Show();
00075     void Hide();
00076     void HideAll();
00077     void Popup(int x, int y);  //calls SetPos() then Show()
00078     //    void EnableIdx();
00079     //    void DisableIdx();
00080     void Click(int, int, int);
00081     void MouseDown(int, int, int);
00082     void MouseDown2(int, int, int);
00083 };
00084 

Generated on Mon Mar 5 09:49:14 2007 for DigiForce by  doxygen 1.4.7