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