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