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