home *** CD-ROM | disk | FTP | other *** search
- /*------------------------------------------------------------------*/
- /* ADDMENU.C */
- /*------------------------------------------------------------------*/
- /* API ▒` ªí : 1. StartUp() ( in addmenu.c ) */
- /* 2. ShutDown() ( in addmenu.c ) */
- /* API ¿τ╝╞└] : addmenu.plb */
- /* ⌐IÑsñΦªí : SET LIBRARY TO ADDMENU ( ⌐IÑs StartUp() ) */
- /* SET LIBRARY TO ( ⌐IÑs ShutDown() ) */
- /*------------------------------------------------------------------*/
- #include <pro_ext.h>
-
- MENUID SysMenuId;
- MENUID PopupId;
- ITEMID PadId;
-
- void FAR SetClockOn()
- {
- _Execute("SET CLOCK ON");
- }
-
- void FAR SetClockOff()
- {
- _Execute("SET CLOCK OFF");
- }
-
- void FAR SetStatOn()
- {
- _Execute("SET STATUS ON");
- }
-
- void FAR SetStatOff()
- {
- _Execute("SET STATUS Off");
- }
-
- void FAR StartUp()
- {
- ITEMID Bar1_Id;
- ITEMID Bar2_Id;
- ITEMID Bar3_Id;
- ITEMID Bar4_Id;
-
- int Error;
- /*
- ╝WÑ[ñ@¡╙╖s¬║ÑDÑ\»α┐∩╢╡ (PAD) ª▄ FoxPro ñº¿t▓╬Ñ\»α¬φ│µñW
- */
- SysMenuId = _MenuId(_SYSMENU);
- PadId = _GetNewItemId(SysMenuId);
-
- if (_NewItem(SysMenuId, PadId, _LASTITEM, "E\\<nvironment"))
- {
- _Error(623); /* Ñ\»α┐∩╢╡╡L¬k│Q⌐w╕q */
- }
- /*
- ⌐w╕q╖s╝WñºÑDÑ\»α┐∩╢╡ (PAD) ¬║ñU⌐╘¼≡┼πªíÑ\»α¬φ│µ (POPUP)
- */
- PopupId = _GetNewMenuId();
-
- if (Error = _NewMenu(MPOPUP, PopupId))
- {
- _Error(-Error);
- }
-
- Bar1_Id = _GetNewItemId(PopupId);
- /*
- ╜╨¬`╖N: ╜╨⌐≤⌐IÑsÑ⌠ª≤¿ΣѪ _GetNewItemId() ½eѲ⌐IÑs _NewItem()
- */
- if (_NewItem(PopupId, Bar1_Id, _LASTITEM, "\\<1.CLOCK ON"))
- {
- _Error(623); /* Ñ\»α┐∩╢╡╡L¬k│Q⌐w╕q */
- }
-
- Bar2_Id = _GetNewItemId(PopupId);
-
- if (_NewItem(PopupId, Bar2_Id, _LASTITEM, "\\<2.CLOCK OFF"))
- {
- _Error(623); /* Ñ\»α┐∩╢╡╡L¬k│Q⌐w╕q */
- }
-
- Bar3_Id = _GetNewItemId(PopupId);
-
- if (_NewItem(PopupId, Bar3_Id, _LASTITEM, "\\<3.STATUS ON"))
- {
- _Error(623); /* Ñ\»α┐∩╢╡╡L¬k│Q⌐w╕q */
- }
-
- Bar4_Id = _GetNewItemId(PopupId);
-
- if (_NewItem(PopupId, Bar4_Id, _LASTITEM, "\\<4.STATUS OFF"))
- {
- _Error(623); /* Ñ\»α┐∩╢╡╡L¬k│Q⌐w╕q */
- }
-
- /*
- ▒NñU⌐╘¼≡┼πªíÑ\»α¬φ│µ (POPUP:PopupId) ªw╕m⌐≤╖s╝WñºÑDÑ\»α┐∩╢╡ (PAD:PadId) ñW
- */
- _SetItemSubMenu(SysMenuId, PadId, PopupId);
- /*
- │]⌐w╝÷┴Σ
- */
- _SetItemCmdKey(SysMenuId, PadId, 0x4100 | 49, "");
- _SetItemCmdKey(PopupId, Bar1_Id, 0x4100 | 120, "Alt+1");
- _SetItemCmdKey(PopupId, Bar2_Id, 0x4100 | 121, "Alt+2");
- _SetItemCmdKey(PopupId, Bar3_Id, 0x4100 | 122, "Alt+3");
- _SetItemCmdKey(PopupId, Bar4_Id, 0x4100 | 123, "Alt+4");
- /*
- │]⌐wªU¡╙ñlÑ\»α┐∩╢╡│Q┐∩╛▄½ß⌐╥¡n░⌡ªµñº▒`ªí
- */
- _OnSelection(PopupId, Bar1_Id, SetClockOn);
- _OnSelection(PopupId, Bar2_Id, SetClockOff);
- _OnSelection(PopupId, Bar3_Id, SetStatOn);
- _OnSelection(PopupId, Bar4_Id, SetStatOff);
- }
-
- void FAR ShutDown()
- {
- _DisposeItem(SysMenuId, PadId);
- _DisposeMenu(PopupId);
- }
-
- FoxInfo myFoxInfo[] =
- {
- {"STARTUP", StartUp, CALLONLOAD, ""},
- {"SHUTDOWN", ShutDown, CALLONUNLOAD, ""},
- };
-
- FoxTable _FoxTable =
- {
- (FoxTable FAR *)0,
- sizeof(myFoxInfo) / sizeof(FoxInfo),
- myFoxInfo
- };