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 //---------------------------------------------------------------------------
19 // Put some wx default wxChar* values into wxStrings.
20 DECLARE_DEF_STRING(FrameNameStr);
21 DECLARE_DEF_STRING(DialogNameStr);
22 DECLARE_DEF_STRING(StatusLineNameStr);
23 DECLARE_DEF_STRING(ToolBarNameStr);
26 //---------------------------------------------------------------------------
31 wxFULLSCREEN_NOMENUBAR,
32 wxFULLSCREEN_NOTOOLBAR,
33 wxFULLSCREEN_NOSTATUSBAR,
34 wxFULLSCREEN_NOBORDER,
35 wxFULLSCREEN_NOCAPTION,
43 %typemap(in) (int widths, int* widths_field) {
44 $1 = PyList_Size($input);
45 $2 = int_LIST_helper($input);
46 if ($2 == NULL) SWIG_fail;
49 %typemap(freearg) (int widths, int* widths_field) {
54 //---------------------------------------------------------------------------
56 class wxTopLevelWindow : public wxWindow
60 // No constructor as it can not be used directly from Python
62 // maximize = True => maximize, otherwise - restore
63 virtual void Maximize(bool maximize = True);
65 // undo Maximize() or Iconize()
66 virtual void Restore();
68 // iconize = True => iconize, otherwise - restore
69 virtual void Iconize(bool iconize = True);
71 // return True if the frame is maximized
72 virtual bool IsMaximized() const;
74 // return True if the frame is iconized
75 virtual bool IsIconized() const;
78 wxIcon GetIcon() const;
81 virtual void SetIcon(const wxIcon& icon);
83 // set the frame icons
84 virtual void SetIcons(const wxIconBundle& icons );
86 // maximize the window to cover entire screen
87 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
89 // return True if the frame is in fullscreen mode
90 virtual bool IsFullScreen() const;
92 virtual void SetTitle(const wxString& title);
93 virtual wxString GetTitle() const;
95 // Set the shape of the window to the given region.
96 // Returns True if the platform supports this feature (and the operation
98 virtual bool SetShape(const wxRegion& region);
103 //---------------------------------------------------------------------------
106 // wxFrame is a top-level window with optional menubar, statusbar and toolbar
108 // For each of *bars, a frame may have several of them, but only one is
109 // managed by the frame, i.e. resized/moved when the frame is and whose size
110 // is accounted for in client size calculations - all others should be taken
113 class wxFrame : public wxTopLevelWindow {
115 %addtofunc wxFrame "self._setOORInfo(self)"
116 %addtofunc wxFrame() ""
118 wxFrame(wxWindow* parent, const wxWindowID id, const wxString& title,
119 const wxPoint& pos = wxDefaultPosition,
120 const wxSize& size = wxDefaultSize,
121 long style = wxDEFAULT_FRAME_STYLE,
122 const wxString& name = wxPyFrameNameStr);
123 %name(PreFrame)wxFrame();
125 bool Create(wxWindow* parent, const wxWindowID id, const wxString& title,
126 const wxPoint& pos = wxDefaultPosition,
127 const wxSize& size = wxDefaultSize,
128 long style = wxDEFAULT_FRAME_STYLE,
129 const wxString& name = wxPyFrameNameStr);
135 // get the origin of the client area (which may be different from (0, 0)
136 // if the frame has a toolbar) in client coordinates
137 virtual wxPoint GetClientAreaOrigin() const;
139 // sends a size event to the window using its current size -- this has an
140 // effect of refreshing the window layout
142 virtual void SendSizeEvent() { }
145 // menu bar functions
146 // ------------------
148 virtual void SetMenuBar(wxMenuBar *menubar);
149 virtual wxMenuBar *GetMenuBar() const;
152 // process menu command: returns True if processed
153 bool ProcessCommand(int winid);
154 %pythoncode { Command = ProcessCommand }
157 // status bar functions
158 // --------------------
160 // create the main status bar by calling OnCreateStatusBar()
161 virtual wxStatusBar* CreateStatusBar(int number = 1,
162 long style = wxST_SIZEGRIP,
163 wxWindowID winid = 0,
164 const wxString& name = wxPyStatusLineNameStr);
165 // TODO: with directors?
166 // // return a new status bar
167 // virtual wxStatusBar *OnCreateStatusBar(int number,
170 // const wxString& name);
172 // get the main status bar
173 virtual wxStatusBar *GetStatusBar() const;
175 // sets the main status bar
176 void SetStatusBar(wxStatusBar *statBar);
178 // forward these to status bar
179 virtual void SetStatusText(const wxString &text, int number = 0);
180 virtual void SetStatusWidths(int widths, const int* widths_field); //uses typemap above
181 void PushStatusText(const wxString &text, int number = 0);
182 void PopStatusText(int number = 0);
184 // set the status bar pane the help will be shown in
185 void SetStatusBarPane(int n);
186 int GetStatusBarPane() const;
192 // create main toolbar bycalling OnCreateToolBar()
193 virtual wxToolBar* CreateToolBar(long style = -1,
194 wxWindowID winid = -1,
195 const wxString& name = wxPyToolBarNameStr);
196 // TODO: with directors?
197 // // return a new toolbar
198 // virtual wxToolBar *OnCreateToolBar(long style,
200 // const wxString& name );
202 // get/set the main toolbar
203 virtual wxToolBar *GetToolBar() const;
204 virtual void SetToolBar(wxToolBar *toolbar);
207 // show help text (typically in the statusbar); show is False
208 // if you are hiding the help, True otherwise
209 virtual void DoGiveHelp(const wxString& text, bool show);
212 // send wxUpdateUIEvents for all menu items in the menubar,
213 // or just for menu if non-NULL
214 void DoMenuUpdates(wxMenu* menu = NULL);
217 //---------------------------------------------------------------------------
220 class wxDialog : public wxTopLevelWindow {
222 %addtofunc wxDialog "self._setOORInfo(self)"
223 %addtofunc wxDialog() ""
225 wxDialog(wxWindow* parent,
227 const wxString& title,
228 const wxPoint& pos = wxDefaultPosition,
229 const wxSize& size = wxDefaultSize,
230 long style = wxDEFAULT_DIALOG_STYLE,
231 const wxString& name = wxPyDialogNameStr);
232 %name(PreDialog)wxDialog();
234 bool Create(wxWindow* parent,
236 const wxString& title,
237 const wxPoint& pos = wxDefaultPosition,
238 const wxSize& size = wxDefaultSize,
239 long style = wxDEFAULT_DIALOG_STYLE,
240 const wxString& name = wxPyDialogNameStr);
243 // the modal dialogs have a return code - usually the id of the last
245 void SetReturnCode(int returnCode) { m_returnCode = returnCode; }
246 int GetReturnCode() const { return m_returnCode; }
248 // splits text up at newlines and places the
249 // lines into a vertical wxBoxSizer
250 wxSizer *CreateTextSizer( const wxString &message );
252 // places buttons into a horizontal wxBoxSizer
253 wxSizer *CreateButtonSizer( long flags );
256 void SetModal(bool flag);
257 virtual bool IsModal() const;
259 // Shows the dialog and starts a nested event loop that returns when
260 // EndModal is called.
261 virtual int ShowModal();
263 // may be called to terminate the dialog with the given return code
264 virtual void EndModal(int retCode);
266 // returns True if we're in a modal loop
268 bool IsModalShowing() {
270 return self->m_modalShowing;
272 return self->IsModalShowing();
278 //---------------------------------------------------------------------------
282 class wxMiniFrame : public wxFrame {
284 %addtofunc wxMiniFrame "self._setOORInfo(self)"
285 %addtofunc wxMiniFrame() ""
287 wxMiniFrame(wxWindow* parent, const wxWindowID id, const wxString& title,
288 const wxPoint& pos = wxDefaultPosition,
289 const wxSize& size = wxDefaultSize,
290 long style = wxDEFAULT_FRAME_STYLE,
291 const wxString& name = wxPyFrameNameStr);
292 %name(PreMiniFrame)wxMiniFrame();
294 bool Create(wxWindow* parent, const wxWindowID id, const wxString& title,
295 const wxPoint& pos = wxDefaultPosition,
296 const wxSize& size = wxDefaultSize,
297 long style = wxDEFAULT_FRAME_STYLE,
298 const wxString& name = wxPyFrameNameStr);
303 //---------------------------------------------------------------------------
308 wxSPLASH_CENTRE_ON_PARENT,
309 wxSPLASH_CENTRE_ON_SCREEN,
316 class wxSplashScreenWindow: public wxWindow
319 %addtofunc wxSplashScreenWindow "self._setOORInfo(self)"
321 wxSplashScreenWindow(const wxBitmap& bitmap,
322 wxWindow* parent, wxWindowID id,
323 const wxPoint& pos = wxDefaultPosition,
324 const wxSize& size = wxDefaultSize,
325 long style = wxNO_BORDER);
327 void SetBitmap(const wxBitmap& bitmap);
328 wxBitmap& GetBitmap();
332 class wxSplashScreen : public wxFrame {
334 %addtofunc wxSplashScreen "self._setOORInfo(self)"
336 wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds,
337 wxWindow* parent, wxWindowID id,
338 const wxPoint& pos = wxDefaultPosition,
339 const wxSize& size = wxDefaultSize,
340 long style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP);
342 long GetSplashStyle() const;
343 wxSplashScreenWindow* GetSplashWindow() const;
344 int GetTimeout() const;
348 //---------------------------------------------------------------------------