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