home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a120 / 1.ddi / API / ADDMENU.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-23  |  3.3 KB  |  133 lines

  1. /*------------------------------------------------------------------*/
  2. /* ADDMENU.C                                                        */
  3. /*------------------------------------------------------------------*/
  4. /* API ▒`  ªí : 1. StartUp()  ( in addmenu.c )                      */
  5. /*              2. ShutDown() ( in addmenu.c )                      */
  6. /* API ¿τ╝╞└] : addmenu.plb                                         */
  7. /* ⌐IÑsñΦªí   : SET LIBRARY TO ADDMENU ( ⌐IÑs StartUp()  )          */
  8. /*              SET LIBRARY TO         ( ⌐IÑs ShutDown() )          */
  9. /*------------------------------------------------------------------*/
  10. #include <pro_ext.h>
  11.  
  12. MENUID SysMenuId;
  13. MENUID PopupId;
  14. ITEMID PadId;
  15.  
  16. void FAR SetClockOn()
  17. {
  18.     _Execute("SET CLOCK ON");
  19. }
  20.  
  21. void FAR SetClockOff()
  22. {
  23.     _Execute("SET CLOCK OFF");
  24. }
  25.  
  26. void FAR SetStatOn()
  27. {
  28.     _Execute("SET STATUS ON");
  29. }
  30.  
  31. void FAR SetStatOff()
  32. {
  33.     _Execute("SET STATUS Off");
  34. }
  35.  
  36. void FAR StartUp()
  37. {
  38.         ITEMID Bar1_Id;
  39.         ITEMID Bar2_Id;
  40.         ITEMID Bar3_Id;
  41.         ITEMID Bar4_Id;
  42.  
  43.         int Error;
  44. /*
  45.     ╝WÑ[ñ@¡╙╖s¬║ÑDÑ\»α┐∩╢╡ (PAD) ª▄ FoxPro ñº¿t▓╬Ñ\»α¬φ│µñW
  46. */
  47.     SysMenuId = _MenuId(_SYSMENU);
  48.     PadId = _GetNewItemId(SysMenuId);
  49.  
  50.     if (_NewItem(SysMenuId, PadId, _LASTITEM, "E\\<nvironment"))
  51.     {
  52.         _Error(623); /* Ñ\»α┐∩╢╡╡L¬k│Q⌐w╕q */
  53.     }
  54. /*
  55.     ⌐w╕q╖s╝WñºÑDÑ\»α┐∩╢╡ (PAD) ¬║ñU⌐╘¼≡┼πªíÑ\»α¬φ│µ (POPUP)
  56. */
  57.     PopupId = _GetNewMenuId();
  58.  
  59.     if (Error = _NewMenu(MPOPUP, PopupId))
  60.     {
  61.         _Error(-Error);
  62.     }
  63.  
  64.     Bar1_Id = _GetNewItemId(PopupId);
  65. /*
  66.     ╜╨¬`╖N: ╜╨⌐≤⌐IÑsÑ⌠ª≤¿ΣѪ _GetNewItemId() ½eѲ⌐IÑs _NewItem()
  67. */
  68.     if (_NewItem(PopupId, Bar1_Id, _LASTITEM, "\\<1.CLOCK   ON"))
  69.     {
  70.         _Error(623); /* Ñ\»α┐∩╢╡╡L¬k│Q⌐w╕q */
  71.     }
  72.  
  73.     Bar2_Id = _GetNewItemId(PopupId);
  74.  
  75.     if (_NewItem(PopupId, Bar2_Id, _LASTITEM, "\\<2.CLOCK   OFF"))
  76.     {
  77.         _Error(623); /* Ñ\»α┐∩╢╡╡L¬k│Q⌐w╕q */
  78.     }
  79.  
  80.     Bar3_Id = _GetNewItemId(PopupId);
  81.  
  82.     if (_NewItem(PopupId, Bar3_Id, _LASTITEM, "\\<3.STATUS  ON"))
  83.     {
  84.         _Error(623); /* Ñ\»α┐∩╢╡╡L¬k│Q⌐w╕q */
  85.     }
  86.  
  87.     Bar4_Id = _GetNewItemId(PopupId);
  88.  
  89.     if (_NewItem(PopupId, Bar4_Id, _LASTITEM, "\\<4.STATUS  OFF"))
  90.     {
  91.         _Error(623); /* Ñ\»α┐∩╢╡╡L¬k│Q⌐w╕q */
  92.     }
  93.  
  94. /*
  95.     ▒NñU⌐╘¼≡┼πªíÑ\»α¬φ│µ (POPUP:PopupId) ªw╕m⌐≤╖s╝WñºÑDÑ\»α┐∩╢╡ (PAD:PadId) ñW
  96. */
  97.     _SetItemSubMenu(SysMenuId, PadId, PopupId);
  98. /*
  99.     │]⌐w╝÷┴Σ
  100. */
  101.     _SetItemCmdKey(SysMenuId, PadId, 0x4100 |  49, "");
  102.     _SetItemCmdKey(PopupId, Bar1_Id, 0x4100 | 120, "Alt+1");
  103.     _SetItemCmdKey(PopupId, Bar2_Id, 0x4100 | 121, "Alt+2");
  104.     _SetItemCmdKey(PopupId, Bar3_Id, 0x4100 | 122, "Alt+3");
  105.     _SetItemCmdKey(PopupId, Bar4_Id, 0x4100 | 123, "Alt+4");
  106. /*
  107.     │]⌐wªU¡╙ñlÑ\»α┐∩╢╡│Q┐∩╛▄½ß⌐╥¡n░⌡ªµñº▒`ªí
  108. */
  109.     _OnSelection(PopupId, Bar1_Id, SetClockOn);
  110.     _OnSelection(PopupId, Bar2_Id, SetClockOff);
  111.     _OnSelection(PopupId, Bar3_Id, SetStatOn);
  112.     _OnSelection(PopupId, Bar4_Id, SetStatOff);
  113. }
  114.  
  115. void FAR ShutDown()
  116. {
  117.     _DisposeItem(SysMenuId, PadId);
  118.     _DisposeMenu(PopupId);
  119. }
  120.  
  121. FoxInfo myFoxInfo[] =
  122. {
  123.     {"STARTUP",     StartUp,    CALLONLOAD,   ""},
  124.     {"SHUTDOWN",    ShutDown,   CALLONUNLOAD, ""},
  125. };
  126.  
  127. FoxTable _FoxTable =
  128. {
  129.     (FoxTable FAR *)0,
  130.     sizeof(myFoxInfo) / sizeof(FoxInfo),
  131.     myFoxInfo
  132. };
  133.