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 class wxFrame : public wxTopLevelWindow {
150 %pythonAppend wxFrame "self._setOORInfo(self)"
151 %pythonAppend wxFrame() ""
153 wxFrame(wxWindow* parent, const wxWindowID id, const wxString& title,
154 const wxPoint& pos = wxDefaultPosition,
155 const wxSize& size = wxDefaultSize,
156 long style = wxDEFAULT_FRAME_STYLE,
157 const wxString& name = wxPyFrameNameStr);
158 %name(PreFrame)wxFrame();
160 bool Create(wxWindow* parent, const wxWindowID id, const wxString& title,
161 const wxPoint& pos = wxDefaultPosition,
162 const wxSize& size = wxDefaultSize,
163 long style = wxDEFAULT_FRAME_STYLE,
164 const wxString& name = wxPyFrameNameStr);
170 // get the origin of the client area (which may be different from (0, 0)
171 // if the frame has a toolbar) in client coordinates
172 virtual wxPoint GetClientAreaOrigin() const;
174 // sends a size event to the window using its current size -- this has an
175 // effect of refreshing the window layout
177 virtual void SendSizeEvent() { }
180 // menu bar functions
181 // ------------------
183 virtual void SetMenuBar(wxMenuBar *menubar);
184 virtual wxMenuBar *GetMenuBar() const;
187 // process menu command: returns True if processed
188 bool ProcessCommand(int winid);
189 %pythoncode { Command = ProcessCommand }
192 // status bar functions
193 // --------------------
195 // create the main status bar by calling OnCreateStatusBar()
196 virtual wxStatusBar* CreateStatusBar(int number = 1,
197 long style = wxDEFAULT_STATUSBAR_STYLE,
198 wxWindowID winid = 0,
199 const wxString& name = wxPyStatusLineNameStr);
200 // TODO: with directors?
201 // // return a new status bar
202 // virtual wxStatusBar *OnCreateStatusBar(int number,
205 // const wxString& name);
207 // get the main status bar
208 virtual wxStatusBar *GetStatusBar() const;
210 // sets the main status bar
211 void SetStatusBar(wxStatusBar *statBar);
213 // forward these to status bar
214 virtual void SetStatusText(const wxString &text, int number = 0);
215 virtual void SetStatusWidths(int widths, const int* widths_field); //uses typemap above
216 void PushStatusText(const wxString &text, int number = 0);
217 void PopStatusText(int number = 0);
219 // set the status bar pane the help will be shown in
220 void SetStatusBarPane(int n);
221 int GetStatusBarPane() const;
227 // create main toolbar bycalling OnCreateToolBar()
228 virtual wxToolBar* CreateToolBar(long style = -1,
229 wxWindowID winid = -1,
230 const wxString& name = wxPyToolBarNameStr);
231 // TODO: with directors?
232 // // return a new toolbar
233 // virtual wxToolBar *OnCreateToolBar(long style,
235 // const wxString& name );
237 // get/set the main toolbar
238 virtual wxToolBar *GetToolBar() const;
239 virtual void SetToolBar(wxToolBar *toolbar);
242 // show help text (typically in the statusbar); show is False
243 // if you are hiding the help, True otherwise
244 virtual void DoGiveHelp(const wxString& text, bool show);
247 // send wxUpdateUIEvents for all menu items in the menubar,
248 // or just for menu if non-NULL
249 void DoMenuUpdates(wxMenu* menu = NULL);
251 static wxVisualAttributes
252 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
255 //---------------------------------------------------------------------------
258 class wxDialog : public wxTopLevelWindow {
260 %pythonAppend wxDialog "self._setOORInfo(self)"
261 %pythonAppend wxDialog() ""
263 wxDialog(wxWindow* parent,
265 const wxString& title,
266 const wxPoint& pos = wxDefaultPosition,
267 const wxSize& size = wxDefaultSize,
268 long style = wxDEFAULT_DIALOG_STYLE,
269 const wxString& name = wxPyDialogNameStr);
270 %name(PreDialog)wxDialog();
272 bool Create(wxWindow* parent,
274 const wxString& title,
275 const wxPoint& pos = wxDefaultPosition,
276 const wxSize& size = wxDefaultSize,
277 long style = wxDEFAULT_DIALOG_STYLE,
278 const wxString& name = wxPyDialogNameStr);
281 // the modal dialogs have a return code - usually the id of the last
283 void SetReturnCode(int returnCode) { m_returnCode = returnCode; }
284 int GetReturnCode() const { return m_returnCode; }
286 // splits text up at newlines and places the
287 // lines into a vertical wxBoxSizer
288 wxSizer *CreateTextSizer( const wxString &message );
290 // places buttons into a horizontal wxBoxSizer
291 wxSizer *CreateButtonSizer( long flags );
294 //void SetModal(bool flag);
296 // is the dialog in modal state right now?
297 virtual bool IsModal() const;
299 // Shows the dialog and starts a nested event loop that returns when
300 // EndModal is called.
301 virtual int ShowModal();
303 // may be called to terminate the dialog with the given return code
304 virtual void EndModal(int retCode);
306 static wxVisualAttributes
307 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
310 //---------------------------------------------------------------------------
314 class wxMiniFrame : public wxFrame {
316 %pythonAppend wxMiniFrame "self._setOORInfo(self)"
317 %pythonAppend wxMiniFrame() ""
319 wxMiniFrame(wxWindow* parent, const wxWindowID id, const wxString& title,
320 const wxPoint& pos = wxDefaultPosition,
321 const wxSize& size = wxDefaultSize,
322 long style = wxDEFAULT_FRAME_STYLE,
323 const wxString& name = wxPyFrameNameStr);
324 %name(PreMiniFrame)wxMiniFrame();
326 bool Create(wxWindow* parent, const wxWindowID id, const wxString& title,
327 const wxPoint& pos = wxDefaultPosition,
328 const wxSize& size = wxDefaultSize,
329 long style = wxDEFAULT_FRAME_STYLE,
330 const wxString& name = wxPyFrameNameStr);
335 //---------------------------------------------------------------------------
340 wxSPLASH_CENTRE_ON_PARENT,
341 wxSPLASH_CENTRE_ON_SCREEN,
348 class wxSplashScreenWindow: public wxWindow
351 %pythonAppend wxSplashScreenWindow "self._setOORInfo(self)"
353 wxSplashScreenWindow(const wxBitmap& bitmap,
354 wxWindow* parent, wxWindowID id,
355 const wxPoint& pos = wxDefaultPosition,
356 const wxSize& size = wxDefaultSize,
357 long style = wxNO_BORDER);
359 void SetBitmap(const wxBitmap& bitmap);
360 wxBitmap& GetBitmap();
364 class wxSplashScreen : public wxFrame {
366 %pythonAppend wxSplashScreen "self._setOORInfo(self)"
368 wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds,
369 wxWindow* parent, wxWindowID id,
370 const wxPoint& pos = wxDefaultPosition,
371 const wxSize& size = wxDefaultSize,
372 long style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP);
374 long GetSplashStyle() const;
375 wxSplashScreenWindow* GetSplashWindow() const;
376 int GetTimeout() const;
380 //---------------------------------------------------------------------------