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