home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / df3os2.zip / MENUBAR.H < prev    next >
C/C++ Source or Header  |  1993-09-23  |  1KB  |  49 lines

  1. // -------- menubar.h 
  2.  
  3. #ifndef MENUBAR_H
  4. #define MENUBAR_H
  5.  
  6. #include "textbox.h"
  7. #include "popdown.h"
  8.  
  9. class MenuBarItem    {
  10. public:
  11.     String *title;       // menu bar selection label
  12.     int x1;              // 1st label position on bar
  13.     int x2;              // last  "      "     "   "
  14.     MenuSelection **ms;  // popdown selection list
  15.     PopDown *popdown;    // popdown window
  16.     void (*menuprep)();  // menu prep function
  17.     MenuBarItem(const char *Title, MenuSelection **Ms = 0,
  18.                             void (*MenuPrep)() = 0);
  19.     ~MenuBarItem() { if (title) delete title; }
  20. };
  21.  
  22. class MenuBar : public TextBox    {
  23.     MenuBarItem *menuitems; // list of popdowns
  24.     int menucount;          // count of popdowns
  25.     int selection;          // current selection on the bar
  26.     Bool ispoppeddown;      // True = a menu is down
  27.     DFWindow *oldfocus;     // previous focus
  28.     void Select();
  29.     Bool AcceleratorKey(int key);
  30.     Bool ShortcutKey(int key);
  31.     void ParentSized(int xdif, int ydif);
  32. public:
  33.     MenuBar(MenuBarItem *MenuItems, DFWindow *par);
  34.     ~MenuBar();
  35.     // -------- menubar API messages
  36.     void Keyboard(int key);
  37.     void LeftButton(int mx, int my);
  38.     Bool SetFocus();
  39.     void ResetFocus();
  40.     void Paint();
  41.     void Select(int sel);
  42.     void SetSelection(int sel);
  43. };
  44.  
  45. #endif
  46.  
  47.  
  48.  
  49.