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