]>
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 | ||
e51483b1 RD |
72 | // Styles for RequestUserAttention |
73 | enum | |
74 | { | |
75 | wxUSER_ATTENTION_INFO = 1, | |
76 | wxUSER_ATTENTION_ERROR = 2 | |
77 | }; | |
f6bcfd97 | 78 | |
d14a1e28 | 79 | //--------------------------------------------------------------------------- |
ecc08ead RD |
80 | |
81 | class wxTopLevelWindow : public wxWindow | |
82 | { | |
83 | public: | |
ecc08ead | 84 | |
d14a1e28 | 85 | // No constructor as it can not be used directly from Python |
ecc08ead | 86 | |
dd9f7fea | 87 | // maximize = True => maximize, otherwise - restore |
a72f4631 | 88 | virtual void Maximize(bool maximize = true); |
ecc08ead RD |
89 | |
90 | // undo Maximize() or Iconize() | |
91 | virtual void Restore(); | |
92 | ||
dd9f7fea | 93 | // iconize = True => iconize, otherwise - restore |
a72f4631 | 94 | virtual void Iconize(bool iconize = true); |
ecc08ead | 95 | |
dd9f7fea | 96 | // return True if the frame is maximized |
ecc08ead RD |
97 | virtual bool IsMaximized() const; |
98 | ||
dd9f7fea | 99 | // return True if the frame is iconized |
ecc08ead RD |
100 | virtual bool IsIconized() const; |
101 | ||
102 | // get the frame icon | |
c5943253 | 103 | wxIcon GetIcon() const; |
ecc08ead RD |
104 | |
105 | // set the frame icon | |
106 | virtual void SetIcon(const wxIcon& icon); | |
107 | ||
0e9b78ce RD |
108 | // set the frame icons |
109 | virtual void SetIcons(const wxIconBundle& icons ); | |
ecc08ead RD |
110 | |
111 | // maximize the window to cover entire screen | |
112 | virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); | |
113 | ||
dd9f7fea | 114 | // return True if the frame is in fullscreen mode |
ecc08ead RD |
115 | virtual bool IsFullScreen() const; |
116 | ||
117 | virtual void SetTitle(const wxString& title); | |
118 | virtual wxString GetTitle() const; | |
1542ea39 RD |
119 | |
120 | // Set the shape of the window to the given region. | |
dd9f7fea | 121 | // Returns True if the platform supports this feature (and the operation |
1542ea39 RD |
122 | // is successful.) |
123 | virtual bool SetShape(const wxRegion& region); | |
124 | ||
e51483b1 RD |
125 | |
126 | // Attracts the users attention to this window if the application is | |
127 | // inactive (should be called when a background event occurs) | |
128 | virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO); | |
129 | ||
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() "" | |
b39c3fa0 | 154 | %typemap(out) wxFrame*; // turn off this typemap |
d14a1e28 | 155 | |
d5573410 RD |
156 | wxFrame(wxWindow* parent, const wxWindowID id=-1, |
157 | const wxString& title = wxPyEmptyString, | |
b68dc582 RD |
158 | const wxPoint& pos = wxDefaultPosition, |
159 | const wxSize& size = wxDefaultSize, | |
9c039d08 | 160 | long style = wxDEFAULT_FRAME_STYLE, |
137b5242 | 161 | const wxString& name = wxPyFrameNameStr); |
d14a1e28 | 162 | %name(PreFrame)wxFrame(); |
9c039d08 | 163 | |
b39c3fa0 RD |
164 | // Turn it back on again |
165 | %typemap(out) wxFrame* { $result = wxPyMake_wxObject($1, $owner); } | |
166 | ||
167 | ||
d5573410 RD |
168 | bool Create(wxWindow* parent, const wxWindowID id=-1, |
169 | const wxString& title = wxPyEmptyString, | |
09f3d4e6 RD |
170 | const wxPoint& pos = wxDefaultPosition, |
171 | const wxSize& size = wxDefaultSize, | |
172 | long style = wxDEFAULT_FRAME_STYLE, | |
137b5242 | 173 | const wxString& name = wxPyFrameNameStr); |
9c039d08 | 174 | |
0122b7e3 | 175 | |
d14a1e28 RD |
176 | // frame state |
177 | // ----------- | |
ecc08ead | 178 | |
d14a1e28 RD |
179 | // get the origin of the client area (which may be different from (0, 0) |
180 | // if the frame has a toolbar) in client coordinates | |
181 | virtual wxPoint GetClientAreaOrigin() const; | |
182 | ||
183 | // sends a size event to the window using its current size -- this has an | |
184 | // effect of refreshing the window layout | |
185 | // | |
705b61cc | 186 | virtual void SendSizeEvent(); |
d14a1e28 RD |
187 | |
188 | ||
189 | // menu bar functions | |
190 | // ------------------ | |
191 | ||
192 | virtual void SetMenuBar(wxMenuBar *menubar); | |
193 | virtual wxMenuBar *GetMenuBar() const; | |
ecc08ead RD |
194 | |
195 | ||
dd9f7fea | 196 | // process menu command: returns True if processed |
d14a1e28 RD |
197 | bool ProcessCommand(int winid); |
198 | %pythoncode { Command = ProcessCommand } | |
199 | ||
ecc08ead | 200 | |
d14a1e28 RD |
201 | // status bar functions |
202 | // -------------------- | |
203 | ||
204 | // create the main status bar by calling OnCreateStatusBar() | |
205 | virtual wxStatusBar* CreateStatusBar(int number = 1, | |
69d81895 | 206 | long style = wxDEFAULT_STATUSBAR_STYLE, |
d14a1e28 RD |
207 | wxWindowID winid = 0, |
208 | const wxString& name = wxPyStatusLineNameStr); | |
209 | // TODO: with directors? | |
210 | // // return a new status bar | |
211 | // virtual wxStatusBar *OnCreateStatusBar(int number, | |
212 | // long style, | |
213 | // wxWindowID winid, | |
214 | // const wxString& name); | |
ecc08ead RD |
215 | |
216 | // get the main status bar | |
d14a1e28 | 217 | virtual wxStatusBar *GetStatusBar() const; |
ecc08ead RD |
218 | |
219 | // sets the main status bar | |
220 | void SetStatusBar(wxStatusBar *statBar); | |
221 | ||
222 | // forward these to status bar | |
223 | virtual void SetStatusText(const wxString &text, int number = 0); | |
d14a1e28 | 224 | virtual void SetStatusWidths(int widths, const int* widths_field); //uses typemap above |
94e36a51 RD |
225 | void PushStatusText(const wxString &text, int number = 0); |
226 | void PopStatusText(int number = 0); | |
227 | ||
94e36a51 RD |
228 | // set the status bar pane the help will be shown in |
229 | void SetStatusBarPane(int n); | |
230 | int GetStatusBarPane() const; | |
ecc08ead RD |
231 | |
232 | ||
d14a1e28 RD |
233 | // toolbar functions |
234 | // ----------------- | |
235 | ||
236 | // create main toolbar bycalling OnCreateToolBar() | |
237 | virtual wxToolBar* CreateToolBar(long style = -1, | |
238 | wxWindowID winid = -1, | |
137b5242 | 239 | const wxString& name = wxPyToolBarNameStr); |
d14a1e28 RD |
240 | // TODO: with directors? |
241 | // // return a new toolbar | |
242 | // virtual wxToolBar *OnCreateToolBar(long style, | |
243 | // wxWindowID winid, | |
244 | // const wxString& name ); | |
ecc08ead RD |
245 | |
246 | // get/set the main toolbar | |
d14a1e28 RD |
247 | virtual wxToolBar *GetToolBar() const; |
248 | virtual void SetToolBar(wxToolBar *toolbar); | |
ecc08ead | 249 | |
d14a1e28 | 250 | |
dd9f7fea RD |
251 | // show help text (typically in the statusbar); show is False |
252 | // if you are hiding the help, True otherwise | |
d14a1e28 | 253 | virtual void DoGiveHelp(const wxString& text, bool show); |
3ef86e32 RD |
254 | |
255 | ||
256 | // send wxUpdateUIEvents for all menu items in the menubar, | |
257 | // or just for menu if non-NULL | |
258 | void DoMenuUpdates(wxMenu* menu = NULL); | |
880715c9 RD |
259 | |
260 | static wxVisualAttributes | |
261 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
9c039d08 RD |
262 | }; |
263 | ||
ecc08ead | 264 | //--------------------------------------------------------------------------- |
d14a1e28 | 265 | %newgroup |
ecc08ead | 266 | |
ab1f7d2a RD |
267 | MustHaveApp(wxDialog); |
268 | ||
ecc08ead RD |
269 | class wxDialog : public wxTopLevelWindow { |
270 | public: | |
2b9048c5 RD |
271 | %pythonAppend wxDialog "self._setOORInfo(self)" |
272 | %pythonAppend wxDialog() "" | |
b39c3fa0 | 273 | %typemap(out) wxDialog*; // turn off this typemap |
d14a1e28 | 274 | |
ecc08ead | 275 | wxDialog(wxWindow* parent, |
d5573410 RD |
276 | const wxWindowID id=-1, |
277 | const wxString& title = wxPyEmptyString, | |
ecc08ead RD |
278 | const wxPoint& pos = wxDefaultPosition, |
279 | const wxSize& size = wxDefaultSize, | |
280 | long style = wxDEFAULT_DIALOG_STYLE, | |
137b5242 | 281 | const wxString& name = wxPyDialogNameStr); |
d14a1e28 | 282 | %name(PreDialog)wxDialog(); |
ecc08ead | 283 | |
b39c3fa0 RD |
284 | // Turn it back on again |
285 | %typemap(out) wxDialog* { $result = wxPyMake_wxObject($1, $owner); } | |
286 | ||
ecc08ead | 287 | bool Create(wxWindow* parent, |
d5573410 RD |
288 | const wxWindowID id=-1, |
289 | const wxString& title = wxPyEmptyString, | |
ecc08ead RD |
290 | const wxPoint& pos = wxDefaultPosition, |
291 | const wxSize& size = wxDefaultSize, | |
292 | long style = wxDEFAULT_DIALOG_STYLE, | |
137b5242 | 293 | const wxString& name = wxPyDialogNameStr); |
ecc08ead | 294 | |
0122b7e3 | 295 | |
d14a1e28 RD |
296 | // the modal dialogs have a return code - usually the id of the last |
297 | // pressed button | |
705b61cc RD |
298 | void SetReturnCode(int returnCode); |
299 | int GetReturnCode() const; | |
ecc08ead | 300 | |
d14a1e28 RD |
301 | // splits text up at newlines and places the |
302 | // lines into a vertical wxBoxSizer | |
303 | wxSizer *CreateTextSizer( const wxString &message ); | |
ecc08ead | 304 | |
d14a1e28 RD |
305 | // places buttons into a horizontal wxBoxSizer |
306 | wxSizer *CreateButtonSizer( long flags ); | |
ecc08ead | 307 | |
ecc08ead | 308 | |
f87da722 RD |
309 | //void SetModal(bool flag); |
310 | ||
311 | // is the dialog in modal state right now? | |
d14a1e28 RD |
312 | virtual bool IsModal() const; |
313 | ||
314 | // Shows the dialog and starts a nested event loop that returns when | |
315 | // EndModal is called. | |
316 | virtual int ShowModal(); | |
317 | ||
318 | // may be called to terminate the dialog with the given return code | |
319 | virtual void EndModal(int retCode); | |
880715c9 RD |
320 | |
321 | static wxVisualAttributes | |
322 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
705b61cc RD |
323 | |
324 | %pythoncode { | |
325 | def SendSizeEvent(self): | |
326 | self.ProcessEvent(wx.SizeEvent((-1,-1))) | |
327 | } | |
d14a1e28 | 328 | }; |
ecc08ead | 329 | |
9c039d08 | 330 | //--------------------------------------------------------------------------- |
d14a1e28 RD |
331 | %newgroup |
332 | ||
9c039d08 | 333 | |
ab1f7d2a RD |
334 | MustHaveApp(wxMiniFrame); |
335 | ||
9c039d08 RD |
336 | class wxMiniFrame : public wxFrame { |
337 | public: | |
2b9048c5 RD |
338 | %pythonAppend wxMiniFrame "self._setOORInfo(self)" |
339 | %pythonAppend wxMiniFrame() "" | |
d14a1e28 | 340 | |
d5573410 RD |
341 | wxMiniFrame(wxWindow* parent, const wxWindowID id=-1, |
342 | const wxString& title = wxPyEmptyString, | |
b68dc582 RD |
343 | const wxPoint& pos = wxDefaultPosition, |
344 | const wxSize& size = wxDefaultSize, | |
9c039d08 | 345 | long style = wxDEFAULT_FRAME_STYLE, |
137b5242 | 346 | const wxString& name = wxPyFrameNameStr); |
d14a1e28 | 347 | %name(PreMiniFrame)wxMiniFrame(); |
9c039d08 | 348 | |
d5573410 RD |
349 | bool Create(wxWindow* parent, const wxWindowID id=-1, |
350 | const wxString& title = wxPyEmptyString, | |
09f3d4e6 RD |
351 | const wxPoint& pos = wxDefaultPosition, |
352 | const wxSize& size = wxDefaultSize, | |
353 | long style = wxDEFAULT_FRAME_STYLE, | |
137b5242 | 354 | const wxString& name = wxPyFrameNameStr); |
0122b7e3 | 355 | |
9c039d08 | 356 | }; |
b8b8dda7 RD |
357 | |
358 | ||
359 | //--------------------------------------------------------------------------- | |
d14a1e28 RD |
360 | %newgroup |
361 | ||
b8b8dda7 | 362 | |
b5a5d647 RD |
363 | enum { |
364 | wxSPLASH_CENTRE_ON_PARENT, | |
365 | wxSPLASH_CENTRE_ON_SCREEN, | |
366 | wxSPLASH_NO_CENTRE, | |
367 | wxSPLASH_TIMEOUT, | |
368 | wxSPLASH_NO_TIMEOUT, | |
369 | }; | |
370 | ||
371 | ||
ab1f7d2a RD |
372 | MustHaveApp(wxSplashScreenWindow); |
373 | ||
b5a5d647 RD |
374 | class wxSplashScreenWindow: public wxWindow |
375 | { | |
376 | public: | |
2b9048c5 | 377 | %pythonAppend wxSplashScreenWindow "self._setOORInfo(self)" |
d14a1e28 | 378 | |
b5a5d647 RD |
379 | wxSplashScreenWindow(const wxBitmap& bitmap, |
380 | wxWindow* parent, wxWindowID id, | |
381 | const wxPoint& pos = wxDefaultPosition, | |
382 | const wxSize& size = wxDefaultSize, | |
383 | long style = wxNO_BORDER); | |
384 | ||
385 | void SetBitmap(const wxBitmap& bitmap); | |
386 | wxBitmap& GetBitmap(); | |
387 | }; | |
388 | ||
389 | ||
ab1f7d2a RD |
390 | MustHaveApp(wxSplashScreen); |
391 | ||
b5a5d647 RD |
392 | class wxSplashScreen : public wxFrame { |
393 | public: | |
2b9048c5 | 394 | %pythonAppend wxSplashScreen "self._setOORInfo(self)" |
d14a1e28 | 395 | |
b5a5d647 | 396 | wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds, |
d5573410 | 397 | wxWindow* parent, wxWindowID id=-1, |
b5a5d647 RD |
398 | const wxPoint& pos = wxDefaultPosition, |
399 | const wxSize& size = wxDefaultSize, | |
479101ca | 400 | long style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP); |
b5a5d647 RD |
401 | |
402 | long GetSplashStyle() const; | |
403 | wxSplashScreenWindow* GetSplashWindow() const; | |
404 | int GetTimeout() const; | |
405 | }; | |
406 | ||
407 | ||
408 | //--------------------------------------------------------------------------- |