]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/private.h
reverted use of DeferWindowPos() instead of MoveWindow()
[wxWidgets.git] / include / wx / msw / private.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: private.h
3 // Purpose: Private declarations: as this header is only included by
4 // wxWidgets itself, it may contain identifiers which don't start
5 // with "wx".
6 // Author: Julian Smart
7 // Modified by:
8 // Created: 01/02/97
9 // RCS-ID: $Id$
10 // Copyright: (c) Julian Smart
11 // Licence: wxWindows licence
12 /////////////////////////////////////////////////////////////////////////////
13
14 #ifndef _WX_PRIVATE_H_
15 #define _WX_PRIVATE_H_
16
17 #include "wx/msw/wrapwin.h"
18
19 #ifdef __WXMICROWIN__
20 // Extra prototypes and symbols not defined by MicroWindows
21 #include "wx/msw/microwin.h"
22 #endif
23
24 // Include fixes for MSLU:
25 #include "wx/msw/mslu.h"
26
27 #include "wx/log.h"
28
29 class WXDLLEXPORT wxFont;
30 class WXDLLEXPORT wxWindow;
31
32 // ---------------------------------------------------------------------------
33 // private constants
34 // ---------------------------------------------------------------------------
35
36 // 260 was taken from windef.h
37 #ifndef MAX_PATH
38 #define MAX_PATH 260
39 #endif
40
41 // ---------------------------------------------------------------------------
42 // standard icons from the resources
43 // ---------------------------------------------------------------------------
44
45 #if wxUSE_GUI
46
47 WXDLLEXPORT_DATA(extern HICON) wxSTD_FRAME_ICON;
48 WXDLLEXPORT_DATA(extern HICON) wxSTD_MDIPARENTFRAME_ICON;
49 WXDLLEXPORT_DATA(extern HICON) wxSTD_MDICHILDFRAME_ICON;
50 WXDLLEXPORT_DATA(extern HICON) wxDEFAULT_FRAME_ICON;
51 WXDLLEXPORT_DATA(extern HICON) wxDEFAULT_MDIPARENTFRAME_ICON;
52 WXDLLEXPORT_DATA(extern HICON) wxDEFAULT_MDICHILDFRAME_ICON;
53 WXDLLEXPORT_DATA(extern HFONT) wxSTATUS_LINE_FONT;
54
55 #endif // wxUSE_GUI
56
57 // ---------------------------------------------------------------------------
58 // define things missing from some compilers' headers
59 // ---------------------------------------------------------------------------
60
61 #if defined(__WXWINCE__) || (defined(__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS)
62 #ifndef ZeroMemory
63 inline void ZeroMemory(void *buf, size_t len) { memset(buf, 0, len); }
64 #endif
65 #endif // old mingw32
66
67 // this defines a CASTWNDPROC macro which casts a pointer to the type of a
68 // window proc
69 #if defined(STRICT) || defined(__GNUC__)
70 typedef WNDPROC WndProcCast;
71 #else
72 typedef FARPROC WndProcCast;
73 #endif
74
75
76 #define CASTWNDPROC (WndProcCast)
77
78
79
80 // ---------------------------------------------------------------------------
81 // some stuff for old Windows versions (FIXME: what does it do here??)
82 // ---------------------------------------------------------------------------
83
84 #if !defined(APIENTRY) // NT defines APIENTRY, 3.x not
85 #define APIENTRY FAR PASCAL
86 #endif
87
88 #ifdef __WIN32__
89 #define _EXPORT
90 #else
91 #define _EXPORT _export
92 #endif
93
94 #ifndef __WIN32__
95 typedef signed short int SHORT;
96 #endif
97
98 #if !defined(__WIN32__) // 3.x uses FARPROC for dialogs
99 #ifndef STRICT
100 #define DLGPROC FARPROC
101 #endif
102 #endif
103
104 #if wxUSE_PENWIN
105 WXDLLEXPORT void wxRegisterPenWin();
106 WXDLLEXPORT void wxCleanUpPenWin();
107 WXDLLEXPORT void wxEnablePenAppHooks (bool hook);
108 #endif // wxUSE_PENWIN
109
110 #if wxUSE_ITSY_BITSY
111 #define IBS_HORZCAPTION 0x4000L
112 #define IBS_VERTCAPTION 0x8000L
113
114 UINT WINAPI ibGetCaptionSize( HWND hWnd ) ;
115 UINT WINAPI ibSetCaptionSize( HWND hWnd, UINT nSize ) ;
116 LRESULT WINAPI ibDefWindowProc( HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam ) ;
117 VOID WINAPI ibAdjustWindowRect( HWND hWnd, LPRECT lprc ) ;
118 #endif // wxUSE_ITSY_BITSY
119
120 #if wxUSE_CTL3D
121 #include "wx/msw/ctl3d/ctl3d.h"
122 #endif // wxUSE_CTL3D
123
124 /*
125 * Decide what window classes we're going to use
126 * for this combination of CTl3D/FAFA settings
127 */
128
129 #define STATIC_CLASS wxT("STATIC")
130 #define STATIC_FLAGS (SS_LEFT|WS_CHILD|WS_VISIBLE)
131 #define CHECK_CLASS wxT("BUTTON")
132 #define CHECK_FLAGS (BS_AUTOCHECKBOX|WS_TABSTOP|WS_CHILD)
133 #define CHECK_IS_FAFA FALSE
134 #define RADIO_CLASS wxT("BUTTON")
135 #define RADIO_FLAGS (BS_AUTORADIOBUTTON|WS_CHILD|WS_VISIBLE)
136 #define RADIO_SIZE 20
137 #define RADIO_IS_FAFA FALSE
138 #define PURE_WINDOWS
139 #define GROUP_CLASS wxT("BUTTON")
140 #define GROUP_FLAGS (BS_GROUPBOX|WS_CHILD|WS_VISIBLE)
141
142 /*
143 #define BITCHECK_FLAGS (FB_BITMAP|FC_BUTTONDRAW|FC_DEFAULT|WS_VISIBLE)
144 #define BITRADIO_FLAGS (FC_BUTTONDRAW|FB_BITMAP|FC_RADIO|WS_CHILD|WS_VISIBLE)
145 */
146
147 // ---------------------------------------------------------------------------
148 // misc macros
149 // ---------------------------------------------------------------------------
150
151 #define MEANING_CHARACTER '0'
152 #define DEFAULT_ITEM_WIDTH 100
153 #define DEFAULT_ITEM_HEIGHT 80
154
155 // Scale font to get edit control height
156 //#define EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy) (3*(cy)/2)
157 #define EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy) (cy+8)
158
159 // Generic subclass proc, for panel item moving/sizing and intercept
160 // EDIT control VK_RETURN messages
161 extern LONG APIENTRY _EXPORT
162 wxSubclassedGenericControlProc(WXHWND hWnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
163
164 // ---------------------------------------------------------------------------
165 // useful macros and functions
166 // ---------------------------------------------------------------------------
167
168 // a wrapper macro for ZeroMemory()
169 #if defined(__WIN32__) && !defined(__WXMICROWIN__)
170 #define wxZeroMemory(obj) ::ZeroMemory(&obj, sizeof(obj))
171 #else
172 #define wxZeroMemory(obj) memset((void*) & obj, 0, sizeof(obj))
173 #endif
174
175 #if wxUSE_GUI
176
177 #include <wx/gdicmn.h>
178 #include <wx/colour.h>
179
180 // make conversion from wxColour and COLORREF a bit less painful
181 inline COLORREF wxColourToRGB(const wxColour& c)
182 {
183 return RGB(c.Red(), c.Green(), c.Blue());
184 }
185
186 inline COLORREF wxColourToPalRGB(const wxColour& c)
187 {
188 return PALETTERGB(c.Red(), c.Green(), c.Blue());
189 }
190
191 inline wxColour wxRGBToColour(COLORREF rgb)
192 {
193 return wxColour(GetRValue(rgb), GetGValue(rgb), GetBValue(rgb));
194 }
195
196 inline void wxRGBToColour(wxColour& c, COLORREF rgb)
197 {
198 c.Set(GetRValue(rgb), GetGValue(rgb), GetBValue(rgb));
199 }
200
201 // get the standard colour map for some standard colours - see comment in this
202 // function to understand why is it needed and when should it be used
203 //
204 // it returns a wxCOLORMAP (can't use COLORMAP itself here as comctl32.dll
205 // might be not included/available) array of size wxSTD_COLOUR_MAX
206 //
207 // NB: if you change these colours, update wxBITMAP_STD_COLOURS in the
208 // resources as well: it must have the same number of pixels!
209 enum wxSTD_COLOUR
210 {
211 wxSTD_COL_BTNTEXT,
212 wxSTD_COL_BTNSHADOW,
213 wxSTD_COL_BTNFACE,
214 wxSTD_COL_BTNHIGHLIGHT,
215 wxSTD_COL_MAX
216 };
217
218 struct WXDLLEXPORT wxCOLORMAP
219 {
220 COLORREF from, to;
221 };
222
223 // this function is implemented in src/msw/window.cpp
224 extern wxCOLORMAP *wxGetStdColourMap();
225
226 // create a wxRect from Windows RECT
227 inline wxRect wxRectFromRECT(const RECT& r)
228 {
229 return wxRect(r.left, r.top, r.right - r.left, r.bottom - r.top);
230 }
231
232 // copy Windows RECT to our wxRect
233 inline void wxCopyRECTToRect(const RECT& r, wxRect& rect)
234 {
235 rect = wxRectFromRECT(r);
236 }
237
238 // translations between HIMETRIC units (which OLE likes) and pixels (which are
239 // liked by all the others) - implemented in msw/utilsexc.cpp
240 extern void HIMETRICToPixel(LONG *x, LONG *y);
241 extern void PixelToHIMETRIC(LONG *x, LONG *y);
242
243 // Windows convention of the mask is opposed to the wxWidgets one, so we need
244 // to invert the mask each time we pass one/get one to/from Windows
245 extern HBITMAP wxInvertMask(HBITMAP hbmpMask, int w = 0, int h = 0);
246
247 // Creates an icon or cursor depending from a bitmap
248 //
249 // The bitmap must be valid and it should have a mask. If it doesn't, a default
250 // mask is created using light grey as the transparent colour.
251 extern HICON wxBitmapToHICON(const wxBitmap& bmp);
252
253 // Same requirments as above apply and the bitmap must also have the correct
254 // size.
255 extern
256 HCURSOR wxBitmapToHCURSOR(const wxBitmap& bmp, int hotSpotX, int hotSpotY);
257
258 // get (x, y) from DWORD - notice that HI/LOWORD can *not* be used because they
259 // will fail on system with multiple monitors where the coords may be negative
260 //
261 // these macros are standard now (Win98) but some older headers don't have them
262 #ifndef GET_X_LPARAM
263 #define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
264 #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
265 #endif // GET_X_LPARAM
266
267 // get the current state of SHIFT/CTRL keys
268 inline bool wxIsShiftDown()
269 {
270 // return (::GetKeyState(VK_SHIFT) & 0x100) != 0;
271 // Returns different negative values on WinME and WinNT,
272 // so simply test for negative value.
273 return ::GetKeyState(VK_SHIFT) < 0;
274 }
275
276 inline bool wxIsCtrlDown()
277 {
278 // return (::GetKeyState(VK_CONTROL) & 0x100) != 0;
279 // Returns different negative values on WinME and WinNT,
280 // so simply test for negative value.
281 return ::GetKeyState(VK_CONTROL) < 0;
282 }
283
284 // wrapper around GetWindowRect() and GetClientRect() APIs doing error checking
285 // for Win32
286 inline RECT wxGetWindowRect(HWND hwnd)
287 {
288 RECT rect;
289
290 if ( !::GetWindowRect(hwnd, &rect) )
291 {
292 wxLogLastError(_T("GetWindowRect"));
293 }
294
295 return rect;
296 }
297
298 inline RECT wxGetClientRect(HWND hwnd)
299 {
300 RECT rect;
301
302 if ( !::GetClientRect(hwnd, &rect) )
303 {
304 wxLogLastError(_T("GetClientRect"));
305 }
306
307 return rect;
308 }
309
310 // ---------------------------------------------------------------------------
311 // small helper classes
312 // ---------------------------------------------------------------------------
313
314 // a template to make initializing Windows styructs less painful: it zeroes all
315 // the struct fields and also sets cbSize member to the correct value (and so
316 // can be only used with structures which have this member...)
317 template <class T>
318 struct WinStruct : public T
319 {
320 WinStruct()
321 {
322 ::ZeroMemory(this, sizeof(T));
323
324 // explicit qualification is required here for this to be valid C++
325 this->cbSize = sizeof(T);
326 }
327 };
328
329
330 // create an instance of this class and use it as the HDC for screen, will
331 // automatically release the DC going out of scope
332 class ScreenHDC
333 {
334 public:
335 ScreenHDC() { m_hdc = ::GetDC(NULL); }
336 ~ScreenHDC() { ::ReleaseDC(NULL, m_hdc); }
337
338 operator HDC() const { return m_hdc; }
339
340 private:
341 HDC m_hdc;
342
343 DECLARE_NO_COPY_CLASS(ScreenHDC)
344 };
345
346 // the same as ScreenHDC but for window DCs
347 class WindowHDC
348 {
349 public:
350 WindowHDC(HWND hwnd) { m_hdc = ::GetDC(m_hwnd = hwnd); }
351 ~WindowHDC() { ::ReleaseDC(m_hwnd, m_hdc); }
352
353 operator HDC() const { return m_hdc; }
354
355 private:
356 HWND m_hwnd;
357 HDC m_hdc;
358
359 DECLARE_NO_COPY_CLASS(WindowHDC)
360 };
361
362 // the same as ScreenHDC but for memory DCs: creates the HDC compatible with
363 // the given one (screen by default) in ctor and destroys it in dtor
364 class MemoryHDC
365 {
366 public:
367 MemoryHDC(HDC hdc = 0) { m_hdc = ::CreateCompatibleDC(hdc); }
368 ~MemoryHDC() { ::DeleteDC(m_hdc); }
369
370 operator HDC() const { return m_hdc; }
371
372 private:
373 HDC m_hdc;
374
375 DECLARE_NO_COPY_CLASS(MemoryHDC)
376 };
377
378 // a class which selects a GDI object into a DC in its ctor and deselects in
379 // dtor
380 class SelectInHDC
381 {
382 public:
383 SelectInHDC(HDC hdc, HGDIOBJ hgdiobj) : m_hdc(hdc)
384 { m_hgdiobj = ::SelectObject(hdc, hgdiobj); }
385
386 ~SelectInHDC() { ::SelectObject(m_hdc, m_hgdiobj); }
387
388 // return true if the object was successfully selected
389 operator bool() const { return m_hgdiobj != 0; }
390
391 private:
392 HDC m_hdc;
393 HGDIOBJ m_hgdiobj;
394
395 DECLARE_NO_COPY_CLASS(SelectInHDC)
396 };
397
398 // a class for temporary bitmaps
399 class CompatibleBitmap
400 {
401 public:
402 CompatibleBitmap(HDC hdc, int w, int h)
403 {
404 m_hbmp = ::CreateCompatibleBitmap(hdc, w, h);
405 }
406
407 ~CompatibleBitmap()
408 {
409 if ( m_hbmp )
410 ::DeleteObject(m_hbmp);
411 }
412
413 operator HBITMAP() const { return m_hbmp; }
414
415 private:
416 HBITMAP m_hbmp;
417 };
418
419 // when working with global pointers (which is unfortunately still necessary
420 // sometimes, e.g. for clipboard) it is important to unlock them exactly as
421 // many times as we lock them which just asks for using a "smart lock" class
422 class GlobalPtr
423 {
424 public:
425 GlobalPtr(HGLOBAL hGlobal) : m_hGlobal(hGlobal)
426 {
427 m_ptr = GlobalLock(hGlobal);
428 if ( !m_ptr )
429 {
430 wxLogLastError(_T("GlobalLock"));
431 }
432 }
433
434 ~GlobalPtr()
435 {
436 if ( !GlobalUnlock(m_hGlobal) )
437 {
438 #ifdef __WXDEBUG__
439 // this might happen simply because the block became unlocked
440 DWORD dwLastError = ::GetLastError();
441 if ( dwLastError != NO_ERROR )
442 {
443 wxLogApiError(_T("GlobalUnlock"), dwLastError);
444 }
445 #endif // __WXDEBUG__
446 }
447 }
448
449 operator void *() const { return m_ptr; }
450
451 private:
452 HGLOBAL m_hGlobal;
453 void *m_ptr;
454
455 DECLARE_NO_COPY_CLASS(GlobalPtr)
456 };
457
458 // ---------------------------------------------------------------------------
459 // macros to make casting between WXFOO and FOO a bit easier: the GetFoo()
460 // returns Foo cast to the Windows type for oruselves, while GetFooOf() takes
461 // an argument which should be a pointer or reference to the object of the
462 // corresponding class (this depends on the macro)
463 // ---------------------------------------------------------------------------
464
465 #define GetHwnd() ((HWND)GetHWND())
466 #define GetHwndOf(win) ((HWND)((win)->GetHWND()))
467 // old name
468 #define GetWinHwnd GetHwndOf
469
470 #define GetHdc() ((HDC)GetHDC())
471 #define GetHdcOf(dc) ((HDC)(dc).GetHDC())
472
473 #define GetHbitmap() ((HBITMAP)GetHBITMAP())
474 #define GetHbitmapOf(bmp) ((HBITMAP)(bmp).GetHBITMAP())
475
476 #define GetHicon() ((HICON)GetHICON())
477 #define GetHiconOf(icon) ((HICON)(icon).GetHICON())
478
479 #define GetHaccel() ((HACCEL)GetHACCEL())
480 #define GetHaccelOf(table) ((HACCEL)((table).GetHACCEL()))
481
482 #define GetHbrush() ((HPEN)GetResourceHandle())
483 #define GetHbrushOf(brush) ((HPEN)(brush).GetResourceHandle())
484
485 #define GetHmenu() ((HMENU)GetHMenu())
486 #define GetHmenuOf(menu) ((HMENU)menu->GetHMenu())
487
488 #define GetHcursor() ((HCURSOR)GetHCURSOR())
489 #define GetHcursorOf(cursor) ((HCURSOR)(cursor).GetHCURSOR())
490
491 #define GetHfont() ((HFONT)GetHFONT())
492 #define GetHfontOf(font) ((HFONT)(font).GetHFONT())
493
494 #define GetHpalette() ((HPALETTE)GetHPALETTE())
495 #define GetHpaletteOf(pal) ((HPALETTE)(pal).GetHPALETTE())
496
497 #define GetHpen() ((HPEN)GetResourceHandle())
498 #define GetHpenOf(pen) ((HPEN)(pen).GetResourceHandle())
499
500 #define GetHrgn() ((HRGN)GetHRGN())
501 #define GetHrgnOf(rgn) ((HRGN)(rgn).GetHRGN())
502
503 #endif // wxUSE_GUI
504
505 // ---------------------------------------------------------------------------
506 // global data
507 // ---------------------------------------------------------------------------
508
509 WXDLLIMPEXP_DATA_BASE(extern HINSTANCE) wxhInstance;
510
511 // ---------------------------------------------------------------------------
512 // global functions
513 // ---------------------------------------------------------------------------
514
515 extern "C"
516 {
517 WXDLLIMPEXP_BASE HINSTANCE wxGetInstance();
518 }
519
520 WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
521
522 // return the full name of the program file
523 inline wxString wxGetFullModuleName()
524 {
525 wxString fullname;
526 if ( !::GetModuleFileName
527 (
528 (HMODULE)wxGetInstance(),
529 wxStringBuffer(fullname, MAX_PATH),
530 MAX_PATH
531 ) )
532 {
533 wxLogLastError(_T("GetModuleFileName"));
534 }
535
536 return fullname;
537 }
538
539 #if wxUSE_GUI
540
541 // cursor stuff
542 extern HCURSOR wxGetCurrentBusyCursor(); // from msw/utils.cpp
543 extern const wxCursor *wxGetGlobalCursor(); // from msw/cursor.cpp
544
545 WXDLLEXPORT void wxGetCharSize(WXHWND wnd, int *x, int *y, const wxFont& the_font);
546 WXDLLEXPORT void wxFillLogFont(LOGFONT *logFont, const wxFont *font);
547 WXDLLEXPORT wxFont wxCreateFontFromLogFont(const LOGFONT *logFont);
548 WXDLLEXPORT wxFontEncoding wxGetFontEncFromCharSet(int charset);
549
550 WXDLLEXPORT void wxSliderEvent(WXHWND control, WXWORD wParam, WXWORD pos);
551 WXDLLEXPORT void wxScrollBarEvent(WXHWND hbar, WXWORD wParam, WXWORD pos);
552
553 // Find maximum size of window/rectangle
554 WXDLLEXPORT extern void wxFindMaxSize(WXHWND hwnd, RECT *rect);
555
556 // Safely get the window text (i.e. without using fixed size buffer)
557 WXDLLEXPORT extern wxString wxGetWindowText(WXHWND hWnd);
558
559 // get the window class name
560 WXDLLEXPORT extern wxString wxGetWindowClass(WXHWND hWnd);
561
562 // get the window id (should be unsigned, hence this is not wxWindowID which
563 // is, for mainly historical reasons, signed)
564 WXDLLEXPORT extern WXWORD wxGetWindowId(WXHWND hWnd);
565
566 // check if hWnd's WNDPROC is wndProc. Return true if yes, false if they are
567 // different
568 WXDLLEXPORT extern bool wxCheckWindowWndProc(WXHWND hWnd, WXFARPROC wndProc);
569
570 // Does this window style specify any border?
571 inline bool wxStyleHasBorder(long style)
572 {
573 return (style & (wxSIMPLE_BORDER | wxRAISED_BORDER |
574 wxSUNKEN_BORDER | wxDOUBLE_BORDER)) != 0;
575 }
576
577 // ----------------------------------------------------------------------------
578 // functions mapping HWND to wxWindow
579 // ----------------------------------------------------------------------------
580
581 // this function simply checks whether the given hWnd corresponds to a wxWindow
582 // and returns either that window if it does or NULL otherwise
583 WXDLLEXPORT extern wxWindow* wxFindWinFromHandle(WXHWND hWnd);
584
585 // find the window for HWND which is part of some wxWindow, i.e. unlike
586 // wxFindWinFromHandle() above it will also work for "sub controls" of a
587 // wxWindow.
588 //
589 // returns the wxWindow corresponding to the given HWND or NULL.
590 WXDLLEXPORT extern wxWindow *wxGetWindowFromHWND(WXHWND hwnd);
591
592 // Get the size of an icon
593 WXDLLEXPORT extern wxSize wxGetHiconSize(HICON hicon);
594
595 // Lines are drawn differently for WinCE and regular WIN32
596 WXDLLEXPORT void wxDrawLine(HDC hdc, int x1, int y1, int x2, int y2);
597
598 // ----------------------------------------------------------------------------
599 // 32/64 bit helpers
600 // ----------------------------------------------------------------------------
601
602 #ifdef __WIN64__
603
604 inline void *wxGetWindowProc(HWND hwnd)
605 {
606 return (void *)::GetWindowLongPtr(hwnd, GWLP_WNDPROC);
607 }
608
609 inline void *wxGetWindowUserData(HWND hwnd)
610 {
611 return (void *)::GetWindowLongPtr(hwnd, GWLP_USERDATA);
612 }
613
614 inline WNDPROC wxSetWindowProc(HWND hwnd, WNDPROC func)
615 {
616 return (WNDPROC)::SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)func);
617 }
618
619 inline void *wxSetWindowUserData(HWND hwnd, void *data)
620 {
621 return (void *)::SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)data);
622 }
623
624 #else // __WIN32__
625
626 #ifdef __VISUALC__
627 // strangely enough, VC++ 7.1 gives warnings about 32 -> 64 bit conversions
628 // in the functions below, even in spite of the explicit casts
629 #pragma warning(disable:4311)
630 #pragma warning(disable:4312)
631 #endif
632
633 inline void *wxGetWindowProc(HWND hwnd)
634 {
635 return (void *)::GetWindowLong(hwnd, GWL_WNDPROC);
636 }
637
638 inline void *wxGetWindowUserData(HWND hwnd)
639 {
640 return (void *)::GetWindowLong(hwnd, GWL_USERDATA);
641 }
642
643 inline WNDPROC wxSetWindowProc(HWND hwnd, WNDPROC func)
644 {
645 return (WNDPROC)::SetWindowLong(hwnd, GWL_WNDPROC, (LONG)func);
646 }
647
648 inline void *wxSetWindowUserData(HWND hwnd, void *data)
649 {
650 return (void *)::SetWindowLong(hwnd, GWL_USERDATA, (LONG)data);
651 }
652
653 #ifdef __VISUALC__
654 #pragma warning(default:4311)
655 #pragma warning(default:4312)
656 #endif
657
658 #endif // __WIN64__/__WIN32__
659
660 #endif // wxUSE_GUI
661
662 #endif
663 // _WX_PRIVATE_H_