]>
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); |
1b8c7ba6 | 171 | %RenameCtor(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 | |
705b61cc | 194 | virtual void SendSizeEvent(); |
d14a1e28 RD |
195 | |
196 | ||
197 | // menu bar functions | |
198 | // ------------------ | |
199 | ||
200 | virtual void SetMenuBar(wxMenuBar *menubar); | |
201 | virtual wxMenuBar *GetMenuBar() const; | |
ecc08ead RD |
202 | |
203 | ||
dd9f7fea | 204 | // process menu command: returns True if processed |
d14a1e28 RD |
205 | bool ProcessCommand(int winid); |
206 | %pythoncode { Command = ProcessCommand } | |
207 | ||
ecc08ead | 208 | |
d14a1e28 RD |
209 | // status bar functions |
210 | // -------------------- | |
211 | ||
212 | // create the main status bar by calling OnCreateStatusBar() | |
213 | virtual wxStatusBar* CreateStatusBar(int number = 1, | |
69d81895 | 214 | long style = wxDEFAULT_STATUSBAR_STYLE, |
d14a1e28 RD |
215 | wxWindowID winid = 0, |
216 | const wxString& name = wxPyStatusLineNameStr); | |
217 | // TODO: with directors? | |
218 | // // return a new status bar | |
219 | // virtual wxStatusBar *OnCreateStatusBar(int number, | |
220 | // long style, | |
221 | // wxWindowID winid, | |
222 | // const wxString& name); | |
ecc08ead RD |
223 | |
224 | // get the main status bar | |
d14a1e28 | 225 | virtual wxStatusBar *GetStatusBar() const; |
ecc08ead RD |
226 | |
227 | // sets the main status bar | |
228 | void SetStatusBar(wxStatusBar *statBar); | |
229 | ||
230 | // forward these to status bar | |
231 | virtual void SetStatusText(const wxString &text, int number = 0); | |
d14a1e28 | 232 | virtual void SetStatusWidths(int widths, const int* widths_field); //uses typemap above |
94e36a51 RD |
233 | void PushStatusText(const wxString &text, int number = 0); |
234 | void PopStatusText(int number = 0); | |
235 | ||
94e36a51 RD |
236 | // set the status bar pane the help will be shown in |
237 | void SetStatusBarPane(int n); | |
238 | int GetStatusBarPane() const; | |
ecc08ead RD |
239 | |
240 | ||
d14a1e28 RD |
241 | // toolbar functions |
242 | // ----------------- | |
243 | ||
244 | // create main toolbar bycalling OnCreateToolBar() | |
245 | virtual wxToolBar* CreateToolBar(long style = -1, | |
246 | wxWindowID winid = -1, | |
137b5242 | 247 | const wxString& name = wxPyToolBarNameStr); |
d14a1e28 RD |
248 | // TODO: with directors? |
249 | // // return a new toolbar | |
250 | // virtual wxToolBar *OnCreateToolBar(long style, | |
251 | // wxWindowID winid, | |
252 | // const wxString& name ); | |
ecc08ead RD |
253 | |
254 | // get/set the main toolbar | |
d14a1e28 RD |
255 | virtual wxToolBar *GetToolBar() const; |
256 | virtual void SetToolBar(wxToolBar *toolbar); | |
ecc08ead | 257 | |
d14a1e28 | 258 | |
dd9f7fea RD |
259 | // show help text (typically in the statusbar); show is False |
260 | // if you are hiding the help, True otherwise | |
d14a1e28 | 261 | virtual void DoGiveHelp(const wxString& text, bool show); |
3ef86e32 RD |
262 | |
263 | ||
264 | // send wxUpdateUIEvents for all menu items in the menubar, | |
265 | // or just for menu if non-NULL | |
266 | void DoMenuUpdates(wxMenu* menu = NULL); | |
880715c9 RD |
267 | |
268 | static wxVisualAttributes | |
269 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
9c039d08 RD |
270 | }; |
271 | ||
ecc08ead | 272 | //--------------------------------------------------------------------------- |
d14a1e28 | 273 | %newgroup |
ecc08ead | 274 | |
ab1f7d2a RD |
275 | MustHaveApp(wxDialog); |
276 | ||
ecc08ead RD |
277 | class wxDialog : public wxTopLevelWindow { |
278 | public: | |
2b9048c5 RD |
279 | %pythonAppend wxDialog "self._setOORInfo(self)" |
280 | %pythonAppend wxDialog() "" | |
b39c3fa0 | 281 | %typemap(out) wxDialog*; // turn off this typemap |
d14a1e28 | 282 | |
ecc08ead | 283 | wxDialog(wxWindow* parent, |
d5573410 RD |
284 | const wxWindowID id=-1, |
285 | const wxString& title = wxPyEmptyString, | |
ecc08ead RD |
286 | const wxPoint& pos = wxDefaultPosition, |
287 | const wxSize& size = wxDefaultSize, | |
288 | long style = wxDEFAULT_DIALOG_STYLE, | |
137b5242 | 289 | const wxString& name = wxPyDialogNameStr); |
1b8c7ba6 | 290 | %RenameCtor(PreDialog, wxDialog()); |
ecc08ead | 291 | |
b39c3fa0 RD |
292 | // Turn it back on again |
293 | %typemap(out) wxDialog* { $result = wxPyMake_wxObject($1, $owner); } | |
294 | ||
ecc08ead | 295 | bool Create(wxWindow* parent, |
d5573410 RD |
296 | const wxWindowID id=-1, |
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); |
ecc08ead | 302 | |
0122b7e3 | 303 | |
d14a1e28 RD |
304 | // the modal dialogs have a return code - usually the id of the last |
305 | // pressed button | |
705b61cc RD |
306 | void SetReturnCode(int returnCode); |
307 | int GetReturnCode() const; | |
ecc08ead | 308 | |
d14a1e28 RD |
309 | // splits text up at newlines and places the |
310 | // lines into a vertical wxBoxSizer | |
9283228f | 311 | wxSizer* CreateTextSizer( const wxString &message ); |
ecc08ead | 312 | |
d14a1e28 | 313 | // places buttons into a horizontal wxBoxSizer |
9283228f RD |
314 | wxSizer* CreateButtonSizer( long flags ); |
315 | wxStdDialogButtonSizer* CreateStdDialogButtonSizer( long flags ); | |
ecc08ead | 316 | |
f87da722 RD |
317 | //void SetModal(bool flag); |
318 | ||
319 | // is the dialog in modal state right now? | |
d14a1e28 RD |
320 | virtual bool IsModal() const; |
321 | ||
322 | // Shows the dialog and starts a nested event loop that returns when | |
323 | // EndModal is called. | |
324 | virtual int ShowModal(); | |
325 | ||
326 | // may be called to terminate the dialog with the given return code | |
327 | virtual void EndModal(int retCode); | |
880715c9 RD |
328 | |
329 | static wxVisualAttributes | |
330 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
705b61cc RD |
331 | |
332 | %pythoncode { | |
333 | def SendSizeEvent(self): | |
334 | self.ProcessEvent(wx.SizeEvent((-1,-1))) | |
335 | } | |
d14a1e28 | 336 | }; |
ecc08ead | 337 | |
9c039d08 | 338 | //--------------------------------------------------------------------------- |
d14a1e28 RD |
339 | %newgroup |
340 | ||
9c039d08 | 341 | |
ab1f7d2a RD |
342 | MustHaveApp(wxMiniFrame); |
343 | ||
9c039d08 RD |
344 | class wxMiniFrame : public wxFrame { |
345 | public: | |
2b9048c5 RD |
346 | %pythonAppend wxMiniFrame "self._setOORInfo(self)" |
347 | %pythonAppend wxMiniFrame() "" | |
d14a1e28 | 348 | |
d5573410 RD |
349 | wxMiniFrame(wxWindow* parent, const wxWindowID id=-1, |
350 | const wxString& title = wxPyEmptyString, | |
b68dc582 RD |
351 | const wxPoint& pos = wxDefaultPosition, |
352 | const wxSize& size = wxDefaultSize, | |
9c039d08 | 353 | long style = wxDEFAULT_FRAME_STYLE, |
137b5242 | 354 | const wxString& name = wxPyFrameNameStr); |
1b8c7ba6 | 355 | %RenameCtor(PreMiniFrame, wxMiniFrame()); |
9c039d08 | 356 | |
d5573410 RD |
357 | bool Create(wxWindow* parent, const wxWindowID id=-1, |
358 | const wxString& title = wxPyEmptyString, | |
09f3d4e6 RD |
359 | const wxPoint& pos = wxDefaultPosition, |
360 | const wxSize& size = wxDefaultSize, | |
361 | long style = wxDEFAULT_FRAME_STYLE, | |
137b5242 | 362 | const wxString& name = wxPyFrameNameStr); |
0122b7e3 | 363 | |
9c039d08 | 364 | }; |
b8b8dda7 RD |
365 | |
366 | ||
367 | //--------------------------------------------------------------------------- | |
d14a1e28 RD |
368 | %newgroup |
369 | ||
b8b8dda7 | 370 | |
b5a5d647 RD |
371 | enum { |
372 | wxSPLASH_CENTRE_ON_PARENT, | |
373 | wxSPLASH_CENTRE_ON_SCREEN, | |
374 | wxSPLASH_NO_CENTRE, | |
375 | wxSPLASH_TIMEOUT, | |
376 | wxSPLASH_NO_TIMEOUT, | |
377 | }; | |
378 | ||
379 | ||
ab1f7d2a RD |
380 | MustHaveApp(wxSplashScreenWindow); |
381 | ||
b5a5d647 RD |
382 | class wxSplashScreenWindow: public wxWindow |
383 | { | |
384 | public: | |
2b9048c5 | 385 | %pythonAppend wxSplashScreenWindow "self._setOORInfo(self)" |
d14a1e28 | 386 | |
b5a5d647 RD |
387 | wxSplashScreenWindow(const wxBitmap& bitmap, |
388 | wxWindow* parent, wxWindowID id, | |
389 | const wxPoint& pos = wxDefaultPosition, | |
390 | const wxSize& size = wxDefaultSize, | |
391 | long style = wxNO_BORDER); | |
392 | ||
393 | void SetBitmap(const wxBitmap& bitmap); | |
394 | wxBitmap& GetBitmap(); | |
395 | }; | |
396 | ||
397 | ||
ab1f7d2a RD |
398 | MustHaveApp(wxSplashScreen); |
399 | ||
b5a5d647 RD |
400 | class wxSplashScreen : public wxFrame { |
401 | public: | |
2b9048c5 | 402 | %pythonAppend wxSplashScreen "self._setOORInfo(self)" |
d14a1e28 | 403 | |
b5a5d647 | 404 | wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds, |
d5573410 | 405 | wxWindow* parent, wxWindowID id=-1, |
b5a5d647 RD |
406 | const wxPoint& pos = wxDefaultPosition, |
407 | const wxSize& size = wxDefaultSize, | |
479101ca | 408 | long style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP); |
b5a5d647 RD |
409 | |
410 | long GetSplashStyle() const; | |
411 | wxSplashScreenWindow* GetSplashWindow() const; | |
412 | int GetTimeout() const; | |
413 | }; | |
414 | ||
415 | ||
416 | //--------------------------------------------------------------------------- |