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