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