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