home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 10 / ioProg_10.iso / soft / optima / hpp.z / WDEF.HPP < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-02  |  8.2 KB  |  297 lines

  1. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2.    %     Copyright (C) 1995 by Watcom International Corp.  All rights    %
  3.    %     reserved.  No part of this software may be reproduced or        %
  4.    %     used in any form or by any means - graphic, electronic or       %
  5.    %     mechanical, including photocopying, recording, taping or        %
  6.    %     information storage and retrieval systems - except with the     %
  7.    %     written permission of Watcom International Corp.
  8.    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  9. */
  10.  
  11. #ifndef _WDEF_HPP_INCLUDED
  12. #define _WDEF_HPP_INCLUDED
  13.  
  14. #ifndef _WNO_PRAGMA_PUSH
  15. #pragma pack(push,4);
  16. #pragma enum int;
  17. #endif
  18.  
  19. // Include basic stuff...
  20.  
  21. #ifndef _WDECL_HPP_INCLUDED
  22. #include "wdecl.hpp"
  23. #endif
  24.  
  25. //
  26. // Get rid of conflicts...
  27. //
  28.  
  29. #undef FindWindow
  30. #undef SendMessage
  31. #undef GetClassName
  32. #if defined( _UNICODE )
  33.     #define FindWindow  FindWindowW
  34.     #define SendMessage SendMessageW
  35.     #define GetClassName    GetClassNameW
  36. #else
  37.     #define FindWindow  FindWindowA
  38.     #define SendMessage SendMessageA
  39.     #define GetClassName    GetClassNameA
  40. #endif
  41.  
  42. //
  43. // Forward declarations for classes
  44. //
  45.  
  46. class WObject;
  47. class WToolItem;
  48. class WScrollBar;
  49.  
  50. class WMessage;
  51. class WWindow;
  52. struct WInstance;
  53.  
  54. //
  55. // General type definitions
  56. //
  57.  
  58. #define LAST_32BIT      0xFFFFFFFF
  59. #define LAST_16BIT      0xFFFF
  60.  
  61. #define LAST_16TO32BIT  0xFFFFFFFF
  62.  
  63. typedef unsigned long WDialogID;
  64. typedef unsigned long WNotifyInfo;
  65.  
  66. #if defined( HDWP )
  67. typedef HDWP            WDeferMoveHandle;
  68. #else
  69. enum WDeferMoveHandle { NULLHDWP       = 0,  LASTHDWP =   LAST_16TO32BIT };
  70. #endif
  71. #if defined( HWND )
  72. typedef HWND            WWindowHandle;
  73. #else
  74. enum WWindowHandle    { NULLHWND       = 0,  LASTHWND =   LAST_16TO32BIT };
  75. #endif
  76. #if defined( HMENU )
  77. typedef HMENU           WMenuHandle;
  78. #else
  79. enum WMenuHandle      { NULLHMNU       = 0,  LASTHMNU =   LAST_16TO32BIT };
  80. #endif
  81. #if defined( HDC )
  82. typedef HDC             WDeviceHandle;
  83. #else
  84. enum WDeviceHandle    { NULLHDEV       = 0,  LASTHDEV =   LAST_16TO32BIT };
  85. #endif
  86. #if defined( HBITMAP )
  87. typedef HBITMAP         WBitmapHandle;
  88. #else
  89. enum WBitmapHandle    { NULLHBMP       = 0,  LASTHBMP =   LAST_16TO32BIT };
  90. #endif
  91. #if defined( HICON )
  92. typedef HICON           WIconHandle;
  93. #else
  94. enum WIconHandle      { NULLHICON      = 0,  LASTHICON =  LAST_16TO32BIT };
  95. #endif
  96. #if defined( HCURSOR )
  97. typedef HCURSOR         WCursorHandle;
  98. #else
  99. enum WCursorHandle    { NULLHCURSOR    = 0,  LASTHCURSOR =LAST_16TO32BIT };
  100. #endif
  101. #if defined( HBRUSH )
  102. typedef HPEN            WBrushHandle;
  103. #else
  104. enum WBrushHandle     { NULLHBRUSH     = 0,  LASTHBRUSH = LAST_16TO32BIT };
  105. #endif
  106. #if defined( HPEN )
  107. typedef HPEN            WPenHandle;
  108. #else
  109. enum WPenHandle       { NULLHPEN       = 0,  LASTHPEN =   LAST_16TO32BIT };
  110. #endif
  111. #if defined( HFONT )
  112. typedef HFONT           WFontHandle;
  113. #else
  114. enum WFontHandle      { NULLHFONT      = 0,  LASTHFONT =  LAST_16TO32BIT };
  115. #endif
  116. #if defined( HIMAGELIST )
  117. typedef HIMAGELIST      WImageListHandle;
  118. #else
  119. enum WImageListHandle { NULLHIMAGELIST = 0,  LASTHIMAGELIST = LAST_16TO32BIT };
  120. #endif
  121. #if defined( HMODULE )
  122. typedef HMODULE         WModuleHandle;
  123. #else
  124. enum WModuleHandle    { NULLHMODULE    = 0,  LASTHMODULE = LAST_16TO32BIT };
  125. #endif
  126. #if defined( HGLOBAL )
  127. typedef HGLOBAL         WMemoryHandle;
  128. #else
  129. enum WMemoryHandle    { NULLHMEM       = 0,  LASTHMEM = LAST_16TO32BIT };
  130. #endif
  131. #if defined( HKL )
  132. typedef HKL             WKeyboardHandle;
  133. #else
  134. enum WKeyboardHandle  { NULLKEYBOARD   = 0,  LASTHKEYBOARD = LAST_16TO32BIT };
  135. #endif
  136. enum WNotify          { NULLNOTIFY     = 0,  LASTNOTIFY = LAST_16BIT };
  137. enum WCallbackProc    { NULLCALLBACK   = 0,  LASTCALLBACK = LAST_32BIT };
  138.  
  139. //
  140. // _ApplicationModule
  141. //
  142. //    This global variable must be defined by any program that uses
  143. //    classes that require resources.
  144.  
  145. extern WModuleHandle _ApplicationModule;
  146.  
  147.  
  148. typedef struct WInstance * WINSTANCE;
  149.  
  150. class WWindow;
  151.  
  152. class WCMCLASS WRange {
  153.  
  154.     public:
  155.  
  156.         /***************************************************************
  157.          * Constructors and Destructors
  158.          ***************************************************************/
  159.  
  160.         WRange();
  161.         WRange( WLong s, WLong e );
  162.         WRange( const WRange & r );
  163.  
  164.         ~WRange();
  165.  
  166.         /***************************************************************
  167.          * Properties
  168.          ***************************************************************/
  169.  
  170.         WInt GetDistance() const;
  171.  
  172.     public:
  173.  
  174.         /***************************************************************
  175.          * Data Members
  176.          ***************************************************************/
  177.  
  178.         WLong start;
  179.         WLong end;
  180. };
  181.  
  182. enum WStyle       { NULLWSTYLE =    0,  LASTWSTYLE = LAST_32BIT };
  183.  
  184. inline WStyle operator|( WStyle lhs, WStyle rhs )
  185.     { return (WStyle)((unsigned long)lhs | (unsigned long)rhs); }
  186.  
  187. inline WStyle operator&( WStyle lhs, WStyle rhs )
  188.     { return (WStyle)((unsigned long)lhs & (unsigned long)rhs); }
  189.  
  190. inline WStyle operator~( WStyle style )
  191.     { return (WStyle)(~(unsigned long)style); }
  192.  
  193. inline WStyle & operator|=( WStyle & lhs, WStyle rhs )
  194.     { lhs = (WStyle)((unsigned long)lhs | (unsigned long)rhs); return lhs; }
  195.  
  196. inline WStyle & operator&=( WStyle & lhs, WStyle rhs )
  197.     { lhs = (WStyle)((unsigned long)lhs & (unsigned long)rhs); return lhs; }
  198.  
  199. #ifndef _WCHAR_HPP_INCLUDED
  200. #  include "wchar.hpp"
  201. #endif
  202. #ifndef _WBASECL_HPP_INCLUDED
  203. #  include "wbasecl.hpp"
  204. #endif
  205. #ifndef _WMEMORY_HPP_INCLUDED
  206. #  include "wmemory.hpp"
  207. #endif
  208. #ifndef _WDEBUG_HPP_INCLUDED
  209. #  include "wdebug.hpp"
  210. #endif
  211.  
  212. inline int WMin( int a, int b ) { return (a<b) ? a  : b; }
  213. inline int WMax( int a, int b ) { return (a>b) ? a  : b; }
  214. inline int WAbs( int a )        { return (a<0) ? -a : a; }
  215.  
  216. extern unsigned long WProcessID;
  217. extern WBool WDraggingMode;
  218.  
  219. enum WShowStyle {
  220.     WWinStateHide               = 0,
  221.     WWinStateShowNormal         = 1,
  222.     WWinStateNormal             = WWinStateShowNormal,
  223.     WWinStateMinimized          = 2,
  224.     WWinStateShowMinimized      = WWinStateMinimized,
  225.     WWinStateMaximized          = 3,
  226.     WWinStateShowMaximized      = WWinStateMaximized,
  227.     WWinStateMaximize           = WWinStateMaximized,
  228.     WWinStateShowNoActivate     = 4,
  229.     WWinStateShow               = 5,
  230.     WWinStateMinimize           = 6,
  231.     WWinStateShowMinNoActivate  = 7,
  232.     WWinStateShowNA             = 8,
  233.     WWinStateShowRestore        = 9,
  234.     WWinStateShowDefault        = 10,
  235.     WWinStateMax                = WWinStateShowDefault
  236. };
  237.  
  238. // ------ Scrollbar Definitions ------- //
  239.  
  240. enum WScrollMessage {
  241.     WLineUp                     = 0,
  242.     WLineLeft                   = WLineUp,
  243.     WLineDown                   = 1,
  244.     WLineRight                  = WLineDown,
  245.     WPageUp                     = 2,
  246.     WPageLeft                   = WPageUp,
  247.     WPageDown                   = 3,
  248.     WPageRight                  = WPageDown,
  249.     WPosition                   = 4,
  250.     WTrack                      = 5,
  251.     WTop                        = 6,
  252.     WLeft                       = WTop,
  253.     WBottom                     = 7,
  254.     WRight                      = WBottom,
  255.     WEndScroll                  = 8,
  256. };
  257.  
  258. enum WScrollDir {
  259.     WScrollHorizontal           = 0,
  260.     WScrollVertical             = 1,
  261. };
  262.  
  263. enum WMouseFlagValues {
  264.     WMKNone         = 0x0000,
  265.     WMKLeftDown     = 0x0001,
  266.     WMKLeftButton   = WMKLeftDown,
  267.     WMKRightDown    = 0x0002,
  268.     WMKRightButton  = WMKRightDown,
  269.     WMKShift        = 0x0004,
  270.     WMKControl      = 0x0008,
  271.     WMKMiddleDown   = 0x0010,
  272.     WMKMiddleButton = WMKMiddleDown,
  273.     WMKAlt          = 0x0020
  274. };
  275. typedef WULong WMouseFlags;
  276.  
  277. #define WClass_SendMessage(type,msg,wp,lp) \
  278.                      (type)SendMessage(WMessage(msg,wp,lp))
  279.  
  280. #define inline_win32 inline
  281. #define inline_win   inline
  282. #define inline_win16
  283. #define inline_os2
  284.  
  285. #if defined( DECLARE_HANDLE )
  286.     typedef HWND _WHWND;
  287. #else
  288.     typedef void *_WHWND;
  289. #endif
  290.  
  291. #ifndef _WNO_PRAGMA_PUSH
  292. #pragma enum pop;
  293. #pragma pack(pop);
  294. #endif
  295.  
  296. #endif // _WDEF_HPP_INCLUDED
  297.