]> git.saurik.com Git - wxWidgets.git/blob - include/wx/nativewin.h
Add some missing commas. Fixes #11443
[wxWidgets.git] / include / wx / nativewin.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/nativewin.h
3 // Purpose: classes allowing to wrap a native window handle
4 // Author: Vadim Zeitlin
5 // Created: 2008-03-05
6 // RCS-ID: $Id$
7 // Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwindows.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_NATIVEWIN_H_
12 #define _WX_NATIVEWIN_H_
13
14 #include "wx/toplevel.h"
15
16 // this symbol can be tested in the user code to see if the current wx port has
17 // support for creating wxNativeContainerWindow from native windows
18 //
19 // be optimistic by default, we undefine it below if we don't have it finally
20 #define wxHAS_NATIVE_CONTAINER_WINDOW
21
22 // we define the following typedefs for each of the platform supporting native
23 // windows wrapping:
24 //
25 // - wxNativeContainerWindowHandle is the toolkit-level handle of the native
26 // window, i.e. HWND/GdkWindow*/NSWindow
27 //
28 // - wxNativeContainerWindowId is the lowest level identifier of the native
29 // window, i.e. HWND/GdkNativeWindow/NSWindow (so it's the same as above for
30 // all platforms except GTK where we also can work with Window/XID)
31 //
32 // later we'll also have
33 //
34 // - wxNativeWindowHandle for child windows (which will be wrapped by
35 // wxNativeWindow<T> class), it is HWND/GtkWidget*/ControlRef
36 #if defined(__WXMSW__)
37 #include "wx/msw/wrapwin.h"
38
39 typedef HWND wxNativeContainerWindowId;
40 typedef HWND wxNativeContainerWindowHandle;
41 #elif defined(__WXGTK__)
42 #include <gdk/gdk.h>
43
44 typedef GdkNativeWindow wxNativeContainerWindowId;
45 typedef GdkWindow *wxNativeContainerWindowHandle;
46 #else
47 // no support for using native windows under this platform yet
48 #undef wxHAS_NATIVE_CONTAINER_WINDOW
49 #endif
50
51 #ifdef wxHAS_NATIVE_CONTAINER_WINDOW
52
53 // ----------------------------------------------------------------------------
54 // wxNativeContainerWindow: can be used for creating other wxWindows inside it
55 // ----------------------------------------------------------------------------
56
57 class WXDLLIMPEXP_CORE wxNativeContainerWindow : public wxTopLevelWindow
58 {
59 public:
60 // default ctor, call Create() later
61 wxNativeContainerWindow() { }
62
63 // create a window from an existing native window handle
64 //
65 // use GetHandle() to check if the creation was successful, it will return
66 // 0 if the handle was invalid
67 wxNativeContainerWindow(wxNativeContainerWindowHandle handle)
68 {
69 Create(handle);
70 }
71
72 // same as ctor above but with a return code
73 bool Create(wxNativeContainerWindowHandle handle);
74
75 #if defined(__WXGTK__)
76 // this is a convenient ctor for wxGTK applications which can also create
77 // the objects of this class from the really native window handles and not
78 // only the GdkWindow objects
79 //
80 // wxNativeContainerWindowId is Window (i.e. an XID, i.e. an int) under X11
81 // (when GDK_WINDOWING_X11 is defined) or HWND under Win32
82 wxNativeContainerWindow(wxNativeContainerWindowId winid) { Create(winid); }
83
84 bool Create(wxNativeContainerWindowId winid);
85 #endif // wxGTK
86
87 // unlike for the normal windows, dtor will not destroy the native window
88 // as it normally doesn't belong to us
89 virtual ~wxNativeContainerWindow();
90
91
92 // provide (trivial) implementation of the base class pure virtuals
93 virtual void SetTitle(const wxString& WXUNUSED(title))
94 {
95 wxFAIL_MSG( "not implemented for native windows" );
96 }
97
98 virtual wxString GetTitle() const
99 {
100 wxFAIL_MSG( "not implemented for native windows" );
101
102 return wxString();
103 }
104
105 virtual void Maximize(bool WXUNUSED(maximize) = true)
106 {
107 wxFAIL_MSG( "not implemented for native windows" );
108 }
109
110 virtual bool IsMaximized() const
111 {
112 wxFAIL_MSG( "not implemented for native windows" );
113
114 return false;
115 }
116
117 virtual void Iconize(bool WXUNUSED(iconize) = true)
118 {
119 wxFAIL_MSG( "not implemented for native windows" );
120 }
121
122 virtual bool IsIconized() const
123 {
124 // this is called by wxGTK implementation so don't assert
125 return false;
126 }
127
128 virtual void Restore()
129 {
130 wxFAIL_MSG( "not implemented for native windows" );
131 }
132
133 virtual bool ShowFullScreen(bool WXUNUSED(show),
134 long WXUNUSED(style) = wxFULLSCREEN_ALL)
135 {
136 wxFAIL_MSG( "not implemented for native windows" );
137
138 return false;
139 }
140
141 virtual bool IsFullScreen() const
142 {
143 wxFAIL_MSG( "not implemented for native windows" );
144
145 return false;
146 }
147
148
149 // this is an implementation detail: called when the native window is
150 // destroyed by an outside agency; deletes the C++ object too but can in
151 // principle be overridden to something else (knowing that the window
152 // handle of this object and all of its children is invalid any more)
153 virtual void OnNativeDestroyed();
154
155 protected:
156 #ifdef __WXMSW__
157 virtual WXLRESULT
158 MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
159 #endif // __WXMSW__
160
161 private:
162 wxDECLARE_NO_COPY_CLASS(wxNativeContainerWindow);
163 };
164
165 #endif // wxHAS_NATIVE_CONTAINER_WINDOW
166
167 #endif // _WX_NATIVEWIN_H_
168