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