]>
Commit | Line | Data |
---|---|---|
9c039d08 | 1 | ///////////////////////////////////////////////////////////////////////////// |
d14a1e28 RD |
2 | // Name: _toplvl.i |
3 | // Purpose: SWIG definitions for wxTopLevelWindow, wxFrame, wxDialog and etc. | |
9c039d08 RD |
4 | // |
5 | // Author: Robin Dunn | |
6 | // | |
d14a1e28 | 7 | // Created: 27-Aug-1998 |
9c039d08 | 8 | // RCS-ID: $Id$ |
d14a1e28 | 9 | // Copyright: (c) 2003 by Total Control Software |
9c039d08 RD |
10 | // Licence: wxWindows license |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
d14a1e28 | 13 | // Not a %module |
9c039d08 | 14 | |
9c039d08 | 15 | |
d14a1e28 | 16 | //--------------------------------------------------------------------------- |
9c039d08 | 17 | |
b2dc1044 RD |
18 | MAKE_CONST_WXSTRING(FrameNameStr); |
19 | MAKE_CONST_WXSTRING(DialogNameStr); | |
20 | MAKE_CONST_WXSTRING(StatusLineNameStr); | |
21 | MAKE_CONST_WXSTRING(ToolBarNameStr); | |
137b5242 | 22 | |
d14a1e28 RD |
23 | //--------------------------------------------------------------------------- |
24 | %newgroup | |
137b5242 | 25 | |
447f48ba RD |
26 | enum |
27 | { | |
28 | wxSTAY_ON_TOP, | |
29 | wxICONIZE, | |
30 | wxMINIMIZE, | |
31 | wxMAXIMIZE, | |
32 | wxCLOSE_BOX, | |
33 | wxTHICK_FRAME, | |
34 | wxSYSTEM_MENU, | |
35 | wxMINIMIZE_BOX, | |
36 | wxMAXIMIZE_BOX, | |
37 | wxTINY_CAPTION_HORIZ, | |
38 | wxTINY_CAPTION_VERT, | |
39 | wxRESIZE_BOX, | |
40 | wxRESIZE_BORDER, | |
41 | ||
42 | wxDIALOG_NO_PARENT, | |
43 | ||
44 | wxDEFAULT_FRAME_STYLE, | |
45 | wxDEFAULT_DIALOG_STYLE, | |
46 | ||
47 | wxFRAME_TOOL_WINDOW, | |
48 | wxFRAME_FLOAT_ON_PARENT, | |
49 | wxFRAME_NO_WINDOW_MENU, | |
50 | wxFRAME_NO_TASKBAR, | |
51 | wxFRAME_SHAPED, | |
52 | ||
53 | // Obsolete | |
6cffbf02 RD |
54 | wxDIALOG_MODAL, |
55 | wxDIALOG_MODELESS, | |
56 | wxUSER_COLOURS, | |
57 | wxNO_3D, | |
447f48ba RD |
58 | }; |
59 | ||
d14a1e28 RD |
60 | enum |
61 | { | |
f6bcfd97 BP |
62 | wxFULLSCREEN_NOMENUBAR, |
63 | wxFULLSCREEN_NOTOOLBAR, | |
64 | wxFULLSCREEN_NOSTATUSBAR, | |
65 | wxFULLSCREEN_NOBORDER, | |
66 | wxFULLSCREEN_NOCAPTION, | |
ecc08ead RD |
67 | wxFULLSCREEN_ALL, |
68 | ||
69 | wxTOPLEVEL_EX_DIALOG, | |
f6bcfd97 BP |
70 | }; |
71 | ||
72 | ||
ecc08ead | 73 | |
d14a1e28 RD |
74 | %typemap(in) (int widths, int* widths_field) { |
75 | $1 = PyList_Size($input); | |
76 | $2 = int_LIST_helper($input); | |
77 | if ($2 == NULL) SWIG_fail; | |
78 | } | |
79 | ||
80 | %typemap(freearg) (int widths, int* widths_field) { | |
81 | if ($2) delete [] $2; | |
82 | } | |
83 | ||
84 | ||
85 | //--------------------------------------------------------------------------- | |
ecc08ead RD |
86 | |
87 | class wxTopLevelWindow : public wxWindow | |
88 | { | |
89 | public: | |
ecc08ead | 90 | |
d14a1e28 | 91 | // No constructor as it can not be used directly from Python |
ecc08ead | 92 | |
dd9f7fea RD |
93 | // maximize = True => maximize, otherwise - restore |
94 | virtual void Maximize(bool maximize = True); | |
ecc08ead RD |
95 | |
96 | // undo Maximize() or Iconize() | |
97 | virtual void Restore(); | |
98 | ||
dd9f7fea RD |
99 | // iconize = True => iconize, otherwise - restore |
100 | virtual void Iconize(bool iconize = True); | |
ecc08ead | 101 | |
dd9f7fea | 102 | // return True if the frame is maximized |
ecc08ead RD |
103 | virtual bool IsMaximized() const; |
104 | ||
dd9f7fea | 105 | // return True if the frame is iconized |
ecc08ead RD |
106 | virtual bool IsIconized() const; |
107 | ||
108 | // get the frame icon | |
c5943253 | 109 | wxIcon GetIcon() const; |
ecc08ead RD |
110 | |
111 | // set the frame icon | |
112 | virtual void SetIcon(const wxIcon& icon); | |
113 | ||
0e9b78ce RD |
114 | // set the frame icons |
115 | virtual void SetIcons(const wxIconBundle& icons ); | |
ecc08ead RD |
116 | |
117 | // maximize the window to cover entire screen | |
118 | virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); | |
119 | ||
dd9f7fea | 120 | // return True if the frame is in fullscreen mode |
ecc08ead RD |
121 | virtual bool IsFullScreen() const; |
122 | ||
123 | virtual void SetTitle(const wxString& title); | |
124 | virtual wxString GetTitle() const; | |
1542ea39 RD |
125 | |
126 | // Set the shape of the window to the given region. | |
dd9f7fea | 127 | // Returns True if the platform supports this feature (and the operation |
1542ea39 RD |
128 | // is successful.) |
129 | virtual bool SetShape(const wxRegion& region); | |
130 | ||
a212b779 RD |
131 | #ifdef __WXMAC__ |
132 | void MacSetMetalAppearance( bool on ) ; | |
133 | bool MacGetMetalAppearance() const ; | |
134 | #endif | |
ecc08ead RD |
135 | }; |
136 | ||
ecc08ead | 137 | |
d14a1e28 RD |
138 | //--------------------------------------------------------------------------- |
139 | %newgroup | |
140 | ||
141 | // wxFrame is a top-level window with optional menubar, statusbar and toolbar | |
142 | // | |
143 | // For each of *bars, a frame may have several of them, but only one is | |
144 | // managed by the frame, i.e. resized/moved when the frame is and whose size | |
145 | // is accounted for in client size calculations - all others should be taken | |
146 | // care of manually. | |
ecc08ead | 147 | |
ab1f7d2a RD |
148 | MustHaveApp(wxFrame); |
149 | ||
ecc08ead | 150 | class wxFrame : public wxTopLevelWindow { |
9c039d08 | 151 | public: |
2b9048c5 RD |
152 | %pythonAppend wxFrame "self._setOORInfo(self)" |
153 | %pythonAppend wxFrame() "" | |
d14a1e28 | 154 | |
d5573410 RD |
155 | wxFrame(wxWindow* parent, const wxWindowID id=-1, |
156 | const wxString& title = wxPyEmptyString, | |
b68dc582 RD |
157 | const wxPoint& pos = wxDefaultPosition, |
158 | const wxSize& size = wxDefaultSize, | |
9c039d08 | 159 | long style = wxDEFAULT_FRAME_STYLE, |
137b5242 | 160 | const wxString& name = wxPyFrameNameStr); |
d14a1e28 | 161 | %name(PreFrame)wxFrame(); |
9c039d08 | 162 | |
d5573410 RD |
163 | bool Create(wxWindow* parent, const wxWindowID id=-1, |
164 | const wxString& title = wxPyEmptyString, | |
09f3d4e6 RD |
165 | const wxPoint& pos = wxDefaultPosition, |
166 | const wxSize& size = wxDefaultSize, | |
167 | long style = wxDEFAULT_FRAME_STYLE, | |
137b5242 | 168 | const wxString& name = wxPyFrameNameStr); |
9c039d08 | 169 | |
0122b7e3 | 170 | |
d14a1e28 RD |
171 | // frame state |
172 | // ----------- | |
ecc08ead | 173 | |
d14a1e28 RD |
174 | // get the origin of the client area (which may be different from (0, 0) |
175 | // if the frame has a toolbar) in client coordinates | |
176 | virtual wxPoint GetClientAreaOrigin() const; | |
177 | ||
178 | // sends a size event to the window using its current size -- this has an | |
179 | // effect of refreshing the window layout | |
180 | // | |
181 | virtual void SendSizeEvent() { } | |
182 | ||
183 | ||
184 | // menu bar functions | |
185 | // ------------------ | |
186 | ||
187 | virtual void SetMenuBar(wxMenuBar *menubar); | |
188 | virtual wxMenuBar *GetMenuBar() const; | |
ecc08ead RD |
189 | |
190 | ||
dd9f7fea | 191 | // process menu command: returns True if processed |
d14a1e28 RD |
192 | bool ProcessCommand(int winid); |
193 | %pythoncode { Command = ProcessCommand } | |
194 | ||
ecc08ead | 195 | |
d14a1e28 RD |
196 | // status bar functions |
197 | // -------------------- | |
198 | ||
199 | // create the main status bar by calling OnCreateStatusBar() | |
200 | virtual wxStatusBar* CreateStatusBar(int number = 1, | |
69d81895 | 201 | long style = wxDEFAULT_STATUSBAR_STYLE, |
d14a1e28 RD |
202 | wxWindowID winid = 0, |
203 | const wxString& name = wxPyStatusLineNameStr); | |
204 | // TODO: with directors? | |
205 | // // return a new status bar | |
206 | // virtual wxStatusBar *OnCreateStatusBar(int number, | |
207 | // long style, | |
208 | // wxWindowID winid, | |
209 | // const wxString& name); | |
ecc08ead RD |
210 | |
211 | // get the main status bar | |
d14a1e28 | 212 | virtual wxStatusBar *GetStatusBar() const; |
ecc08ead RD |
213 | |
214 | // sets the main status bar | |
215 | void SetStatusBar(wxStatusBar *statBar); | |
216 | ||
217 | // forward these to status bar | |
218 | virtual void SetStatusText(const wxString &text, int number = 0); | |
d14a1e28 | 219 | virtual void SetStatusWidths(int widths, const int* widths_field); //uses typemap above |
94e36a51 RD |
220 | void PushStatusText(const wxString &text, int number = 0); |
221 | void PopStatusText(int number = 0); | |
222 | ||
94e36a51 RD |
223 | // set the status bar pane the help will be shown in |
224 | void SetStatusBarPane(int n); | |
225 | int GetStatusBarPane() const; | |
ecc08ead RD |
226 | |
227 | ||
d14a1e28 RD |
228 | // toolbar functions |
229 | // ----------------- | |
230 | ||
231 | // create main toolbar bycalling OnCreateToolBar() | |
232 | virtual wxToolBar* CreateToolBar(long style = -1, | |
233 | wxWindowID winid = -1, | |
137b5242 | 234 | const wxString& name = wxPyToolBarNameStr); |
d14a1e28 RD |
235 | // TODO: with directors? |
236 | // // return a new toolbar | |
237 | // virtual wxToolBar *OnCreateToolBar(long style, | |
238 | // wxWindowID winid, | |
239 | // const wxString& name ); | |
ecc08ead RD |
240 | |
241 | // get/set the main toolbar | |
d14a1e28 RD |
242 | virtual wxToolBar *GetToolBar() const; |
243 | virtual void SetToolBar(wxToolBar *toolbar); | |
ecc08ead | 244 | |
d14a1e28 | 245 | |
dd9f7fea RD |
246 | // show help text (typically in the statusbar); show is False |
247 | // if you are hiding the help, True otherwise | |
d14a1e28 | 248 | virtual void DoGiveHelp(const wxString& text, bool show); |
3ef86e32 RD |
249 | |
250 | ||
251 | // send wxUpdateUIEvents for all menu items in the menubar, | |
252 | // or just for menu if non-NULL | |
253 | void DoMenuUpdates(wxMenu* menu = NULL); | |
880715c9 RD |
254 | |
255 | static wxVisualAttributes | |
256 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
9c039d08 RD |
257 | }; |
258 | ||
ecc08ead | 259 | //--------------------------------------------------------------------------- |
d14a1e28 | 260 | %newgroup |
ecc08ead | 261 | |
ab1f7d2a RD |
262 | MustHaveApp(wxDialog); |
263 | ||
ecc08ead RD |
264 | class wxDialog : public wxTopLevelWindow { |
265 | public: | |
2b9048c5 RD |
266 | %pythonAppend wxDialog "self._setOORInfo(self)" |
267 | %pythonAppend wxDialog() "" | |
d14a1e28 | 268 | |
ecc08ead | 269 | wxDialog(wxWindow* parent, |
d5573410 RD |
270 | const wxWindowID id=-1, |
271 | const wxString& title = wxPyEmptyString, | |
ecc08ead RD |
272 | const wxPoint& pos = wxDefaultPosition, |
273 | const wxSize& size = wxDefaultSize, | |
274 | long style = wxDEFAULT_DIALOG_STYLE, | |
137b5242 | 275 | const wxString& name = wxPyDialogNameStr); |
d14a1e28 | 276 | %name(PreDialog)wxDialog(); |
ecc08ead RD |
277 | |
278 | bool Create(wxWindow* parent, | |
d5573410 RD |
279 | const wxWindowID id=-1, |
280 | const wxString& title = wxPyEmptyString, | |
ecc08ead RD |
281 | const wxPoint& pos = wxDefaultPosition, |
282 | const wxSize& size = wxDefaultSize, | |
283 | long style = wxDEFAULT_DIALOG_STYLE, | |
137b5242 | 284 | const wxString& name = wxPyDialogNameStr); |
ecc08ead | 285 | |
0122b7e3 | 286 | |
d14a1e28 RD |
287 | // the modal dialogs have a return code - usually the id of the last |
288 | // pressed button | |
289 | void SetReturnCode(int returnCode) { m_returnCode = returnCode; } | |
290 | int GetReturnCode() const { return m_returnCode; } | |
ecc08ead | 291 | |
d14a1e28 RD |
292 | // splits text up at newlines and places the |
293 | // lines into a vertical wxBoxSizer | |
294 | wxSizer *CreateTextSizer( const wxString &message ); | |
ecc08ead | 295 | |
d14a1e28 RD |
296 | // places buttons into a horizontal wxBoxSizer |
297 | wxSizer *CreateButtonSizer( long flags ); | |
ecc08ead | 298 | |
ecc08ead | 299 | |
f87da722 RD |
300 | //void SetModal(bool flag); |
301 | ||
302 | // is the dialog in modal state right now? | |
d14a1e28 RD |
303 | virtual bool IsModal() const; |
304 | ||
305 | // Shows the dialog and starts a nested event loop that returns when | |
306 | // EndModal is called. | |
307 | virtual int ShowModal(); | |
308 | ||
309 | // may be called to terminate the dialog with the given return code | |
310 | virtual void EndModal(int retCode); | |
880715c9 RD |
311 | |
312 | static wxVisualAttributes | |
313 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
d14a1e28 | 314 | }; |
ecc08ead | 315 | |
9c039d08 | 316 | //--------------------------------------------------------------------------- |
d14a1e28 RD |
317 | %newgroup |
318 | ||
9c039d08 | 319 | |
ab1f7d2a RD |
320 | MustHaveApp(wxMiniFrame); |
321 | ||
9c039d08 RD |
322 | class wxMiniFrame : public wxFrame { |
323 | public: | |
2b9048c5 RD |
324 | %pythonAppend wxMiniFrame "self._setOORInfo(self)" |
325 | %pythonAppend wxMiniFrame() "" | |
d14a1e28 | 326 | |
d5573410 RD |
327 | wxMiniFrame(wxWindow* parent, const wxWindowID id=-1, |
328 | const wxString& title = wxPyEmptyString, | |
b68dc582 RD |
329 | const wxPoint& pos = wxDefaultPosition, |
330 | const wxSize& size = wxDefaultSize, | |
9c039d08 | 331 | long style = wxDEFAULT_FRAME_STYLE, |
137b5242 | 332 | const wxString& name = wxPyFrameNameStr); |
d14a1e28 | 333 | %name(PreMiniFrame)wxMiniFrame(); |
9c039d08 | 334 | |
d5573410 RD |
335 | bool Create(wxWindow* parent, const wxWindowID id=-1, |
336 | const wxString& title = wxPyEmptyString, | |
09f3d4e6 RD |
337 | const wxPoint& pos = wxDefaultPosition, |
338 | const wxSize& size = wxDefaultSize, | |
339 | long style = wxDEFAULT_FRAME_STYLE, | |
137b5242 | 340 | const wxString& name = wxPyFrameNameStr); |
0122b7e3 | 341 | |
9c039d08 | 342 | }; |
b8b8dda7 RD |
343 | |
344 | ||
345 | //--------------------------------------------------------------------------- | |
d14a1e28 RD |
346 | %newgroup |
347 | ||
b8b8dda7 | 348 | |
b5a5d647 RD |
349 | enum { |
350 | wxSPLASH_CENTRE_ON_PARENT, | |
351 | wxSPLASH_CENTRE_ON_SCREEN, | |
352 | wxSPLASH_NO_CENTRE, | |
353 | wxSPLASH_TIMEOUT, | |
354 | wxSPLASH_NO_TIMEOUT, | |
355 | }; | |
356 | ||
357 | ||
ab1f7d2a RD |
358 | MustHaveApp(wxSplashScreenWindow); |
359 | ||
b5a5d647 RD |
360 | class wxSplashScreenWindow: public wxWindow |
361 | { | |
362 | public: | |
2b9048c5 | 363 | %pythonAppend wxSplashScreenWindow "self._setOORInfo(self)" |
d14a1e28 | 364 | |
b5a5d647 RD |
365 | wxSplashScreenWindow(const wxBitmap& bitmap, |
366 | wxWindow* parent, wxWindowID id, | |
367 | const wxPoint& pos = wxDefaultPosition, | |
368 | const wxSize& size = wxDefaultSize, | |
369 | long style = wxNO_BORDER); | |
370 | ||
371 | void SetBitmap(const wxBitmap& bitmap); | |
372 | wxBitmap& GetBitmap(); | |
373 | }; | |
374 | ||
375 | ||
ab1f7d2a RD |
376 | MustHaveApp(wxSplashScreen); |
377 | ||
b5a5d647 RD |
378 | class wxSplashScreen : public wxFrame { |
379 | public: | |
2b9048c5 | 380 | %pythonAppend wxSplashScreen "self._setOORInfo(self)" |
d14a1e28 | 381 | |
b5a5d647 | 382 | wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds, |
d5573410 | 383 | wxWindow* parent, wxWindowID id=-1, |
b5a5d647 RD |
384 | const wxPoint& pos = wxDefaultPosition, |
385 | const wxSize& size = wxDefaultSize, | |
479101ca | 386 | long style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP); |
b5a5d647 RD |
387 | |
388 | long GetSplashStyle() const; | |
389 | wxSplashScreenWindow* GetSplashWindow() const; | |
390 | int GetTimeout() const; | |
391 | }; | |
392 | ||
393 | ||
394 | //--------------------------------------------------------------------------- |