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