home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / yacl-012.zip / uidemo / menu_dbl / main.cxx < prev    next >
C/C++ Source or Header  |  1995-04-08  |  2KB  |  72 lines

  1.  
  2.  
  3. #include "ui/menu.h"
  4. #include "ui/applic.h"
  5. #include "ui/composit.h"
  6.  
  7. #include "menudrv.h"
  8. #include "ids.h"
  9.  
  10. #ifdef __BORLANDC__
  11. extern unsigned _stklen = 35000;
  12. #endif
  13.  
  14. UI_MenuItemDescriptor App1Submenu [] = {
  15.   {"A one",          ID_SUBMENU1}
  16. , {"A two",          ID_SUBMENU2}
  17. , {NULL,                       0}
  18. };
  19.  
  20. UI_MenuItemDescriptor App1Menu [] = {
  21.   {"&Jan",           ID_JAN,       NULL       }
  22. , {"&Feb",           ID_FEB,       NULL       }
  23. , {"&Mar",           ID_MAR,       App1Submenu}
  24. , {UIMenu_Separator, NULL,         NULL       }
  25. , {"&Apr",           ID_APR,       NULL       }
  26. , {"Ma&y",           ID_MAY,       NULL       }
  27. , {NULL,             0,            NULL       }
  28. };
  29.  
  30. UI_MenuItemDescriptor App2Menu [] = {
  31.     {"Monday",       ID_MON}
  32.   , {"Tuesday",      ID_TUE}
  33.   , {"Wednesday",    ID_WED}
  34.   , {0,                   0}
  35. };
  36.  
  37.  
  38. UI_MenuItemDescriptor MainMenuDesc [] = {
  39.     {"&One",        ID_APP1,   App1Menu}
  40.   , {"&Two",        ID_APP2,   App2Menu}
  41.   , {NULL  ,              0,   NULL    }
  42. };
  43.  
  44.  
  45.  
  46. typedef CL_Binding<MenuDriver> MenuBinding;
  47.  
  48.  
  49. // ======================== Main program ===========================
  50.  
  51.  
  52. int UI_Application::Main (int, char* [])
  53. {
  54.     UI_CompositeVObject* root = new UI_CompositeVObject
  55.         (NULL, NULL, FALSE, UI_Rectangle (100, 100, 250, 250));
  56.     MakeTopWindow (root);
  57.     root->Title() = "Parent window";
  58.     UI_MenuBar*     mainMenu =  new UI_MenuBar (root, MainMenuDesc);
  59.     MenuDriver driver;
  60.     driver.Setup (mainMenu);
  61.  
  62.     UI_CompositeVObject* child = new UI_CompositeVObject
  63.         (root, NULL, FALSE, UI_Rectangle (200, 200, 250, 250));
  64.     child->Title() = "Child window";
  65.     UI_MenuBar* childMenu =  new UI_MenuBar (child, MainMenuDesc);
  66.     MenuDriver childDriver;
  67.     childDriver.Setup (childMenu);
  68.     Run();
  69.     return 0;
  70. }
  71.  
  72.