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