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 //---------------------------------------------------------------------------
28 wxFULLSCREEN_NOMENUBAR,
29 wxFULLSCREEN_NOTOOLBAR,
30 wxFULLSCREEN_NOSTATUSBAR,
31 wxFULLSCREEN_NOBORDER,
32 wxFULLSCREEN_NOCAPTION,
40 %typemap(in) (int widths, int* widths_field) {
41 $1 = PyList_Size($input);
42 $2 = int_LIST_helper($input);
43 if ($2 == NULL) SWIG_fail;
46 %typemap(freearg) (int widths, int* widths_field) {
51 //---------------------------------------------------------------------------
53 class wxTopLevelWindow : public wxWindow
57 // No constructor as it can not be used directly from Python
59 // maximize = True => maximize, otherwise - restore
60 virtual void Maximize(bool maximize = True);
62 // undo Maximize() or Iconize()
63 virtual void Restore();
65 // iconize = True => iconize, otherwise - restore
66 virtual void Iconize(bool iconize = True);
68 // return True if the frame is maximized
69 virtual bool IsMaximized() const;
71 // return True if the frame is iconized
72 virtual bool IsIconized() const;
75 wxIcon GetIcon() const;
78 virtual void SetIcon(const wxIcon& icon);
80 // set the frame icons
81 virtual void SetIcons(const wxIconBundle& icons );
83 // maximize the window to cover entire screen
84 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
86 // return True if the frame is in fullscreen mode
87 virtual bool IsFullScreen() const;
89 virtual void SetTitle(const wxString& title);
90 virtual wxString GetTitle() const;
92 // Set the shape of the window to the given region.
93 // Returns True if the platform supports this feature (and the operation
95 virtual bool SetShape(const wxRegion& region);
100 //---------------------------------------------------------------------------
103 // wxFrame is a top-level window with optional menubar, statusbar and toolbar
105 // For each of *bars, a frame may have several of them, but only one is
106 // managed by the frame, i.e. resized/moved when the frame is and whose size
107 // is accounted for in client size calculations - all others should be taken
110 class wxFrame : public wxTopLevelWindow {
112 %pythonAppend wxFrame "self._setOORInfo(self)"
113 %pythonAppend wxFrame() ""
115 wxFrame(wxWindow* parent, const wxWindowID id, const wxString& title,
116 const wxPoint& pos = wxDefaultPosition,
117 const wxSize& size = wxDefaultSize,
118 long style = wxDEFAULT_FRAME_STYLE,
119 const wxString& name = wxPyFrameNameStr);
120 %name(PreFrame)wxFrame();
122 bool Create(wxWindow* parent, const wxWindowID id, const wxString& title,
123 const wxPoint& pos = wxDefaultPosition,
124 const wxSize& size = wxDefaultSize,
125 long style = wxDEFAULT_FRAME_STYLE,
126 const wxString& name = wxPyFrameNameStr);
132 // get the origin of the client area (which may be different from (0, 0)
133 // if the frame has a toolbar) in client coordinates
134 virtual wxPoint GetClientAreaOrigin() const;
136 // sends a size event to the window using its current size -- this has an
137 // effect of refreshing the window layout
139 virtual void SendSizeEvent() { }
142 // menu bar functions
143 // ------------------
145 virtual void SetMenuBar(wxMenuBar *menubar);
146 virtual wxMenuBar *GetMenuBar() const;
149 // process menu command: returns True if processed
150 bool ProcessCommand(int winid);
151 %pythoncode { Command = ProcessCommand }
154 // status bar functions
155 // --------------------
157 // create the main status bar by calling OnCreateStatusBar()
158 virtual wxStatusBar* CreateStatusBar(int number = 1,
159 long style = wxDEFAULT_STATUSBAR_STYLE,
160 wxWindowID winid = 0,
161 const wxString& name = wxPyStatusLineNameStr);
162 // TODO: with directors?
163 // // return a new status bar
164 // virtual wxStatusBar *OnCreateStatusBar(int number,
167 // const wxString& name);
169 // get the main status bar
170 virtual wxStatusBar *GetStatusBar() const;
172 // sets the main status bar
173 void SetStatusBar(wxStatusBar *statBar);
175 // forward these to status bar
176 virtual void SetStatusText(const wxString &text, int number = 0);
177 virtual void SetStatusWidths(int widths, const int* widths_field); //uses typemap above
178 void PushStatusText(const wxString &text, int number = 0);
179 void PopStatusText(int number = 0);
181 // set the status bar pane the help will be shown in
182 void SetStatusBarPane(int n);
183 int GetStatusBarPane() const;
189 // create main toolbar bycalling OnCreateToolBar()
190 virtual wxToolBar* CreateToolBar(long style = -1,
191 wxWindowID winid = -1,
192 const wxString& name = wxPyToolBarNameStr);
193 // TODO: with directors?
194 // // return a new toolbar
195 // virtual wxToolBar *OnCreateToolBar(long style,
197 // const wxString& name );
199 // get/set the main toolbar
200 virtual wxToolBar *GetToolBar() const;
201 virtual void SetToolBar(wxToolBar *toolbar);
204 // show help text (typically in the statusbar); show is False
205 // if you are hiding the help, True otherwise
206 virtual void DoGiveHelp(const wxString& text, bool show);
209 // send wxUpdateUIEvents for all menu items in the menubar,
210 // or just for menu if non-NULL
211 void DoMenuUpdates(wxMenu* menu = NULL);
214 //---------------------------------------------------------------------------
217 class wxDialog : public wxTopLevelWindow {
219 %pythonAppend wxDialog "self._setOORInfo(self)"
220 %pythonAppend wxDialog() ""
222 wxDialog(wxWindow* parent,
224 const wxString& title,
225 const wxPoint& pos = wxDefaultPosition,
226 const wxSize& size = wxDefaultSize,
227 long style = wxDEFAULT_DIALOG_STYLE,
228 const wxString& name = wxPyDialogNameStr);
229 %name(PreDialog)wxDialog();
231 bool Create(wxWindow* parent,
233 const wxString& title,
234 const wxPoint& pos = wxDefaultPosition,
235 const wxSize& size = wxDefaultSize,
236 long style = wxDEFAULT_DIALOG_STYLE,
237 const wxString& name = wxPyDialogNameStr);
240 // the modal dialogs have a return code - usually the id of the last
242 void SetReturnCode(int returnCode) { m_returnCode = returnCode; }
243 int GetReturnCode() const { return m_returnCode; }
245 // splits text up at newlines and places the
246 // lines into a vertical wxBoxSizer
247 wxSizer *CreateTextSizer( const wxString &message );
249 // places buttons into a horizontal wxBoxSizer
250 wxSizer *CreateButtonSizer( long flags );
253 //void SetModal(bool flag);
255 // is the dialog in modal state right now?
256 virtual bool IsModal() const;
258 // Shows the dialog and starts a nested event loop that returns when
259 // EndModal is called.
260 virtual int ShowModal();
262 // may be called to terminate the dialog with the given return code
263 virtual void EndModal(int retCode);
265 // returns True if we're in a modal loop
267 bool IsModalShowing() {
269 return self->m_modalShowing;
271 return self->IsModalShowing();
277 //---------------------------------------------------------------------------
281 class wxMiniFrame : public wxFrame {
283 %pythonAppend wxMiniFrame "self._setOORInfo(self)"
284 %pythonAppend wxMiniFrame() ""
286 wxMiniFrame(wxWindow* parent, const wxWindowID id, const wxString& title,
287 const wxPoint& pos = wxDefaultPosition,
288 const wxSize& size = wxDefaultSize,
289 long style = wxDEFAULT_FRAME_STYLE,
290 const wxString& name = wxPyFrameNameStr);
291 %name(PreMiniFrame)wxMiniFrame();
293 bool Create(wxWindow* parent, const wxWindowID id, const wxString& title,
294 const wxPoint& pos = wxDefaultPosition,
295 const wxSize& size = wxDefaultSize,
296 long style = wxDEFAULT_FRAME_STYLE,
297 const wxString& name = wxPyFrameNameStr);
302 //---------------------------------------------------------------------------
307 wxSPLASH_CENTRE_ON_PARENT,
308 wxSPLASH_CENTRE_ON_SCREEN,
315 class wxSplashScreenWindow: public wxWindow
318 %pythonAppend wxSplashScreenWindow "self._setOORInfo(self)"
320 wxSplashScreenWindow(const wxBitmap& bitmap,
321 wxWindow* parent, wxWindowID id,
322 const wxPoint& pos = wxDefaultPosition,
323 const wxSize& size = wxDefaultSize,
324 long style = wxNO_BORDER);
326 void SetBitmap(const wxBitmap& bitmap);
327 wxBitmap& GetBitmap();
331 class wxSplashScreen : public wxFrame {
333 %pythonAppend wxSplashScreen "self._setOORInfo(self)"
335 wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds,
336 wxWindow* parent, wxWindowID id,
337 const wxPoint& pos = wxDefaultPosition,
338 const wxSize& size = wxDefaultSize,
339 long style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP);
341 long GetSplashStyle() const;
342 wxSplashScreenWindow* GetSplashWindow() const;
343 int GetTimeout() const;
347 //---------------------------------------------------------------------------