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