home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 October / Chip_1997-10_cd.bin / tema / sybase / powerj / hpp.z / WWINDOW.HPP < prev    next >
C/C++ Source or Header  |  1997-01-24  |  59KB  |  1,711 lines

  1. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2.    %     Copyright (C) 1994, by WATCOM International Inc.  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 Inc.                 %
  8.    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  9. */
  10.  
  11. /*************************************************************************
  12.  *
  13.  * WWindow -- Base Window class
  14.  *
  15.  *
  16.  *   Events:
  17.  *
  18.  *       Activate --
  19.  *
  20.  *       CalculateSize --
  21.  *
  22.  *       CharacterPress --
  23.  *
  24.  *       Close --
  25.  *
  26.  *       Command --
  27.  *
  28.  *       CompareItem --
  29.  *
  30.  *       ContextHelp --
  31.  *
  32.  *       ContextMenu --
  33.  *
  34.  *       ControlColor --
  35.  *
  36.  *       Create --
  37.  *
  38.  *       Deactivate --
  39.  *
  40.  *       DeleteItem --
  41.  *
  42.  *       Destroy --
  43.  *
  44.  *       DeviceChange --
  45.  *
  46.  *       DisplayChange --
  47.  *
  48.  *       DockingChange --
  49.  *
  50.  *       DragContinue -- When a drag-and-drop operation is about to continue
  51.  *
  52.  *       DragDrop -- When a drag-and-drop operation has been accepted
  53.  *
  54.  *       DragEnd -- When a drag-and-drop operation has ended
  55.  *
  56.  *       DragEnter -- When a drag-and-drop operation has been entered
  57.  *
  58.  *       DragFeedback -- When a drag-and-drop operation requests feedback
  59.  *
  60.  *       DragFill --
  61.  *
  62.  *       DragLeave -- When a drag-and-drop operation is about to end
  63.  *
  64.  *       DragOver -- When a window is currently a candidate for a
  65.  *                   drag-and-drop operation
  66.  *
  67.  *       DragScroll -- When a drag-and-drop operation is about to scroll
  68.  *
  69.  *       DragStart -- When a drag-and-drop operation has started
  70.  *
  71.  *       DrawItem -- When an item is to be drawn
  72.  *
  73.  *       DropFile -- When a window has been the recipient of a file
  74.  *                   drag-and-drop operation
  75.  *
  76.  *       EndSession --
  77.  *
  78.  *       EnterIdle -- When a child modal dialog box or menu enters an idle
  79.  *                    state
  80.  *
  81.  *       EraseBackground -- When the background of the window needs painting
  82.  *
  83.  *       GetCursor --
  84.  *
  85.  *       GotFocus -- When a window has received the focus
  86.  *
  87.  *       Help -- When help is requested (i.e. F1 is pressed)
  88.  *
  89.  *       Hide --
  90.  *
  91.  *       HitTest --
  92.  *
  93.  *       InitMenu --
  94.  *
  95.  *       InitPopupMenu --
  96.  *
  97.  *       InputLangChange --
  98.  *
  99.  *       InputLangChangeRequest --
  100.  *
  101.  *       KeyDown --
  102.  *
  103.  *       KeyUp --
  104.  *
  105.  *       LeftButtonDown -- When the left mouse button has been depressed
  106.  *
  107.  *       LeftButtonDouble -- When the left mouse button double clicked
  108.  *
  109.  *       LeftButtonUp -- When the left mouse button has been released
  110.  *
  111.  *       LostFocus -- When a window has lost the focus
  112.  *
  113.  *       Maximize --
  114.  *
  115.  *       MeasureItem --
  116.  *
  117.  *       MenuSelect --
  118.  *
  119.  *       MiddleButtonDown -- When the middle mouse button has been depressed
  120.  *
  121.  *       MiddleButtonDouble -- When the middle mouse button double clicked
  122.  *
  123.  *       MiddleButtonUp -- When the middle mouse button has been released
  124.  *
  125.  *       Minimize --
  126.  *
  127.  *       MouseMove -- When the mouse moves
  128.  *
  129.  *       Move -- When the window has moved
  130.  *
  131.  *       NeedToolTipText --
  132.  *
  133.  *       NonClientPaint --
  134.  *
  135.  *       Notify --
  136.  *
  137.  *       Paint --
  138.  *
  139.  *       PaletteChanged --
  140.  *
  141.  *       PositionChanged --
  142.  *
  143.  *       PositionChanging --
  144.  *
  145.  *       PowerBroadcast --
  146.  *
  147.  *       Print --
  148.  *
  149.  *       PrintClient --
  150.  *
  151.  *       PrivateMessage --
  152.  *
  153.  *       QueryEndSession --
  154.  *
  155.  *       QueryNewPalette --
  156.  *
  157.  *       Resize --
  158.  *
  159.  *       RightButtonDown -- When the right mouse button has been depressed
  160.  *
  161.  *       RightButtonDouble -- When the right mouse button double clicked
  162.  *
  163.  *       RightButtonUp -- When the right mouse button has been released
  164.  *
  165.  *       Scroll --
  166.  *
  167.  *       SettingChange --
  168.  *
  169.  *       Show --
  170.  *
  171.  *       SizeChanging --
  172.  *
  173.  *       SysColorChange --
  174.  *
  175.  *       SysDeadChar --
  176.  *
  177.  *       SystemCommand --
  178.  *
  179.  *       SystemKeyDown --
  180.  *
  181.  *       User -- When a user event is signalled
  182.  *
  183.  *       UserChanged --
  184.  *
  185.  *************************************************************************/
  186.  
  187. #ifndef _WWINDOW_HPP_INCLUDED
  188. #define _WWINDOW_HPP_INCLUDED
  189.  
  190. #ifndef _WNO_PRAGMA_PUSH
  191. #pragma pack(push,8);
  192. #pragma enum int;
  193. #endif
  194.  
  195. #include "wdef.hpp"
  196. #include "wdrag.hpp"
  197. #include "winputcx.hpp"                 // IMM input context
  198.  
  199. #ifndef _WCALLBACK_HPP_INCLUDED
  200. #  include "wcallbck.hpp"
  201. #endif
  202. #ifndef _WKEYDEFS_HPP_INCLUDED
  203. #  include "wkeydefs.hpp"
  204. #endif
  205. #ifndef _WOBJECT_HPP_INCLUDED
  206. #  include "wobject.hpp"
  207. #endif
  208. #ifndef _WRECT_HPP_INCLUDED
  209. #  include "wrect.hpp"
  210. #endif
  211. #ifndef _WSTRING_HPP_INCLUDED
  212. #  include "wstring.hpp"
  213. #endif
  214. #ifndef _WCOLOR_HPP_INCLUDED
  215. #  include "wcolor.hpp"
  216. #endif
  217. #ifndef _WBRUSH_HPP_INCLUDED
  218. #  include "wbrush.hpp"
  219. #endif
  220. #ifndef _WFONT_HPP_INCLUDED
  221. #  include "wfont.hpp"
  222. #endif
  223. #ifndef _WEVENTD_HPP_INCLUDED
  224. #  include "weventd.hpp"
  225. #endif
  226. #ifndef _WMESSAGE_HPP_INCLUDED
  227. #  include "wmessage.hpp"
  228. #endif
  229. #ifndef _WREGION_HPP_INCLUDED
  230. #  include "wregion.hpp"
  231. #endif
  232. #ifndef _WSEMAPHORE_HPP_INCLUDED
  233. #  include "wsemaphr.hpp"
  234. #endif
  235. #ifndef _WVECTOR_HPP_INCLUDED
  236. #  include "wvector.hpp"
  237. #endif
  238. #ifndef _WDRAW_HPP_INCLUDED
  239. #  include "wdraw.hpp"
  240. #endif
  241. #ifndef _WKEYBLAY_HPP_INCLUDED
  242. #  include "wkeyblay.hpp"
  243. #endif
  244.  
  245. #ifndef _WIN16
  246. #undef PostMessage
  247. #undef SendMessage
  248. #if defined( _UNICODE )
  249.     #define PostMessage                 PostMessageW
  250.     #define SendMessage                 SendMessageW
  251. #else
  252.     #define PostMessage                 PostMessageA
  253.     #define SendMessage                 SendMessageA
  254. #endif
  255. #endif
  256.  
  257. class WPopupMenu;
  258. class WMenu;
  259. class WCursor;
  260. class WResourceID;
  261. class WColor;
  262. class WFont;
  263. class WDisplayCanvas;
  264. class WCanvas;
  265. class WToolTip;
  266. class WForm;
  267. class WControl;
  268. class WWindow;
  269. class WHotKey;
  270. class WDockFloatingForm;
  271.  
  272. enum WDockPosition {
  273.     WDockNotDocked = 0,
  274.     WDockFloating,
  275.     WDockTop,
  276.     WDockBottom,
  277.     WDockLeft,
  278.     WDockRight
  279. };
  280.  
  281. enum WHitTestCode {
  282.     WHTError = -2,
  283.     WHTTransparent = -1,
  284.     WHTNowhere = 0,
  285.     WHTClient = 1,
  286.     WHTCaption = 2,
  287.     WHTSysMenu = 3,
  288.     WHTGrowBox = 4,
  289.     WHTSize = WHTGrowBox,
  290.     WHTMenu = 5,
  291.     WHTHScroll = 6,
  292.     WHTVScroll = 7,
  293.     WHTMinButton = 8,
  294.     WHTMaxButton = 9,
  295.     WHTLeft = 10,
  296.     WHTRight = 11,
  297.     WHTTop = 12,
  298.     WHTTopLeft = 13,
  299.     WHTTopRight = 14,
  300.     WHTBottom = 15,
  301.     WHTBottomLeft = 16,
  302.     WHTBottomRight = 17,
  303.     WHTBorder = 18,
  304.     WHTReduce = WHTMinButton,
  305.     WHTZoom = WHTMaxButton,
  306.     WHTSizeFirst = WHTLeft,
  307.     WHTSizeLast = WHTBottomRight,
  308.     WHTObject = 19,
  309.     WHTClose = 20,
  310.     WHTHelp = 21
  311. };
  312.  
  313. enum WDragMode {
  314.     WNoDrag                     = 0,
  315.     WManualDrag                 = 1,
  316.     WAutomaticLeftDrag          = 2,
  317.     WAutomaticRightDrag         = 3,
  318. };
  319.  
  320. typedef WUShort WMouseMessage;
  321.  
  322. /**************************************************
  323. ******************************************************
  324. ***************************************************/
  325.  
  326. enum WDeviceType {
  327.     WDeviceTypeOEM      = 0x00000000,
  328.     WDeviceTypeDevNode  = 0x00000001,
  329.     WDeviceTypeVolume   = 0x00000002,
  330.     WDeviceTypePort     = 0x00000003,
  331.     WDeviceTypeNet      = 0x00000004,
  332.  
  333.     WDeviceTypeNULL     = 0xffffffff
  334. };
  335.  
  336. enum WEventType {
  337.     WEventTypeAppyBegin         = 0x0000,
  338.     WEventTypeAppyEnd           = 0x0001,
  339.     WEventTypeDevNodesChanged   = 0x0007,
  340.     WEventTypeQueryChangeConfig = 0x0017,
  341.     WEventTypeConfigChanged     = 0x0018,
  342.     WEventTypeConfigChangeCanceled = 0x0019,
  343.     WEventTypeMonitorChange     = 0x001b,
  344.     WEventTypeShellLoggedOn     = 0x0020,
  345.  
  346.     WEventTypeConfigMGAPI32     = 0x0022,
  347.     
  348.     WEventTypeVolLockQueryLock  = 0x8041,
  349.     WEventTypeVolLockLockTaken  = 0x8042,
  350.     WEventTypeVolLockLockFailed = 0x8043,
  351.     WEventTypeVolLockQueryUnlock= 0x8044,
  352.     WEventTypeVolLockLockReleased = 0x0045,
  353.     WEventTypeVolLockUnlockFailed = 0x8046,
  354.     
  355.     WEventTypeNoDiskSpace       = 0x0047,
  356.     WEventTypeConfigGMGPrivate  = 0x7fff,
  357.  
  358.     WEventTypeDevArrival        = 0x8000,
  359.     WEventTypeDevQueryMode      = 0x8001,
  360.     WEventTypeDevQueryModeFailed= 0x8002,
  361.     WEventTypeDevRemovePending  = 0x8003,
  362.     WEventTypeDevRemoveComplete = 0x8004,
  363.     WEventTypeDevTypeSpecific   = 0x8005,
  364.  
  365.     WEventTypeVPowerDAPI        = 0x8100,
  366.     WEventTypeUserDefined       = 0xffff
  367. };
  368.  
  369. struct WWindowPlacement {
  370.     WShowStyle          showStyle;
  371.     WPoint              minimizedPosition;
  372.     WPoint              maximizedPosition;
  373.     WRect               normalPosition;
  374. };
  375.  
  376. struct WDeviceChangeEventData : public WEventData {
  377.     WEventType          eventType;
  378.     WDeviceType         deviceType;
  379. };
  380.  
  381. enum WVolumeLockPermission {
  382.     WVolumeLockPermAllowWrites  = 0x01,
  383.     WVolumeLockPermFailWrites   = 0x00,
  384.     WVolumeLockPermFailMemMapping = 0x02,
  385.     WVolumeLockPermAllowMemMapping= 0x00,
  386.     WVolumeLockPermUserMask     = 0x03,
  387.     WVolumeLockPermLockForFormat= 0x04  
  388. };
  389.  
  390. enum WVolumeLockFlags {
  391.     WVolumeLockFlagsLogicalLock = 0x00,
  392.     WVolumeLockFlagsPhysicalLock= 0x01  
  393. };    
  394.  
  395. struct WVolumeLockDeviceChangeEventData : public WDeviceChangeEventData {
  396.     WDWord              owner;
  397.     WByte               permision;
  398.     WByte               lockType;
  399.     WByte               drive;
  400.     WByte               flags;      
  401. };
  402.  
  403. struct WOEMDeviceChangeEventData : public WDeviceChangeEventData {
  404.     WDWord      identifier;
  405.     WDWord      suppFunc;   
  406. };
  407.  
  408.  
  409. struct WDevNodeDeviceChangeEventData : public WDeviceChangeEventData {
  410.     WDWord      devNode;
  411. };
  412.  
  413. enum WVolumeDeviceChangeFlags {
  414.     WVolumeDeviceChangeMedia    = 0x0001,
  415.     WVolumeDeviceChangeNet      = 0x0002
  416. };
  417.  
  418. struct WVolumeDeviceChangeEventData : public WDeviceChangeEventData {
  419.     WDWord              unitMask;
  420.     WUShort             flags;
  421. };
  422.  
  423. struct WPortDeviceChangeEventData : public WDeviceChangeEventData {
  424.     WString                     name;
  425. };
  426.  
  427. enum WNetDeviceChangeFlags {
  428.     WNetDeviceChangeResource    = 0x00000001,
  429.     WNetDeviceChangeXPort       = 0x00000002,
  430.     WNetDeviceChangeSlowNet     = 0x00000004
  431. };    
  432.  
  433. struct WNetDeviceChangeEventData : public WDeviceChangeEventData {
  434.     WDWord              resource;
  435.     WDWord              flags;
  436. };
  437.  
  438. struct WUserDefinedDeviceChangeEventData : public WDeviceChangeEventData {
  439.     WString             name;
  440. };
  441.  
  442. struct WMGAPI32DeviceChangeEventData : public WDeviceChangeEventData {
  443.     void*               userDefined;
  444. };
  445.  
  446. struct WVPowerDAPIDeviceChangeEventData : public WDeviceChangeEventData {
  447.     void*               power;
  448. };
  449.  
  450. struct WNoDiskSpaceDeviceChangeEventData : public WDeviceChangeEventData {
  451.     void*               driveNumber;
  452. };
  453.  
  454. struct WDisplayChangeEventData : public WEventData {
  455.     WUShort BitPerPixel;
  456.     WUShort xResolution;
  457.     WUShort yResolution;
  458. };
  459.  
  460. struct WDockingChangeEventData : public WEventData {
  461.     WDockPosition       oldPosition;
  462.     WDockPosition       newPosition;
  463. };
  464.  
  465. enum WPowerBroadcastPowerEvent {
  466.  
  467.     WPowerBroadcastQuerySuspend         = 0x0000,
  468.     WPowerBroadcastQueryStandBy         = 0x0001,
  469.     WPowerBroadcastSuspendFailed        = 0x0002,
  470.     WPowerBroadcastStandByFailed        = 0x0003,
  471.     WPowerBroadcastSuspend              = 0x0004,
  472.     WPowerBroadcastStandBy              = 0x0005,
  473.     WPowerBroadcastResumeCritical       = 0x0006,
  474.     WPowerBroadcastResumeSuspend        = 0x0007,
  475.     WPowerBroadcastResumeStandBy        = 0x0008,
  476.     WPowerBroadcastBatteryLow           = 0x0009,
  477.     WPowerBroadcastPowerStatusChange    = 0x000a,
  478.     WPowerBroadcastOEMEvent             = 0x000b
  479. };
  480.  
  481. enum WPowerBroadcastPowerFlag {
  482.     WPowerBroadcastResumeFromFailure    = 0x00000001
  483. };
  484.  
  485. struct WPowerBroadcastEventData : public WEventData {
  486.     WDWord  powerEvent;
  487.     WDWord  powerData;
  488. };
  489.  
  490. enum WSettingChangeAction {
  491.     WSettingChangeGetBeep               =  1,
  492.     WSettingChangeSetBeep               =  2,
  493.     WSettingChangeGetMouse              =  3,
  494.     WSettingChangeSetMouse              =  4,
  495.     WSettingChangeGetBorder             =  5,
  496.     WSettingChangeSetBorder             =  6,
  497.     WSettingChangeGetKeyboardSpeed      = 10,
  498.     WSettingChangeSetKeyboardSpeed      = 11,
  499.     WSettingChangeLangDriver            = 12,
  500.     WSettingChangeIconHorizontalSpacing = 13,
  501.     WSettingChangeGetScreenSaveTimeOut  = 14,
  502.     WSettingChangeSetScreenSaveTimeOut  = 15,
  503.     WSettingChangeGetScreenSaveActive   = 16,
  504.     WSettingChangeSetScreenSaveActive   = 17,
  505.     WSettingChangeGetGridGranularity    = 18,
  506.     WSettingChangeSetGridGranularity    = 19,
  507.     WSettingChangeSetDeskWallPaper      = 20,
  508.     WSettingChangeSetDeskPattern        = 21,
  509.     WSettingChangeGetKeyboardDelay      = 22,
  510.     WSettingChangeSetKeyboardDelay      = 23,
  511.     WSettingChangeIconVerticalSpacing   = 24,
  512.     WSettingChangeGetIconTitleWrap      = 25,
  513.     WSettingChangeSetIconTitleWrap      = 26,
  514.     WSettingChangeGetMenuDropAlignment  = 27,
  515.     WSettingChangeSetMenuDropAlignment  = 28,
  516.     WSettingChangeSetDoubleClkWidth     = 29,
  517.     WSettingChangeSetDoubleClkHeight    = 30,
  518.     WSettingChangeGetIconTitleLogFont   = 31,
  519.     WSettingChangeSetDoubleClickTime    = 32,
  520.     WSettingChangeSetMouseButtonSwap    = 33,
  521.     WSettingChangeSetIconTitleLogFont   = 34,
  522.     WSettingChangeGetFastTaskSwitch     = 35,
  523.     WSettingChangeSetFastTaskSwitch     = 36,
  524.     WSettingChangeSetDragFullWindows    = 37,
  525.     WSettingChangeGetDragFullWindows    = 38,
  526.     WSettingChangeGetNonClientMetrics   = 41,
  527.     WSettingChangeSetNonClientMetrics   = 42,
  528.     WSettingChangeGetMinimizedMetrics   = 43,
  529.     WSettingChangeSetMinimizedMetrics   = 44,
  530.     WSettingChangeGetIconMetrics        = 45,
  531.     WSettingChangeSetIconMetrics        = 46,
  532.     WSettingChangeSetWorkArea           = 47,
  533.     WSettingChangeGetWorkArea           = 48,
  534.     WSettingChangeSetPenWindows         = 49,
  535.     WSettingChangeGetHighContrast       = 66,
  536.     WSettingChangeSetHighContrast       = 67,
  537.     WSettingChangeGetKeyboardPref       = 68,
  538.     WSettingChangeSetKeyboardPref       = 69,
  539.     WSettingChangeGetScreenReader       = 70,
  540.     WSettingChangeSetScreenReader       = 71,
  541.     WSettingChangeGetAnimation          = 72,
  542.     WSettingChangeSetAnimation          = 73,
  543.     WSettingChangeGetFontSmoothing      = 74,
  544.     WSettingChangeSetFontSmoothing      = 75,
  545.     WSettingChangeSetDragWidth          = 76,
  546.     WSettingChangeSetDragHeight         = 77,
  547.     WSettingChangeSetHandHeld           = 78,
  548.     WSettingChangeGetLowPowerTimeOut    = 79,
  549.     WSettingChangeGetPowerOffTimeOut    = 80,
  550.     WSettingChangeSetLowPowerTimeOut    = 81,
  551.     WSettingChangeSetPowerOffTimeOut    = 82,
  552.     WSettingChangeGetLowPowerActive     = 83,
  553.     WSettingChangeGetPowerOffActive     = 84,
  554.     WSettingChangeSetLowPowerActive     = 85,
  555.     WSettingChangeSetPowerOffActive     = 86,
  556.     WSettingChangeSetCursors            = 87,
  557.     WSettingChangeSetIcons              = 88,
  558.     WSettingChangeGetDefaultInputLang   = 89,
  559.     WSettingChangeSetDefaultInputLang   = 90,
  560.     WSettingChangeSetLangToggle         = 91,
  561.     WSettingChangeGetWindowsExtension   = 92,
  562.     WSettingChangeSetMouseTrails        = 93,
  563.     WSettingChangeGetMouseTrails        = 94,
  564.     WSettingChangeScreenSaverRunning    = 97,
  565.     WSettingChangeGetFilterKeys         = 50,
  566.     WSettingChangeSetFilterKeys         = 51,
  567.     WSettingChangeGetToggleKeys         = 52,
  568.     WSettingChangeSetToggleKeys         = 53,
  569.     WSettingChangeGetMouseKeys          = 54,
  570.     WSettingChangeSetMouseKeys          = 55,
  571.     WSettingChangeGetShowSounds         = 56,
  572.     WSettingChangeSetShowSounds         = 57,
  573.     WSettingChangeGetStickyKeys         = 58,
  574.     WSettingChangeSetStickyKeys         = 59,
  575.     WSettingChangeGetAccessTimeOut      = 60,
  576.     WSettingChangeSetAccessTimeOut      = 61,
  577.     WSettingChangeGetSerialKeys         = 62,
  578.     WSettingChangeSetSerialKeys         = 63,
  579.     WSettingChangeGetSoundSentry        = 64,
  580.     WSettingChangeSetSoundSentry        = 65
  581. };
  582.  
  583. enum WSettingChangeFlags {
  584.     WSettingChangeUpdateIniFile         = 0x0001,
  585.     WSettingChangeSendWinIniChange      = 0x0002,
  586.     WSettingChangeSendChange            = 0x0002, // == WSettingChangeSendWinIniChange
  587. };
  588.  
  589. struct WSettingChangeEventData : public WEventData {
  590.     WDWord   flags;
  591.     WString  metricsName;
  592. };
  593.  
  594. struct WLangChangeEventData : public WEventData {
  595.     WDWord              charSet;
  596.     WKeyboardHandle     hkl;            
  597. };
  598.  
  599. struct WLangChangeRequestEventData : public WEventData {
  600.     WBool               sysCharSet;
  601.     WKeyboardHandle     hkl;            
  602. };
  603.  
  604. struct WScrollBarEventData;
  605.  
  606. struct WSysDeadCharEventData : public WEventData {
  607.     WUnicodeChar        charCode;
  608.     WULong              keyData;
  609. };
  610.  
  611. /**************************************************
  612. ******************************************************
  613. ***************************************************/
  614.  
  615. struct WActivateEventData : public WEventData {
  616.     WWindow *           window;
  617.     WWindowHandle       handle;
  618.     WBool               causedByClick;
  619. };
  620.  
  621. struct WCalculateSizeEventData : public WEventData {
  622.     WRect               size;
  623.     WBool               adjust;
  624. };
  625.  
  626. struct WCharacterPressEventData : public WEventData {
  627.     WKeyState           state;
  628.     WChar               key;
  629.     WBool               prevDown;
  630.     WBool               keyDown;
  631.     WUInt               scanCode;
  632.     WUInt               repeatCount;
  633. };
  634.  
  635. struct WContextMenuEventData : public WEventData {
  636.     WWindow *           sourceWindow;
  637.     WWindowHandle       sourceHandle;
  638.     WPoint              clickedAt;
  639. };
  640.  
  641. struct WEndSessionEventData : public WEventData {
  642.     WBool               endSession;
  643.     WBool               logoff;
  644. };
  645.  
  646. struct WEnterIdleEventData : public WEventData {
  647.     WBool               isDialog;
  648.     WWindow *           window;
  649.     WWindowHandle       handle;
  650. };
  651.  
  652. struct WFocusEventData : public WEventData {
  653.     WWindow *           other;
  654.     WWindowHandle       handle;
  655. };
  656.  
  657. struct WGetCursorEventData : public WEventData {
  658.     WHitTestCode        hitTestCode;
  659.     WEventID            mouseEvent;
  660. };
  661.  
  662. struct WHelpEventData : public WEventData {
  663.     WULong              helpID;
  664.     WULong              objectID;
  665.     WULong              handle;
  666.     WBool               menuHelp;
  667. };
  668.  
  669. struct WHitTestEventData : public WEventData {
  670.     WPoint              newPosition;
  671.     WHitTestCode        hitTestCode;
  672. };
  673.  
  674. struct WKeyPressEventData : public WEventData {
  675.     WKeyState           state;
  676.     WKeyPressCode       key;
  677.     WBool               prevDown;
  678.     WBool               keyDown;
  679.     WUInt               scanCode;
  680.     WUInt               repeatCount;
  681. };
  682.  
  683. struct WMessageEventData : public WEventData, public WMessage {
  684. };
  685.  
  686. struct WMouseEventData : public WEventData {
  687.     WPoint              newPosition;
  688.     WMouseFlags         mouseFlags;
  689. };
  690.  
  691. struct WMoveEventData : public WEventData {
  692.     WPoint              newPosition;
  693. };
  694.  
  695. struct WPaintEventData : public WEventData {
  696.     WDisplayCanvas *    canvas;
  697. };
  698.  
  699. struct WPaletteChangedEventData : public WEventData {
  700.     WWindow *           window;
  701.     WWindowHandle       handle;
  702. };
  703.  
  704. struct WQueryEndSessionEventData : public WEventData {
  705.     WUInt               source;
  706.     WBool               logoff;
  707. };
  708.  
  709. struct WResizeEventData : public WEventData {
  710.     WRect               newPosition;
  711.     WRect               oldPosition;
  712.     WBool               minimizing;
  713.     WBool               maximizing;
  714. };
  715.  
  716. struct WToolTipTextEventData : public WEventData {
  717.     WWindow *           source;
  718.     WULong              id;
  719.     WString             string;
  720. };
  721.  
  722. struct WUserEventData : public WEventData {
  723.     WULong              data;
  724. };
  725.  
  726. // Flags for print events
  727.  
  728. #define WPEDF_CHECKVISIBLE 0x01L
  729. #define WPEDF_NONCLIENT    0x02L
  730. #define WPEDF_CLIENT       0x04L
  731. #define WPEDF_ERASEBKGND   0x08L
  732. #define WPEDF_CHILDREN     0x10L
  733. #define WPEDF_OWNED        0x20L
  734.  
  735. struct WPrintEventData : public WEventData {
  736.     WCanvas *canvas;
  737.     WULong   flags;
  738. };
  739.  
  740. typedef WPrintEventData WPrintClientEventData;
  741.  
  742. struct WHotKeyInfo {
  743.     WKeyState           state;
  744.     WKeyPressCode       code;
  745. };
  746.  
  747. typedef WULong                  WDialogCode;
  748.  
  749. #define WDefaultSize            (0x80000000)
  750.  
  751. #define WDLGCodeWantArrows      (0x0001)
  752. #define WDLGCodeWantTab         (0x0002)
  753. #define WDLGCodeWantAllKeys     (0x0004)
  754. #define WDLGCodeWantMessage     (0x0004)
  755. #define WDLGCodeHasSetSel       (0x0008)
  756. #define WDLGCodeDefPushButton   (0x0010)
  757. #define WDLGCodeUnDefPushButton (0x0020)
  758. #define WDLGCodeRadioButton     (0x0040)
  759. #define WDLGCodeWantChars       (0x0080)
  760. #define WDLGCodeStatic          (0x0100)
  761. #define WDLGCodeButton          (0x2000)
  762.  
  763. //
  764. // Window styles
  765. //
  766.  
  767. #define WSDefault          ((WStyle)0x10CF0000L) // WS_OVERLAPPEDWINDOW|WS_VISIBLE
  768.  
  769. #define WSVisible          ((WStyle)0x10000000L) // WS_VISIBLE
  770. #define WSDisabled         ((WStyle)0x08000000L) // WS_DISABLED
  771. #define WSCaption          ((WStyle)0x00C00000L) // WS_CAPTION
  772. #define WSClipChildren     ((WStyle)0x02000000L) // WS_CLIPCHILDREN
  773. #define WSClipSiblings     ((WStyle)0x04000000L) // WS_CLIPSIBLINGS
  774. #define WSMinimize         ((WStyle)0x20000000L) // WS_MINIMIZE
  775. #define WSMaximize         ((WStyle)0x01000000L) // WS_MAXIMIZE
  776. #define WSHScroll          ((WStyle)0x00100000L) // WS_HSCROLL
  777. #define WSVScroll          ((WStyle)0x00200000L) // WS_VSCROLL
  778. #define WSSizeable         ((WStyle)0x00040000L) // WS_THICKFRAME
  779. #define WSBorder           ((WStyle)0x00800000L) // WS_BORDER
  780. #define WSDlgBorder        ((WStyle)0x00400000L) // WS_DLGFRAME
  781. #define WSDlgFrame         ((WStyle)0x00400000L) // WS_DLGFRAME
  782. #define WSSysMenu          ((WStyle)0x00080000L) // WS_SYSMENU
  783. #define WSSystemMenu       ((WStyle)0x00080000L) // WS_SYSMENU
  784. #define WSOverlapped       ((WStyle)0x00000000L) // WS_OVERLAPPED
  785. #define WSPopup            ((WStyle)0x80000000L) // WS_POPUP
  786. #define WSChild            ((WStyle)0x40000000L) // WS_CHILD
  787. #define WSMinimizeBox      ((WStyle)0x00020000L) // WS_MINIMIZEBOX
  788. #define WSMaximizeBox      ((WStyle)0x00010000L) // WS_MAXIMIZEBOX
  789. #define WSGroup            ((WStyle)0x00020000L) // WS_GROUP
  790. #define WSTabStop          ((WStyle)0x00010000L) // WS_TABSTOP
  791. #define WSResizeBorder     ((WStyle)0x00040000L) // WS_THICKFRAME
  792.  
  793. #define WSExAcceptDropFile ((WStyle)0x00000010L) // WS_EX_ACCEPTFILES
  794. #define WSExAcceptFiles    ((WStyle)0x00000010L) // WS_EX_ACCEPTFILES
  795. #define WSExDlgModalFrame  ((WStyle)0x00000001L) // WS_EX_DLGMODALFRAME
  796. #define WSExNoParentNotify ((WStyle)0x00000004L) // WS_EX_NOPARENTNOTIFY
  797. #define WSExTopmost        ((WStyle)0x00000008L) // WS_EX_TOPMOST
  798. #define WSExTransparent    ((WStyle)0x00000020L) // WS_EX_TRANSPARENT
  799. #define WSExMDIChild       ((WStyle)0x00000040L) // WS_EX_MDICHILD
  800. #define WSExToolWindow     ((WStyle)0x00000080L) // WS_EX_TOOLWINDOW
  801. #define WSExWindowEdge     ((WStyle)0x00000100L) // WS_EX_WINDOWEDGE
  802. #define WSExClientEdge     ((WStyle)0x00000200L) // WS_EX_CLIENTEDGE
  803. #define WSExContextHelp    ((WStyle)0x00000400L) // WS_EX_CONTEXTHELP
  804. #define WSExRight          ((WStyle)0x00001000L) // WS_EX_RIGHT
  805. #define WSExLeft           ((WStyle)0x00000000L) // WS_EX_LEFT
  806. #define WSExLTRReading     ((WStyle)0x00000000L) // WS_EX_LTRREADING
  807. #define WSExRTLReading     ((WStyle)0x00002000L) // WS_EX_RTLREADING
  808. #define WSExLeftScrollbar  ((WStyle)0x00004000L) // WS_EX_LEFTSCROLLBAR
  809. #define WSExRightScrollbar ((WStyle)0x00000000L) // WS_EX_RIGHTSCROLLBAR
  810. #define WSExControlParent  ((WStyle)0x00010000L) // WS_EX_CONTROLPARENT
  811. #define WSExStaticEdge     ((WStyle)0x00020000L) // WS_EX_STATICEDGE
  812. #define WSExAppWindow      ((WStyle)0x00040000L) // WS_EX_APPWINDOW
  813.  
  814. class WCMCLASS WWindow : public WEventGenerator {
  815.     WDeclareSubclass( WWindow, WEventGenerator );
  816.  
  817.     public:
  818.  
  819.         /**************************************************************
  820.          * Constructors and destructors
  821.          **************************************************************/
  822.     
  823.         WWindow();
  824.         WWindow( WWindow *parent, WWindowHandle hdl=NULLHWND );
  825.         WWindow( WWindow *parent, WUInt id, WWindowHandle hdl=NULLHWND );
  826.     
  827.         ~WWindow();
  828.  
  829.         /**************************************************************
  830.          * Properties
  831.          **************************************************************/
  832.  
  833.         // AcceptDropFile
  834.  
  835.         virtual WBool GetAcceptDropFile() const;
  836.         virtual WBool SetAcceptDropFile( WBool acceptDropFile );
  837.  
  838.         // AlwaysOnTop
  839.  
  840.         WBool GetAlwaysOnTop() const;
  841.         WBool SetAlwaysOnTop( WBool alwaysOnTop );
  842.  
  843.         // BackColor
  844.  
  845.         virtual WColor GetBackColor( WBool getResultingColor=TRUE ) const;
  846.         virtual WBool SetBackColor( const WColor & backColor );
  847.  
  848.         // Capture
  849.  
  850.         WBool GetCapture() const;
  851.         WBool SetCapture( WBool capture=TRUE );
  852.  
  853.         // ClientRectangle
  854.  
  855.         WRect GetClientRectangle( WBool absolute=FALSE ) const;
  856.  
  857.         // DefaultStyle
  858.  
  859.         virtual WStyle GetDefaultStyle() const;
  860.  
  861.         // DefaultExtendedStyle
  862.  
  863.         virtual WStyle GetDefaultExtendedStyle() const;
  864.  
  865.         // Dockable
  866.  
  867.         WBool GetDockable() const;
  868.         WBool SetDockable( WBool dockable );
  869.  
  870.         // DockableAtPosition
  871.  
  872.         WBool GetDockableAtPosition( WDockPosition pos ) const;
  873.         WBool SetDockableAtPosition( WBool dockable, WDockPosition pos );
  874.  
  875.         // DockedFrame
  876.  
  877.         WDockFloatingForm *GetDockedFrame() const;
  878.         WBool              SetDockedFrame( WDockFloatingForm * frame );
  879.  
  880.         // DockedIndex
  881.  
  882.         WBool SetDockedIndex( WInt index );
  883.         WInt  GetDockedIndex() const;
  884.  
  885.         // DockedMinimumSize
  886.  
  887.         virtual WSize GetDockedMinimumSize() const;
  888.  
  889.         // DockedOffset
  890.  
  891.         WInt  GetDockedOffset() const;
  892.         WBool SetDockedOffset( WInt offset );
  893.  
  894.         // DockedParent
  895.  
  896.         virtual WForm *GetDockedParent() const;
  897.         virtual WBool  SetDockedParent( WForm * dockedParent );
  898.  
  899.         // DockedPosition
  900.  
  901.         virtual WDockPosition GetDockedPosition();
  902.         virtual void SetDockedPosition( WDockPosition pos, WInt index=0,
  903.                                         WBool insert=FALSE,
  904.                                         WWindow * sibling=NULL,
  905.                                         WBool insertBeforeSibling=TRUE,
  906.                                         WBool callEventHandler=TRUE );
  907.  
  908.         // DockDragging
  909.  
  910.         WBool SetDockDragging( WBool dockDragging );
  911.         WBool GetDockDragging() const;
  912.  
  913.         // DockDragStarting
  914.  
  915.         WBool SetDockDragStarting( WBool dockDragStarting );
  916.         WBool GetDockDragStarting() const;
  917.  
  918.         // DockWrappable
  919.  
  920.         WBool GetDockWrappable() const;
  921.         WBool SetDockWrappable( WBool wrappable );
  922.  
  923.         // DialogCode
  924.  
  925.         virtual WULong GetDialogCode( WUInt wParam = 0, WLong lParam = 0 );
  926.  
  927.         // DragMode
  928.  
  929.         WDragMode     GetDragMode() const;
  930.         virtual WBool SetDragMode( WDragMode mode );
  931.  
  932.         // DragSourceTag
  933.         //
  934.         //    If not a null/empty string, identifies the window as a
  935.         //    drag source and describes the tag to be used to
  936.         //    fill the structures for DragEvent.
  937.  
  938.         WString GetDragSourceTag() const;
  939.         WBool   SetDragSourceTag( const WString & tag );
  940.  
  941.         // DragTargetTag
  942.         //
  943.         //    If not a null string, identifies the tags that
  944.         //    the window accepts for drag operations. A '*' means all,
  945.         //    a null/empty string means none.
  946.  
  947.         WString GetDragTargetTag() const;
  948.         WBool   SetDragTargetTag( const WString & tag );
  949.     
  950.         // Enabled
  951.  
  952.         virtual WBool SetEnabled( WBool enabled );
  953.         virtual WBool GetEnabled() const;
  954.  
  955.         // ExtendedStyle
  956.  
  957.         WStyle GetExtendedStyle() const;
  958.         WBool  SetExtendedStyle( WStyle style, WBool clone );
  959.         WBool  SetExtendedStyle( WStyle style );
  960.  
  961.         // Focus
  962.  
  963.         WBool SetFocus( WBool focus=TRUE );
  964.         WBool GetFocus() const;
  965.     
  966.         // Font
  967.  
  968.         virtual WBool SetFont( const WFont & font, WBool preserveSize=TRUE );
  969.         virtual WFont GetFont( WBool getResultingFont=TRUE );
  970.  
  971.         // ForeColor
  972.  
  973.         virtual WColor GetForeColor( WBool getResultingColor=TRUE ) const;
  974.         virtual WBool  SetForeColor( const WColor & foreColor );
  975.  
  976.         // Handle
  977.  
  978.         WWindowHandle GetHandle() const { return _handle; }
  979.         WBool         SetHandle( WWindowHandle handle );
  980.  
  981.         // Height
  982.  
  983.         virtual WInt  GetHeight() const;
  984.         virtual WBool SetHeight( const WInt & height, WBool update=TRUE );
  985.  
  986.         // HelpID
  987.  
  988.         virtual WULong GetHelpID() const;
  989.         virtual WBool  SetHelpID( WULong helpID );
  990.  
  991.         // HotKey
  992.  
  993.         WHotKeyInfo GetHotKey();
  994.         WBool       SetHotKey( const WHotKeyInfo & hotKey );
  995.         WBool       SetHotKey( WHotKey *hotKey );
  996.  
  997.         // InputContext
  998.  
  999.         virtual WInputContext   GetInputContext() const;
  1000.  
  1001.         // InputMode
  1002.  
  1003.         virtual WDWord  GetInputMode() const;
  1004.         virtual WBool   SetInputMode( WDWord mode );
  1005.  
  1006.         // Left
  1007.  
  1008.         virtual WInt  GetLeft() const;
  1009.         virtual WBool SetLeft( const WInt & left, WBool update=TRUE );
  1010.  
  1011.         // Name
  1012.  
  1013.         virtual WString GetName() const;
  1014.         virtual WBool   SetName( const WString & name );
  1015.  
  1016.         // Owner
  1017.  
  1018.         WWindow *GetOwner() const;
  1019.  
  1020.         // Painting
  1021.  
  1022.         virtual WBool GetPainting() const;
  1023.         virtual WBool SetPainting( WBool painting, WBool forceRedraw=TRUE,
  1024.                                    WBool update=FALSE );
  1025.  
  1026.         // Parent
  1027.  
  1028.         virtual WWindow *GetParent() const;
  1029.         virtual WBool    SetParent( const WWindow * parent );
  1030.  
  1031.         // Popup
  1032.  
  1033.         virtual WPopupMenu *GetPopup();
  1034.         virtual WBool       SetPopup( WPopupMenu * popup );
  1035.  
  1036.         // Rectangle
  1037.  
  1038.         virtual WRect GetRectangle( WBool absolute=FALSE ) const;
  1039.         virtual WBool SetRectangle( const WRect & rectangle,
  1040.                                     WBool update=TRUE );
  1041.  
  1042.         // RegisteredClass
  1043.  
  1044.         virtual const WChar *GetRegisteredClass();
  1045.  
  1046.         // Style
  1047.  
  1048.         WStyle GetStyle() const;
  1049.         virtual WBool SetStyle( WStyle style, WBool clone );
  1050.         virtual WBool SetStyle( WStyle style );
  1051.  
  1052.         // Text
  1053.  
  1054.         virtual WString GetText() const;
  1055.         virtual WBool   SetText( const WString & text );
  1056.  
  1057.         // TextLength
  1058.  
  1059.         virtual size_t GetTextLength() const;
  1060.  
  1061.         // ToolTip
  1062.  
  1063.         virtual WToolTip *GetToolTip() const;
  1064.         virtual WBool     SetToolTip( WToolTip * toolTip );
  1065.  
  1066.         // ToolTipText
  1067.  
  1068.         WString       GetToolTipText() const;
  1069.         virtual WBool SetToolTipText( const WString & toolTipText );
  1070.  
  1071.         // Top
  1072.  
  1073.         virtual WInt  GetTop() const;
  1074.         virtual WBool SetTop( const WInt & top, WBool update=TRUE );
  1075.  
  1076.         // Topmost
  1077.  
  1078.         WBool SetTopmost( WBool topmost );
  1079.         WBool GetTopmost() const;
  1080.  
  1081.         // UserData
  1082.  
  1083.         virtual void *GetUserData() const;
  1084.         virtual WBool SetUserData( void * userData );
  1085.  
  1086.         // Valid
  1087.  
  1088.         WBool GetValid();
  1089.  
  1090.         // Visible
  1091.  
  1092.         virtual WBool GetVisible() const;
  1093.         virtual WBool SetVisible( WBool visible );
  1094.  
  1095.         // Width
  1096.  
  1097.         virtual WInt  GetWidth() const;
  1098.         virtual WBool SetWidth( const WInt & width, WBool update=TRUE );
  1099.  
  1100.         // WindowID
  1101.  
  1102.         virtual WUInt GetWindowID() const;
  1103.         virtual WBool SetWindowID( WUInt windowID );
  1104.  
  1105.         // WindowPlacement
  1106.  
  1107.         WWindowPlacement GetWindowPlacement() const;
  1108.         WBool SetWindowPlacement( const WWindowPlacement & windowPlacement,
  1109.                                   WBool restoreToMaximized=FALSE,
  1110.                                   WBool setMinimizedPosition=TRUE );
  1111.  
  1112.         // ZOrder
  1113.  
  1114.         virtual WUInt GetZOrder() const;
  1115.         virtual WBool SetZOrder( WUInt zorder );
  1116.  
  1117.  
  1118.         /**************************************************************
  1119.          * Methods
  1120.          **************************************************************/
  1121.  
  1122.         // AdjustFloatingFormStyle
  1123.  
  1124.         virtual WBool AdjustFloatingFormStyle( WStyle & style,
  1125.                                                WStyle & exStyle );
  1126.  
  1127.         // BringToTop
  1128.  
  1129.         virtual WBool BringToTop();
  1130.     
  1131.         // CalculateSize
  1132.  
  1133.         virtual WRect CalculateSize( const WRect & size, WBool adjust );
  1134.  
  1135.         // ChangeStyle
  1136.  
  1137.         WBool ChangeStyle( WStyle style, WBool on, WBool clone );
  1138.         WBool ChangeStyle( WStyle style, WBool on );
  1139.  
  1140.         // ChangeExtendedStyle
  1141.  
  1142.         WBool ChangeExtendedStyle( WStyle style, WBool on, WBool clone );
  1143.         WBool ChangeExtendedStyle( WStyle style, WBool on );
  1144.  
  1145.         // ClipMouse
  1146.  
  1147.         WBool ClipMouse( const WRect & clipRectangle, WBool absolute=FALSE );
  1148.     
  1149.         // Create
  1150.         //
  1151.         //     Create a window.
  1152.  
  1153.         WBool Create( WWindow *parent );
  1154.         WBool Create( WWindow *parent, const WChar *text );
  1155.         WBool Create( WWindow *parent, const WChar *text, void *data );
  1156.         WBool Create( WWindow * parent, const WRect & rectangle,
  1157.                       const WChar * text=NULL, void * data=NULL );
  1158.         WBool Create( WWindow * parent, const WRect & rectangle,
  1159.                       const WChar * text, WStyle style,
  1160.                       WStyle exStyle, void * data=NULL );
  1161.         WBool Create( WWindow * parent, const WResourceID & id,
  1162.                       WModuleHandle module=_ApplicationModule );
  1163.  
  1164.         // CreateToolTip
  1165.  
  1166.         WBool CreateToolTip( WBool rectangleBased=FALSE,
  1167.                              WLong rectangleBasedId=1 );
  1168.  
  1169.         // Destroy
  1170.  
  1171.         virtual WBool Destroy();
  1172.  
  1173.         // EnableScrollBar
  1174.  
  1175.         WBool EnableScrollBar( WScrollDir bar, WBool enable=TRUE );
  1176.  
  1177.         // FindDragSource
  1178.         //
  1179.         //     After the user has signalled a drag, call this routine to
  1180.         //     find out if anyone actually wants to start a drag or not.
  1181.         //     Returns NULL if no one does, otherwise returns the object
  1182.         //     whose StartDrag method should be called.  Note that this
  1183.         //     routine may call one or more DragStart events.  The
  1184.         //     structures will be initialized appropriately for passing
  1185.         //     to the StartDrag method.
  1186.  
  1187.         WWindow *FindDragSource( WDragEventData & event, WDragInfo *dragInfo );
  1188.  
  1189.  
  1190.         // InDragScrollInset
  1191.         //
  1192.         //     Returns TRUE if the given point is in the drag scroll
  1193.         //     inset for the window.  Point can be given in client
  1194.         //     or screen coordinates.
  1195.  
  1196.         virtual WBool InDragScrollInset( const WPoint & point,
  1197.                                          WBool absolute ) const;
  1198.  
  1199.         // InitializeClass
  1200.         //
  1201.         //     A virtual function whose task is twofold:
  1202.         //      a) to register the class (once only)
  1203.         //      b) to return the name of the class
  1204.  
  1205.         virtual const WChar *InitializeClass();
  1206.  
  1207.         // Invalidate
  1208.  
  1209.         WBool Invalidate( WBool erase=TRUE );
  1210.         WBool Invalidate( const WRect & rectangle, WBool erase=TRUE );
  1211.         WBool Invalidate( const WRegion & region, WBool erase=TRUE );
  1212.     
  1213.         // InvokeHelp
  1214.         //
  1215.         //     Simulates the user pressing F1 for the window.
  1216.  
  1217.         WBool InvokeHelp() const;
  1218.  
  1219.         // Move
  1220.  
  1221.         virtual WBool Move( const WRect & rectangle, WBool update=TRUE );
  1222.         virtual WBool Move( const WRect & rectangle, WDeferMoveHandle & dwp );
  1223.         virtual WBool Move( const WPoint & point, WBool update=TRUE );
  1224.         virtual WBool Move( const WPoint & point, WDeferMoveHandle & dwp );
  1225.     
  1226.         // PostMessage
  1227.  
  1228.         WLong PostMessage( const WMessage & msg ) const;
  1229.         
  1230.         // PostUserEvent
  1231.         //
  1232.         //     Post a user-defined "event" (a 32-bit value) which
  1233.         //     is to be processed by the target window's "User" event.
  1234.         //     The event is posted to the message queue and thus
  1235.         //     can be used across threads.
  1236.  
  1237.         WBool PostUserEvent( WWindow * postTo, WULong data );
  1238.  
  1239.         // Scroll
  1240.  
  1241.         virtual WBool Scroll( const WPoint & amount, WRect * toScroll=NULL,
  1242.                               WRect * clipRegion=NULL );
  1243.  
  1244.         // SendMessage
  1245.  
  1246.         WLong SendMessage( const WMessage & msg ) const;
  1247.  
  1248.         // StartDrag
  1249.         //
  1250.         //     Used to actually start a dragging operation.  Captures
  1251.         //     mouse input until the given mouse button is released
  1252.         //     or escape is pressed (or the DragContinue event returns
  1253.         //     a cancel).  If no draginfo is provided, default values
  1254.         //     are used.  If targetDragOver is TRUE, the target object
  1255.         //     will get DragEnter/DragOver/DragLeave/DragDrop events.
  1256.         //     If sourceDragOver is TRUE, the source will also get
  1257.         //     these events as if they were being sent to the drag target.
  1258.  
  1259.         WBool StartDrag( WDragEventData & event,
  1260.                          WULong whichButton=WMK_LBUTTON,
  1261.                          WDragInfo *draginfo=NULL,
  1262.                          WBool sourceDragOver=FALSE,
  1263.                          WBool targetDragOver=TRUE );
  1264.         WBool StartDrag( WULong whichButton=WMK_LBUTTON,
  1265.                          WDragInfo *draginfo=NULL,
  1266.                          WBool sourceDragOver=FALSE,
  1267.                          WBool targetDragOver=TRUE );
  1268.  
  1269.         // StartFakeDrag
  1270.         //
  1271.         //     Simulates a dragging operation between two windows.
  1272.         //     Calls DragStart event at the beginning and then
  1273.         //     DragEnd at the end.  In between, calls DragEnter,
  1274.         //     DragOver, DragDrop for either or both the source
  1275.         //     and target windows.  DragContinue, DragFeedback
  1276.         //     DragLeave and DragScroll are never called.
  1277.         
  1278.         WBool StartFakeDrag( WWindow *target, WDragEventData & event,
  1279.                              WULong   whichButton=WMK_LBUTTON,
  1280.                              WDragInfo *draginfo=NULL,
  1281.                              WBool sourceDragOver=FALSE,
  1282.                              WBool targetDragOver=TRUE );
  1283.         WBool StartFakeDrag( WWindow *target,
  1284.                              WULong   whichButton=WMK_LBUTTON,
  1285.                              WDragInfo *draginfo=NULL,
  1286.                              WBool sourceDragOver=FALSE,
  1287.                              WBool targetDragOver=TRUE );
  1288.  
  1289.         // Update
  1290.  
  1291.         virtual WBool Update( WBool force=FALSE );
  1292.     
  1293.         // UnClipMouse
  1294.  
  1295.         WBool UnClipMouse();
  1296.     
  1297.         // Validate
  1298.  
  1299.         WBool Validate();
  1300.         WBool Validate( const WRect & rectangle );
  1301.         WBool Validate( const WRegion & region );
  1302.     
  1303.         /**************************************************************
  1304.          * Item Properties
  1305.          **************************************************************/
  1306.  
  1307.         // ScrollIncrement
  1308.  
  1309.         virtual WLong GetScrollIncrement( WScrollDir bar ) const;
  1310.         virtual WBool SetScrollIncrement( WScrollDir bar, WLong increment );
  1311.  
  1312.         // ScrollPosition
  1313.  
  1314.         virtual WBool SetScrollPosition( WScrollDir bar, WInt pos,
  1315.                                          WBool redraw=TRUE );
  1316.         virtual WInt GetScrollPosition( WScrollDir bar );
  1317.     
  1318.         // ScrollRange
  1319.  
  1320.         virtual WBool SetScrollRange( WScrollDir bar, const WRange & range,
  1321.                                       WBool redraw=TRUE );
  1322.         virtual WRange GetScrollRange( WScrollDir bar ) const;
  1323.  
  1324.         // ScrollStep
  1325.  
  1326.         virtual WLong GetScrollStep( WScrollDir bar ) const;
  1327.         virtual WBool SetScrollStep( WScrollDir bar, WLong step );
  1328.  
  1329.         // ScrollPageSize
  1330.  
  1331.         virtual WBool SetScrollPageSize( WScrollDir bar, const WInt & psize );
  1332.         virtual WInt GetScrollPageSize( WScrollDir bar ) const;
  1333.  
  1334.         /**************************************************************
  1335.          * Static Properties
  1336.          **************************************************************/
  1337.  
  1338.         // FocusWindow
  1339.  
  1340.         static WWindow * GetFocusWindow();
  1341.     
  1342.         /**************************************************************
  1343.          * Static Methods
  1344.          **************************************************************/
  1345.  
  1346.         // AcceptsDropFile
  1347.  
  1348.         static WWindowHandle AcceptsDropFile( WWindowHandle handle );
  1349.  
  1350.         // BeginDeferMove
  1351.  
  1352.         static WDeferMoveHandle BeginDeferMove( WInt numWindows=0 );
  1353.  
  1354.         // EndDeferMove
  1355.  
  1356.         static WBool EndDeferMove( WDeferMoveHandle dwp );
  1357.  
  1358.         // HitText
  1359.  
  1360.         static WHitTestCode HitTest( WWindowHandle handle,
  1361.                                      const WPoint & pt );
  1362.  
  1363.         // DropFile
  1364.  
  1365.         static WBool DropFile( WWindowHandle handle, WArray<WString> files );
  1366.         static WBool DropFile( WWindowHandle handle, WArray<WString> files,
  1367.                                const WPoint & pt, WBool inNonClientArea,
  1368.                                WBool useUnicode );
  1369.  
  1370.         // FindWindow
  1371.  
  1372.         static WWindow * FindWindow( WWindowHandle hdl );
  1373.  
  1374.         // MapWindowPoint
  1375.  
  1376.         static WBool MapWindowPoint( WWindow * source, WWindow * dest,
  1377.                                      WPoint & pt );
  1378.  
  1379.         /**************************************************************
  1380.          * Message processing
  1381.          **************************************************************/
  1382.         
  1383.         virtual WBool ProcessMessage( const WMessage & msg,
  1384.                                       WLong & returns );
  1385.     
  1386.         virtual WBool DefaultProcess( const WMessage & msg,
  1387.                                       WLong & returns );
  1388.  
  1389.         virtual WBool CallNextWindowProcedure( const WMessage & msg,
  1390.                                                WLong & returns );
  1391.     
  1392.         virtual WBool ProcessCommand( WUInt id, WNotify code, WNotifyInfo info,
  1393.                                       WLong & returns );
  1394.     
  1395.         virtual WBool ProcessNotify( WUInt id, WNotify code, WNotifyInfo info,
  1396.                                      WLong & returns );
  1397.     
  1398.         /**************************************************************
  1399.          * Creation functions
  1400.          **************************************************************/
  1401.  
  1402.     public:
  1403.         virtual WBool AttachToWindow( WWindowHandle handle, WBool destroy,
  1404.                                       WBool subclass=TRUE );
  1405.  
  1406.         virtual WWindowHandle DetachFromWindow();
  1407.  
  1408.         virtual void * GetTargetWindowProc() const;
  1409.  
  1410.         virtual WInt GetTargetOffset() const;
  1411.  
  1412.  
  1413.         virtual WBool CloneWindow( WStyle newStyle, WStyle newExStyle,
  1414.                                    void * data=NULL );
  1415.  
  1416.     protected:
  1417.  
  1418.         void GetWindowStyles( WStyle & normal, WStyle & extended ) const;
  1419.  
  1420.         void ResetWindowStyles();
  1421.  
  1422.         virtual void CopyWindowData( WWindowHandle oldWin,
  1423.                                      WWindowHandle newWin );
  1424.  
  1425.         virtual WBool LoadWindow( WWindow * parent,
  1426.                                   const WResourceID & id,
  1427.                                   WModuleHandle module=_ApplicationModule );
  1428.     
  1429.         virtual WBool MakeWindow( WWindow * parent, WUInt id,
  1430.                                   const WChar *className,
  1431.                                   const WChar *title, const WRect & r,
  1432.                                   WStyle wstyle, WStyle exStyle,
  1433.                                   void * data=NULL );
  1434.  
  1435.         virtual WBool DoStartDrag( WDragEventData & event,
  1436.                                    WULong whichButton,
  1437.                                    WDragInfo *draginfo,
  1438.                                    WBool sourceDragOver,
  1439.                                    WBool targetDragOver );
  1440.  
  1441.         virtual WBool DoStartFakeDrag( WWindow *, WDragEventData & event,
  1442.                                    WULong whichButton,
  1443.                                    WDragInfo *draginfo,
  1444.                                    WBool sourceDragOver,
  1445.                                    WBool targetDragOver );
  1446.  
  1447.         virtual void EventNotice( WEventID id, WEventNotice type );
  1448.  
  1449.         WLong FastSendMessage( WUInt msg, WUInt wParam, WLong lParam ) const;
  1450.  
  1451.         WBool CreateInputContext( WWindowHandle winHandle );
  1452.         WBool AssociateInputContext( WWindowHandle winHandle );
  1453.         WBool DestroyInputContext( WWindowHandle winHandle );
  1454.  
  1455.         /**************************************************************
  1456.          * Event handlers
  1457.          **************************************************************/
  1458.         
  1459.     public:
  1460.  
  1461.         WBool DestroyEventHandler( WWindow * window, WEventData * event );
  1462.         WBool CommandEventHandler( WWindow * window,
  1463.                                    WMessageEventData * event );
  1464.         WBool NotifyEventHandler( WWindow * window,
  1465.                                   WMessageEventData * event );
  1466.         WBool InitPopupMenuEventHandler( WWindow * window,
  1467.                                          WMessageEventData * event );
  1468.         WBool PrivateMessageEventHandler( WWindow * window,
  1469.                                           WMessageEventData * event );
  1470.         WBool ControlColorEventHandler( WWindow * window,
  1471.                                         WMessageEventData * event );
  1472.         WBool NeedToolTipTextEventHandler( WWindow * source,
  1473.                                            WToolTipTextEventData * event );
  1474.         WBool MenuSelectEventHandler( WWindow * window,
  1475.                                       WMessageEventData * event );
  1476.         WBool RightButtonDownHandler( WWindow * window,
  1477.                                       WMouseEventData * event );
  1478.         WBool LeftButtonDownHandler( WWindow * window,
  1479.                                      WMouseEventData * event );
  1480.         WBool RightButtonUpHandler( WWindow * window,
  1481.                                     WMouseEventData * event );
  1482.         WBool ContextMenuHandler( WWindow * window,
  1483.                                   WEventData * event );
  1484.         WBool ContextHelpHandler( WWindow * window,
  1485.                                   WHelpEventData * event );
  1486.         WBool DockLeftButtonUpHandler( WWindow * window,
  1487.                                        WMouseEventData * event );
  1488.         WBool DockLeftButtonDownHandler( WWindow * window,
  1489.                                          WMouseEventData * event );
  1490.         WBool DockMouseMoveHandler( WWindow * window,
  1491.                                     WMouseEventData * event );
  1492.         WBool DockKeyDownEventHandler( WWindow * window,
  1493.                                        WKeyPressEventData * event );
  1494.         WBool ScrollEventHandler( WWindow * window,
  1495.                                   WScrollBarEventData * event );
  1496.         WBool DummyEventHandler( WWindow * window,
  1497.                                  WEventData * event );
  1498.  
  1499.         // Default handlers for drag sources...
  1500.  
  1501.         virtual WBool WantsDragMessage( WULong whichButton ) const;
  1502.         virtual WBool FillDragEventData( WDragEventData & event ) const;
  1503.  
  1504.         WBool DragStartHandler( WWindow *window, WDragEventData *event );
  1505.         WBool DragContinueHandler( WWindow *window, WDragEventData *event );
  1506.         WBool DragFeedbackHandler( WWindow *window, WDragEventData *event );
  1507.         WBool DragEndHandler( WWindow *window, WDragEventData *event );
  1508.         WBool DragFillHandler( WWindow *window, WDragEventData *event );
  1509.  
  1510.         WBool DragEnterHandler( WWindow *window, WDragEventData *event );
  1511.         WBool DragOverHandler( WWindow *window, WDragEventData *event );
  1512.         WBool DragLeaveHandler( WWindow *window, WDragEventData *event );
  1513.         WBool DragDropHandler( WWindow *window, WDragEventData *event );
  1514.  
  1515.         /**************************************************************
  1516.          * Other
  1517.          **************************************************************/
  1518.         
  1519.         int operator==( const WWindow & obj ) const;
  1520.         int operator!=( const WWindow & obj ) const;
  1521.  
  1522.         virtual void SetClassIcon( const WResourceID & id );
  1523.  
  1524.         virtual WBool SelectControlColors( WDeviceHandle handle,
  1525.                                            WBrushHandle * backBrush,
  1526.                                            WBool backOnly,
  1527.                                            WBool setDefaults=TRUE,
  1528.                                            WColor * backColor=NULL,
  1529.                                            WColor * foreColor=NULL,
  1530.                                            WBool queryOnlyMode=FALSE );
  1531.  
  1532.         WCursor SetCursor( const WCursor & cursor, WBool persistent=FALSE );
  1533.     
  1534.         WBool IsVisible();
  1535.     
  1536.         WBool IsEnabled();
  1537.     
  1538.         WBool       SetCurrentPopupMenu( WPopupMenu *popup );
  1539.         WPopupMenu *GetCurrentPopupMenu() const;
  1540.  
  1541.         virtual WBool OnMouseMessage( const WMessage & msg );
  1542.  
  1543.         virtual WBool RelayToTooltip( const WMessage & msg );
  1544.  
  1545.         virtual WUInt AssignWindowID();
  1546.  
  1547.         virtual WBool FilterMessage( WMessage & msg, WBool & eatMessage );
  1548.  
  1549.         virtual void AddControl( WControl * ctrl );
  1550.         virtual void RemoveControl( WControl * ctrl );
  1551.  
  1552.     private:
  1553.  
  1554.         void    CommonInit();
  1555.  
  1556.     public:
  1557.  
  1558.         WBool LocalProcessGetDialogCode( const WMessage & msg,
  1559.                                          WLong & returns );
  1560.         WBool LocalProcessPaint( const WMessage & msg, WLong & returns );
  1561.         WBool LocalProcessNCButton( const WMessage & msg, WLong & returns );
  1562.         WBool LocalProcessButton( const WMessage & msg, WLong & returns );
  1563.         WBool LocalProcessNCHitTest( const WMessage & msg, WLong & returns );
  1564.         WBool LocalProcessDropFiles( const WMessage & msg, WLong & returns );
  1565.         WBool LocalProcessScroll( const WMessage & msg, WLong & returns );
  1566.         WBool LocalProcessInitMenuPopup( const WMessage & msg,
  1567.                                          WLong & returns );
  1568.         WBool LocalProcessMenuSelect( const WMessage & msg, WLong & returns );
  1569.         WBool LocalProcessEnterIdle( const WMessage & msg, WLong & returns );
  1570.         WBool LocalProcessEraseBackground( const WMessage & msg,
  1571.                                            WLong & returns );
  1572.         WBool LocalProcessDeleteItem( const WMessage & msg, WLong & returns );
  1573.         WBool LocalProcessMeasureItem( const WMessage & msg,
  1574.                                        WLong & returns );
  1575.         WBool LocalProcessCompareItem( const WMessage & msg,
  1576.                                        WLong & returns );
  1577.         WBool LocalProcessDrawItem( const WMessage & msg, WLong & returns );
  1578.         WBool LocalProcessNCPaint( const WMessage & msg, WLong & returns );
  1579.         WBool LocalProcessEndSession( const WMessage & msg, WLong & returns );
  1580.         WBool LocalProcessQueryEndSession( const WMessage & msg,
  1581.                                            WLong & returns );
  1582.         WBool LocalProcessWindowPosChanging( const WMessage & msg,
  1583.                                              WLong & returns );
  1584.         WBool LocalProcessWindowPosChanged( const WMessage & msg,
  1585.                                             WLong & returns );
  1586.         WBool LocalProcessCtlColor( const WMessage & msg, WLong & returns );
  1587.         WBool LocalProcessShowWindow( const WMessage & msg, WLong & returns );
  1588.         WBool LocalProcessCreate( const WMessage & msg, WLong & returns );
  1589.         WBool LocalProcessDestroy( const WMessage & msg, WLong & returns );
  1590.         WBool LocalProcessSetCursor( const WMessage & msg, WLong & returns );
  1591.         WBool LocalProcessFocus( const WMessage & msg, WLong & returns );
  1592.         WBool LocalProcessActivate( const WMessage & msg, WLong & returns );
  1593.         WBool LocalProcessSysCommand( const WMessage & msg, WLong & returns );
  1594.         WBool LocalProcessCommand( const WMessage & msg, WLong & returns );
  1595.         WBool LocalProcessQueryNewPalette( const WMessage & msg,
  1596.                                            WLong & returns );
  1597.         WBool LocalProcessPaletteChanged( const WMessage & msg,
  1598.                                           WLong & returns );
  1599.         WBool LocalProcessMove( const WMessage & msg, WLong & returns );
  1600.         WBool LocalProcessSize( const WMessage & msg, WLong & returns );
  1601.         WBool LocalProcessSysKeyDown( const WMessage & msg, WLong & returns );
  1602.         WBool LocalProcessKeyDown( const WMessage & msg, WLong & returns );
  1603.         WBool LocalProcessKeyUp( const WMessage & msg, WLong & returns );
  1604.         WBool LocalProcessChar( const WMessage & msg, WLong & returns );
  1605.         WBool LocalProcessSysDeadChar( const WMessage & msg,
  1606.                                        WLong & returns );
  1607.         WBool LocalProcessSysColorChange( const WMessage & msg,
  1608.                                           WLong & returns );
  1609.         WBool LocalProcessNotify( const WMessage & msg, WLong & returns );
  1610.         WBool LocalProcessContextMenu( const WMessage & msg,
  1611.                                        WLong & returns );
  1612.         WBool LocalProcessHelp( const WMessage & msg, WLong & returns );
  1613.         WBool LocalProcessMultiMedia( const WMessage & msg, WLong & returns );
  1614.         WBool LocalProcessCaptureChanged( const WMessage & msg,
  1615.                                           WLong & returns );
  1616.         WBool LocalProcessDeviceChange( const WMessage & msg,
  1617.                                         WLong & returns );
  1618.         WBool LocalProcessDisplayChange( const WMessage & msg,
  1619.                                          WLong & returns );
  1620.         WBool LocalProcessPower( const WMessage & msg, WLong & returns );
  1621.         WBool LocalProcessSettingChange( const WMessage & msg,
  1622.                                          WLong & returns );
  1623.         WBool LocalProcessUserChanged( const WMessage & msg,
  1624.                                        WLong & returns );
  1625.         WBool LocalProcessInputLangChange( const WMessage & msg,
  1626.                                            WLong & returns );
  1627.         WBool LocalProcessInputLangChangeRequest( const WMessage & msg,
  1628.                                                   WLong & returns );
  1629.         WBool LocalProcessPrint( const WMessage & msg, WLong & returns );
  1630.  
  1631.         /**************************************************************
  1632.          * Data members
  1633.          **************************************************************/
  1634.     
  1635.     protected:
  1636.  
  1637.         class WDragTagData {
  1638.             public:
  1639.                 WDragTagData();
  1640.                 ~WDragTagData();
  1641.  
  1642.                 WString _source;
  1643.                 WString _target;
  1644.         };
  1645.  
  1646.         WVector<WWindow> *              _children;
  1647.         WULong                          _flags;
  1648.         WStyle                          _styles;
  1649.         WStyle                          _exStyles;
  1650.         WWindowHandle                   _handle;
  1651.         WCallbackProc                   _prevWindowProc;
  1652.         WCallbackProc                   _currWindowProc;
  1653.         void *                          _userData;
  1654.         WPopupMenu *                    _currentPopup;
  1655.         WPopupMenu *                    _popupMenu;
  1656.         WFont *                         _textFont;
  1657.         WRect                           _storeRect;
  1658.         WRect                           _storeClientRect;
  1659.         WDragTagData *                  _dragTags;
  1660.         WColor *                        _backColor;
  1661.         WBrush *                        _backBrush;
  1662.         WColor *                        _foreColor;
  1663.         WDWord                          _wwinEventBits;
  1664.         WDWord                          _threadID;
  1665.         WBool                           _fastSend;
  1666.     
  1667.     private:
  1668.  
  1669.         WWindow *                       _parent;
  1670.         WUInt                           _windowID;
  1671.         WToolTip *                      _toolTip;
  1672.         WDragMode                       _dragMode;
  1673.         WBool                           _dockable;
  1674.         WForm *                         _dockedParent;
  1675.         WString *                       _toolTipText;
  1676.         WString *                       _name;
  1677.         WCursorHandle                   _cursorHandle;
  1678.         WLong                           _increment[2];
  1679.         WLong                           _step[2];
  1680.  
  1681.         WDockFloatingForm *             _dockedFrame;
  1682.         WInt                            _dockedOffset;
  1683.         WDockPosition                   _dockPosition;
  1684.         WInt                            _dockedIndex;
  1685.         WBool                           _dockDragging;
  1686.         WBool                           _dockableAtPos[6];
  1687.         WBool                           _dockWrap;
  1688.         WBool                           _dockDragStarting;
  1689.         WULong                          _helpId;
  1690.         WInputContext                   _inputContext;
  1691.         WInputContextHandle             _oldInputContextHandle;
  1692. };
  1693.  
  1694. extern template WVector<WWindow>;
  1695.  
  1696. struct WDropFileEventData : public WEventData {
  1697.     WPoint              dropPoint;      // mouse position
  1698.     WStringArray        fileName;
  1699.     // Note: These two members are technically redundant, but here for
  1700.     // backwards compatibility and ease of use
  1701.     WULong              numFiles;
  1702.     WChar **            fileNames;
  1703. };
  1704.  
  1705. #ifndef _WNO_PRAGMA_PUSH
  1706. #pragma enum pop;
  1707. #pragma pack(pop);
  1708. #endif
  1709.  
  1710. #endif // _WWINDOW_HPP_INCLUDED
  1711.