1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG definitions for wxTopLevelWindow, wxFrame, wxDialog and etc.
7 // Created: 27-Aug-1998
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
16 //---------------------------------------------------------------------------
18 MAKE_CONST_WXSTRING(FrameNameStr);
19 MAKE_CONST_WXSTRING(DialogNameStr);
20 MAKE_CONST_WXSTRING(StatusLineNameStr);
21 MAKE_CONST_WXSTRING(ToolBarNameStr);
23 //---------------------------------------------------------------------------
44 wxDEFAULT_FRAME_STYLE,
45 wxDEFAULT_DIALOG_STYLE,
48 wxFRAME_FLOAT_ON_PARENT,
49 wxFRAME_NO_WINDOW_MENU,
63 wxFULLSCREEN_NOMENUBAR,
64 wxFULLSCREEN_NOTOOLBAR,
65 wxFULLSCREEN_NOSTATUSBAR,
66 wxFULLSCREEN_NOBORDER,
67 wxFULLSCREEN_NOCAPTION,
73 // Styles for RequestUserAttention
76 wxUSER_ATTENTION_INFO = 1,
77 wxUSER_ATTENTION_ERROR = 2
80 //---------------------------------------------------------------------------
82 class wxTopLevelWindow : public wxWindow
86 // No constructor as it can not be used directly from Python
88 // maximize = True => maximize, otherwise - restore
89 virtual void Maximize(bool maximize = true);
91 // undo Maximize() or Iconize()
92 virtual void Restore();
94 // iconize = True => iconize, otherwise - restore
95 virtual void Iconize(bool iconize = true);
97 // return True if the frame is maximized
98 virtual bool IsMaximized() const;
100 // return True if the frame is iconized
101 virtual bool IsIconized() const;
103 // get the frame icon
104 wxIcon GetIcon() const;
106 // set the frame icon
107 virtual void SetIcon(const wxIcon& icon);
109 // set the frame icons
110 virtual void SetIcons(const wxIconBundle& icons );
112 // maximize the window to cover entire screen
113 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
115 // return True if the frame is in fullscreen mode
116 virtual bool IsFullScreen() const;
118 virtual void SetTitle(const wxString& title);
119 virtual wxString GetTitle() const;
121 // Set the shape of the window to the given region.
122 // Returns True if the platform supports this feature (and the operation
124 virtual bool SetShape(const wxRegion& region);
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);
131 // Is this the active frame (highlighted in the taskbar)?
132 virtual bool IsActive();
135 void MacSetMetalAppearance( bool on ) ;
136 bool MacGetMetalAppearance() const ;
139 // TODO: Should they raise not implemented or just NOP???
140 void MacSetMetalAppearance( bool on ) { /*wxPyRaiseNotImplemented();*/ }
141 bool MacGetMetalAppearance() const { /*wxPyRaiseNotImplemented();*/ return false; }
147 //---------------------------------------------------------------------------
150 // wxFrame is a top-level window with optional menubar, statusbar and toolbar
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
157 MustHaveApp(wxFrame);
159 class wxFrame : public wxTopLevelWindow {
161 %pythonAppend wxFrame "self._setOORInfo(self)"
162 %pythonAppend wxFrame() ""
163 %typemap(out) wxFrame*; // turn off this typemap
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();
173 // Turn it back on again
174 %typemap(out) wxFrame* { $result = wxPyMake_wxObject($1, $owner); }
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);
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;
192 // sends a size event to the window using its current size -- this has an
193 // effect of refreshing the window layout
195 virtual void SendSizeEvent();
198 // menu bar functions
199 // ------------------
201 virtual void SetMenuBar(wxMenuBar *menubar);
202 virtual wxMenuBar *GetMenuBar() const;
205 // process menu command: returns True if processed
206 bool ProcessCommand(int winid);
207 %pythoncode { Command = ProcessCommand }
210 // status bar functions
211 // --------------------
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,
223 // const wxString& name);
225 // get the main status bar
226 virtual wxStatusBar *GetStatusBar() const;
228 // sets the main status bar
229 void SetStatusBar(wxStatusBar *statBar);
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);
237 // set the status bar pane the help will be shown in
238 void SetStatusBarPane(int n);
239 int GetStatusBarPane() const;
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,
253 // const wxString& name );
255 // get/set the main toolbar
256 virtual wxToolBar *GetToolBar() const;
257 virtual void SetToolBar(wxToolBar *toolbar);
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);
265 // send wxUpdateUIEvents for all menu items in the menubar,
266 // or just for menu if non-NULL
267 void DoMenuUpdates(wxMenu* menu = NULL);
269 static wxVisualAttributes
270 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
273 //---------------------------------------------------------------------------
276 MustHaveApp(wxDialog);
278 class wxDialog : public wxTopLevelWindow {
280 %pythonAppend wxDialog "self._setOORInfo(self)"
281 %pythonAppend wxDialog() ""
282 %typemap(out) wxDialog*; // turn off this typemap
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();
293 // Turn it back on again
294 %typemap(out) wxDialog* { $result = wxPyMake_wxObject($1, $owner); }
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);
305 // the modal dialogs have a return code - usually the id of the last
307 void SetReturnCode(int returnCode);
308 int GetReturnCode() const;
310 // splits text up at newlines and places the
311 // lines into a vertical wxBoxSizer
312 wxSizer *CreateTextSizer( const wxString &message );
314 // places buttons into a horizontal wxBoxSizer
315 wxSizer *CreateButtonSizer( long flags );
318 //void SetModal(bool flag);
320 // is the dialog in modal state right now?
321 virtual bool IsModal() const;
323 // Shows the dialog and starts a nested event loop that returns when
324 // EndModal is called.
325 virtual int ShowModal();
327 // may be called to terminate the dialog with the given return code
328 virtual void EndModal(int retCode);
330 static wxVisualAttributes
331 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
334 def SendSizeEvent(self):
335 self.ProcessEvent(wx.SizeEvent((-1,-1)))
339 //---------------------------------------------------------------------------
343 MustHaveApp(wxMiniFrame);
345 class wxMiniFrame : public wxFrame {
347 %pythonAppend wxMiniFrame "self._setOORInfo(self)"
348 %pythonAppend wxMiniFrame() ""
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();
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);
368 //---------------------------------------------------------------------------
373 wxSPLASH_CENTRE_ON_PARENT,
374 wxSPLASH_CENTRE_ON_SCREEN,
381 MustHaveApp(wxSplashScreenWindow);
383 class wxSplashScreenWindow: public wxWindow
386 %pythonAppend wxSplashScreenWindow "self._setOORInfo(self)"
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);
394 void SetBitmap(const wxBitmap& bitmap);
395 wxBitmap& GetBitmap();
399 MustHaveApp(wxSplashScreen);
401 class wxSplashScreen : public wxFrame {
403 %pythonAppend wxSplashScreen "self._setOORInfo(self)"
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);
411 long GetSplashStyle() const;
412 wxSplashScreenWindow* GetSplashWindow() const;
413 int GetTimeout() const;
417 //---------------------------------------------------------------------------