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, const wxString& title,
156 const wxPoint& pos = wxDefaultPosition,
157 const wxSize& size = wxDefaultSize,
158 long style = wxDEFAULT_FRAME_STYLE,
159 const wxString& name = wxPyFrameNameStr);
160 %name(PreFrame)wxFrame();
162 bool Create(wxWindow* parent, const wxWindowID id, const wxString& title,
163 const wxPoint& pos = wxDefaultPosition,
164 const wxSize& size = wxDefaultSize,
165 long style = wxDEFAULT_FRAME_STYLE,
166 const wxString& name = wxPyFrameNameStr);
172 // get the origin of the client area (which may be different from (0, 0)
173 // if the frame has a toolbar) in client coordinates
174 virtual wxPoint GetClientAreaOrigin() const;
176 // sends a size event to the window using its current size -- this has an
177 // effect of refreshing the window layout
179 virtual void SendSizeEvent() { }
182 // menu bar functions
183 // ------------------
185 virtual void SetMenuBar(wxMenuBar *menubar);
186 virtual wxMenuBar *GetMenuBar() const;
189 // process menu command: returns True if processed
190 bool ProcessCommand(int winid);
191 %pythoncode { Command = ProcessCommand }
194 // status bar functions
195 // --------------------
197 // create the main status bar by calling OnCreateStatusBar()
198 virtual wxStatusBar* CreateStatusBar(int number = 1,
199 long style = wxDEFAULT_STATUSBAR_STYLE,
200 wxWindowID winid = 0,
201 const wxString& name = wxPyStatusLineNameStr);
202 // TODO: with directors?
203 // // return a new status bar
204 // virtual wxStatusBar *OnCreateStatusBar(int number,
207 // const wxString& name);
209 // get the main status bar
210 virtual wxStatusBar *GetStatusBar() const;
212 // sets the main status bar
213 void SetStatusBar(wxStatusBar *statBar);
215 // forward these to status bar
216 virtual void SetStatusText(const wxString &text, int number = 0);
217 virtual void SetStatusWidths(int widths, const int* widths_field); //uses typemap above
218 void PushStatusText(const wxString &text, int number = 0);
219 void PopStatusText(int number = 0);
221 // set the status bar pane the help will be shown in
222 void SetStatusBarPane(int n);
223 int GetStatusBarPane() const;
229 // create main toolbar bycalling OnCreateToolBar()
230 virtual wxToolBar* CreateToolBar(long style = -1,
231 wxWindowID winid = -1,
232 const wxString& name = wxPyToolBarNameStr);
233 // TODO: with directors?
234 // // return a new toolbar
235 // virtual wxToolBar *OnCreateToolBar(long style,
237 // const wxString& name );
239 // get/set the main toolbar
240 virtual wxToolBar *GetToolBar() const;
241 virtual void SetToolBar(wxToolBar *toolbar);
244 // show help text (typically in the statusbar); show is False
245 // if you are hiding the help, True otherwise
246 virtual void DoGiveHelp(const wxString& text, bool show);
249 // send wxUpdateUIEvents for all menu items in the menubar,
250 // or just for menu if non-NULL
251 void DoMenuUpdates(wxMenu* menu = NULL);
253 static wxVisualAttributes
254 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
257 //---------------------------------------------------------------------------
260 MustHaveApp(wxDialog);
262 class wxDialog : public wxTopLevelWindow {
264 %pythonAppend wxDialog "self._setOORInfo(self)"
265 %pythonAppend wxDialog() ""
267 wxDialog(wxWindow* parent,
269 const wxString& title,
270 const wxPoint& pos = wxDefaultPosition,
271 const wxSize& size = wxDefaultSize,
272 long style = wxDEFAULT_DIALOG_STYLE,
273 const wxString& name = wxPyDialogNameStr);
274 %name(PreDialog)wxDialog();
276 bool Create(wxWindow* parent,
278 const wxString& title,
279 const wxPoint& pos = wxDefaultPosition,
280 const wxSize& size = wxDefaultSize,
281 long style = wxDEFAULT_DIALOG_STYLE,
282 const wxString& name = wxPyDialogNameStr);
285 // the modal dialogs have a return code - usually the id of the last
287 void SetReturnCode(int returnCode) { m_returnCode = returnCode; }
288 int GetReturnCode() const { return m_returnCode; }
290 // splits text up at newlines and places the
291 // lines into a vertical wxBoxSizer
292 wxSizer *CreateTextSizer( const wxString &message );
294 // places buttons into a horizontal wxBoxSizer
295 wxSizer *CreateButtonSizer( long flags );
298 //void SetModal(bool flag);
300 // is the dialog in modal state right now?
301 virtual bool IsModal() const;
303 // Shows the dialog and starts a nested event loop that returns when
304 // EndModal is called.
305 virtual int ShowModal();
307 // may be called to terminate the dialog with the given return code
308 virtual void EndModal(int retCode);
310 static wxVisualAttributes
311 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
314 //---------------------------------------------------------------------------
318 MustHaveApp(wxMiniFrame);
320 class wxMiniFrame : public wxFrame {
322 %pythonAppend wxMiniFrame "self._setOORInfo(self)"
323 %pythonAppend wxMiniFrame() ""
325 wxMiniFrame(wxWindow* parent, const wxWindowID id, const wxString& title,
326 const wxPoint& pos = wxDefaultPosition,
327 const wxSize& size = wxDefaultSize,
328 long style = wxDEFAULT_FRAME_STYLE,
329 const wxString& name = wxPyFrameNameStr);
330 %name(PreMiniFrame)wxMiniFrame();
332 bool Create(wxWindow* parent, const wxWindowID id, const wxString& title,
333 const wxPoint& pos = wxDefaultPosition,
334 const wxSize& size = wxDefaultSize,
335 long style = wxDEFAULT_FRAME_STYLE,
336 const wxString& name = wxPyFrameNameStr);
341 //---------------------------------------------------------------------------
346 wxSPLASH_CENTRE_ON_PARENT,
347 wxSPLASH_CENTRE_ON_SCREEN,
354 MustHaveApp(wxSplashScreenWindow);
356 class wxSplashScreenWindow: public wxWindow
359 %pythonAppend wxSplashScreenWindow "self._setOORInfo(self)"
361 wxSplashScreenWindow(const wxBitmap& bitmap,
362 wxWindow* parent, wxWindowID id,
363 const wxPoint& pos = wxDefaultPosition,
364 const wxSize& size = wxDefaultSize,
365 long style = wxNO_BORDER);
367 void SetBitmap(const wxBitmap& bitmap);
368 wxBitmap& GetBitmap();
372 MustHaveApp(wxSplashScreen);
374 class wxSplashScreen : public wxFrame {
376 %pythonAppend wxSplashScreen "self._setOORInfo(self)"
378 wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds,
379 wxWindow* parent, wxWindowID id,
380 const wxPoint& pos = wxDefaultPosition,
381 const wxSize& size = wxDefaultSize,
382 long style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP);
384 long GetSplashStyle() const;
385 wxSplashScreenWindow* GetSplashWindow() const;
386 int GetTimeout() const;
390 //---------------------------------------------------------------------------