]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/window.h
missing const added (patch 1295036)
[wxWidgets.git] / include / wx / msw / window.h
CommitLineData
2bda0e17 1/////////////////////////////////////////////////////////////////////////////
1e6feb95 2// Name: wx/msw/window.h
2bda0e17
KB
3// Purpose: wxWindow class
4// Author: Julian Smart
1e6feb95
VZ
5// Modified by: Vadim Zeitlin on 13.05.99: complete refont of message handling,
6// elimination of Default(), ...
2bda0e17
KB
7// Created: 01/02/97
8// RCS-ID: $Id$
371a5b4e 9// Copyright: (c) Julian Smart
65571936 10// Licence: wxWindows licence
2bda0e17
KB
11/////////////////////////////////////////////////////////////////////////////
12
bbcdf8bc
JS
13#ifndef _WX_WINDOW_H_
14#define _WX_WINDOW_H_
2bda0e17 15
cc2b7472
VZ
16// ---------------------------------------------------------------------------
17// headers
18// ---------------------------------------------------------------------------
19
1e6feb95
VZ
20// [at least] some version of Windows send extra mouse move messages after
21// a mouse click or a key press - to temporarily fix this problem, set the
22// define below to 1
23//
24// a better solution should be found later...
a23fd0e1
VZ
25#define wxUSE_MOUSEEVENT_HACK 0
26
cc2b7472
VZ
27// ---------------------------------------------------------------------------
28// constants
29// ---------------------------------------------------------------------------
1e6d9499 30
e951b8e4
WS
31#if WXWIN_COMPATIBILITY_2_4
32// they're unused by wxWidgets...
cc2b7472 33enum
1e6d9499 34{
cc2b7472
VZ
35 wxKEY_SHIFT = 1,
36 wxKEY_CTRL = 2
1e6d9499 37};
e951b8e4 38#endif
1e6d9499 39
cc2b7472
VZ
40// ---------------------------------------------------------------------------
41// wxWindow declaration for MSW
42// ---------------------------------------------------------------------------
b782f2e0 43
1e6feb95 44class WXDLLEXPORT wxWindowMSW : public wxWindowBase
1e6d9499 45{
8e44f3ca
JS
46 friend class wxSpinCtrl;
47 friend class wxSlider;
48 friend class wxRadioBox;
fa61fec5
MW
49#if defined __VISUALC__ && __VISUALC__ <= 1200
50 friend class wxWindowMSW;
51#endif
2bda0e17 52public:
6463b9f5 53 wxWindowMSW() { Init(); }
1e6feb95
VZ
54
55 wxWindowMSW(wxWindow *parent,
56 wxWindowID id,
57 const wxPoint& pos = wxDefaultPosition,
58 const wxSize& size = wxDefaultSize,
59 long style = 0,
6463b9f5
JS
60 const wxString& name = wxPanelNameStr)
61 {
62 Init();
63 Create(parent, id, pos, size, style, name);
64 }
2bda0e17 65
1e6feb95 66 virtual ~wxWindowMSW();
2bda0e17 67
cc2b7472
VZ
68 bool Create(wxWindow *parent,
69 wxWindowID id,
70 const wxPoint& pos = wxDefaultPosition,
71 const wxSize& size = wxDefaultSize,
72 long style = 0,
73 const wxString& name = wxPanelNameStr);
bfc6fde4 74
cc2b7472 75 // implement base class pure virtuals
42e69d6b
VZ
76 virtual void SetTitle( const wxString& title);
77 virtual wxString GetTitle() const;
78
bfc6fde4 79 virtual void Raise();
bfc6fde4
VZ
80 virtual void Lower();
81
27d2dbbc
WS
82 virtual bool Show( bool show = true );
83 virtual bool Enable( bool enable = true );
bfc6fde4 84
cc2b7472 85 virtual void SetFocus();
ddf9d04f 86 virtual void SetFocusFromKbd();
bfc6fde4 87
1e6feb95 88 virtual bool Reparent(wxWindowBase *newParent);
bfc6fde4 89
cc2b7472 90 virtual void WarpPointer(int x, int y);
bfc6fde4 91
27d2dbbc 92 virtual void Refresh( bool eraseBackground = true,
cc2b7472 93 const wxRect *rect = (const wxRect *) NULL );
1e6feb95 94 virtual void Update();
a0e449ff
VZ
95 virtual void Freeze();
96 virtual void Thaw();
bfc6fde4 97
b2d5a7ee 98 virtual void SetWindowStyleFlag( long style );
cc2b7472
VZ
99 virtual bool SetCursor( const wxCursor &cursor );
100 virtual bool SetFont( const wxFont &font );
bfc6fde4 101
bfc6fde4
VZ
102 virtual int GetCharHeight() const;
103 virtual int GetCharWidth() const;
cc2b7472
VZ
104 virtual void GetTextExtent(const wxString& string,
105 int *x, int *y,
106 int *descent = (int *) NULL,
107 int *externalLeading = (int *) NULL,
108 const wxFont *theFont = (const wxFont *) NULL)
109 const;
110
1e6feb95 111#if wxUSE_MENUS_NATIVE
a1665b22 112 virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
1e6feb95 113#endif // wxUSE_MENUS_NATIVE
cc2b7472
VZ
114
115 virtual void SetScrollbar( int orient, int pos, int thumbVisible,
27d2dbbc
WS
116 int range, bool refresh = true );
117 virtual void SetScrollPos( int orient, int pos, bool refresh = true );
cc2b7472
VZ
118 virtual int GetScrollPos( int orient ) const;
119 virtual int GetScrollThumb( int orient ) const;
120 virtual int GetScrollRange( int orient ) const;
121 virtual void ScrollWindow( int dx, int dy,
122 const wxRect* rect = (wxRect *) NULL );
2bda0e17 123
9cd6d737
VZ
124 virtual bool ScrollLines(int lines);
125 virtual bool ScrollPages(int pages);
b9b3393e 126
47d67540 127#if wxUSE_DRAG_AND_DROP
cc2b7472
VZ
128 virtual void SetDropTarget( wxDropTarget *dropTarget );
129#endif // wxUSE_DRAG_AND_DROP
9f3362c4 130
bfc6fde4
VZ
131 // Accept files for dragging
132 virtual void DragAcceptFiles(bool accept);
2bda0e17 133
b0cb0158
VZ
134#if WXWIN_COMPATIBILITY_2_4
135 wxDEPRECATED( bool GetUseCtl3D() const );
136 wxDEPRECATED( bool GetTransparentBackground() const );
27d2dbbc 137 wxDEPRECATED( void SetTransparent(bool t = true) );
b0cb0158
VZ
138#endif // WXWIN_COMPATIBILITY_2_4
139
1e6feb95 140#ifndef __WXUNIVERSAL__
cc2b7472
VZ
141 // Native resource loading (implemented in src/msw/nativdlg.cpp)
142 // FIXME: should they really be all virtual?
bfc6fde4
VZ
143 virtual bool LoadNativeDialog(wxWindow* parent, wxWindowID& id);
144 virtual bool LoadNativeDialog(wxWindow* parent, const wxString& name);
42e69d6b
VZ
145 wxWindow* GetWindowChild1(wxWindowID id);
146 wxWindow* GetWindowChild(wxWindowID id);
1e6feb95 147#endif // __WXUNIVERSAL__
2bda0e17 148
540b6b09 149#if wxUSE_HOTKEY
5048c832 150 // install and deinstall a system wide hotkey
540b6b09 151 virtual bool RegisterHotKey(int hotkeyId, int modifiers, int keycode);
5048c832 152 virtual bool UnregisterHotKey(int hotkeyId);
540b6b09 153#endif // wxUSE_HOTKEY
5048c832 154
ed4780ea
VZ
155 // window handle stuff
156 // -------------------
2bda0e17 157
d7c24517
VZ
158 WXHWND GetHWND() const { return m_hWnd; }
159 void SetHWND(WXHWND hWnd) { m_hWnd = hWnd; }
160 virtual WXWidget GetHandle() const { return GetHWND(); }
2bda0e17 161
ed4780ea
VZ
162 void AssociateHandle(WXWidget handle);
163 void DissociateHandle();
164
f7040b5f
VZ
165 // does this window have deferred position and/or size?
166 bool IsSizeDeferred() const;
167
ed4780ea
VZ
168
169 // implementation from now on
170 // ==========================
171
cc2b7472
VZ
172 // event handlers
173 // --------------
00c4e897 174
63da7df7 175 void OnPaint(wxPaintEvent& event);
8681b094 176 void OnEraseBackground(wxEraseEvent& event);
79099b80 177#ifdef __WXWINCE__
8681b094 178 void OnInitDialog(wxInitDialogEvent& event);
79099b80 179#endif
2bda0e17 180
2bda0e17 181public:
bfc6fde4
VZ
182 // Windows subclassing
183 void SubclassWin(WXHWND hWnd);
184 void UnsubclassWin();
bfc6fde4 185
a23fd0e1
VZ
186 WXFARPROC MSWGetOldWndProc() const { return m_oldWndProc; }
187 void MSWSetOldWndProc(WXFARPROC proc) { m_oldWndProc = proc; }
bfc6fde4 188
27d2dbbc 189 // return true if the window is of a standard (i.e. not wxWidgets') class
5a403e3f
VZ
190 //
191 // to understand why does it work, look at SubclassWin() code and comments
192 bool IsOfStandardClass() const { return m_oldWndProc != NULL; }
193
197dd9af 194 wxWindow *FindItem(long id) const;
27d2dbbc 195 wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = false) const;
bfc6fde4 196
27d2dbbc
WS
197 // MSW only: true if this control is part of the main control
198 virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return false; };
bfc6fde4 199
77ffb593 200 // translate wxWidgets style flags for this control into the Windows style
b2d5a7ee
VZ
201 // and optional extended style for the corresponding native control
202 //
203 // this is the function that should be overridden in the derived classes,
204 // but you will mostly use MSWGetCreateWindowFlags() below
fe3d9123 205 virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const ;
b2d5a7ee 206
77ffb593 207 // get the MSW window flags corresponding to wxWidgets ones
b2d5a7ee
VZ
208 //
209 // the functions returns the flags (WS_XXX) directly and puts the ext
210 // (WS_EX_XXX) flags into the provided pointer if not NULL
211 WXDWORD MSWGetCreateWindowFlags(WXDWORD *exflags = NULL) const
212 { return MSWGetStyle(GetWindowStyle(), exflags); }
213
77ffb593 214 // translate wxWidgets coords into Windows ones suitable to be passed to
b225f659
VZ
215 // ::CreateWindow()
216 //
27d2dbbc 217 // returns true if non default coords are returned, false otherwise
b225f659
VZ
218 bool MSWGetCreateWindowCoords(const wxPoint& pos,
219 const wxSize& size,
220 int& x, int& y,
221 int& w, int& h) const;
222
9dfef5ac
VZ
223 // get the HWND to be used as parent of this window with CreateWindow()
224 virtual WXHWND MSWGetParent() const;
225
b225f659
VZ
226 // creates the window of specified Windows class with given style, extended
227 // style, title and geometry (default values
228 //
27d2dbbc 229 // returns true if the window has been created, false if creation failed
b225f659
VZ
230 bool MSWCreate(const wxChar *wclass,
231 const wxChar *title = NULL,
232 const wxPoint& pos = wxDefaultPosition,
233 const wxSize& size = wxDefaultSize,
234 WXDWORD style = 0,
a23fd0e1 235 WXDWORD exendedStyle = 0);
b225f659 236
42e69d6b 237 virtual bool MSWCommand(WXUINT param, WXWORD id);
bfc6fde4 238
1e6feb95 239#ifndef __WXUNIVERSAL__
bfc6fde4
VZ
240 // Create an appropriate wxWindow from a HWND
241 virtual wxWindow* CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd);
242
243 // Make sure the window style reflects the HWND style (roughly)
244 virtual void AdoptAttributesFromHWND();
1e6feb95 245#endif // __WXUNIVERSAL__
bfc6fde4
VZ
246
247 // Setup background and foreground colours correctly
248 virtual void SetupColours();
249
42e69d6b
VZ
250 // ------------------------------------------------------------------------
251 // helpers for message handlers: these perform the same function as the
252 // message crackers from <windowsx.h> - they unpack WPARAM and LPARAM into
253 // the correct parameters
254 // ------------------------------------------------------------------------
255
256 void UnpackCommand(WXWPARAM wParam, WXLPARAM lParam,
257 WXWORD *id, WXHWND *hwnd, WXWORD *cmd);
258 void UnpackActivate(WXWPARAM wParam, WXLPARAM lParam,
259 WXWORD *state, WXWORD *minimized, WXHWND *hwnd);
260 void UnpackScroll(WXWPARAM wParam, WXLPARAM lParam,
261 WXWORD *code, WXWORD *pos, WXHWND *hwnd);
262 void UnpackCtlColor(WXWPARAM wParam, WXLPARAM lParam,
01c500af 263 WXHDC *hdc, WXHWND *hwnd);
42e69d6b
VZ
264 void UnpackMenuSelect(WXWPARAM wParam, WXLPARAM lParam,
265 WXWORD *item, WXWORD *flags, WXHMENU *hmenu);
266
a23fd0e1 267 // ------------------------------------------------------------------------
3cfcd50b 268 // internal handlers for MSW messages: all handlers return a boolean value:
27d2dbbc 269 // true means that the handler processed the event and false that it didn't
a23fd0e1 270 // ------------------------------------------------------------------------
bfc6fde4 271
42e69d6b
VZ
272 // there are several cases where we have virtual functions for Windows
273 // message processing: this is because these messages often require to be
274 // processed in a different manner in the derived classes. For all other
275 // messages, however, we do *not* have corresponding MSWOnXXX() function
276 // and if the derived class wants to process them, it should override
277 // MSWWindowProc() directly.
a23fd0e1 278
42e69d6b 279 // scroll event (both horizontal and vertical)
a23fd0e1
VZ
280 virtual bool MSWOnScroll(int orientation, WXWORD nSBCode,
281 WXWORD pos, WXHWND control);
282
42e69d6b 283 // child control notifications
a23fd0e1
VZ
284#ifdef __WIN95__
285 virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
286#endif // __WIN95__
287
42e69d6b
VZ
288 // owner-drawn controls need to process these messages
289 virtual bool MSWOnDrawItem(int id, WXDRAWITEMSTRUCT *item);
290 virtual bool MSWOnMeasureItem(int id, WXMEASUREITEMSTRUCT *item);
291
292 // the rest are not virtual
293 bool HandleCreate(WXLPCREATESTRUCT cs, bool *mayCreate);
294 bool HandleInitDialog(WXHWND hWndFocus);
295 bool HandleDestroy();
296
297 bool HandlePaint();
1a784dfc
VZ
298 bool HandlePrintClient(WXHDC hDC);
299 bool HandleEraseBkgnd(WXHDC hDC);
42e69d6b
VZ
300
301 bool HandleMinimize();
302 bool HandleMaximize();
303 bool HandleSize(int x, int y, WXUINT flag);
5706de1c 304 bool HandleSizing(wxRect& rect);
42e69d6b
VZ
305 bool HandleGetMinMaxInfo(void *mmInfo);
306
307 bool HandleShow(bool show, int status);
308 bool HandleActivate(int flag, bool minimized, WXHWND activate);
309
310 bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
42e69d6b 311
48fa6bd3 312 bool HandleCtlColor(WXHBRUSH *hBrush, WXHDC hdc, WXHWND hWnd);
a23fd0e1 313
42e69d6b
VZ
314 bool HandlePaletteChanged(WXHWND hWndPalChange);
315 bool HandleQueryNewPalette();
316 bool HandleSysColorChange();
574c939e 317 bool HandleDisplayChange();
a5e84126 318 bool HandleCaptureChanged(WXHWND gainedCapture);
a23fd0e1 319
42e69d6b
VZ
320 bool HandleQueryEndSession(long logOff, bool *mayEnd);
321 bool HandleEndSession(bool endSession, long logOff);
a23fd0e1 322
42e69d6b
VZ
323 bool HandleSetFocus(WXHWND wnd);
324 bool HandleKillFocus(WXHWND wnd);
bfc6fde4 325
42e69d6b 326 bool HandleDropFiles(WXWPARAM wParam);
bfc6fde4 327
42e69d6b
VZ
328 bool HandleMouseEvent(WXUINT msg, int x, int y, WXUINT flags);
329 bool HandleMouseMove(int x, int y, WXUINT flags);
d2c52078 330 bool HandleMouseWheel(WXWPARAM wParam, WXLPARAM lParam);
bfc6fde4 331
27d2dbbc 332 bool HandleChar(WXWPARAM wParam, WXLPARAM lParam, bool isASCII = false);
33ac7e6f
KB
333 bool HandleKeyDown(WXWPARAM wParam, WXLPARAM lParam);
334 bool HandleKeyUp(WXWPARAM wParam, WXLPARAM lParam);
5048c832
JS
335#if wxUSE_ACCEL
336 bool HandleHotKey(WXWPARAM wParam, WXLPARAM lParam);
337#endif
b74cce40
VZ
338#ifdef __WIN32__
339 int HandleMenuChar(int chAccel, WXLPARAM lParam);
340#endif
bfc6fde4 341
42e69d6b
VZ
342 bool HandleQueryDragIcon(WXHICON *hIcon);
343
344 bool HandleSetCursor(WXHWND hWnd, short nHitTest, int mouseMsg);
bfc6fde4 345
bfc6fde4 346 // Window procedure
c140b7e7 347 virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
bfc6fde4
VZ
348
349 // Calls an appropriate default window procedure
c140b7e7 350 virtual WXLRESULT MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
a37d422a
VZ
351
352 // message processing helpers
353
27d2dbbc 354 // return false if the message shouldn't be translated/preprocessed but
a37d422a
VZ
355 // dispatched normally
356 virtual bool MSWShouldPreProcessMessage(WXMSG* pMsg);
357
27d2dbbc 358 // return true if the message was preprocessed and shouldn't be dispatched
bfc6fde4 359 virtual bool MSWProcessMessage(WXMSG* pMsg);
a37d422a 360
27d2dbbc 361 // return true if the message was translated and shouldn't be dispatched
bfc6fde4 362 virtual bool MSWTranslateMessage(WXMSG* pMsg);
a37d422a
VZ
363
364 // called when the window is about to be destroyed
bfc6fde4
VZ
365 virtual void MSWDestroyWindow();
366
01c500af 367
c5bd3c62
VZ
368 // this function should return the brush to paint the children controls
369 // background or 0 if this window doesn't impose any particular background
370 // on its children
371 //
c3732409
VZ
372 // the base class version returns a solid brush if we have a non default
373 // background colour or 0 otherwise
2bae4332 374 virtual WXHBRUSH MSWGetBgBrushForChild(WXHDC hDC, WXHWND hWnd);
c5bd3c62 375
c3732409
VZ
376 // return the background brush to use for painting the given window by
377 // quering the parent windows via their MSWGetBgBrushForChild() recursively
c5bd3c62 378 //
2bae4332 379 // hWndToPaint is normally NULL meaning this window itself, but it can also
c3732409
VZ
380 // be a child of this window which is used by the static box and could be
381 // potentially useful for other transparent controls
2bae4332 382 WXHBRUSH MSWGetBgBrush(WXHDC hDC, WXHWND hWndToPaint = NULL);
c3732409
VZ
383
384 // gives the parent the possibility to draw its children background, e.g.
385 // this is used by wxNotebook to do it using DrawThemeBackground()
07c19327 386 //
c3732409
VZ
387 // return true if background was drawn, false otherwise
388 virtual bool MSWPrintChild(WXHDC WXUNUSED(hDC), wxWindow * WXUNUSED(child))
389 {
390 return false;
391 }
07c19327 392
ce0e1aac
JS
393 // some controls (e.g. wxListBox) need to set the return value themselves
394 //
395 // return true to let parent handle it if we don't, false otherwise
396 virtual bool MSWShouldPropagatePrintChild()
397 {
398 return true;
399 }
400
07c19327 401
bfc6fde4
VZ
402 // Responds to colour changes: passes event on to children.
403 void OnSysColourChanged(wxSysColourChangedEvent& event);
404
a23fd0e1
VZ
405 // initialize various fields of wxMouseEvent (common part of MSWOnMouseXXX)
406 void InitMouseEvent(wxMouseEvent& event, int x, int y, WXUINT flags);
bfc6fde4 407
1e6feb95
VZ
408 // check if mouse is in the window
409 bool IsMouseInWindow() const;
410
51e4e266
VZ
411 // synthesize a wxEVT_LEAVE_WINDOW event and set m_mouseInWindow to false
412 void GenerateMouseLeave();
413
e39af974
JS
414 // virtual function for implementing internal idle
415 // behaviour
c3732409 416 virtual void OnInternalIdle();
e39af974 417
2bda0e17 418protected:
d7c24517
VZ
419 // the window handle
420 WXHWND m_hWnd;
421
cc2b7472 422 // the old window proc (we subclass all windows)
bfc6fde4 423 WXFARPROC m_oldWndProc;
2bda0e17 424
cc2b7472 425 // additional (MSW specific) flags
cc2b7472 426 bool m_mouseInWindow:1;
68304caf 427 bool m_lastKeydownProcessed:1;
bfc6fde4 428
cc2b7472 429 // the size of one page for scrolling
bfc6fde4
VZ
430 int m_xThumbSize;
431 int m_yThumbSize;
2bda0e17 432
a23fd0e1
VZ
433#if wxUSE_MOUSEEVENT_HACK
434 // the coordinates of the last mouse event and the type of it
cc2b7472
VZ
435 long m_lastMouseX,
436 m_lastMouseY;
437 int m_lastMouseEvent;
a23fd0e1 438#endif // wxUSE_MOUSEEVENT_HACK
bfc6fde4 439
cc2b7472 440 // implement the base class pure virtuals
dabc0cd5
VZ
441 virtual void DoClientToScreen( int *x, int *y ) const;
442 virtual void DoScreenToClient( int *x, int *y ) const;
cc2b7472
VZ
443 virtual void DoGetPosition( int *x, int *y ) const;
444 virtual void DoGetSize( int *width, int *height ) const;
445 virtual void DoGetClientSize( int *width, int *height ) const;
446 virtual void DoSetSize(int x, int y,
447 int width, int height,
448 int sizeFlags = wxSIZE_AUTO);
bfc6fde4 449 virtual void DoSetClientSize(int width, int height);
2bda0e17 450
94633ad9
VZ
451 virtual void DoCaptureMouse();
452 virtual void DoReleaseMouse();
68304caf 453
a494b2bc
VZ
454 // has the window been frozen by Freeze()?
455 bool IsFrozen() const { return m_frozenness > 0; }
456
7d86a2d4
VZ
457 // this simply moves/resizes the given HWND which is supposed to be our
458 // sibling (this is useful for controls which are composite at MSW level
459 // and for which DoMoveWindow() is not enough)
86e30911
VZ
460 //
461 // returns true if the window move was deferred, false if it was moved
462 // immediately (no error return)
463 bool DoMoveSibling(WXHWND hwnd, int x, int y, int width, int height);
7d86a2d4 464
b782f2e0
VZ
465 // move the window to the specified location and resize it: this is called
466 // from both DoSetSize() and DoSetClientSize() and would usually just call
467 // ::MoveWindow() except for composite controls which will want to arrange
468 // themselves inside the given rectangle
469 virtual void DoMoveWindow(int x, int y, int width, int height);
470
cc2b7472
VZ
471#if wxUSE_TOOLTIPS
472 virtual void DoSetToolTip( wxToolTip *tip );
bd9cd534
VZ
473
474 // process TTN_NEEDTEXT message properly (i.e. fixing the bugs in
475 // comctl32.dll in our code -- see the function body for more info)
476 bool HandleTooltipNotify(WXUINT code,
477 WXLPARAM lParam,
478 const wxString& ttip);
cc2b7472
VZ
479#endif // wxUSE_TOOLTIPS
480
b09bda68 481 // the helper functions used by HandleChar/KeyXXX methods
9c7df356
VZ
482 wxKeyEvent CreateKeyEvent(wxEventType evType, int id,
483 WXLPARAM lParam = 0, WXWPARAM wParam = 0) const;
b09bda68 484
3b72cd91
VZ
485
486 // default OnEraseBackground() implementation, return true if we did erase
c3732409
VZ
487 // the background, false otherwise (i.e. the system should erase it)
488 bool DoEraseBackground(WXHDC hDC);
3b72cd91 489
d7e0024b
VZ
490 // generate WM_UPDATEUISTATE if it's needed for the OS we're running under
491 void MSWUpdateUIState();
492
fd3f686c
VZ
493private:
494 // common part of all ctors
495 void Init();
496
a23fd0e1
VZ
497 // the (non-virtual) handlers for the events
498 bool HandleMove(int x, int y);
5706de1c 499 bool HandleMoving(wxRect& rect);
a23fd0e1
VZ
500 bool HandleJoystickEvent(WXUINT msg, int x, int y, WXUINT flags);
501
502#ifdef __WIN95__
503 bool HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
504#endif // __WIN95__
505
d7cbabe0
VZ
506 // list of disabled children before last call to our Disable()
507 wxWindowList *m_childrenDisabled;
508
a1037371
VZ
509 // number of calls to Freeze() minus number of calls to Thaw()
510 unsigned int m_frozenness;
511
220f77b0 512 // current defer window position operation handle (may be NULL)
3b72cd91 513 WXHANDLE m_hDWP;
220f77b0 514
67644c1d
RD
515 // When deferred positioning is done these hold the pending changes, and
516 // are used for the default values if another size/pos changes is done on
517 // this window before the group of deferred changes is completed.
518 wxPoint m_pendingPosition;
519 wxSize m_pendingSize;
220f77b0 520
e8e4fa12
GT
521 DECLARE_DYNAMIC_CLASS(wxWindowMSW)
522 DECLARE_NO_COPY_CLASS(wxWindowMSW)
fd3f686c 523 DECLARE_EVENT_TABLE()
2bda0e17
KB
524};
525
b0cb0158
VZ
526// ----------------------------------------------------------------------------
527// inline functions
528// ----------------------------------------------------------------------------
529
530#if WXWIN_COMPATIBILITY_2_4
531
532inline bool wxWindowMSW::GetUseCtl3D() const { return false; }
533inline bool wxWindowMSW::GetTransparentBackground() const { return false; }
534inline void wxWindowMSW::SetTransparent(bool WXUNUSED(t)) { }
535
536#endif // WXWIN_COMPATIBILITY_2_4
537
cc2b7472
VZ
538// ---------------------------------------------------------------------------
539// global functions
540// ---------------------------------------------------------------------------
2bda0e17 541
cc2b7472 542// kbd code translation
ff792344 543WXDLLEXPORT int wxCharCodeMSWToWX(int keySym, WXLPARAM lParam = 0);
373a5fb3 544WXDLLEXPORT WXWORD wxCharCodeWXToMSW(int id, bool *IsVirtual);
2bda0e17 545
b225f659
VZ
546// window creation helper class: before creating a new HWND, instantiate an
547// object of this class on stack - this allows to process the messages sent to
548// the window even before CreateWindow() returns
549class wxWindowCreationHook
550{
551public:
552 wxWindowCreationHook(wxWindowMSW *winBeingCreated);
553 ~wxWindowCreationHook();
554};
555
cbc8c6ee
VZ
556// ----------------------------------------------------------------------------
557// global objects
558// ----------------------------------------------------------------------------
559
560// notice that this hash must be defined after wxWindow declaration as it
561// needs to "see" its dtor and not just forward declaration
562#include "wx/hash.h"
563
564// pseudo-template HWND <-> wxWindow hash table
54d73f3d
MB
565#if WXWIN_COMPATIBILITY_2_4
566WX_DECLARE_HASH(wxWindow, wxWindowList, wxWinHashTable);
567#else
40ad3426 568WX_DECLARE_HASH(wxWindowMSW, wxWindowList, wxWinHashTable);
54d73f3d 569#endif
cbc8c6ee
VZ
570
571extern wxWinHashTable *wxWinHandleHash;
572
2bda0e17 573#endif
bbcdf8bc 574 // _WX_WINDOW_H_