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