]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_toplvl.i
document HasAlignment(), Left/RightIndent() and Tabs() (patch 1527048)
[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,
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
64enum
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
77enum
78{
79 wxUSER_ATTENTION_INFO = 1,
80 wxUSER_ATTENTION_ERROR = 2
81};
f6bcfd97 82
d14a1e28 83//---------------------------------------------------------------------------
ecc08ead
RD
84
85class wxTopLevelWindow : public wxWindow
86{
87public:
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
4a983d2c
RD
103 // return true if the frame is always maximized
104 // due to native guidelines or current policy
105 virtual bool IsAlwaysMaximized() const;
106
dd9f7fea 107 // return True if the frame is iconized
ecc08ead
RD
108 virtual bool IsIconized() const;
109
110 // get the frame icon
c5943253 111 wxIcon GetIcon() const;
ecc08ead
RD
112
113 // set the frame icon
114 virtual void SetIcon(const wxIcon& icon);
115
0e9b78ce 116 // set the frame icons
5cf1cb10 117 virtual void SetIcons(const wxIconBundle& icons);
ecc08ead
RD
118
119 // maximize the window to cover entire screen
120 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
121
dd9f7fea 122 // return True if the frame is in fullscreen mode
ecc08ead
RD
123 virtual bool IsFullScreen() const;
124
125 virtual void SetTitle(const wxString& title);
126 virtual wxString GetTitle() const;
1542ea39
RD
127
128 // Set the shape of the window to the given region.
5cf1cb10
DS
129 // Returns True if the platform supports this feature
130 // (and the operation is successful.)
1542ea39
RD
131 virtual bool SetShape(const wxRegion& region);
132
5cf1cb10
DS
133 // Attracts the users attention to this window if the application is inactive
134 // (should be called when a background event occurs)
e51483b1
RD
135 virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO);
136
2e5cc335
RD
137 // Is this the active frame (highlighted in the taskbar)?
138 virtual bool IsActive();
5cf1cb10 139
a212b779 140#ifdef __WXMAC__
f355f03e
RD
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 }
5cf1cb10 151 bool MacGetMetalAppearance() const;
3e98bb2a 152#else
5cf1cb10
DS
153 %extend
154 {
3e98bb2a
RD
155 // TODO: Should they raise not implemented or just NOP???
156 void MacSetMetalAppearance( bool on ) { /*wxPyRaiseNotImplemented();*/ }
157 bool MacGetMetalAppearance() const { /*wxPyRaiseNotImplemented();*/ return false; }
158 }
a212b779 159#endif
51941b48
RD
160
161 DocDeclStr(
162 void , CenterOnScreen(int dir = wxBOTH),
163 "Center the window on screen", "");
164 %pythoncode { CentreOnScreen = CenterOnScreen }
50f3c41d
RD
165
166#ifdef __WXMSW__
167 bool EnableCloseButton(bool enable = true);
168#else
169 %extend {
170 bool EnableCloseButton(bool enable = true) { return false; }
171 }
172#endif
173
07880314
RD
174 virtual bool SetTransparent(byte alpha);
175 virtual bool CanSetTransparent();
50f3c41d 176
ecc08ead
RD
177};
178
ecc08ead 179
d14a1e28
RD
180//---------------------------------------------------------------------------
181%newgroup
182
183// wxFrame is a top-level window with optional menubar, statusbar and toolbar
184//
185// For each of *bars, a frame may have several of them, but only one is
186// managed by the frame, i.e. resized/moved when the frame is and whose size
187// is accounted for in client size calculations - all others should be taken
188// care of manually.
ecc08ead 189
ab1f7d2a
RD
190MustHaveApp(wxFrame);
191
5cf1cb10
DS
192class wxFrame : public wxTopLevelWindow
193{
9c039d08 194public:
2b9048c5
RD
195 %pythonAppend wxFrame "self._setOORInfo(self)"
196 %pythonAppend wxFrame() ""
b39c3fa0 197 %typemap(out) wxFrame*; // turn off this typemap
d14a1e28 198
5cf1cb10
DS
199 wxFrame(wxWindow* parent,
200 const wxWindowID id = -1,
d5573410 201 const wxString& title = wxPyEmptyString,
b68dc582
RD
202 const wxPoint& pos = wxDefaultPosition,
203 const wxSize& size = wxDefaultSize,
9c039d08 204 long style = wxDEFAULT_FRAME_STYLE,
137b5242 205 const wxString& name = wxPyFrameNameStr);
1b8c7ba6 206 %RenameCtor(PreFrame, wxFrame());
9c039d08 207
b39c3fa0
RD
208 // Turn it back on again
209 %typemap(out) wxFrame* { $result = wxPyMake_wxObject($1, $owner); }
210
5cf1cb10
DS
211 bool Create(wxWindow* parent,
212 const wxWindowID id = -1,
213 const wxString& title = wxPyEmptyString,
214 const wxPoint& pos = wxDefaultPosition,
215 const wxSize& size = wxDefaultSize,
216 long style = wxDEFAULT_FRAME_STYLE,
217 const wxString& name = wxPyFrameNameStr);
0122b7e3 218
d14a1e28
RD
219 // frame state
220 // -----------
ecc08ead 221
d14a1e28
RD
222 // get the origin of the client area (which may be different from (0, 0)
223 // if the frame has a toolbar) in client coordinates
224 virtual wxPoint GetClientAreaOrigin() const;
225
5cf1cb10
DS
226 // sends a size event to the window using its current size:
227 // this has a side effect of refreshing the window layout
705b61cc 228 virtual void SendSizeEvent();
d14a1e28 229
d14a1e28
RD
230 // menu bar functions
231 // ------------------
232
233 virtual void SetMenuBar(wxMenuBar *menubar);
234 virtual wxMenuBar *GetMenuBar() const;
ecc08ead 235
dd9f7fea 236 // process menu command: returns True if processed
d14a1e28
RD
237 bool ProcessCommand(int winid);
238 %pythoncode { Command = ProcessCommand }
239
d14a1e28
RD
240 // status bar functions
241 // --------------------
242
243 // create the main status bar by calling OnCreateStatusBar()
244 virtual wxStatusBar* CreateStatusBar(int number = 1,
69d81895 245 long style = wxDEFAULT_STATUSBAR_STYLE,
d14a1e28
RD
246 wxWindowID winid = 0,
247 const wxString& name = wxPyStatusLineNameStr);
5cf1cb10 248
d14a1e28
RD
249// TODO: with directors?
250// // return a new status bar
251// virtual wxStatusBar *OnCreateStatusBar(int number,
252// long style,
253// wxWindowID winid,
254// const wxString& name);
ecc08ead
RD
255
256 // get the main status bar
d14a1e28 257 virtual wxStatusBar *GetStatusBar() const;
ecc08ead
RD
258
259 // sets the main status bar
260 void SetStatusBar(wxStatusBar *statBar);
261
262 // forward these to status bar
263 virtual void SetStatusText(const wxString &text, int number = 0);
5cf1cb10 264 virtual void SetStatusWidths(int widths, const int* widths_field); // uses typemap above
94e36a51
RD
265 void PushStatusText(const wxString &text, int number = 0);
266 void PopStatusText(int number = 0);
267
94e36a51
RD
268 // set the status bar pane the help will be shown in
269 void SetStatusBarPane(int n);
270 int GetStatusBarPane() const;
ecc08ead 271
d14a1e28
RD
272 // toolbar functions
273 // -----------------
274
275 // create main toolbar bycalling OnCreateToolBar()
276 virtual wxToolBar* CreateToolBar(long style = -1,
277 wxWindowID winid = -1,
137b5242 278 const wxString& name = wxPyToolBarNameStr);
5cf1cb10 279
d14a1e28
RD
280// TODO: with directors?
281// // return a new toolbar
282// virtual wxToolBar *OnCreateToolBar(long style,
283// wxWindowID winid,
284// const wxString& name );
ecc08ead
RD
285
286 // get/set the main toolbar
d14a1e28
RD
287 virtual wxToolBar *GetToolBar() const;
288 virtual void SetToolBar(wxToolBar *toolbar);
ecc08ead 289
dd9f7fea
RD
290 // show help text (typically in the statusbar); show is False
291 // if you are hiding the help, True otherwise
d14a1e28 292 virtual void DoGiveHelp(const wxString& text, bool show);
3ef86e32 293
3ef86e32
RD
294 // send wxUpdateUIEvents for all menu items in the menubar,
295 // or just for menu if non-NULL
296 void DoMenuUpdates(wxMenu* menu = NULL);
880715c9
RD
297
298 static wxVisualAttributes
299 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
9c039d08
RD
300};
301
ecc08ead 302//---------------------------------------------------------------------------
d14a1e28 303%newgroup
ecc08ead 304
ab1f7d2a
RD
305MustHaveApp(wxDialog);
306
5cf1cb10
DS
307class wxDialog : public wxTopLevelWindow
308{
ecc08ead 309public:
1631143c
RD
310 enum
311 {
312 // all flags allowed in wxDialogBase::CreateButtonSizer()
5cf1cb10 313 ButtonSizerFlags = wxOK | wxCANCEL | wxYES | wxNO | wxHELP | wxNO_DEFAULT
1631143c
RD
314 };
315
2b9048c5
RD
316 %pythonAppend wxDialog "self._setOORInfo(self)"
317 %pythonAppend wxDialog() ""
b39c3fa0 318 %typemap(out) wxDialog*; // turn off this typemap
d14a1e28 319
ecc08ead 320 wxDialog(wxWindow* parent,
5cf1cb10 321 const wxWindowID id = -1,
d5573410 322 const wxString& title = wxPyEmptyString,
ecc08ead
RD
323 const wxPoint& pos = wxDefaultPosition,
324 const wxSize& size = wxDefaultSize,
325 long style = wxDEFAULT_DIALOG_STYLE,
137b5242 326 const wxString& name = wxPyDialogNameStr);
1b8c7ba6 327 %RenameCtor(PreDialog, wxDialog());
ecc08ead 328
b39c3fa0
RD
329 // Turn it back on again
330 %typemap(out) wxDialog* { $result = wxPyMake_wxObject($1, $owner); }
331
ecc08ead 332 bool Create(wxWindow* parent,
5cf1cb10 333 const wxWindowID id = -1,
d5573410 334 const wxString& title = wxPyEmptyString,
ecc08ead
RD
335 const wxPoint& pos = wxDefaultPosition,
336 const wxSize& size = wxDefaultSize,
337 long style = wxDEFAULT_DIALOG_STYLE,
137b5242 338 const wxString& name = wxPyDialogNameStr);
ecc08ead 339
5cf1cb10 340 // the modal dialogs have a return code - usually the ID of the last
d14a1e28 341 // pressed button
705b61cc
RD
342 void SetReturnCode(int returnCode);
343 int GetReturnCode() const;
ecc08ead 344
99fbb25b
RD
345 // The identifier for the affirmative button
346 void SetAffirmativeId(int affirmativeId);
347 int GetAffirmativeId() const;
348
349 // Identifier for Esc key translation
350 void SetEscapeId(int escapeId);
351 int GetEscapeId() const;
352
d14a1e28
RD
353 // splits text up at newlines and places the
354 // lines into a vertical wxBoxSizer
9283228f 355 wxSizer* CreateTextSizer( const wxString &message );
ecc08ead 356
d14a1e28 357 // places buttons into a horizontal wxBoxSizer
1631143c
RD
358 wxSizer* CreateButtonSizer( long flags,
359 bool separated = false,
5cf1cb10 360 wxCoord distance = 0 );
9283228f 361 wxStdDialogButtonSizer* CreateStdDialogButtonSizer( long flags );
ecc08ead 362
5cf1cb10 363 //void SetModal( bool flag );
f87da722
RD
364
365 // is the dialog in modal state right now?
d14a1e28
RD
366 virtual bool IsModal() const;
367
368 // Shows the dialog and starts a nested event loop that returns when
369 // EndModal is called.
370 virtual int ShowModal();
371
372 // may be called to terminate the dialog with the given return code
373 virtual void EndModal(int retCode);
880715c9
RD
374
375 static wxVisualAttributes
376 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
d14a1e28 377};
ecc08ead 378
9c039d08 379//---------------------------------------------------------------------------
d14a1e28
RD
380%newgroup
381
9c039d08 382
ab1f7d2a
RD
383MustHaveApp(wxMiniFrame);
384
5cf1cb10
DS
385class wxMiniFrame : public wxFrame
386{
9c039d08 387public:
2b9048c5
RD
388 %pythonAppend wxMiniFrame "self._setOORInfo(self)"
389 %pythonAppend wxMiniFrame() ""
d14a1e28 390
5cf1cb10
DS
391 wxMiniFrame(wxWindow* parent,
392 const wxWindowID id = -1,
393 const wxString& title = wxPyEmptyString,
394 const wxPoint& pos = wxDefaultPosition,
395 const wxSize& size = wxDefaultSize,
396 long style = wxDEFAULT_FRAME_STYLE,
397 const wxString& name = wxPyFrameNameStr);
1b8c7ba6 398 %RenameCtor(PreMiniFrame, wxMiniFrame());
9c039d08 399
5cf1cb10
DS
400 bool Create(wxWindow* parent,
401 const wxWindowID id = -1,
402 const wxString& title = wxPyEmptyString,
403 const wxPoint& pos = wxDefaultPosition,
404 const wxSize& size = wxDefaultSize,
405 long style = wxDEFAULT_FRAME_STYLE,
406 const wxString& name = wxPyFrameNameStr);
9c039d08 407};
b8b8dda7
RD
408
409
410//---------------------------------------------------------------------------
d14a1e28
RD
411%newgroup
412
b8b8dda7 413
5cf1cb10
DS
414enum
415{
b5a5d647
RD
416 wxSPLASH_CENTRE_ON_PARENT,
417 wxSPLASH_CENTRE_ON_SCREEN,
418 wxSPLASH_NO_CENTRE,
419 wxSPLASH_TIMEOUT,
420 wxSPLASH_NO_TIMEOUT,
421};
422
423
ab1f7d2a
RD
424MustHaveApp(wxSplashScreenWindow);
425
b5a5d647
RD
426class wxSplashScreenWindow: public wxWindow
427{
428public:
2b9048c5 429 %pythonAppend wxSplashScreenWindow "self._setOORInfo(self)"
d14a1e28 430
b5a5d647 431 wxSplashScreenWindow(const wxBitmap& bitmap,
5cf1cb10
DS
432 wxWindow* parent,
433 wxWindowID id,
434 const wxPoint& pos = wxDefaultPosition,
435 const wxSize& size = wxDefaultSize,
436 long style = wxNO_BORDER);
b5a5d647
RD
437
438 void SetBitmap(const wxBitmap& bitmap);
439 wxBitmap& GetBitmap();
440};
441
442
ab1f7d2a
RD
443MustHaveApp(wxSplashScreen);
444
5cf1cb10
DS
445class wxSplashScreen : public wxFrame
446{
b5a5d647 447public:
2b9048c5 448 %pythonAppend wxSplashScreen "self._setOORInfo(self)"
d14a1e28 449
5cf1cb10
DS
450 wxSplashScreen(const wxBitmap& bitmap,
451 long splashStyle, int milliseconds,
452 wxWindow* parent,
453 wxWindowID id = -1,
454 const wxPoint& pos = wxDefaultPosition,
455 const wxSize& size = wxDefaultSize,
456 long style = wxSIMPLE_BORDER | wxFRAME_NO_TASKBAR | wxSTAY_ON_TOP);
b5a5d647
RD
457
458 long GetSplashStyle() const;
459 wxSplashScreenWindow* GetSplashWindow() const;
460 int GetTimeout() const;
461};
462
463
464//---------------------------------------------------------------------------