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,
74 %typemap(in) (int widths, int* widths_field) {
75 $1 = PyList_Size($input);
76 $2 = int_LIST_helper($input);
77 if ($2 == NULL) SWIG_fail;
80 %typemap(freearg) (int widths, int* widths_field) {
85 //---------------------------------------------------------------------------
87 class wxTopLevelWindow : public wxWindow
91 // No constructor as it can not be used directly from Python
93 // maximize = True => maximize, otherwise - restore
94 virtual void Maximize(bool maximize = True);
96 // undo Maximize() or Iconize()
97 virtual void Restore();
99 // iconize = True => iconize, otherwise - restore
100 virtual void Iconize(bool iconize = True);
102 // return True if the frame is maximized
103 virtual bool IsMaximized() const;
105 // return True if the frame is iconized
106 virtual bool IsIconized() const;
108 // get the frame icon
109 wxIcon GetIcon() const;
111 // set the frame icon
112 virtual void SetIcon(const wxIcon& icon);
114 // set the frame icons
115 virtual void SetIcons(const wxIconBundle& icons );
117 // maximize the window to cover entire screen
118 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
120 // return True if the frame is in fullscreen mode
121 virtual bool IsFullScreen() const;
123 virtual void SetTitle(const wxString& title);
124 virtual wxString GetTitle() const;
126 // Set the shape of the window to the given region.
127 // Returns True if the platform supports this feature (and the operation
129 virtual bool SetShape(const wxRegion& region);
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() ""
155 wxFrame(wxWindow* parent, const wxWindowID id=-1,
156 const wxString& title = wxPyEmptyString,
157 const wxPoint& pos = wxDefaultPosition,
158 const wxSize& size = wxDefaultSize,
159 long style = wxDEFAULT_FRAME_STYLE,
160 const wxString& name = wxPyFrameNameStr);
161 %name(PreFrame)wxFrame();
163 bool Create(wxWindow* parent, const wxWindowID id=-1,
164 const wxString& title = wxPyEmptyString,
165 const wxPoint& pos = wxDefaultPosition,
166 const wxSize& size = wxDefaultSize,
167 long style = wxDEFAULT_FRAME_STYLE,
168 const wxString& name = wxPyFrameNameStr);
174 // get the origin of the client area (which may be different from (0, 0)
175 // if the frame has a toolbar) in client coordinates
176 virtual wxPoint GetClientAreaOrigin() const;
178 // sends a size event to the window using its current size -- this has an
179 // effect of refreshing the window layout
181 virtual void SendSizeEvent() { }
184 // menu bar functions
185 // ------------------
187 virtual void SetMenuBar(wxMenuBar *menubar);
188 virtual wxMenuBar *GetMenuBar() const;
191 // process menu command: returns True if processed
192 bool ProcessCommand(int winid);
193 %pythoncode { Command = ProcessCommand }
196 // status bar functions
197 // --------------------
199 // create the main status bar by calling OnCreateStatusBar()
200 virtual wxStatusBar* CreateStatusBar(int number = 1,
201 long style = wxDEFAULT_STATUSBAR_STYLE,
202 wxWindowID winid = 0,
203 const wxString& name = wxPyStatusLineNameStr);
204 // TODO: with directors?
205 // // return a new status bar
206 // virtual wxStatusBar *OnCreateStatusBar(int number,
209 // const wxString& name);
211 // get the main status bar
212 virtual wxStatusBar *GetStatusBar() const;
214 // sets the main status bar
215 void SetStatusBar(wxStatusBar *statBar);
217 // forward these to status bar
218 virtual void SetStatusText(const wxString &text, int number = 0);
219 virtual void SetStatusWidths(int widths, const int* widths_field); //uses typemap above
220 void PushStatusText(const wxString &text, int number = 0);
221 void PopStatusText(int number = 0);
223 // set the status bar pane the help will be shown in
224 void SetStatusBarPane(int n);
225 int GetStatusBarPane() const;
231 // create main toolbar bycalling OnCreateToolBar()
232 virtual wxToolBar* CreateToolBar(long style = -1,
233 wxWindowID winid = -1,
234 const wxString& name = wxPyToolBarNameStr);
235 // TODO: with directors?
236 // // return a new toolbar
237 // virtual wxToolBar *OnCreateToolBar(long style,
239 // const wxString& name );
241 // get/set the main toolbar
242 virtual wxToolBar *GetToolBar() const;
243 virtual void SetToolBar(wxToolBar *toolbar);
246 // show help text (typically in the statusbar); show is False
247 // if you are hiding the help, True otherwise
248 virtual void DoGiveHelp(const wxString& text, bool show);
251 // send wxUpdateUIEvents for all menu items in the menubar,
252 // or just for menu if non-NULL
253 void DoMenuUpdates(wxMenu* menu = NULL);
255 static wxVisualAttributes
256 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
259 //---------------------------------------------------------------------------
262 MustHaveApp(wxDialog);
264 class wxDialog : public wxTopLevelWindow {
266 %pythonAppend wxDialog "self._setOORInfo(self)"
267 %pythonAppend wxDialog() ""
269 wxDialog(wxWindow* parent,
270 const wxWindowID id=-1,
271 const wxString& title = wxPyEmptyString,
272 const wxPoint& pos = wxDefaultPosition,
273 const wxSize& size = wxDefaultSize,
274 long style = wxDEFAULT_DIALOG_STYLE,
275 const wxString& name = wxPyDialogNameStr);
276 %name(PreDialog)wxDialog();
278 bool Create(wxWindow* parent,
279 const wxWindowID id=-1,
280 const wxString& title = wxPyEmptyString,
281 const wxPoint& pos = wxDefaultPosition,
282 const wxSize& size = wxDefaultSize,
283 long style = wxDEFAULT_DIALOG_STYLE,
284 const wxString& name = wxPyDialogNameStr);
287 // the modal dialogs have a return code - usually the id of the last
289 void SetReturnCode(int returnCode) { m_returnCode = returnCode; }
290 int GetReturnCode() const { return m_returnCode; }
292 // splits text up at newlines and places the
293 // lines into a vertical wxBoxSizer
294 wxSizer *CreateTextSizer( const wxString &message );
296 // places buttons into a horizontal wxBoxSizer
297 wxSizer *CreateButtonSizer( long flags );
300 //void SetModal(bool flag);
302 // is the dialog in modal state right now?
303 virtual bool IsModal() const;
305 // Shows the dialog and starts a nested event loop that returns when
306 // EndModal is called.
307 virtual int ShowModal();
309 // may be called to terminate the dialog with the given return code
310 virtual void EndModal(int retCode);
312 static wxVisualAttributes
313 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
316 //---------------------------------------------------------------------------
320 MustHaveApp(wxMiniFrame);
322 class wxMiniFrame : public wxFrame {
324 %pythonAppend wxMiniFrame "self._setOORInfo(self)"
325 %pythonAppend wxMiniFrame() ""
327 wxMiniFrame(wxWindow* parent, const wxWindowID id=-1,
328 const wxString& title = wxPyEmptyString,
329 const wxPoint& pos = wxDefaultPosition,
330 const wxSize& size = wxDefaultSize,
331 long style = wxDEFAULT_FRAME_STYLE,
332 const wxString& name = wxPyFrameNameStr);
333 %name(PreMiniFrame)wxMiniFrame();
335 bool Create(wxWindow* parent, const wxWindowID id=-1,
336 const wxString& title = wxPyEmptyString,
337 const wxPoint& pos = wxDefaultPosition,
338 const wxSize& size = wxDefaultSize,
339 long style = wxDEFAULT_FRAME_STYLE,
340 const wxString& name = wxPyFrameNameStr);
345 //---------------------------------------------------------------------------
350 wxSPLASH_CENTRE_ON_PARENT,
351 wxSPLASH_CENTRE_ON_SCREEN,
358 MustHaveApp(wxSplashScreenWindow);
360 class wxSplashScreenWindow: public wxWindow
363 %pythonAppend wxSplashScreenWindow "self._setOORInfo(self)"
365 wxSplashScreenWindow(const wxBitmap& bitmap,
366 wxWindow* parent, wxWindowID id,
367 const wxPoint& pos = wxDefaultPosition,
368 const wxSize& size = wxDefaultSize,
369 long style = wxNO_BORDER);
371 void SetBitmap(const wxBitmap& bitmap);
372 wxBitmap& GetBitmap();
376 MustHaveApp(wxSplashScreen);
378 class wxSplashScreen : public wxFrame {
380 %pythonAppend wxSplashScreen "self._setOORInfo(self)"
382 wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds,
383 wxWindow* parent, wxWindowID id=-1,
384 const wxPoint& pos = wxDefaultPosition,
385 const wxSize& size = wxDefaultSize,
386 long style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP);
388 long GetSplashStyle() const;
389 wxSplashScreenWindow* GetSplashWindow() const;
390 int GetTimeout() const;
394 //---------------------------------------------------------------------------