home *** CD-ROM | disk | FTP | other *** search
- /*------------------------------------------------------------------*/
- /* FOXEVENT.C */
- /*------------------------------------------------------------------*/
- /* API ▒` ªí : 1. ActivateEvent() (in FOXEVENT.C) */
- /* 2. DeActivateEvent() (in FOXEVENT.C) */
- /* 3. PutInt() (in FOXEVENT.C) */
- /* 4. ChkNulls() (in FOXEVENT.C) */
- /* 5. ListFindWindow() (in FOXEVENT.C) */
- /* 6. ChkModifiers() (in FOXEVENT.C) */
- /* 7. ListEvent() (in FOXEVENT.C) */
- /* 8. EventHandler() (in FOXEVENT.C) */
- /* API ¿τ╝╞└] : FOXEVENT.PLB */
- /* ⌐IÑsñΦªí : SET LIBRARY TO FOXEVENT.PLB(⌐IÑs ActivateEvent() ) */
- /* SET LIBRARY TO (⌐IÑs DeActivateEvent()) */
- /*------------------------------------------------------------------*/
-
- #include <pro_ext.h>
-
-
- #define nl _PutChr(0x0a);
-
-
- int eventid; /* º┌¡╠¬║¿╞Ñ≤│B▓z╛╣ */
- long count_nulls=0; /* Ñ╬¿╙▓╓¡p╡Ω╡L¿╞Ñ≤ñºª╕╝╞¬║▓╓¡p¡p╝╞╛╣ */
-
-
-
- /* ª╣▒`ªí▒N▒╡ª¼ñ@¡╙¬°╛π╝╞¿├▒N¿Σ╕mñJñ@¡╙ Value ╡▓║c┼Θññ */
- /* , ╡M½ßªA▒Nª╣╡▓║c┼Θ┐ΘÑX */
-
- PutInt(unsigned long number)
- {
- Value val;
-
-
- val.ev_type = 'I';
- val.ev_width = 10;
- val.ev_long = number;
- _PutValue(&val);
-
-
- }
-
-
-
- ChkNulls()
- {
-
- if (count_nulls) /* └╦¼d¼Oº_ñwª│╡Ω╡L¿╞Ñ≤│Q│B▓z */
- {
- _Execute("CLEAR");
- _PutStr("\n\nñw │B ▓z ñº ╡Ω ╡L ¿╞ Ñ≤ ¬║ ╝╞ Ñ╪ : ");
- PutInt(count_nulls);
- count_nulls = 0; /* ▒N¡p╝╞╛╣¡½│]¼░╣s */
- }
-
- }
-
-
-
-
- ListFindWindow(WHandle FAR *window, Point win_point)
- {
- int where;
-
-
- where = _FindWindow(window, win_point);
- _PutStr("▒z⌐≤╡°╡íñWñºª≤ª∞╕m½÷ñU╖╞╣½Ñ¬½÷╢s : ");
- switch (where)
- {
- case inBorder:
- _PutStr("╡°╡íñº├Σ¼╔ñW\n");
- break;
- case inHelp:
- _PutStr("╗▓ºU╗í⌐·(Help)╡°╡íññ\n");
- break;
- case inContent:
- _PutStr("╡°╡íñºñσªrñ║«e░╧ññ\n");
- break;
- case inDrag:
- _PutStr("╡°╡íñº│╗║▌╝╨├D░╧(ÑτºYÑiÑ╬¿╙▓oñ▐╡°╡íñº│╗║▌├Σ¼╔)ñW \n");
- break;
- case inGrow:
- _PutStr("▒▒¿ε╡°╡íñjñpñº╝╨░OñW\n");
- break;
- case inGoAway:
- _PutStr("├÷│¼╡°╡íñº╝╨░OñW \n");
- break;
- case inZoom:
- _PutStr("⌐±ñj╡°╡íª▄│╠ñjñº╝╨░OñW \n");
- break;
- case inVUpArrow:
- _PutStr("ªVñW▒▓░╩ñº╝╨░OñW \n");
- break;
- case inVDownArrow:
- _PutStr("ªVñU▒▓░╩ñº╝╨░OñW \n");
- break;
- case inVPageUp:
- _PutStr("ªVñW▒▓¡╢ñº▒▓░╩╝╨Ñ▄░╧ññ \n");
- break;
- case inVPageDown:
- _PutStr("ªVñU▒▓¡╢ñº▒▓░╩╝╨Ñ▄░╧ñW \n");
- break;
- case inVThumb:
- _PutStr("½½¬╜▒▓░╩╝╨Ñ▄¼Wñññº╝╨░OñW \n");
- break;
- case inHUpArrow:
- _PutStr("ªVѬ▒▓░╩ñº╝╨░OñW \n");
- break;
- case inHDownArrow:
- _PutStr("ªVÑk▒▓░╩ñº╝╨░OñW \n");
- break;
- case inHPageUp:
- _PutStr("ªVѬ▒▓¡╢ñº▒▓░╩╝╨Ñ▄░╧ññ\n");
- break;
- case inHPageDown:
- _PutStr("ªVÑk▒▓¡╢ñº▒▓░╩╝╨Ñ▄░╧ññ\n");
- break;
- case inHThumb:
- _PutStr("ñ⌠Ñ¡▒▓░╩╝╨Ñ▄¼Wñññº╝╨░OñW \n");
- break;
- case inMenuBar:
- _PutStr(" Ñ\ »α ¬φ │µ ñº ┐∩ ╢╡ ñW \n");
- break;
- }
-
- }
-
-
-
- ChkModifiers(short modifiers)
- {
-
- int others=FALSE;
-
- if (modifiers & altKey) /* Alt ┴Σ│Q½÷ñU */
- {
- if (modifiers & ctrlKey) /* Ctrl ┴Σ */
- {
- _PutStr("Ctrl");
- others = TRUE;
- }
-
- if (modifiers & shiftKey) /* Shift ┴Σ */
- {
- if (others)
- _PutChr('+');
- _PutStr("Shift");
- others = TRUE;
- }
-
-
- if (others)
- _PutChr('+');
- _PutStr("Alt");
-
-
- }
- else
- {
- if (modifiers & ctrlKey)
- if (modifiers & shiftKey)
- _PutStr("Ctrl+Shift");
- else
- _PutStr("Ctrl");
- else
- if (modifiers & shiftKey)
- _PutStr("Shift");
- }
-
-
- _PutChr(0x0a);
- others = FALSE;
-
-
- }
-
-
-
- ListEvent(EventRec FAR *ev, char FAR *whatevent)
- {
-
-
-
- ChkNulls(); /* └╦¼d╡Ω╡L¿╞Ñ≤ */
- _PutStr("\n\n============== ╖s¬║¿╞Ñ≤ ==============\n\n");
-
- _PutStr("ñ░ ╗≥ ¿╞ Ñ≤ : ");
- _PutStr(whatevent); nl;
-
- _PutStr("╖╞ ╣½ ¬║ ñ⌠ Ñ¡ ª∞ ╕m «y ╝╨ : ");
- PutInt((long) ev->where.h); nl;
-
- _PutStr("╖╞ ╣½ ¬║ ½½ ¬╜ ª∞ ╕m «y ╝╨ : ");
- PutInt((long) ev->where.v); nl;
-
- _PutStr("½÷┴Σñº½÷┴Σ╜X⌐╬¼Yñ@¡╙╡°╡íñº MHANDLE : ");
- /* └╦¼d¼Oº_ñ@¡╙Ñ┐│W¬║┴Σ│Q½÷ñU */
- if (ev->what == keyDownEvent && !(ev->modifiers & shiftCodeMask))
- _PutChr(ev->message);
- else
- PutInt(ev->message); nl;
-
- _PutStr("╡▓ ║c ┼Θ EventRec ñº ╕Ω «╞ ╢╡ misc : ");
- PutInt(ev->misc); nl;
-
- _PutStr("╡▓ ║c ┼Θ EventRec ñº ╕Ω «╞ ╢╡ misc2 : ");
- PutInt(ev->misc2); nl;
-
- if (ev->mbState == leftButton)
- _PutStr("╖╞ ╣½ ½÷ ╢s ñº ¬¼ ║A : ╖╞╣½ñºÑ¬½÷╢s│Q½÷ñU\n");
-
- _PutStr("╜╒ ╕` ┴Σ(Ctrl,Shift,ñ╬ Alt) ñº ¡╚ : ");
- ChkModifiers(ev->modifiers);
-
-
- }
-
-
- FAR EventHandler(WHandle theWindow, EventRec FAR *ev)
- {
-
-
-
- switch(ev->what)
- {
- case nullEvent:
- count_nulls++;
- return NO;
-
- case mouseDownEvent:
- ListEvent(ev, "mouseDownEvent");
- ListFindWindow(&theWindow, ev->where);
- return NO;
- break;
-
- case keyDownEvent:
- ListEvent(ev, "keyDownEvent");
- return NO;
- break;
-
- case activateEvent:
- ListEvent(ev, "activateEvent");
- return NO;
- break;
-
- case deactivateEvent:
- ListEvent(ev, "deactivateEvent");
- return NO;
- break;
-
- case menuHitEvent:
- ListEvent(ev, "menuHitEvent");
- return NO;
- break;
-
- case closeEvent:
- ListEvent(ev, "closeEvent");
- return NO;
- break;
-
- case hideEvent:
- ListEvent(ev, "hideEvent");
- return NO;
- break;
-
- case showEvent:
- ListEvent(ev, "showEvent");
- return NO;
- break;
-
- case hotkeyEvent:
- ListEvent(ev, "hotkeyEvent");
- return NO;
- break;
-
- case sizeEvent:
- ListEvent(ev, "sizeEvent");
- return NO;
- break;
-
- case zoomEvent:
- ListEvent(ev, "zoomEvent");
- return NO;
- break;
-
-
- default:
- return NO;
- }
- return YES;
- }
-
-
- FAR ActivateEvent()
- {
-
- eventid = _ActivateHandler(EventHandler);
- _Execute("SET PRINT TO FOXEVENT.TXT");
- _Execute("SET PRINT ON");
-
- }
-
-
-
-
- FAR DeActivateEvent()
- {
-
- _DeActivateHandler(eventid);
- _Execute("SET PRINT OFF");
- _Execute("SET PRINT TO");
-
- }
-
- FoxInfo myFoxInfo[] =
- {
- {"ACTIVATEEVENT", ActivateEvent, CALLONLOAD, ""},
- {"DEACTIVATEEVENT", DeActivateEvent, CALLONUNLOAD, ""}
- };
-
- FoxTable _FoxTable =
- {
- (FoxTable FAR *)0,
- sizeof(myFoxInfo) / sizeof(FoxInfo),
- myFoxInfo
- };