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