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