]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_toplvl.i
use the right number in the tarball filename
[wxWidgets.git] / wxPython / src / _toplvl.i
CommitLineData
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
18MAKE_CONST_WXSTRING(FrameNameStr);
19MAKE_CONST_WXSTRING(DialogNameStr);
20MAKE_CONST_WXSTRING(StatusLineNameStr);
21MAKE_CONST_WXSTRING(ToolBarNameStr);
137b5242 22
d14a1e28
RD
23//---------------------------------------------------------------------------
24%newgroup
137b5242 25
447f48ba
RD
26enum
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,
5472694a 56 wxWS_EX_CONTEXTHELP,
c430d0dc 57
447f48ba 58 // Obsolete
6cffbf02
RD
59 wxDIALOG_MODAL,
60 wxDIALOG_MODELESS,
61 wxUSER_COLOURS,
62 wxNO_3D,
5472694a
RD
63
64 wxFRAME_EX_CONTEXTHELP,
65 wxDIALOG_EX_CONTEXTHELP,
447f48ba
RD
66};
67
5472694a 68
d14a1e28
RD
69enum
70{
f6bcfd97
BP
71 wxFULLSCREEN_NOMENUBAR,
72 wxFULLSCREEN_NOTOOLBAR,
73 wxFULLSCREEN_NOSTATUSBAR,
74 wxFULLSCREEN_NOBORDER,
75 wxFULLSCREEN_NOCAPTION,
ecc08ead
RD
76 wxFULLSCREEN_ALL,
77
78 wxTOPLEVEL_EX_DIALOG,
f6bcfd97
BP
79};
80
e51483b1
RD
81// Styles for RequestUserAttention
82enum
83{
84 wxUSER_ATTENTION_INFO = 1,
85 wxUSER_ATTENTION_ERROR = 2
86};
f6bcfd97 87
d14a1e28 88//---------------------------------------------------------------------------
ecc08ead
RD
89
90class wxTopLevelWindow : public wxWindow
91{
92public:
ecc08ead 93
d14a1e28 94 // No constructor as it can not be used directly from Python
ecc08ead 95
dd9f7fea 96 // maximize = True => maximize, otherwise - restore
a72f4631 97 virtual void Maximize(bool maximize = true);
ecc08ead
RD
98
99 // undo Maximize() or Iconize()
100 virtual void Restore();
101
dd9f7fea 102 // iconize = True => iconize, otherwise - restore
a72f4631 103 virtual void Iconize(bool iconize = true);
ecc08ead 104
dd9f7fea 105 // return True if the frame is maximized
ecc08ead
RD
106 virtual bool IsMaximized() const;
107
4a983d2c
RD
108 // return true if the frame is always maximized
109 // due to native guidelines or current policy
110 virtual bool IsAlwaysMaximized() const;
111
dd9f7fea 112 // return True if the frame is iconized
ecc08ead
RD
113 virtual bool IsIconized() const;
114
115 // get the frame icon
c5943253 116 wxIcon GetIcon() const;
ecc08ead
RD
117
118 // set the frame icon
119 virtual void SetIcon(const wxIcon& icon);
120
0e9b78ce 121 // set the frame icons
5cf1cb10 122 virtual void SetIcons(const wxIconBundle& icons);
ecc08ead
RD
123
124 // maximize the window to cover entire screen
125 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
126
dd9f7fea 127 // return True if the frame is in fullscreen mode
ecc08ead
RD
128 virtual bool IsFullScreen() const;
129
130 virtual void SetTitle(const wxString& title);
131 virtual wxString GetTitle() const;
1542ea39
RD
132
133 // Set the shape of the window to the given region.
5cf1cb10
DS
134 // Returns True if the platform supports this feature
135 // (and the operation is successful.)
1542ea39
RD
136 virtual bool SetShape(const wxRegion& region);
137
5cf1cb10
DS
138 // Attracts the users attention to this window if the application is inactive
139 // (should be called when a background event occurs)
e51483b1
RD
140 virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO);
141
2e5cc335
RD
142 // Is this the active frame (highlighted in the taskbar)?
143 virtual bool IsActive();
5cf1cb10 144
a212b779 145#ifdef __WXMAC__
f355f03e
RD
146 %extend {
147 void MacSetMetalAppearance( bool on ) {
148 int style = self->GetExtraStyle();
149 if ( on )
150 style |= wxFRAME_EX_METAL;
151 else
152 style &= ~wxFRAME_EX_METAL;
153 self->SetExtraStyle(style);
154 }
155 }
5cf1cb10 156 bool MacGetMetalAppearance() const;
3e98bb2a 157#else
5cf1cb10
DS
158 %extend
159 {
3e98bb2a
RD
160 // TODO: Should they raise not implemented or just NOP???
161 void MacSetMetalAppearance( bool on ) { /*wxPyRaiseNotImplemented();*/ }
162 bool MacGetMetalAppearance() const { /*wxPyRaiseNotImplemented();*/ return false; }
163 }
a212b779 164#endif
51941b48
RD
165
166 DocDeclStr(
167 void , CenterOnScreen(int dir = wxBOTH),
168 "Center the window on screen", "");
169 %pythoncode { CentreOnScreen = CenterOnScreen }
50f3c41d
RD
170
171#ifdef __WXMSW__
172 bool EnableCloseButton(bool enable = true);
173#else
174 %extend {
175 bool EnableCloseButton(bool enable = true) { return false; }
176 }
177#endif
178
6aaca5ba
RD
179
180
181 DocDeclStr(
182 virtual wxWindow *, GetDefaultItem() const,
183 "Get the default child of this parent, i.e. the one which is activated
184by pressing <Enter> such as the OK button on a wx.Dialog.", "");
185
186 DocDeclStr(
187 virtual wxWindow *, SetDefaultItem(wxWindow * child),
188 "Set this child as default, return the old default.", "");
189
190 DocDeclStr(
191 virtual void , SetTmpDefaultItem(wxWindow * win),
192 "Set this child as temporary default", "");
193
194 DocDeclStr(
195 virtual wxWindow *, GetTmpDefaultItem() const,
196 "Return the temporary default item, which can be None.", "");
197
994453b8
RD
198 %property(DefaultItem, GetDefaultItem, SetDefaultItem, doc="See `GetDefaultItem` and `SetDefaultItem`");
199 %property(Icon, GetIcon, SetIcon, doc="See `GetIcon` and `SetIcon`");
200 %property(Title, GetTitle, SetTitle, doc="See `GetTitle` and `SetTitle`");
201 %property(TmpDefaultItem, GetTmpDefaultItem, SetTmpDefaultItem, doc="See `GetTmpDefaultItem` and `SetTmpDefaultItem`");
ecc08ead
RD
202};
203
ecc08ead 204
d14a1e28
RD
205//---------------------------------------------------------------------------
206%newgroup
207
208// wxFrame is a top-level window with optional menubar, statusbar and toolbar
209//
210// For each of *bars, a frame may have several of them, but only one is
211// managed by the frame, i.e. resized/moved when the frame is and whose size
212// is accounted for in client size calculations - all others should be taken
213// care of manually.
ecc08ead 214
ab1f7d2a
RD
215MustHaveApp(wxFrame);
216
5cf1cb10
DS
217class wxFrame : public wxTopLevelWindow
218{
9c039d08 219public:
2b9048c5
RD
220 %pythonAppend wxFrame "self._setOORInfo(self)"
221 %pythonAppend wxFrame() ""
b39c3fa0 222 %typemap(out) wxFrame*; // turn off this typemap
d14a1e28 223
5cf1cb10
DS
224 wxFrame(wxWindow* parent,
225 const wxWindowID id = -1,
d5573410 226 const wxString& title = wxPyEmptyString,
b68dc582
RD
227 const wxPoint& pos = wxDefaultPosition,
228 const wxSize& size = wxDefaultSize,
9c039d08 229 long style = wxDEFAULT_FRAME_STYLE,
137b5242 230 const wxString& name = wxPyFrameNameStr);
1b8c7ba6 231 %RenameCtor(PreFrame, wxFrame());
9c039d08 232
b39c3fa0
RD
233 // Turn it back on again
234 %typemap(out) wxFrame* { $result = wxPyMake_wxObject($1, $owner); }
235
5cf1cb10
DS
236 bool Create(wxWindow* parent,
237 const wxWindowID id = -1,
238 const wxString& title = wxPyEmptyString,
239 const wxPoint& pos = wxDefaultPosition,
240 const wxSize& size = wxDefaultSize,
241 long style = wxDEFAULT_FRAME_STYLE,
242 const wxString& name = wxPyFrameNameStr);
0122b7e3 243
d14a1e28
RD
244 // frame state
245 // -----------
ecc08ead 246
d14a1e28
RD
247 // get the origin of the client area (which may be different from (0, 0)
248 // if the frame has a toolbar) in client coordinates
249 virtual wxPoint GetClientAreaOrigin() const;
250
5cf1cb10
DS
251 // sends a size event to the window using its current size:
252 // this has a side effect of refreshing the window layout
705b61cc 253 virtual void SendSizeEvent();
d14a1e28 254
d14a1e28
RD
255 // menu bar functions
256 // ------------------
257
258 virtual void SetMenuBar(wxMenuBar *menubar);
259 virtual wxMenuBar *GetMenuBar() const;
ecc08ead 260
dd9f7fea 261 // process menu command: returns True if processed
d14a1e28
RD
262 bool ProcessCommand(int winid);
263 %pythoncode { Command = ProcessCommand }
264
d14a1e28
RD
265 // status bar functions
266 // --------------------
267
268 // create the main status bar by calling OnCreateStatusBar()
269 virtual wxStatusBar* CreateStatusBar(int number = 1,
69d81895 270 long style = wxDEFAULT_STATUSBAR_STYLE,
d14a1e28
RD
271 wxWindowID winid = 0,
272 const wxString& name = wxPyStatusLineNameStr);
5cf1cb10 273
d14a1e28
RD
274// TODO: with directors?
275// // return a new status bar
276// virtual wxStatusBar *OnCreateStatusBar(int number,
277// long style,
278// wxWindowID winid,
279// const wxString& name);
ecc08ead
RD
280
281 // get the main status bar
d14a1e28 282 virtual wxStatusBar *GetStatusBar() const;
ecc08ead
RD
283
284 // sets the main status bar
285 void SetStatusBar(wxStatusBar *statBar);
286
287 // forward these to status bar
288 virtual void SetStatusText(const wxString &text, int number = 0);
5cf1cb10 289 virtual void SetStatusWidths(int widths, const int* widths_field); // uses typemap above
94e36a51
RD
290 void PushStatusText(const wxString &text, int number = 0);
291 void PopStatusText(int number = 0);
292
94e36a51
RD
293 // set the status bar pane the help will be shown in
294 void SetStatusBarPane(int n);
295 int GetStatusBarPane() const;
ecc08ead 296
d14a1e28
RD
297 // toolbar functions
298 // -----------------
299
300 // create main toolbar bycalling OnCreateToolBar()
301 virtual wxToolBar* CreateToolBar(long style = -1,
302 wxWindowID winid = -1,
137b5242 303 const wxString& name = wxPyToolBarNameStr);
5cf1cb10 304
d14a1e28
RD
305// TODO: with directors?
306// // return a new toolbar
307// virtual wxToolBar *OnCreateToolBar(long style,
308// wxWindowID winid,
309// const wxString& name );
ecc08ead
RD
310
311 // get/set the main toolbar
d14a1e28
RD
312 virtual wxToolBar *GetToolBar() const;
313 virtual void SetToolBar(wxToolBar *toolbar);
ecc08ead 314
dd9f7fea
RD
315 // show help text (typically in the statusbar); show is False
316 // if you are hiding the help, True otherwise
d14a1e28 317 virtual void DoGiveHelp(const wxString& text, bool show);
3ef86e32 318
3ef86e32
RD
319 // send wxUpdateUIEvents for all menu items in the menubar,
320 // or just for menu if non-NULL
321 void DoMenuUpdates(wxMenu* menu = NULL);
880715c9
RD
322
323 static wxVisualAttributes
324 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
42e2bbb9
RD
325
326 %property(MenuBar, GetMenuBar, SetMenuBar, doc="See `GetMenuBar` and `SetMenuBar`");
327 %property(StatusBar, GetStatusBar, SetStatusBar, doc="See `GetStatusBar` and `SetStatusBar`");
328 %property(StatusBarPane, GetStatusBarPane, SetStatusBarPane, doc="See `GetStatusBarPane` and `SetStatusBarPane`");
329 %property(ToolBar, GetToolBar, SetToolBar, doc="See `GetToolBar` and `SetToolBar`");
9c039d08
RD
330};
331
ecc08ead 332//---------------------------------------------------------------------------
d14a1e28 333%newgroup
ecc08ead 334
ab1f7d2a
RD
335MustHaveApp(wxDialog);
336
5cf1cb10
DS
337class wxDialog : public wxTopLevelWindow
338{
ecc08ead 339public:
1631143c
RD
340 enum
341 {
342 // all flags allowed in wxDialogBase::CreateButtonSizer()
5cf1cb10 343 ButtonSizerFlags = wxOK | wxCANCEL | wxYES | wxNO | wxHELP | wxNO_DEFAULT
1631143c
RD
344 };
345
2b9048c5
RD
346 %pythonAppend wxDialog "self._setOORInfo(self)"
347 %pythonAppend wxDialog() ""
b39c3fa0 348 %typemap(out) wxDialog*; // turn off this typemap
d14a1e28 349
ecc08ead 350 wxDialog(wxWindow* parent,
5cf1cb10 351 const wxWindowID id = -1,
d5573410 352 const wxString& title = wxPyEmptyString,
ecc08ead
RD
353 const wxPoint& pos = wxDefaultPosition,
354 const wxSize& size = wxDefaultSize,
355 long style = wxDEFAULT_DIALOG_STYLE,
137b5242 356 const wxString& name = wxPyDialogNameStr);
1b8c7ba6 357 %RenameCtor(PreDialog, wxDialog());
ecc08ead 358
b39c3fa0
RD
359 // Turn it back on again
360 %typemap(out) wxDialog* { $result = wxPyMake_wxObject($1, $owner); }
361
ecc08ead 362 bool Create(wxWindow* parent,
5cf1cb10 363 const wxWindowID id = -1,
d5573410 364 const wxString& title = wxPyEmptyString,
ecc08ead
RD
365 const wxPoint& pos = wxDefaultPosition,
366 const wxSize& size = wxDefaultSize,
367 long style = wxDEFAULT_DIALOG_STYLE,
137b5242 368 const wxString& name = wxPyDialogNameStr);
ecc08ead 369
5cf1cb10 370 // the modal dialogs have a return code - usually the ID of the last
d14a1e28 371 // pressed button
705b61cc
RD
372 void SetReturnCode(int returnCode);
373 int GetReturnCode() const;
ecc08ead 374
b58d5e2d
RD
375 // Set the identifier for the affirmative button: this button will close
376 // the dialog after validating data and calling TransferDataFromWindow()
99fbb25b
RD
377 void SetAffirmativeId(int affirmativeId);
378 int GetAffirmativeId() const;
379
b58d5e2d
RD
380 // Set identifier for Esc key translation: the button with this id will
381 // close the dialog without doing anything else; special value wxID_NONE
382 // means to not handle Esc at all while wxID_ANY means to map Esc to
383 // wxID_CANCEL if present and GetAffirmativeId() otherwise
99fbb25b
RD
384 void SetEscapeId(int escapeId);
385 int GetEscapeId() const;
386
d14a1e28
RD
387 // splits text up at newlines and places the
388 // lines into a vertical wxBoxSizer
9283228f 389 wxSizer* CreateTextSizer( const wxString &message );
ecc08ead 390
76612558
RD
391
392 // returns a horizontal wxBoxSizer containing the given buttons
393 //
394 // notice that the returned sizer can be NULL if no buttons are put in the
395 // sizer (this mostly happens under smart phones and other atypical
396 // platforms which have hardware buttons replacing OK/Cancel and such)
397 %Rename(_CreateButtonSizer,
398 wxSizer* , CreateButtonSizer( long flags ));
399 %pythoncode {
400 def CreateButtonSizer(self, flags, *ignored):
401 return self._CreateButtonSizer(flags)
402 }
403
404 // returns the sizer containing CreateButtonSizer() below a separating
405 // static line for the platforms which use static lines for items
406 // separation (i.e. not Mac)
407 wxSizer *CreateSeparatedButtonSizer(long flags);
408
9283228f 409 wxStdDialogButtonSizer* CreateStdDialogButtonSizer( long flags );
ecc08ead 410
5cf1cb10 411 //void SetModal( bool flag );
f87da722
RD
412
413 // is the dialog in modal state right now?
d14a1e28
RD
414 virtual bool IsModal() const;
415
416 // Shows the dialog and starts a nested event loop that returns when
417 // EndModal is called.
418 virtual int ShowModal();
419
420 // may be called to terminate the dialog with the given return code
421 virtual void EndModal(int retCode);
880715c9
RD
422
423 static wxVisualAttributes
424 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
0eae5d09
RD
425
426 %property(AffirmativeId, GetAffirmativeId, SetAffirmativeId, doc="See `GetAffirmativeId` and `SetAffirmativeId`");
427 %property(EscapeId, GetEscapeId, SetEscapeId, doc="See `GetEscapeId` and `SetEscapeId`");
428 %property(ReturnCode, GetReturnCode, SetReturnCode, doc="See `GetReturnCode` and `SetReturnCode`");
d14a1e28 429};
ecc08ead 430
9c039d08 431//---------------------------------------------------------------------------
d14a1e28
RD
432%newgroup
433
9c039d08 434
ab1f7d2a
RD
435MustHaveApp(wxMiniFrame);
436
5cf1cb10
DS
437class wxMiniFrame : public wxFrame
438{
9c039d08 439public:
2b9048c5
RD
440 %pythonAppend wxMiniFrame "self._setOORInfo(self)"
441 %pythonAppend wxMiniFrame() ""
d14a1e28 442
5cf1cb10
DS
443 wxMiniFrame(wxWindow* parent,
444 const wxWindowID id = -1,
445 const wxString& title = wxPyEmptyString,
446 const wxPoint& pos = wxDefaultPosition,
447 const wxSize& size = wxDefaultSize,
448 long style = wxDEFAULT_FRAME_STYLE,
449 const wxString& name = wxPyFrameNameStr);
1b8c7ba6 450 %RenameCtor(PreMiniFrame, wxMiniFrame());
9c039d08 451
5cf1cb10
DS
452 bool Create(wxWindow* parent,
453 const wxWindowID id = -1,
454 const wxString& title = wxPyEmptyString,
455 const wxPoint& pos = wxDefaultPosition,
456 const wxSize& size = wxDefaultSize,
457 long style = wxDEFAULT_FRAME_STYLE,
458 const wxString& name = wxPyFrameNameStr);
9c039d08 459};
b8b8dda7
RD
460
461
462//---------------------------------------------------------------------------
d14a1e28
RD
463%newgroup
464
b8b8dda7 465
5cf1cb10
DS
466enum
467{
b5a5d647
RD
468 wxSPLASH_CENTRE_ON_PARENT,
469 wxSPLASH_CENTRE_ON_SCREEN,
470 wxSPLASH_NO_CENTRE,
471 wxSPLASH_TIMEOUT,
472 wxSPLASH_NO_TIMEOUT,
473};
474
475
ab1f7d2a
RD
476MustHaveApp(wxSplashScreenWindow);
477
b5a5d647
RD
478class wxSplashScreenWindow: public wxWindow
479{
480public:
2b9048c5 481 %pythonAppend wxSplashScreenWindow "self._setOORInfo(self)"
d14a1e28 482
b5a5d647 483 wxSplashScreenWindow(const wxBitmap& bitmap,
5cf1cb10
DS
484 wxWindow* parent,
485 wxWindowID id,
486 const wxPoint& pos = wxDefaultPosition,
487 const wxSize& size = wxDefaultSize,
488 long style = wxNO_BORDER);
b5a5d647
RD
489
490 void SetBitmap(const wxBitmap& bitmap);
491 wxBitmap& GetBitmap();
7012bb9f
RD
492
493 %property(Bitmap, GetBitmap, SetBitmap, doc="See `GetBitmap` and `SetBitmap`");
b5a5d647
RD
494};
495
496
ab1f7d2a
RD
497MustHaveApp(wxSplashScreen);
498
5cf1cb10
DS
499class wxSplashScreen : public wxFrame
500{
b5a5d647 501public:
2b9048c5 502 %pythonAppend wxSplashScreen "self._setOORInfo(self)"
d14a1e28 503
5cf1cb10
DS
504 wxSplashScreen(const wxBitmap& bitmap,
505 long splashStyle, int milliseconds,
506 wxWindow* parent,
507 wxWindowID id = -1,
508 const wxPoint& pos = wxDefaultPosition,
509 const wxSize& size = wxDefaultSize,
510 long style = wxSIMPLE_BORDER | wxFRAME_NO_TASKBAR | wxSTAY_ON_TOP);
b5a5d647
RD
511
512 long GetSplashStyle() const;
513 wxSplashScreenWindow* GetSplashWindow() const;
514 int GetTimeout() const;
7012bb9f
RD
515
516 %property(SplashStyle, GetSplashStyle, doc="See `GetSplashStyle`");
517 %property(SplashWindow, GetSplashWindow, doc="See `GetSplashWindow`");
518 %property(Timeout, GetTimeout, doc="See `GetTimeout`");
b5a5d647
RD
519};
520
521
522//---------------------------------------------------------------------------