home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / hpp.z / WDEF.HPP < prev    next >
C/C++ Source or Header  |  1996-11-20  |  11KB  |  386 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,8);
  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. #ifndef _WIN16
  30. #undef FindWindow
  31. #undef SendMessage
  32. #undef GetClassName
  33. #if defined( _UNICODE )
  34.     #define FindWindow  FindWindowW
  35.     #define SendMessage SendMessageW
  36.     #define GetClassName    GetClassNameW
  37. #else
  38.     #define FindWindow  FindWindowA
  39.     #define SendMessage SendMessageA
  40.     #define GetClassName    GetClassNameA
  41. #endif
  42. #endif
  43.  
  44. //
  45. // Forward declarations for classes
  46. //
  47.  
  48. class WObject;
  49. class WScrollBar;
  50.  
  51. class WMessage;
  52. class WWindow;
  53. struct WInstance;
  54.  
  55. //
  56. // General type definitions
  57. //
  58.  
  59. #define LAST_32BIT      0xFFFFFFFF
  60. #define LAST_16BIT      0xFFFF
  61.  
  62. #ifndef _INC_WINDOWS
  63. #define FAR                 __far
  64. #define NEAR                __near
  65. typedef char FAR*           LPSTR;
  66. typedef const char FAR*     LPCSTR;
  67. #endif
  68. #ifdef _WIN16
  69. #define LAST_16TO32BIT  0xFFFF
  70. #ifndef _COMPOBJ_H_
  71. typedef int                 INT;
  72. typedef unsigned int        UINT;
  73. typedef unsigned int        *PUINT;
  74. typedef unsigned char       UCHAR;
  75. typedef UCHAR               *PUCHAR;
  76. typedef unsigned long       ULONG;
  77. typedef ULONG               *PULONG;
  78. typedef unsigned short      USHORT;
  79. typedef short               SHORT;
  80. #endif
  81. typedef LPSTR               LPTSTR;
  82. typedef LPCSTR              LPCTSTR;
  83. #else
  84. #define LAST_16TO32BIT  0xFFFFFFFF
  85. #endif
  86.  
  87. #if defined( _WIN16 ) && defined( _INC_WINDOWS )
  88. #define _WINDEF_
  89. #endif
  90.  
  91. typedef unsigned long WDialogID;
  92. typedef unsigned long WNotifyInfo;
  93.  
  94. #ifdef _WINDEF_
  95. #ifndef STRICT
  96. #error If you wish to include windows.h, you must add the line 'define STRICT' first
  97. #endif
  98. #endif
  99. #ifndef _WINDEF_
  100. #ifndef _WIN16
  101. typedef void *          HANDLE;
  102. #define DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name
  103. #else
  104. typedef const void NEAR*        HANDLE;
  105. #define DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef const struct name##__ NEAR* name
  106. #endif
  107. DECLARE_HANDLE(         HWND );
  108. DECLARE_HANDLE(         HMENU );
  109. DECLARE_HANDLE(         HDC );
  110. DECLARE_HANDLE(         HBITMAP );
  111. DECLARE_HANDLE(         HICON );
  112. DECLARE_HANDLE(         HCURSOR );
  113. DECLARE_HANDLE(         HBRUSH );
  114. DECLARE_HANDLE(         HPEN );
  115. DECLARE_HANDLE(         HFONT );
  116. DECLARE_HANDLE(         HINSTANCE );
  117. DECLARE_HANDLE(         HGLOBAL );
  118. DECLARE_HANDLE(         HIMC );
  119. #ifndef _WIN16
  120. DECLARE_HANDLE(         HKL );
  121. #endif
  122. typedef HINSTANCE       HMODULE;
  123. #ifndef _WIN16
  124. typedef HANDLE          HDWP;
  125. #else
  126. DECLARE_HANDLE(         HDWP );
  127. #endif
  128. #endif
  129. #ifndef _INC_COMMCTRL
  130. #ifndef _WIN16
  131. struct _IMAGELIST;
  132. typedef struct _IMAGELIST near * HIMAGELIST;
  133. #else
  134. struct _PBIMAGELIST;
  135. typedef struct _PBIMAGELIST far * HIMAGELIST;
  136. #endif
  137. #endif
  138. #ifdef _WIN16
  139. DECLARE_HANDLE(         HKL );
  140. #endif
  141.  
  142. typedef HDWP            WDeferMoveHandle;
  143. #define NULLHDWP        (WDeferMoveHandle)0
  144. #define LASTHDWP        (WDeferMoveHandle)LAST_16TO32BIT
  145.  
  146. typedef HWND            WWindowHandle;
  147. #define NULLHWND        (WWindowHandle)0
  148. #define LASTHWND        (WWindowHandle)LAST_16TO32BIT
  149.  
  150. typedef HMENU           WMenuHandle;
  151. #define NULLHMNU        (WMenuHandle)0
  152. #define LASTHMNU        (WMenuHandle)LAST_16TO32BIT
  153.  
  154. typedef HDC             WDeviceHandle;
  155. #define NULLHDEV        (WDeviceHandle)0
  156. #define LASTHDEV        (WDeviceHandle)LAST_16TO32BIT
  157.  
  158. typedef HBITMAP         WBitmapHandle;
  159. #define NULLHBMP        (WBitmapHandle)0
  160. #define LASTHBMP        (WBitmapHandle)LAST_16TO32BIT
  161.  
  162. typedef HICON           WIconHandle;
  163. #define NULLHICON       (WIconHandle)0
  164. #define LASTHICON       (WIconHandle)LAST_16TO32BIT
  165.  
  166. typedef HCURSOR         WCursorHandle;
  167. #define NULLHCURSOR     (WCursorHandle)0
  168. #define LASTHCURSOR     (WCursorHandle)LAST_16TO32BIT
  169.  
  170. typedef HBRUSH          WBrushHandle;
  171. #define NULLHBRUSH      (WBrushHandle)0
  172. #define LASTHBRUSH      (WBrushHandle)LAST_16TO32BIT
  173.  
  174. typedef HPEN            WPenHandle;
  175. #define NULLHPEN        (WPenHandle)0
  176. #define LASTHPEN        (WPenHandle)LAST_16TO32BIT
  177.  
  178. typedef HFONT           WFontHandle;
  179. #define NULLHFONT       (WFontHandle)0
  180. #define LASTHFONT       (WFontHandle)LAST_16TO32BIT
  181.  
  182. typedef HMODULE         WModuleHandle;
  183. #define NULLHMODULE     (WModuleHandle)0
  184. #define LASTHMODULE     (WModuleHandle)LAST_16TO32BIT
  185.  
  186. typedef HGLOBAL         WMemoryHandle;
  187. #define NULLHMEM        (WMemoryHandle)0
  188. #define LASTHMEM        (WMemoryHandle)LAST_16TO32BIT
  189.  
  190. typedef HKL             WKeyboardHandle;
  191. #define NULLHKL         (WKeyboardHandle)0
  192. #define LASTHKL         (WKeyboardHandle)LAST_16TO32BIT
  193.  
  194. typedef HIMC            WInputContextHandle;
  195. #define NULLHIMC        (WInputContextHandle)0;
  196. #define LASTHIME        (WInputContextHanlde)LAST_16TO32BIT
  197.  
  198. typedef HIMAGELIST      WImageListHandle;
  199. #define NULLHIMAGELIST  (WImageListHandle)0
  200. #define LASTHIMAGELIST  (WImageListHandle)LAST_16TO32BIT
  201.  
  202. enum WNotify          { NULLNOTIFY     = 0,  LASTNOTIFY = LAST_16BIT };
  203. enum WCallbackProc    { NULLCALLBACK   = 0,  LASTCALLBACK = LAST_32BIT };
  204.  
  205. #ifndef CALLBACK
  206. #if defined( __NT__ )
  207. #define CALLBACK __stdcall
  208. #else
  209. #define CALLBACK __far __pascal
  210. #endif
  211. #endif
  212. #ifndef WINAPI
  213. #if defined( __NT__ )
  214. #define WINAPI __stdcall
  215. #else
  216. #define WINAPI __far __pascal
  217. #endif
  218. #endif
  219.  
  220. //
  221. // _ApplicationModule
  222. //
  223. //    This global variable must be defined by any program that uses
  224. //    classes that require resources.
  225.  
  226. extern WModuleHandle _ApplicationModule;
  227.  
  228.  
  229. typedef struct WInstance * WINSTANCE;
  230.  
  231. class WWindow;
  232.  
  233. class WCMCLASS WRange {
  234.  
  235.     public:
  236.  
  237.         /***************************************************************
  238.          * Constructors and Destructors
  239.          ***************************************************************/
  240.  
  241.         WRange();
  242.         WRange( WInt s, WInt e );
  243.         WRange( const WRange & r );
  244.  
  245.         ~WRange();
  246.  
  247.         /***************************************************************
  248.          * Properties
  249.          ***************************************************************/
  250.  
  251.         WInt GetDistance() const;
  252.  
  253.         /***************************************************************
  254.          * Methods
  255.          ***************************************************************/
  256.  
  257.         WBool AboveRange( WInt i ) const;
  258.  
  259.         WBool BelowRange( WInt i ) const;
  260.  
  261.         WBool InsideRange( WInt i ) const;
  262.  
  263.         /***************************************************************
  264.          * Data Members
  265.          ***************************************************************/
  266.  
  267.         WInt start;
  268.         WInt end;
  269. };
  270.  
  271. enum WStyle       { NULLWSTYLE =    0,  LASTWSTYLE = LAST_32BIT };
  272.  
  273. inline WStyle operator|( WStyle lhs, WStyle rhs )
  274.     { return (WStyle)((unsigned long)lhs | (unsigned long)rhs); }
  275.  
  276. inline WStyle operator&( WStyle lhs, WStyle rhs )
  277.     { return (WStyle)((unsigned long)lhs & (unsigned long)rhs); }
  278.  
  279. inline WStyle operator~( WStyle style )
  280.     { return (WStyle)(~(unsigned long)style); }
  281.  
  282. inline WStyle & operator|=( WStyle & lhs, WStyle rhs )
  283.     { lhs = (WStyle)((unsigned long)lhs | (unsigned long)rhs); return lhs; }
  284.  
  285. inline WStyle & operator&=( WStyle & lhs, WStyle rhs )
  286.     { lhs = (WStyle)((unsigned long)lhs & (unsigned long)rhs); return lhs; }
  287.  
  288. #ifndef _WCHAR_HPP_INCLUDED
  289. #  include "wchar.hpp"
  290. #endif
  291. #ifndef _WBASECL_HPP_INCLUDED
  292. #  include "wbasecl.hpp"
  293. #endif
  294. #ifndef _WMEMORY_HPP_INCLUDED
  295. #  include "wmemory.hpp"
  296. #endif
  297. #ifndef _WDEBUG_HPP_INCLUDED
  298. #  include "wdebug.hpp"
  299. #endif
  300.  
  301. inline long WMin( long a, long b ) { return (a<b) ? a  : b; }
  302. inline long WMax( long a, long b ) { return (a>b) ? a  : b; }
  303. inline long WAbs( long a )      { return (a<0) ? -a : a; }
  304.  
  305. extern unsigned long WProcessID;
  306. extern WBool WDraggingMode;
  307.  
  308. enum WShowStyle {
  309.     WWinStateHide               = 0,
  310.     WWinStateShowNormal         = 1,
  311.     WWinStateNormal             = WWinStateShowNormal,
  312.     WWinStateMinimized          = 2,
  313.     WWinStateShowMinimized      = WWinStateMinimized,
  314.     WWinStateMaximized          = 3,
  315.     WWinStateShowMaximized      = WWinStateMaximized,
  316.     WWinStateMaximize           = WWinStateMaximized,
  317.     WWinStateShowNoActivate     = 4,
  318.     WWinStateShow               = 5,
  319.     WWinStateMinimize           = 6,
  320.     WWinStateShowMinNoActivate  = 7,
  321.     WWinStateShowNA             = 8,
  322.     WWinStateShowRestore        = 9,
  323.     WWinStateShowDefault        = 10,
  324.     WWinStateMax                = WWinStateShowDefault
  325. };
  326.  
  327. // ------ Scrollbar Definitions ------- //
  328.  
  329. enum WScrollMessage {
  330.     WLineUp                     = 0,
  331.     WLineLeft                   = WLineUp,
  332.     WLineDown                   = 1,
  333.     WLineRight                  = WLineDown,
  334.     WPageUp                     = 2,
  335.     WPageLeft                   = WPageUp,
  336.     WPageDown                   = 3,
  337.     WPageRight                  = WPageDown,
  338.     WPosition                   = 4,
  339.     WTrack                      = 5,
  340.     WTop                        = 6,
  341.     WLeft                       = WTop,
  342.     WBottom                     = 7,
  343.     WRight                      = WBottom,
  344.     WEndScroll                  = 8,
  345. };
  346.  
  347. enum WScrollDir {
  348.     WScrollHorizontal           = 0,
  349.     WScrollVertical             = 1,
  350. };
  351.  
  352. enum WMouseFlagValues {
  353.     WMKNone         = 0x0000,
  354.     WMKLeftDown     = 0x0001,
  355.     WMKLeftButton   = WMKLeftDown,
  356.     WMKRightDown    = 0x0002,
  357.     WMKRightButton  = WMKRightDown,
  358.     WMKShift        = 0x0004,
  359.     WMKControl      = 0x0008,
  360.     WMKMiddleDown   = 0x0010,
  361.     WMKMiddleButton = WMKMiddleDown,
  362.     WMKAlt          = 0x0020
  363. };
  364. typedef WULong WMouseFlags;
  365.  
  366. #define WClass_SendMessage(type,msg,wp,lp) \
  367.                      (type)SendMessage(WMessage(msg,wp,lp))
  368.  
  369. #define inline_win32 inline
  370. #define inline_win   inline
  371. #define inline_win16
  372. #define inline_os2
  373.  
  374. #if defined( DECLARE_HANDLE )
  375.     typedef HWND _WHWND;
  376. #else
  377.     typedef void *_WHWND;
  378. #endif
  379.  
  380. #ifndef _WNO_PRAGMA_PUSH
  381. #pragma enum pop;
  382. #pragma pack(pop);
  383. #endif
  384.  
  385. #endif // _WDEF_HPP_INCLUDED
  386.