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,
62 wxFULLSCREEN_NOMENUBAR,
63 wxFULLSCREEN_NOTOOLBAR,
64 wxFULLSCREEN_NOSTATUSBAR,
65 wxFULLSCREEN_NOBORDER,
66 wxFULLSCREEN_NOCAPTION,
72 // Styles for RequestUserAttention
75 wxUSER_ATTENTION_INFO = 1,
76 wxUSER_ATTENTION_ERROR = 2
79 //---------------------------------------------------------------------------
81 class wxTopLevelWindow : public wxWindow
85 // No constructor as it can not be used directly from Python
87 // maximize = True => maximize, otherwise - restore
88 virtual void Maximize(bool maximize = True);
90 // undo Maximize() or Iconize()
91 virtual void Restore();
93 // iconize = True => iconize, otherwise - restore
94 virtual void Iconize(bool iconize = True);
96 // return True if the frame is maximized
97 virtual bool IsMaximized() const;
99 // return True if the frame is iconized
100 virtual bool IsIconized() const;
102 // get the frame icon
103 wxIcon GetIcon() const;
105 // set the frame icon
106 virtual void SetIcon(const wxIcon& icon);
108 // set the frame icons
109 virtual void SetIcons(const wxIconBundle& icons );
111 // maximize the window to cover entire screen
112 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
114 // return True if the frame is in fullscreen mode
115 virtual bool IsFullScreen() const;
117 virtual void SetTitle(const wxString& title);
118 virtual wxString GetTitle() const;
120 // Set the shape of the window to the given region.
121 // Returns True if the platform supports this feature (and the operation
123 virtual bool SetShape(const wxRegion& region);
126 // Attracts the users attention to this window if the application is
127 // inactive (should be called when a background event occurs)
128 virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO);
132 void MacSetMetalAppearance( bool on ) ;
133 bool MacGetMetalAppearance() const ;
138 //---------------------------------------------------------------------------
141 // wxFrame is a top-level window with optional menubar, statusbar and toolbar
143 // For each of *bars, a frame may have several of them, but only one is
144 // managed by the frame, i.e. resized/moved when the frame is and whose size
145 // is accounted for in client size calculations - all others should be taken
148 MustHaveApp(wxFrame);
150 class wxFrame : public wxTopLevelWindow {
152 %pythonAppend wxFrame "self._setOORInfo(self)"
153 %pythonAppend wxFrame() ""
154 %typemap(out) wxFrame*; // turn off this typemap
156 wxFrame(wxWindow* parent, const wxWindowID id=-1,
157 const wxString& title = wxPyEmptyString,
158 const wxPoint& pos = wxDefaultPosition,
159 const wxSize& size = wxDefaultSize,
160 long style = wxDEFAULT_FRAME_STYLE,
161 const wxString& name = wxPyFrameNameStr);
162 %name(PreFrame)wxFrame();
164 // Turn it back on again
165 %typemap(out) wxFrame* { $result = wxPyMake_wxObject($1, $owner); }
168 bool Create(wxWindow* parent, const wxWindowID id=-1,
169 const wxString& title = wxPyEmptyString,
170 const wxPoint& pos = wxDefaultPosition,
171 const wxSize& size = wxDefaultSize,
172 long style = wxDEFAULT_FRAME_STYLE,
173 const wxString& name = wxPyFrameNameStr);
179 // get the origin of the client area (which may be different from (0, 0)
180 // if the frame has a toolbar) in client coordinates
181 virtual wxPoint GetClientAreaOrigin() const;
183 // sends a size event to the window using its current size -- this has an
184 // effect of refreshing the window layout
186 virtual void SendSizeEvent();
189 // menu bar functions
190 // ------------------
192 virtual void SetMenuBar(wxMenuBar *menubar);
193 virtual wxMenuBar *GetMenuBar() const;
196 // process menu command: returns True if processed
197 bool ProcessCommand(int winid);
198 %pythoncode { Command = ProcessCommand }
201 // status bar functions
202 // --------------------
204 // create the main status bar by calling OnCreateStatusBar()
205 virtual wxStatusBar* CreateStatusBar(int number = 1,
206 long style = wxDEFAULT_STATUSBAR_STYLE,
207 wxWindowID winid = 0,
208 const wxString& name = wxPyStatusLineNameStr);
209 // TODO: with directors?
210 // // return a new status bar
211 // virtual wxStatusBar *OnCreateStatusBar(int number,
214 // const wxString& name);
216 // get the main status bar
217 virtual wxStatusBar *GetStatusBar() const;
219 // sets the main status bar
220 void SetStatusBar(wxStatusBar *statBar);
222 // forward these to status bar
223 virtual void SetStatusText(const wxString &text, int number = 0);
224 virtual void SetStatusWidths(int widths, const int* widths_field); //uses typemap above
225 void PushStatusText(const wxString &text, int number = 0);
226 void PopStatusText(int number = 0);
228 // set the status bar pane the help will be shown in
229 void SetStatusBarPane(int n);
230 int GetStatusBarPane() const;
236 // create main toolbar bycalling OnCreateToolBar()
237 virtual wxToolBar* CreateToolBar(long style = -1,
238 wxWindowID winid = -1,
239 const wxString& name = wxPyToolBarNameStr);
240 // TODO: with directors?
241 // // return a new toolbar
242 // virtual wxToolBar *OnCreateToolBar(long style,
244 // const wxString& name );
246 // get/set the main toolbar
247 virtual wxToolBar *GetToolBar() const;
248 virtual void SetToolBar(wxToolBar *toolbar);
251 // show help text (typically in the statusbar); show is False
252 // if you are hiding the help, True otherwise
253 virtual void DoGiveHelp(const wxString& text, bool show);
256 // send wxUpdateUIEvents for all menu items in the menubar,
257 // or just for menu if non-NULL
258 void DoMenuUpdates(wxMenu* menu = NULL);
260 static wxVisualAttributes
261 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
264 //---------------------------------------------------------------------------
267 MustHaveApp(wxDialog);
269 class wxDialog : public wxTopLevelWindow {
271 %pythonAppend wxDialog "self._setOORInfo(self)"
272 %pythonAppend wxDialog() ""
273 %typemap(out) wxDialog*; // turn off this typemap
275 wxDialog(wxWindow* parent,
276 const wxWindowID id=-1,
277 const wxString& title = wxPyEmptyString,
278 const wxPoint& pos = wxDefaultPosition,
279 const wxSize& size = wxDefaultSize,
280 long style = wxDEFAULT_DIALOG_STYLE,
281 const wxString& name = wxPyDialogNameStr);
282 %name(PreDialog)wxDialog();
284 // Turn it back on again
285 %typemap(out) wxDialog* { $result = wxPyMake_wxObject($1, $owner); }
287 bool Create(wxWindow* parent,
288 const wxWindowID id=-1,
289 const wxString& title = wxPyEmptyString,
290 const wxPoint& pos = wxDefaultPosition,
291 const wxSize& size = wxDefaultSize,
292 long style = wxDEFAULT_DIALOG_STYLE,
293 const wxString& name = wxPyDialogNameStr);
296 // the modal dialogs have a return code - usually the id of the last
298 void SetReturnCode(int returnCode);
299 int GetReturnCode() const;
301 // splits text up at newlines and places the
302 // lines into a vertical wxBoxSizer
303 wxSizer *CreateTextSizer( const wxString &message );
305 // places buttons into a horizontal wxBoxSizer
306 wxSizer *CreateButtonSizer( long flags );
309 //void SetModal(bool flag);
311 // is the dialog in modal state right now?
312 virtual bool IsModal() const;
314 // Shows the dialog and starts a nested event loop that returns when
315 // EndModal is called.
316 virtual int ShowModal();
318 // may be called to terminate the dialog with the given return code
319 virtual void EndModal(int retCode);
321 static wxVisualAttributes
322 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
325 def SendSizeEvent(self):
326 self.ProcessEvent(wx.SizeEvent((-1,-1)))
330 //---------------------------------------------------------------------------
334 MustHaveApp(wxMiniFrame);
336 class wxMiniFrame : public wxFrame {
338 %pythonAppend wxMiniFrame "self._setOORInfo(self)"
339 %pythonAppend wxMiniFrame() ""
341 wxMiniFrame(wxWindow* parent, const wxWindowID id=-1,
342 const wxString& title = wxPyEmptyString,
343 const wxPoint& pos = wxDefaultPosition,
344 const wxSize& size = wxDefaultSize,
345 long style = wxDEFAULT_FRAME_STYLE,
346 const wxString& name = wxPyFrameNameStr);
347 %name(PreMiniFrame)wxMiniFrame();
349 bool Create(wxWindow* parent, const wxWindowID id=-1,
350 const wxString& title = wxPyEmptyString,
351 const wxPoint& pos = wxDefaultPosition,
352 const wxSize& size = wxDefaultSize,
353 long style = wxDEFAULT_FRAME_STYLE,
354 const wxString& name = wxPyFrameNameStr);
359 //---------------------------------------------------------------------------
364 wxSPLASH_CENTRE_ON_PARENT,
365 wxSPLASH_CENTRE_ON_SCREEN,
372 MustHaveApp(wxSplashScreenWindow);
374 class wxSplashScreenWindow: public wxWindow
377 %pythonAppend wxSplashScreenWindow "self._setOORInfo(self)"
379 wxSplashScreenWindow(const wxBitmap& bitmap,
380 wxWindow* parent, wxWindowID id,
381 const wxPoint& pos = wxDefaultPosition,
382 const wxSize& size = wxDefaultSize,
383 long style = wxNO_BORDER);
385 void SetBitmap(const wxBitmap& bitmap);
386 wxBitmap& GetBitmap();
390 MustHaveApp(wxSplashScreen);
392 class wxSplashScreen : public wxFrame {
394 %pythonAppend wxSplashScreen "self._setOORInfo(self)"
396 wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds,
397 wxWindow* parent, wxWindowID id=-1,
398 const wxPoint& pos = wxDefaultPosition,
399 const wxSize& size = wxDefaultSize,
400 long style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP);
402 long GetSplashStyle() const;
403 wxSplashScreenWindow* GetSplashWindow() const;
404 int GetTimeout() const;
408 //---------------------------------------------------------------------------