1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/window.h
3 // Purpose: wxWindowMSW class
4 // Author: Julian Smart
5 // Modified by: Vadim Zeitlin on 13.05.99: complete refont of message handling,
6 // elimination of Default(), ...
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #include "wx/settings.h" // solely for wxSystemColour
17 // if this is set to 1, we use deferred window sizing to reduce flicker when
18 // resizing complicated window hierarchies, but this can in theory result in
19 // different behaviour than the old code so we keep the possibility to use it
20 // by setting this to 0 (in the future this should be removed completely)
22 #define wxUSE_DEFERRED_SIZING 0
24 #define wxUSE_DEFERRED_SIZING 1
27 // ---------------------------------------------------------------------------
28 // wxWindow declaration for MSW
29 // ---------------------------------------------------------------------------
31 class WXDLLIMPEXP_CORE wxWindowMSW
: public wxWindowBase
33 friend class wxSpinCtrl
;
34 friend class wxSlider
;
35 friend class wxRadioBox
;
36 #if defined __VISUALC__ && __VISUALC__ <= 1200
37 friend class wxWindowMSW
;
40 wxWindowMSW() { Init(); }
42 wxWindowMSW(wxWindow
*parent
,
44 const wxPoint
& pos
= wxDefaultPosition
,
45 const wxSize
& size
= wxDefaultSize
,
47 const wxString
& name
= wxPanelNameStr
)
50 Create(parent
, id
, pos
, size
, style
, name
);
53 virtual ~wxWindowMSW();
55 bool Create(wxWindow
*parent
,
57 const wxPoint
& pos
= wxDefaultPosition
,
58 const wxSize
& size
= wxDefaultSize
,
60 const wxString
& name
= wxPanelNameStr
);
62 // implement base class pure virtuals
63 virtual void SetLabel(const wxString
& label
);
64 virtual wxString
GetLabel() const;
69 virtual bool BeginRepositioningChildren();
70 virtual void EndRepositioningChildren();
72 virtual bool Show(bool show
= true);
73 virtual bool ShowWithEffect(wxShowEffect effect
,
76 return MSWShowWithEffect(true, effect
, timeout
);
78 virtual bool HideWithEffect(wxShowEffect effect
,
81 return MSWShowWithEffect(false, effect
, timeout
);
84 virtual void SetFocus();
85 virtual void SetFocusFromKbd();
87 virtual bool Reparent(wxWindowBase
*newParent
);
89 virtual void WarpPointer(int x
, int y
);
91 virtual void Refresh( bool eraseBackground
= true,
92 const wxRect
*rect
= (const wxRect
*) NULL
);
93 virtual void Update();
95 virtual void SetWindowStyleFlag(long style
);
96 virtual void SetExtraStyle(long exStyle
);
97 virtual bool SetCursor( const wxCursor
&cursor
);
98 virtual bool SetFont( const wxFont
&font
);
100 virtual int GetCharHeight() const;
101 virtual int GetCharWidth() const;
103 virtual void SetScrollbar( int orient
, int pos
, int thumbVisible
,
104 int range
, bool refresh
= true );
105 virtual void SetScrollPos( int orient
, int pos
, bool refresh
= true );
106 virtual int GetScrollPos( int orient
) const;
107 virtual int GetScrollThumb( int orient
) const;
108 virtual int GetScrollRange( int orient
) const;
109 virtual void ScrollWindow( int dx
, int dy
,
110 const wxRect
* rect
= NULL
);
112 virtual bool ScrollLines(int lines
);
113 virtual bool ScrollPages(int pages
);
115 virtual void SetLayoutDirection(wxLayoutDirection dir
);
116 virtual wxLayoutDirection
GetLayoutDirection() const;
117 virtual wxCoord
AdjustForLayoutDirection(wxCoord x
,
119 wxCoord widthTotal
) const;
121 #if wxUSE_DRAG_AND_DROP
122 virtual void SetDropTarget( wxDropTarget
*dropTarget
);
123 #endif // wxUSE_DRAG_AND_DROP
125 // Accept files for dragging
126 virtual void DragAcceptFiles(bool accept
);
128 #ifndef __WXUNIVERSAL__
129 // Native resource loading (implemented in src/msw/nativdlg.cpp)
130 // FIXME: should they really be all virtual?
131 virtual bool LoadNativeDialog(wxWindow
* parent
, wxWindowID
& id
);
132 virtual bool LoadNativeDialog(wxWindow
* parent
, const wxString
& name
);
133 wxWindow
* GetWindowChild1(wxWindowID id
);
134 wxWindow
* GetWindowChild(wxWindowID id
);
135 #endif // __WXUNIVERSAL__
138 // install and deinstall a system wide hotkey
139 virtual bool RegisterHotKey(int hotkeyId
, int modifiers
, int keycode
);
140 virtual bool UnregisterHotKey(int hotkeyId
);
141 #endif // wxUSE_HOTKEY
144 bool IsContextMenuEnabled() const { return m_contextMenuEnabled
; }
145 void EnableContextMenu(bool enable
= true) { m_contextMenuEnabled
= enable
; }
148 // window handle stuff
149 // -------------------
151 WXHWND
GetHWND() const { return m_hWnd
; }
152 void SetHWND(WXHWND hWnd
) { m_hWnd
= hWnd
; }
153 virtual WXWidget
GetHandle() const { return GetHWND(); }
155 void AssociateHandle(WXWidget handle
);
156 void DissociateHandle();
158 // does this window have deferred position and/or size?
159 bool IsSizeDeferred() const;
161 // these functions allow to register a global handler for the given Windows
162 // message: it will be called from MSWWindowProc() of any window which gets
163 // this event if it's not processed before (i.e. unlike a hook procedure it
164 // does not override the normal processing)
166 // notice that if you want to process a message for a given window only you
167 // should override its MSWWindowProc() instead
169 // type of the handler: it is called with the message parameters (except
170 // that the window object is passed instead of window handle) and should
171 // return true if it handled the message or false if it should be passed to
173 typedef bool (*MSWMessageHandler
)(wxWindowMSW
*win
,
178 // install a handler, shouldn't be called more than one for the same message
179 static bool MSWRegisterMessageHandler(int msg
, MSWMessageHandler handler
);
181 // unregister a previously registered handler
182 static void MSWUnregisterMessageHandler(int msg
, MSWMessageHandler handler
);
185 // implementation from now on
186 // ==========================
191 void OnPaint(wxPaintEvent
& event
);
193 void OnInitDialog(wxInitDialogEvent
& event
);
197 // Windows subclassing
198 void SubclassWin(WXHWND hWnd
);
199 void UnsubclassWin();
201 WXFARPROC
MSWGetOldWndProc() const { return m_oldWndProc
; }
202 void MSWSetOldWndProc(WXFARPROC proc
) { m_oldWndProc
= proc
; }
204 // return true if the window is of a standard (i.e. not wxWidgets') class
206 // to understand why does it work, look at SubclassWin() code and comments
207 bool IsOfStandardClass() const { return m_oldWndProc
!= NULL
; }
209 wxWindow
*FindItem(long id
) const;
210 wxWindow
*FindItemByHWND(WXHWND hWnd
, bool controlOnly
= false) const;
212 // MSW only: true if this control is part of the main control
213 virtual bool ContainsHWND(WXHWND
WXUNUSED(hWnd
)) const { return false; }
216 // MSW only: true if this window or any of its children have a tooltip
217 virtual bool HasToolTips() const { return GetToolTip() != NULL
; }
218 #endif // wxUSE_TOOLTIPS
220 // translate wxWidgets style flags for this control into the Windows style
221 // and optional extended style for the corresponding native control
223 // this is the function that should be overridden in the derived classes,
224 // but you will mostly use MSWGetCreateWindowFlags() below
225 virtual WXDWORD
MSWGetStyle(long flags
, WXDWORD
*exstyle
= NULL
) const ;
227 // get the MSW window flags corresponding to wxWidgets ones
229 // the functions returns the flags (WS_XXX) directly and puts the ext
230 // (WS_EX_XXX) flags into the provided pointer if not NULL
231 WXDWORD
MSWGetCreateWindowFlags(WXDWORD
*exflags
= NULL
) const
232 { return MSWGetStyle(GetWindowStyle(), exflags
); }
234 // update the real underlying window style flags to correspond to the
235 // current wxWindow object style (safe to call even if window isn't fully
237 void MSWUpdateStyle(long flagsOld
, long exflagsOld
);
239 // get the HWND to be used as parent of this window with CreateWindow()
240 virtual WXHWND
MSWGetParent() const;
242 // get the Win32 window class name used by all wxWindow objects by default
243 static const wxChar
*MSWGetRegisteredClassName();
245 // creates the window of specified Windows class with given style, extended
246 // style, title and geometry (default values
248 // returns true if the window has been created, false if creation failed
249 bool MSWCreate(const wxChar
*wclass
,
250 const wxChar
*title
= NULL
,
251 const wxPoint
& pos
= wxDefaultPosition
,
252 const wxSize
& size
= wxDefaultSize
,
254 WXDWORD exendedStyle
= 0);
256 virtual bool MSWCommand(WXUINT param
, WXWORD id
);
258 #ifndef __WXUNIVERSAL__
259 // Create an appropriate wxWindow from a HWND
260 virtual wxWindow
* CreateWindowFromHWND(wxWindow
* parent
, WXHWND hWnd
);
262 // Make sure the window style reflects the HWND style (roughly)
263 virtual void AdoptAttributesFromHWND();
264 #endif // __WXUNIVERSAL__
266 // Setup background and foreground colours correctly
267 virtual void SetupColours();
269 // ------------------------------------------------------------------------
270 // helpers for message handlers: these perform the same function as the
271 // message crackers from <windowsx.h> - they unpack WPARAM and LPARAM into
272 // the correct parameters
273 // ------------------------------------------------------------------------
275 void UnpackCommand(WXWPARAM wParam
, WXLPARAM lParam
,
276 WXWORD
*id
, WXHWND
*hwnd
, WXWORD
*cmd
);
277 void UnpackActivate(WXWPARAM wParam
, WXLPARAM lParam
,
278 WXWORD
*state
, WXWORD
*minimized
, WXHWND
*hwnd
);
279 void UnpackScroll(WXWPARAM wParam
, WXLPARAM lParam
,
280 WXWORD
*code
, WXWORD
*pos
, WXHWND
*hwnd
);
281 void UnpackCtlColor(WXWPARAM wParam
, WXLPARAM lParam
,
282 WXHDC
*hdc
, WXHWND
*hwnd
);
283 void UnpackMenuSelect(WXWPARAM wParam
, WXLPARAM lParam
,
284 WXWORD
*item
, WXWORD
*flags
, WXHMENU
*hmenu
);
286 // ------------------------------------------------------------------------
287 // internal handlers for MSW messages: all handlers return a boolean value:
288 // true means that the handler processed the event and false that it didn't
289 // ------------------------------------------------------------------------
291 // there are several cases where we have virtual functions for Windows
292 // message processing: this is because these messages often require to be
293 // processed in a different manner in the derived classes. For all other
294 // messages, however, we do *not* have corresponding MSWOnXXX() function
295 // and if the derived class wants to process them, it should override
296 // MSWWindowProc() directly.
298 // scroll event (both horizontal and vertical)
299 virtual bool MSWOnScroll(int orientation
, WXWORD nSBCode
,
300 WXWORD pos
, WXHWND control
);
302 // child control notifications
303 virtual bool MSWOnNotify(int idCtrl
, WXLPARAM lParam
, WXLPARAM
*result
);
305 // owner-drawn controls need to process these messages
306 virtual bool MSWOnDrawItem(int id
, WXDRAWITEMSTRUCT
*item
);
307 virtual bool MSWOnMeasureItem(int id
, WXMEASUREITEMSTRUCT
*item
);
309 // the rest are not virtual
310 bool HandleCreate(WXLPCREATESTRUCT cs
, bool *mayCreate
);
311 bool HandleInitDialog(WXHWND hWndFocus
);
312 bool HandleDestroy();
315 bool HandlePrintClient(WXHDC hDC
);
316 bool HandleEraseBkgnd(WXHDC hDC
);
318 bool HandleMinimize();
319 bool HandleMaximize();
320 bool HandleSize(int x
, int y
, WXUINT flag
);
321 bool HandleSizing(wxRect
& rect
);
322 bool HandleGetMinMaxInfo(void *mmInfo
);
323 bool HandleEnterSizeMove();
324 bool HandleExitSizeMove();
326 bool HandleShow(bool show
, int status
);
327 bool HandleActivate(int flag
, bool minimized
, WXHWND activate
);
329 bool HandleCommand(WXWORD id
, WXWORD cmd
, WXHWND control
);
331 bool HandleCtlColor(WXHBRUSH
*hBrush
, WXHDC hdc
, WXHWND hWnd
);
333 bool HandlePaletteChanged(WXHWND hWndPalChange
);
334 bool HandleQueryNewPalette();
335 bool HandleSysColorChange();
336 bool HandleDisplayChange();
337 bool HandleCaptureChanged(WXHWND gainedCapture
);
338 virtual bool HandleSettingChange(WXWPARAM wParam
, WXLPARAM lParam
);
340 bool HandleQueryEndSession(long logOff
, bool *mayEnd
);
341 bool HandleEndSession(bool endSession
, long logOff
);
343 bool HandleSetFocus(WXHWND wnd
);
344 bool HandleKillFocus(WXHWND wnd
);
346 bool HandleDropFiles(WXWPARAM wParam
);
348 bool HandleMouseEvent(WXUINT msg
, int x
, int y
, WXUINT flags
);
349 bool HandleMouseMove(int x
, int y
, WXUINT flags
);
350 bool HandleMouseWheel(wxMouseWheelAxis axis
,
351 WXWPARAM wParam
, WXLPARAM lParam
);
353 bool HandleChar(WXWPARAM wParam
, WXLPARAM lParam
);
354 bool HandleKeyDown(WXWPARAM wParam
, WXLPARAM lParam
);
355 bool HandleKeyUp(WXWPARAM wParam
, WXLPARAM lParam
);
357 bool HandleHotKey(WXWPARAM wParam
, WXLPARAM lParam
);
360 int HandleMenuChar(int chAccel
, WXLPARAM lParam
);
362 // Create and process a clipboard event specified by type.
363 bool HandleClipboardEvent( WXUINT nMsg
);
365 bool HandleQueryDragIcon(WXHICON
*hIcon
);
367 bool HandleSetCursor(WXHWND hWnd
, short nHitTest
, int mouseMsg
);
369 bool HandlePower(WXWPARAM wParam
, WXLPARAM lParam
, bool *vetoed
);
372 // The main body of common window proc for all wxWindow objects. It tries
373 // to handle the given message and returns true if it was handled (the
374 // appropriate return value is then put in result, which must be non-NULL)
375 // or false if it wasn't.
377 // This function should be overridden in any new code instead of
378 // MSWWindowProc() even if currently most of the code overrides
379 // MSWWindowProc() as it had been written before this function was added.
380 virtual bool MSWHandleMessage(WXLRESULT
*result
,
385 // Common Window procedure for all wxWindow objects: forwards to
386 // MSWHandleMessage() and MSWDefWindowProc() if the message wasn't handled.
387 virtual WXLRESULT
MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
389 // Calls an appropriate default window procedure
390 virtual WXLRESULT
MSWDefWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
392 // message processing helpers
394 // return false if the message shouldn't be translated/preprocessed but
395 // dispatched normally
396 virtual bool MSWShouldPreProcessMessage(WXMSG
* pMsg
);
398 // return true if the message was preprocessed and shouldn't be dispatched
399 virtual bool MSWProcessMessage(WXMSG
* pMsg
);
401 // return true if the message was translated and shouldn't be dispatched
402 virtual bool MSWTranslateMessage(WXMSG
* pMsg
);
404 // called when the window is about to be destroyed
405 virtual void MSWDestroyWindow();
408 // Functions dealing with painting the window background. The derived
409 // classes should normally only need to reimplement MSWGetBgBrush() if they
410 // need to use a non-solid brush for erasing their background. This
411 // function is called by MSWGetBgBrushForChild() which only exists for the
412 // weird wxToolBar case and MSWGetBgBrushForChild() itself is used by
413 // MSWGetBgBrush() to actually find the right brush to use.
415 // Adjust the origin for the brush returned by MSWGetBgBrushForChild().
417 // This needs to be overridden for scrolled windows to ensure that the
418 // scrolling of their associated DC is taken into account.
420 // Both parameters must be non-NULL.
421 virtual void MSWAdjustBrushOrg(int* WXUNUSED(xOrg
),
422 int* WXUNUSED(yOrg
)) const
426 // The brush returned from here must remain valid at least until the next
427 // event loop iteration. Returning 0, as is done by default, indicates
428 // there is no custom background brush.
429 virtual WXHBRUSH
MSWGetCustomBgBrush() { return 0; }
431 // this function should return the brush to paint the children controls
432 // background or 0 if this window doesn't impose any particular background
435 // the hDC parameter is the DC background will be drawn on, it can be used
436 // to call SetBrushOrgEx() on it if the returned brush is a bitmap one
438 // child parameter is never NULL, it can be this window itself or one of
439 // its (grand)children
441 // the base class version returns a solid brush if we have a non default
442 // background colour or 0 otherwise
443 virtual WXHBRUSH
MSWGetBgBrushForChild(WXHDC hDC
, wxWindowMSW
*child
);
445 // return the background brush to use for painting the given window by
446 // querying the parent windows via MSWGetBgBrushForChild() recursively
447 WXHBRUSH
MSWGetBgBrush(WXHDC hDC
);
452 ThemeColourBackground
,
456 // returns a specific theme colour, or if that is not possible then
457 // wxSystemSettings::GetColour(fallback)
458 wxColour
MSWGetThemeColour(const wchar_t *themeName
,
461 MSWThemeColour themeColour
,
462 wxSystemColour fallback
) const;
464 // gives the parent the possibility to draw its children background, e.g.
465 // this is used by wxNotebook to do it using DrawThemeBackground()
467 // return true if background was drawn, false otherwise
468 virtual bool MSWPrintChild(WXHDC
WXUNUSED(hDC
), wxWindow
* WXUNUSED(child
))
473 // some controls (e.g. wxListBox) need to set the return value themselves
475 // return true to let parent handle it if we don't, false otherwise
476 virtual bool MSWShouldPropagatePrintChild()
481 // This should be overridden to return true for the controls which have
482 // themed background that should through their children. Currently only
483 // wxNotebook uses this.
485 // The base class version already returns true if we have a solid
486 // background colour that should be propagated to our children.
487 virtual bool MSWHasInheritableBackground() const
489 return InheritsBackgroundColour();
492 #if !defined(__WXWINCE__) && !defined(__WXUNIVERSAL__)
493 #define wxHAS_MSW_BACKGROUND_ERASE_HOOK
496 #ifdef wxHAS_MSW_BACKGROUND_ERASE_HOOK
497 // allows the child to hook into its parent WM_ERASEBKGND processing: call
498 // MSWSetEraseBgHook() with a non-NULL window to make parent call
499 // MSWEraseBgHook() on this window (don't forget to reset it to NULL
502 // this hack is used by wxToolBar, see comments there
503 void MSWSetEraseBgHook(wxWindow
*child
);
505 // return true if WM_ERASEBKGND is currently hooked
506 bool MSWHasEraseBgHook() const;
508 // called when the window on which MSWSetEraseBgHook() had been called
509 // receives WM_ERASEBKGND
510 virtual bool MSWEraseBgHook(WXHDC
WXUNUSED(hDC
)) { return false; }
511 #endif // wxHAS_MSW_BACKGROUND_ERASE_HOOK
513 // common part of Show/HideWithEffect()
514 bool MSWShowWithEffect(bool show
,
518 // Responds to colour changes: passes event on to children.
519 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
521 // initialize various fields of wxMouseEvent (common part of MSWOnMouseXXX)
522 void InitMouseEvent(wxMouseEvent
& event
, int x
, int y
, WXUINT flags
);
524 // check if mouse is in the window
525 bool IsMouseInWindow() const;
527 // check if a native double-buffering applies for this window
528 virtual bool IsDoubleBuffered() const;
530 void SetDoubleBuffered(bool on
);
532 // synthesize a wxEVT_LEAVE_WINDOW event and set m_mouseInWindow to false
533 void GenerateMouseLeave();
535 // virtual function for implementing internal idle
537 virtual void OnInternalIdle();
540 // this allows you to implement standard control borders without
541 // repeating the code in different classes that are not derived from
543 virtual wxBorder
GetDefaultBorderForControl() const;
545 // choose the default border for this window
546 virtual wxBorder
GetDefaultBorder() const;
548 // Translate wxBORDER_THEME (and other border styles if necessary to the value
549 // that makes most sense for this Windows environment
550 virtual wxBorder
TranslateBorder(wxBorder border
) const;
552 #if wxUSE_MENUS_NATIVE
553 virtual bool DoPopupMenu( wxMenu
*menu
, int x
, int y
);
554 #endif // wxUSE_MENUS_NATIVE
559 // the old window proc (we subclass all windows)
560 WXFARPROC m_oldWndProc
;
562 // additional (MSW specific) flags
563 bool m_mouseInWindow
:1;
564 bool m_lastKeydownProcessed
:1;
566 // the size of one page for scrolling
570 // implement the base class pure virtuals
571 virtual void DoGetTextExtent(const wxString
& string
,
574 int *externalLeading
= NULL
,
575 const wxFont
*font
= NULL
) const;
576 virtual void DoClientToScreen( int *x
, int *y
) const;
577 virtual void DoScreenToClient( int *x
, int *y
) const;
578 virtual void DoGetPosition( int *x
, int *y
) const;
579 virtual void DoGetSize( int *width
, int *height
) const;
580 virtual void DoGetClientSize( int *width
, int *height
) const;
581 virtual void DoSetSize(int x
, int y
,
582 int width
, int height
,
583 int sizeFlags
= wxSIZE_AUTO
);
584 virtual void DoSetClientSize(int width
, int height
);
586 virtual wxSize
DoGetBorderSize() const;
588 virtual void DoCaptureMouse();
589 virtual void DoReleaseMouse();
591 virtual void DoEnable(bool enable
);
593 virtual void DoFreeze();
594 virtual void DoThaw();
596 // this simply moves/resizes the given HWND which is supposed to be our
597 // sibling (this is useful for controls which are composite at MSW level
598 // and for which DoMoveWindow() is not enough)
600 // returns true if the window move was deferred, false if it was moved
601 // immediately (no error return)
602 bool DoMoveSibling(WXHWND hwnd
, int x
, int y
, int width
, int height
);
604 // move the window to the specified location and resize it: this is called
605 // from both DoSetSize() and DoSetClientSize() and would usually just call
606 // ::MoveWindow() except for composite controls which will want to arrange
607 // themselves inside the given rectangle
608 virtual void DoMoveWindow(int x
, int y
, int width
, int height
);
611 virtual void DoSetToolTip( wxToolTip
*tip
);
613 // process TTN_NEEDTEXT message properly (i.e. fixing the bugs in
614 // comctl32.dll in our code -- see the function body for more info)
615 bool HandleTooltipNotify(WXUINT code
,
617 const wxString
& ttip
);
618 #endif // wxUSE_TOOLTIPS
620 // This is used by CreateKeyEvent() and also for wxEVT_CHAR[_HOOK] event
621 // creation. Notice that this method doesn't initialize wxKeyEvent
622 // m_keyCode and m_uniChar fields.
623 void InitAnyKeyEvent(wxKeyEvent
& event
,
625 WXLPARAM lParam
) const;
627 // Helper functions used by HandleKeyXXX() methods and some derived
628 // classes, wParam and lParam have the same meaning as in WM_KEY{DOWN,UP}.
630 // NB: evType here must be wxEVT_KEY_{DOWN,UP} as wParam here contains the
631 // virtual key code, not character!
632 wxKeyEvent
CreateKeyEvent(wxEventType evType
,
634 WXLPARAM lParam
= 0) const;
636 // Another helper for creating wxKeyEvent for wxEVT_CHAR and related types.
638 // The wParam and lParam here must come from WM_CHAR event parameters, i.e.
639 // wParam must be a character and not a virtual code.
640 wxKeyEvent
CreateCharEvent(wxEventType evType
,
642 WXLPARAM lParam
) const;
645 // default OnEraseBackground() implementation, return true if we did erase
646 // the background, false otherwise (i.e. the system should erase it)
647 bool DoEraseBackground(WXHDC hDC
);
649 // generate WM_CHANGEUISTATE if it's needed for the OS we're running under
651 // action should be one of the UIS_XXX constants
652 // state should be one or more of the UISF_XXX constants
653 // if action == UIS_INITIALIZE then it doesn't seem to matter what we use
654 // for state as the system will decide for us what needs to be set
655 void MSWUpdateUIState(int action
, int state
= 0);
657 // translate wxWidgets coords into Windows ones suitable to be passed to
658 // ::CreateWindow(), called from MSWCreate()
659 virtual void MSWGetCreateWindowCoords(const wxPoint
& pos
,
662 int& w
, int& h
) const;
664 bool MSWEnableHWND(WXHWND hWnd
, bool enable
);
667 // common part of all ctors
670 // the (non-virtual) handlers for the events
671 bool HandleMove(int x
, int y
);
672 bool HandleMoving(wxRect
& rect
);
673 bool HandleJoystickEvent(WXUINT msg
, int x
, int y
, WXUINT flags
);
674 bool HandleNotify(int idCtrl
, WXLPARAM lParam
, WXLPARAM
*result
);
676 #if wxUSE_DEFERRED_SIZING
678 // this function is called after the window was resized to its new size
679 virtual void MSWEndDeferWindowPos()
681 m_pendingPosition
= wxDefaultPosition
;
682 m_pendingSize
= wxDefaultSize
;
685 // current defer window position operation handle (may be NULL)
688 // When deferred positioning is done these hold the pending changes, and
689 // are used for the default values if another size/pos changes is done on
690 // this window before the group of deferred changes is completed.
691 wxPoint m_pendingPosition
;
692 wxSize m_pendingSize
;
693 #endif // wxUSE_DEFERRED_SIZING
697 bool m_contextMenuEnabled
;
700 DECLARE_DYNAMIC_CLASS(wxWindowMSW
)
701 wxDECLARE_NO_COPY_CLASS(wxWindowMSW
);
702 DECLARE_EVENT_TABLE()
705 // window creation helper class: before creating a new HWND, instantiate an
706 // object of this class on stack - this allows to process the messages sent to
707 // the window even before CreateWindow() returns
708 class wxWindowCreationHook
711 wxWindowCreationHook(wxWindowMSW
*winBeingCreated
);
712 ~wxWindowCreationHook();
715 #endif // _WX_WINDOW_H_