]>
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 | |
d14a1e28 RD |
26 | enum |
27 | { | |
f6bcfd97 BP |
28 | wxFULLSCREEN_NOMENUBAR, |
29 | wxFULLSCREEN_NOTOOLBAR, | |
30 | wxFULLSCREEN_NOSTATUSBAR, | |
31 | wxFULLSCREEN_NOBORDER, | |
32 | wxFULLSCREEN_NOCAPTION, | |
ecc08ead RD |
33 | wxFULLSCREEN_ALL, |
34 | ||
35 | wxTOPLEVEL_EX_DIALOG, | |
f6bcfd97 BP |
36 | }; |
37 | ||
38 | ||
ecc08ead | 39 | |
d14a1e28 RD |
40 | %typemap(in) (int widths, int* widths_field) { |
41 | $1 = PyList_Size($input); | |
42 | $2 = int_LIST_helper($input); | |
43 | if ($2 == NULL) SWIG_fail; | |
44 | } | |
45 | ||
46 | %typemap(freearg) (int widths, int* widths_field) { | |
47 | if ($2) delete [] $2; | |
48 | } | |
49 | ||
50 | ||
51 | //--------------------------------------------------------------------------- | |
ecc08ead RD |
52 | |
53 | class wxTopLevelWindow : public wxWindow | |
54 | { | |
55 | public: | |
ecc08ead | 56 | |
d14a1e28 | 57 | // No constructor as it can not be used directly from Python |
ecc08ead | 58 | |
dd9f7fea RD |
59 | // maximize = True => maximize, otherwise - restore |
60 | virtual void Maximize(bool maximize = True); | |
ecc08ead RD |
61 | |
62 | // undo Maximize() or Iconize() | |
63 | virtual void Restore(); | |
64 | ||
dd9f7fea RD |
65 | // iconize = True => iconize, otherwise - restore |
66 | virtual void Iconize(bool iconize = True); | |
ecc08ead | 67 | |
dd9f7fea | 68 | // return True if the frame is maximized |
ecc08ead RD |
69 | virtual bool IsMaximized() const; |
70 | ||
dd9f7fea | 71 | // return True if the frame is iconized |
ecc08ead RD |
72 | virtual bool IsIconized() const; |
73 | ||
74 | // get the frame icon | |
c5943253 | 75 | wxIcon GetIcon() const; |
ecc08ead RD |
76 | |
77 | // set the frame icon | |
78 | virtual void SetIcon(const wxIcon& icon); | |
79 | ||
0e9b78ce RD |
80 | // set the frame icons |
81 | virtual void SetIcons(const wxIconBundle& icons ); | |
ecc08ead RD |
82 | |
83 | // maximize the window to cover entire screen | |
84 | virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); | |
85 | ||
dd9f7fea | 86 | // return True if the frame is in fullscreen mode |
ecc08ead RD |
87 | virtual bool IsFullScreen() const; |
88 | ||
89 | virtual void SetTitle(const wxString& title); | |
90 | virtual wxString GetTitle() const; | |
1542ea39 RD |
91 | |
92 | // Set the shape of the window to the given region. | |
dd9f7fea | 93 | // Returns True if the platform supports this feature (and the operation |
1542ea39 RD |
94 | // is successful.) |
95 | virtual bool SetShape(const wxRegion& region); | |
96 | ||
ecc08ead RD |
97 | }; |
98 | ||
ecc08ead | 99 | |
d14a1e28 RD |
100 | //--------------------------------------------------------------------------- |
101 | %newgroup | |
102 | ||
103 | // wxFrame is a top-level window with optional menubar, statusbar and toolbar | |
104 | // | |
105 | // For each of *bars, a frame may have several of them, but only one is | |
106 | // managed by the frame, i.e. resized/moved when the frame is and whose size | |
107 | // is accounted for in client size calculations - all others should be taken | |
108 | // care of manually. | |
ecc08ead RD |
109 | |
110 | class wxFrame : public wxTopLevelWindow { | |
9c039d08 | 111 | public: |
d14a1e28 RD |
112 | %addtofunc wxFrame "self._setOORInfo(self)" |
113 | %addtofunc wxFrame() "" | |
114 | ||
9c039d08 | 115 | wxFrame(wxWindow* parent, const wxWindowID id, const wxString& title, |
b68dc582 RD |
116 | const wxPoint& pos = wxDefaultPosition, |
117 | const wxSize& size = wxDefaultSize, | |
9c039d08 | 118 | long style = wxDEFAULT_FRAME_STYLE, |
137b5242 | 119 | const wxString& name = wxPyFrameNameStr); |
d14a1e28 | 120 | %name(PreFrame)wxFrame(); |
9c039d08 | 121 | |
09f3d4e6 RD |
122 | bool Create(wxWindow* parent, const wxWindowID id, const wxString& title, |
123 | const wxPoint& pos = wxDefaultPosition, | |
124 | const wxSize& size = wxDefaultSize, | |
125 | long style = wxDEFAULT_FRAME_STYLE, | |
137b5242 | 126 | const wxString& name = wxPyFrameNameStr); |
9c039d08 | 127 | |
0122b7e3 | 128 | |
d14a1e28 RD |
129 | // frame state |
130 | // ----------- | |
ecc08ead | 131 | |
d14a1e28 RD |
132 | // get the origin of the client area (which may be different from (0, 0) |
133 | // if the frame has a toolbar) in client coordinates | |
134 | virtual wxPoint GetClientAreaOrigin() const; | |
135 | ||
136 | // sends a size event to the window using its current size -- this has an | |
137 | // effect of refreshing the window layout | |
138 | // | |
139 | virtual void SendSizeEvent() { } | |
140 | ||
141 | ||
142 | // menu bar functions | |
143 | // ------------------ | |
144 | ||
145 | virtual void SetMenuBar(wxMenuBar *menubar); | |
146 | virtual wxMenuBar *GetMenuBar() const; | |
ecc08ead RD |
147 | |
148 | ||
dd9f7fea | 149 | // process menu command: returns True if processed |
d14a1e28 RD |
150 | bool ProcessCommand(int winid); |
151 | %pythoncode { Command = ProcessCommand } | |
152 | ||
ecc08ead | 153 | |
d14a1e28 RD |
154 | // status bar functions |
155 | // -------------------- | |
156 | ||
157 | // create the main status bar by calling OnCreateStatusBar() | |
158 | virtual wxStatusBar* CreateStatusBar(int number = 1, | |
159 | long style = wxST_SIZEGRIP, | |
160 | wxWindowID winid = 0, | |
161 | const wxString& name = wxPyStatusLineNameStr); | |
162 | // TODO: with directors? | |
163 | // // return a new status bar | |
164 | // virtual wxStatusBar *OnCreateStatusBar(int number, | |
165 | // long style, | |
166 | // wxWindowID winid, | |
167 | // const wxString& name); | |
ecc08ead RD |
168 | |
169 | // get the main status bar | |
d14a1e28 | 170 | virtual wxStatusBar *GetStatusBar() const; |
ecc08ead RD |
171 | |
172 | // sets the main status bar | |
173 | void SetStatusBar(wxStatusBar *statBar); | |
174 | ||
175 | // forward these to status bar | |
176 | virtual void SetStatusText(const wxString &text, int number = 0); | |
d14a1e28 | 177 | virtual void SetStatusWidths(int widths, const int* widths_field); //uses typemap above |
94e36a51 RD |
178 | void PushStatusText(const wxString &text, int number = 0); |
179 | void PopStatusText(int number = 0); | |
180 | ||
94e36a51 RD |
181 | // set the status bar pane the help will be shown in |
182 | void SetStatusBarPane(int n); | |
183 | int GetStatusBarPane() const; | |
ecc08ead RD |
184 | |
185 | ||
d14a1e28 RD |
186 | // toolbar functions |
187 | // ----------------- | |
188 | ||
189 | // create main toolbar bycalling OnCreateToolBar() | |
190 | virtual wxToolBar* CreateToolBar(long style = -1, | |
191 | wxWindowID winid = -1, | |
137b5242 | 192 | const wxString& name = wxPyToolBarNameStr); |
d14a1e28 RD |
193 | // TODO: with directors? |
194 | // // return a new toolbar | |
195 | // virtual wxToolBar *OnCreateToolBar(long style, | |
196 | // wxWindowID winid, | |
197 | // const wxString& name ); | |
ecc08ead RD |
198 | |
199 | // get/set the main toolbar | |
d14a1e28 RD |
200 | virtual wxToolBar *GetToolBar() const; |
201 | virtual void SetToolBar(wxToolBar *toolbar); | |
ecc08ead | 202 | |
d14a1e28 | 203 | |
dd9f7fea RD |
204 | // show help text (typically in the statusbar); show is False |
205 | // if you are hiding the help, True otherwise | |
d14a1e28 | 206 | virtual void DoGiveHelp(const wxString& text, bool show); |
3ef86e32 RD |
207 | |
208 | ||
209 | // send wxUpdateUIEvents for all menu items in the menubar, | |
210 | // or just for menu if non-NULL | |
211 | void DoMenuUpdates(wxMenu* menu = NULL); | |
9c039d08 RD |
212 | }; |
213 | ||
ecc08ead | 214 | //--------------------------------------------------------------------------- |
d14a1e28 | 215 | %newgroup |
ecc08ead RD |
216 | |
217 | class wxDialog : public wxTopLevelWindow { | |
218 | public: | |
d14a1e28 RD |
219 | %addtofunc wxDialog "self._setOORInfo(self)" |
220 | %addtofunc wxDialog() "" | |
221 | ||
ecc08ead RD |
222 | wxDialog(wxWindow* parent, |
223 | const wxWindowID id, | |
224 | const wxString& title, | |
225 | const wxPoint& pos = wxDefaultPosition, | |
226 | const wxSize& size = wxDefaultSize, | |
227 | long style = wxDEFAULT_DIALOG_STYLE, | |
137b5242 | 228 | const wxString& name = wxPyDialogNameStr); |
d14a1e28 | 229 | %name(PreDialog)wxDialog(); |
ecc08ead RD |
230 | |
231 | bool Create(wxWindow* parent, | |
232 | const wxWindowID id, | |
233 | const wxString& title, | |
234 | const wxPoint& pos = wxDefaultPosition, | |
235 | const wxSize& size = wxDefaultSize, | |
236 | long style = wxDEFAULT_DIALOG_STYLE, | |
137b5242 | 237 | const wxString& name = wxPyDialogNameStr); |
ecc08ead | 238 | |
0122b7e3 | 239 | |
d14a1e28 RD |
240 | // the modal dialogs have a return code - usually the id of the last |
241 | // pressed button | |
242 | void SetReturnCode(int returnCode) { m_returnCode = returnCode; } | |
243 | int GetReturnCode() const { return m_returnCode; } | |
ecc08ead | 244 | |
d14a1e28 RD |
245 | // splits text up at newlines and places the |
246 | // lines into a vertical wxBoxSizer | |
247 | wxSizer *CreateTextSizer( const wxString &message ); | |
ecc08ead | 248 | |
d14a1e28 RD |
249 | // places buttons into a horizontal wxBoxSizer |
250 | wxSizer *CreateButtonSizer( long flags ); | |
ecc08ead | 251 | |
ecc08ead | 252 | |
d14a1e28 RD |
253 | void SetModal(bool flag); |
254 | virtual bool IsModal() const; | |
255 | ||
256 | // Shows the dialog and starts a nested event loop that returns when | |
257 | // EndModal is called. | |
258 | virtual int ShowModal(); | |
259 | ||
260 | // may be called to terminate the dialog with the given return code | |
261 | virtual void EndModal(int retCode); | |
262 | ||
dd9f7fea | 263 | // returns True if we're in a modal loop |
d14a1e28 RD |
264 | %extend { |
265 | bool IsModalShowing() { | |
266 | #ifdef __WXGTK__ | |
267 | return self->m_modalShowing; | |
268 | #else | |
269 | return self->IsModalShowing(); | |
270 | #endif | |
271 | } | |
272 | } | |
273 | }; | |
ecc08ead | 274 | |
9c039d08 | 275 | //--------------------------------------------------------------------------- |
d14a1e28 RD |
276 | %newgroup |
277 | ||
9c039d08 | 278 | |
9c039d08 RD |
279 | class wxMiniFrame : public wxFrame { |
280 | public: | |
d14a1e28 RD |
281 | %addtofunc wxMiniFrame "self._setOORInfo(self)" |
282 | %addtofunc wxMiniFrame() "" | |
283 | ||
9c039d08 | 284 | wxMiniFrame(wxWindow* parent, const wxWindowID id, const wxString& title, |
b68dc582 RD |
285 | const wxPoint& pos = wxDefaultPosition, |
286 | const wxSize& size = wxDefaultSize, | |
9c039d08 | 287 | long style = wxDEFAULT_FRAME_STYLE, |
137b5242 | 288 | const wxString& name = wxPyFrameNameStr); |
d14a1e28 | 289 | %name(PreMiniFrame)wxMiniFrame(); |
9c039d08 | 290 | |
09f3d4e6 RD |
291 | bool Create(wxWindow* parent, const wxWindowID id, const wxString& title, |
292 | const wxPoint& pos = wxDefaultPosition, | |
293 | const wxSize& size = wxDefaultSize, | |
294 | long style = wxDEFAULT_FRAME_STYLE, | |
137b5242 | 295 | const wxString& name = wxPyFrameNameStr); |
0122b7e3 | 296 | |
9c039d08 | 297 | }; |
b8b8dda7 RD |
298 | |
299 | ||
300 | //--------------------------------------------------------------------------- | |
d14a1e28 RD |
301 | %newgroup |
302 | ||
b8b8dda7 | 303 | |
b5a5d647 RD |
304 | enum { |
305 | wxSPLASH_CENTRE_ON_PARENT, | |
306 | wxSPLASH_CENTRE_ON_SCREEN, | |
307 | wxSPLASH_NO_CENTRE, | |
308 | wxSPLASH_TIMEOUT, | |
309 | wxSPLASH_NO_TIMEOUT, | |
310 | }; | |
311 | ||
312 | ||
313 | class wxSplashScreenWindow: public wxWindow | |
314 | { | |
315 | public: | |
d14a1e28 RD |
316 | %addtofunc wxSplashScreenWindow "self._setOORInfo(self)" |
317 | ||
b5a5d647 RD |
318 | wxSplashScreenWindow(const wxBitmap& bitmap, |
319 | wxWindow* parent, wxWindowID id, | |
320 | const wxPoint& pos = wxDefaultPosition, | |
321 | const wxSize& size = wxDefaultSize, | |
322 | long style = wxNO_BORDER); | |
323 | ||
324 | void SetBitmap(const wxBitmap& bitmap); | |
325 | wxBitmap& GetBitmap(); | |
326 | }; | |
327 | ||
328 | ||
329 | class wxSplashScreen : public wxFrame { | |
330 | public: | |
d14a1e28 RD |
331 | %addtofunc wxSplashScreen "self._setOORInfo(self)" |
332 | ||
b5a5d647 RD |
333 | wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds, |
334 | wxWindow* parent, wxWindowID id, | |
335 | const wxPoint& pos = wxDefaultPosition, | |
336 | const wxSize& size = wxDefaultSize, | |
479101ca | 337 | long style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP); |
b5a5d647 RD |
338 | |
339 | long GetSplashStyle() const; | |
340 | wxSplashScreenWindow* GetSplashWindow() const; | |
341 | int GetTimeout() const; | |
342 | }; | |
343 | ||
344 | ||
345 | //--------------------------------------------------------------------------- |