home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tv20cpp.zip / tvision / system.h < prev    next >
C/C++ Source or Header  |  1998-07-21  |  3KB  |  172 lines

  1. /*
  2.  * system.h
  3.  *
  4.  * Turbo Vision - Version 2.0
  5.  *
  6.  * Copyright (c) 1994 by Borland International
  7.  * All Rights Reserved.
  8.  *
  9.  * Modified by Sergio Sigala <ssigala@globalnet.it>
  10.  */
  11.  
  12. #if !defined( __EVENT_CODES )
  13. #define __EVENT_CODES
  14.  
  15. /* Event codes */
  16.  
  17. const evMouseDown = 0x0001;
  18. const evMouseUp   = 0x0002;
  19. const evMouseMove = 0x0004;
  20. const evMouseAuto = 0x0008;
  21. const evKeyDown   = 0x0010;
  22. const evCommand   = 0x0100;
  23. const evBroadcast = 0x0200;
  24.  
  25. /* Event masks */
  26.  
  27. const evNothing   = 0x0000;
  28. const evMouse     = 0x000f;
  29. const evKeyboard  = 0x0010;
  30. const evMessage   = 0xFF00;
  31.  
  32. /* Mouse button state masks */
  33.  
  34. const mbLeftButton  = 0x01;
  35. const mbRightButton = 0x02;
  36.  
  37. /* Mouse event flags */
  38.  
  39. const meMouseMoved = 0x01;
  40. const meDoubleClick = 0x02;
  41.  
  42. #endif  // __EVENT_CODES
  43.  
  44.  
  45. #if defined( Uses_TEvent ) && !defined( __TEvent )
  46. #define __TEvent
  47.  
  48. struct MouseEventType
  49. {
  50.     TPoint where;
  51.     ulong eventFlags;           // Replacement for doubleClick.
  52.     ulong controlKeyState;
  53.     uchar buttons;
  54. };
  55.  
  56. /*
  57.  * SS: some non-portable code changed.
  58.  */
  59. #ifdef __FreeBSD__
  60. #include <machine/endian.h>
  61. #else
  62. #include <endian.h>
  63. #endif
  64.  
  65. struct CharScanType
  66. {
  67. #if (BYTE_ORDER == LITTLE_ENDIAN)
  68.     uchar charCode;
  69.     uchar scanCode;
  70. #elif (BYTE_ORDER == BIG_ENDIAN)
  71.     uchar scanCode;
  72.     uchar charCode;
  73. #else
  74.     #error architecture not supported by this library
  75. #endif
  76. };
  77.  
  78. struct KeyDownEvent
  79. {
  80.     union
  81.         {
  82.         ushort keyCode;
  83.         CharScanType charScan;
  84.         };
  85.     ulong controlKeyState;
  86. };
  87.  
  88. struct MessageEvent
  89. {
  90.     ushort command;
  91.     union
  92.         {
  93.         void *infoPtr;
  94.         long infoLong;
  95.         ushort infoWord;
  96.         short infoInt;
  97.         uchar infoByte;
  98.         char infoChar;
  99.         };
  100. };
  101.  
  102. struct TEvent
  103. {
  104.  
  105.     ushort what;
  106.     union
  107.     {
  108.         MouseEventType mouse;
  109.         KeyDownEvent keyDown;
  110.         MessageEvent message;
  111.     };
  112.  
  113. };
  114.  
  115. #endif  // Uses_TEvent
  116.  
  117. #if defined( Uses_TEventQueue ) && !defined( __TEventQueue )
  118. #define __TEventQueue
  119.  
  120. class TEventQueue
  121. {
  122. public:
  123.     static ushort doubleDelay;
  124.     static Boolean mouseReverse;
  125. };
  126.  
  127. #endif  // Uses_TEventQueue
  128.  
  129. #if defined( Uses_TScreen ) && !defined( __TScreen )
  130. #define __TScreen
  131.  
  132. class TDisplay
  133. {
  134. public:
  135.     enum videoModes
  136.     {
  137.         smBW80        = 0x0002,
  138.         smCO80        = 0x0003,
  139.         smMono        = 0x0007,
  140.         smFont8x8    = 0x0100
  141.         };
  142. };
  143.  
  144. /*
  145.  * Platform-dependent functions removed.
  146.  * Date: Mon Feb  3 13:19:06 CET 1997
  147.  */
  148. class TScreen: public TDisplay
  149. {
  150. public:
  151.     TScreen();
  152.     ~TScreen();
  153.     static void getEvent(TEvent &event);
  154.     static void makeBeep();
  155.     static void putEvent(TEvent &event);
  156.     static void resume();
  157.     static void suspend();
  158.     static void drawCursor(int show);
  159.     static void drawMouse(int show);
  160.     static void moveCursor(int x, int y);
  161.     static void writeRow(int dst, ushort *src, int len);
  162.  
  163.     /* public data */
  164.  
  165.     static ushort screenMode;
  166.     static uchar screenWidth;
  167.     static uchar screenHeight;
  168.     static ushort *screenBuffer;
  169. };
  170.  
  171. #endif  // Uses_TScreen
  172.