]>
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 RD |
112 | // set the frame icons |
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. | |
dd9f7fea | 125 | // Returns True if the platform supports this feature (and the operation |
1542ea39 RD |
126 | // is successful.) |
127 | virtual bool SetShape(const wxRegion& region); | |
128 | ||
e51483b1 RD |
129 | |
130 | // Attracts the users attention to this window if the application is | |
131 | // inactive (should be called when a background event occurs) | |
132 | virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO); | |
133 | ||
2e5cc335 RD |
134 | // Is this the active frame (highlighted in the taskbar)? |
135 | virtual bool IsActive(); | |
136 | ||
a212b779 RD |
137 | #ifdef __WXMAC__ |
138 | void MacSetMetalAppearance( bool on ) ; | |
139 | bool MacGetMetalAppearance() const ; | |
3e98bb2a RD |
140 | #else |
141 | %extend { | |
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 |
ecc08ead RD |
147 | }; |
148 | ||
ecc08ead | 149 | |
d14a1e28 RD |
150 | //--------------------------------------------------------------------------- |
151 | %newgroup | |
152 | ||
153 | // wxFrame is a top-level window with optional menubar, statusbar and toolbar | |
154 | // | |
155 | // For each of *bars, a frame may have several of them, but only one is | |
156 | // managed by the frame, i.e. resized/moved when the frame is and whose size | |
157 | // is accounted for in client size calculations - all others should be taken | |
158 | // care of manually. | |
ecc08ead | 159 | |
ab1f7d2a RD |
160 | MustHaveApp(wxFrame); |
161 | ||
ecc08ead | 162 | class wxFrame : public wxTopLevelWindow { |
9c039d08 | 163 | public: |
2b9048c5 RD |
164 | %pythonAppend wxFrame "self._setOORInfo(self)" |
165 | %pythonAppend wxFrame() "" | |
b39c3fa0 | 166 | %typemap(out) wxFrame*; // turn off this typemap |
d14a1e28 | 167 | |
d5573410 RD |
168 | wxFrame(wxWindow* parent, const wxWindowID id=-1, |
169 | const wxString& title = wxPyEmptyString, | |
b68dc582 RD |
170 | const wxPoint& pos = wxDefaultPosition, |
171 | const wxSize& size = wxDefaultSize, | |
9c039d08 | 172 | long style = wxDEFAULT_FRAME_STYLE, |
137b5242 | 173 | const wxString& name = wxPyFrameNameStr); |
1b8c7ba6 | 174 | %RenameCtor(PreFrame, wxFrame()); |
9c039d08 | 175 | |
b39c3fa0 RD |
176 | // Turn it back on again |
177 | %typemap(out) wxFrame* { $result = wxPyMake_wxObject($1, $owner); } | |
178 | ||
179 | ||
d5573410 RD |
180 | bool Create(wxWindow* parent, const wxWindowID id=-1, |
181 | const wxString& title = wxPyEmptyString, | |
09f3d4e6 RD |
182 | const wxPoint& pos = wxDefaultPosition, |
183 | const wxSize& size = wxDefaultSize, | |
184 | long style = wxDEFAULT_FRAME_STYLE, | |
137b5242 | 185 | const wxString& name = wxPyFrameNameStr); |
9c039d08 | 186 | |
0122b7e3 | 187 | |
d14a1e28 RD |
188 | // frame state |
189 | // ----------- | |
ecc08ead | 190 | |
d14a1e28 RD |
191 | // get the origin of the client area (which may be different from (0, 0) |
192 | // if the frame has a toolbar) in client coordinates | |
193 | virtual wxPoint GetClientAreaOrigin() const; | |
194 | ||
195 | // sends a size event to the window using its current size -- this has an | |
196 | // effect of refreshing the window layout | |
705b61cc | 197 | virtual void SendSizeEvent(); |
d14a1e28 RD |
198 | |
199 | ||
200 | // menu bar functions | |
201 | // ------------------ | |
202 | ||
203 | virtual void SetMenuBar(wxMenuBar *menubar); | |
204 | virtual wxMenuBar *GetMenuBar() const; | |
ecc08ead RD |
205 | |
206 | ||
dd9f7fea | 207 | // process menu command: returns True if processed |
d14a1e28 RD |
208 | bool ProcessCommand(int winid); |
209 | %pythoncode { Command = ProcessCommand } | |
210 | ||
ecc08ead | 211 | |
d14a1e28 RD |
212 | // status bar functions |
213 | // -------------------- | |
214 | ||
215 | // create the main status bar by calling OnCreateStatusBar() | |
216 | virtual wxStatusBar* CreateStatusBar(int number = 1, | |
69d81895 | 217 | long style = wxDEFAULT_STATUSBAR_STYLE, |
d14a1e28 RD |
218 | wxWindowID winid = 0, |
219 | const wxString& name = wxPyStatusLineNameStr); | |
220 | // TODO: with directors? | |
221 | // // return a new status bar | |
222 | // virtual wxStatusBar *OnCreateStatusBar(int number, | |
223 | // long style, | |
224 | // wxWindowID winid, | |
225 | // const wxString& name); | |
ecc08ead RD |
226 | |
227 | // get the main status bar | |
d14a1e28 | 228 | virtual wxStatusBar *GetStatusBar() const; |
ecc08ead RD |
229 | |
230 | // sets the main status bar | |
231 | void SetStatusBar(wxStatusBar *statBar); | |
232 | ||
233 | // forward these to status bar | |
234 | virtual void SetStatusText(const wxString &text, int number = 0); | |
d14a1e28 | 235 | virtual void SetStatusWidths(int widths, const int* widths_field); //uses typemap above |
94e36a51 RD |
236 | void PushStatusText(const wxString &text, int number = 0); |
237 | void PopStatusText(int number = 0); | |
238 | ||
94e36a51 RD |
239 | // set the status bar pane the help will be shown in |
240 | void SetStatusBarPane(int n); | |
241 | int GetStatusBarPane() const; | |
ecc08ead RD |
242 | |
243 | ||
d14a1e28 RD |
244 | // toolbar functions |
245 | // ----------------- | |
246 | ||
247 | // create main toolbar bycalling OnCreateToolBar() | |
248 | virtual wxToolBar* CreateToolBar(long style = -1, | |
249 | wxWindowID winid = -1, | |
137b5242 | 250 | const wxString& name = wxPyToolBarNameStr); |
d14a1e28 RD |
251 | // TODO: with directors? |
252 | // // return a new toolbar | |
253 | // virtual wxToolBar *OnCreateToolBar(long style, | |
254 | // wxWindowID winid, | |
255 | // const wxString& name ); | |
ecc08ead RD |
256 | |
257 | // get/set the main toolbar | |
d14a1e28 RD |
258 | virtual wxToolBar *GetToolBar() const; |
259 | virtual void SetToolBar(wxToolBar *toolbar); | |
ecc08ead | 260 | |
d14a1e28 | 261 | |
dd9f7fea RD |
262 | // show help text (typically in the statusbar); show is False |
263 | // if you are hiding the help, True otherwise | |
d14a1e28 | 264 | virtual void DoGiveHelp(const wxString& text, bool show); |
3ef86e32 RD |
265 | |
266 | ||
267 | // send wxUpdateUIEvents for all menu items in the menubar, | |
268 | // or just for menu if non-NULL | |
269 | void DoMenuUpdates(wxMenu* menu = NULL); | |
880715c9 RD |
270 | |
271 | static wxVisualAttributes | |
272 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
9c039d08 RD |
273 | }; |
274 | ||
ecc08ead | 275 | //--------------------------------------------------------------------------- |
d14a1e28 | 276 | %newgroup |
ecc08ead | 277 | |
ab1f7d2a RD |
278 | MustHaveApp(wxDialog); |
279 | ||
ecc08ead RD |
280 | class wxDialog : public wxTopLevelWindow { |
281 | public: | |
1631143c RD |
282 | |
283 | enum | |
284 | { | |
285 | // all flags allowed in wxDialogBase::CreateButtonSizer() | |
286 | ButtonSizerFlags = wxOK|wxCANCEL|wxYES|wxNO|wxHELP|wxNO_DEFAULT | |
287 | }; | |
288 | ||
289 | ||
2b9048c5 RD |
290 | %pythonAppend wxDialog "self._setOORInfo(self)" |
291 | %pythonAppend wxDialog() "" | |
b39c3fa0 | 292 | %typemap(out) wxDialog*; // turn off this typemap |
d14a1e28 | 293 | |
ecc08ead | 294 | wxDialog(wxWindow* parent, |
d5573410 RD |
295 | const wxWindowID id=-1, |
296 | const wxString& title = wxPyEmptyString, | |
ecc08ead RD |
297 | const wxPoint& pos = wxDefaultPosition, |
298 | const wxSize& size = wxDefaultSize, | |
299 | long style = wxDEFAULT_DIALOG_STYLE, | |
137b5242 | 300 | const wxString& name = wxPyDialogNameStr); |
1b8c7ba6 | 301 | %RenameCtor(PreDialog, wxDialog()); |
ecc08ead | 302 | |
b39c3fa0 RD |
303 | // Turn it back on again |
304 | %typemap(out) wxDialog* { $result = wxPyMake_wxObject($1, $owner); } | |
305 | ||
ecc08ead | 306 | bool Create(wxWindow* parent, |
d5573410 RD |
307 | const wxWindowID id=-1, |
308 | const wxString& title = wxPyEmptyString, | |
ecc08ead RD |
309 | const wxPoint& pos = wxDefaultPosition, |
310 | const wxSize& size = wxDefaultSize, | |
311 | long style = wxDEFAULT_DIALOG_STYLE, | |
137b5242 | 312 | const wxString& name = wxPyDialogNameStr); |
ecc08ead | 313 | |
0122b7e3 | 314 | |
d14a1e28 RD |
315 | // the modal dialogs have a return code - usually the id of the last |
316 | // pressed button | |
705b61cc RD |
317 | void SetReturnCode(int returnCode); |
318 | int GetReturnCode() const; | |
ecc08ead | 319 | |
d14a1e28 RD |
320 | // splits text up at newlines and places the |
321 | // lines into a vertical wxBoxSizer | |
9283228f | 322 | wxSizer* CreateTextSizer( const wxString &message ); |
ecc08ead | 323 | |
d14a1e28 | 324 | // places buttons into a horizontal wxBoxSizer |
1631143c RD |
325 | wxSizer* CreateButtonSizer( long flags, |
326 | bool separated = false, | |
327 | wxCoord distance = 0 ); | |
9283228f | 328 | wxStdDialogButtonSizer* CreateStdDialogButtonSizer( long flags ); |
ecc08ead | 329 | |
f87da722 RD |
330 | //void SetModal(bool flag); |
331 | ||
332 | // is the dialog in modal state right now? | |
d14a1e28 RD |
333 | virtual bool IsModal() const; |
334 | ||
335 | // Shows the dialog and starts a nested event loop that returns when | |
336 | // EndModal is called. | |
337 | virtual int ShowModal(); | |
338 | ||
339 | // may be called to terminate the dialog with the given return code | |
340 | virtual void EndModal(int retCode); | |
880715c9 RD |
341 | |
342 | static wxVisualAttributes | |
343 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
d14a1e28 | 344 | }; |
ecc08ead | 345 | |
9c039d08 | 346 | //--------------------------------------------------------------------------- |
d14a1e28 RD |
347 | %newgroup |
348 | ||
9c039d08 | 349 | |
ab1f7d2a RD |
350 | MustHaveApp(wxMiniFrame); |
351 | ||
9c039d08 RD |
352 | class wxMiniFrame : public wxFrame { |
353 | public: | |
2b9048c5 RD |
354 | %pythonAppend wxMiniFrame "self._setOORInfo(self)" |
355 | %pythonAppend wxMiniFrame() "" | |
d14a1e28 | 356 | |
d5573410 RD |
357 | wxMiniFrame(wxWindow* parent, const wxWindowID id=-1, |
358 | const wxString& title = wxPyEmptyString, | |
b68dc582 RD |
359 | const wxPoint& pos = wxDefaultPosition, |
360 | const wxSize& size = wxDefaultSize, | |
9c039d08 | 361 | long style = wxDEFAULT_FRAME_STYLE, |
137b5242 | 362 | const wxString& name = wxPyFrameNameStr); |
1b8c7ba6 | 363 | %RenameCtor(PreMiniFrame, wxMiniFrame()); |
9c039d08 | 364 | |
d5573410 RD |
365 | bool Create(wxWindow* parent, const wxWindowID id=-1, |
366 | const wxString& title = wxPyEmptyString, | |
09f3d4e6 RD |
367 | const wxPoint& pos = wxDefaultPosition, |
368 | const wxSize& size = wxDefaultSize, | |
369 | long style = wxDEFAULT_FRAME_STYLE, | |
137b5242 | 370 | const wxString& name = wxPyFrameNameStr); |
0122b7e3 | 371 | |
9c039d08 | 372 | }; |
b8b8dda7 RD |
373 | |
374 | ||
375 | //--------------------------------------------------------------------------- | |
d14a1e28 RD |
376 | %newgroup |
377 | ||
b8b8dda7 | 378 | |
b5a5d647 RD |
379 | enum { |
380 | wxSPLASH_CENTRE_ON_PARENT, | |
381 | wxSPLASH_CENTRE_ON_SCREEN, | |
382 | wxSPLASH_NO_CENTRE, | |
383 | wxSPLASH_TIMEOUT, | |
384 | wxSPLASH_NO_TIMEOUT, | |
385 | }; | |
386 | ||
387 | ||
ab1f7d2a RD |
388 | MustHaveApp(wxSplashScreenWindow); |
389 | ||
b5a5d647 RD |
390 | class wxSplashScreenWindow: public wxWindow |
391 | { | |
392 | public: | |
2b9048c5 | 393 | %pythonAppend wxSplashScreenWindow "self._setOORInfo(self)" |
d14a1e28 | 394 | |
b5a5d647 RD |
395 | wxSplashScreenWindow(const wxBitmap& bitmap, |
396 | wxWindow* parent, wxWindowID id, | |
397 | const wxPoint& pos = wxDefaultPosition, | |
398 | const wxSize& size = wxDefaultSize, | |
399 | long style = wxNO_BORDER); | |
400 | ||
401 | void SetBitmap(const wxBitmap& bitmap); | |
402 | wxBitmap& GetBitmap(); | |
403 | }; | |
404 | ||
405 | ||
ab1f7d2a RD |
406 | MustHaveApp(wxSplashScreen); |
407 | ||
b5a5d647 RD |
408 | class wxSplashScreen : public wxFrame { |
409 | public: | |
2b9048c5 | 410 | %pythonAppend wxSplashScreen "self._setOORInfo(self)" |
d14a1e28 | 411 | |
b5a5d647 | 412 | wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds, |
d5573410 | 413 | wxWindow* parent, wxWindowID id=-1, |
b5a5d647 RD |
414 | const wxPoint& pos = wxDefaultPosition, |
415 | const wxSize& size = wxDefaultSize, | |
479101ca | 416 | long style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP); |
b5a5d647 RD |
417 | |
418 | long GetSplashStyle() const; | |
419 | wxSplashScreenWindow* GetSplashWindow() const; | |
420 | int GetTimeout() const; | |
421 | }; | |
422 | ||
423 | ||
424 | //--------------------------------------------------------------------------- |