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);
134 //---------------------------------------------------------------------------
137 // wxFrame is a top-level window with optional menubar, statusbar and toolbar
139 // For each of *bars, a frame may have several of them, but only one is
140 // managed by the frame, i.e. resized/moved when the frame is and whose size
141 // is accounted for in client size calculations - all others should be taken
144 class wxFrame : public wxTopLevelWindow {
146 %pythonAppend wxFrame "self._setOORInfo(self)"
147 %pythonAppend wxFrame() ""
149 wxFrame(wxWindow* parent, const wxWindowID id, const wxString& title,
150 const wxPoint& pos = wxDefaultPosition,
151 const wxSize& size = wxDefaultSize,
152 long style = wxDEFAULT_FRAME_STYLE,
153 const wxString& name = wxPyFrameNameStr);
154 %name(PreFrame)wxFrame();
156 bool Create(wxWindow* parent, const wxWindowID id, const wxString& title,
157 const wxPoint& pos = wxDefaultPosition,
158 const wxSize& size = wxDefaultSize,
159 long style = wxDEFAULT_FRAME_STYLE,
160 const wxString& name = wxPyFrameNameStr);
166 // get the origin of the client area (which may be different from (0, 0)
167 // if the frame has a toolbar) in client coordinates
168 virtual wxPoint GetClientAreaOrigin() const;
170 // sends a size event to the window using its current size -- this has an
171 // effect of refreshing the window layout
173 virtual void SendSizeEvent() { }
176 // menu bar functions
177 // ------------------
179 virtual void SetMenuBar(wxMenuBar *menubar);
180 virtual wxMenuBar *GetMenuBar() const;
183 // process menu command: returns True if processed
184 bool ProcessCommand(int winid);
185 %pythoncode { Command = ProcessCommand }
188 // status bar functions
189 // --------------------
191 // create the main status bar by calling OnCreateStatusBar()
192 virtual wxStatusBar* CreateStatusBar(int number = 1,
193 long style = wxDEFAULT_STATUSBAR_STYLE,
194 wxWindowID winid = 0,
195 const wxString& name = wxPyStatusLineNameStr);
196 // TODO: with directors?
197 // // return a new status bar
198 // virtual wxStatusBar *OnCreateStatusBar(int number,
201 // const wxString& name);
203 // get the main status bar
204 virtual wxStatusBar *GetStatusBar() const;
206 // sets the main status bar
207 void SetStatusBar(wxStatusBar *statBar);
209 // forward these to status bar
210 virtual void SetStatusText(const wxString &text, int number = 0);
211 virtual void SetStatusWidths(int widths, const int* widths_field); //uses typemap above
212 void PushStatusText(const wxString &text, int number = 0);
213 void PopStatusText(int number = 0);
215 // set the status bar pane the help will be shown in
216 void SetStatusBarPane(int n);
217 int GetStatusBarPane() const;
223 // create main toolbar bycalling OnCreateToolBar()
224 virtual wxToolBar* CreateToolBar(long style = -1,
225 wxWindowID winid = -1,
226 const wxString& name = wxPyToolBarNameStr);
227 // TODO: with directors?
228 // // return a new toolbar
229 // virtual wxToolBar *OnCreateToolBar(long style,
231 // const wxString& name );
233 // get/set the main toolbar
234 virtual wxToolBar *GetToolBar() const;
235 virtual void SetToolBar(wxToolBar *toolbar);
238 // show help text (typically in the statusbar); show is False
239 // if you are hiding the help, True otherwise
240 virtual void DoGiveHelp(const wxString& text, bool show);
243 // send wxUpdateUIEvents for all menu items in the menubar,
244 // or just for menu if non-NULL
245 void DoMenuUpdates(wxMenu* menu = NULL);
248 //---------------------------------------------------------------------------
251 class wxDialog : public wxTopLevelWindow {
253 %pythonAppend wxDialog "self._setOORInfo(self)"
254 %pythonAppend wxDialog() ""
256 wxDialog(wxWindow* parent,
258 const wxString& title,
259 const wxPoint& pos = wxDefaultPosition,
260 const wxSize& size = wxDefaultSize,
261 long style = wxDEFAULT_DIALOG_STYLE,
262 const wxString& name = wxPyDialogNameStr);
263 %name(PreDialog)wxDialog();
265 bool Create(wxWindow* parent,
267 const wxString& title,
268 const wxPoint& pos = wxDefaultPosition,
269 const wxSize& size = wxDefaultSize,
270 long style = wxDEFAULT_DIALOG_STYLE,
271 const wxString& name = wxPyDialogNameStr);
274 // the modal dialogs have a return code - usually the id of the last
276 void SetReturnCode(int returnCode) { m_returnCode = returnCode; }
277 int GetReturnCode() const { return m_returnCode; }
279 // splits text up at newlines and places the
280 // lines into a vertical wxBoxSizer
281 wxSizer *CreateTextSizer( const wxString &message );
283 // places buttons into a horizontal wxBoxSizer
284 wxSizer *CreateButtonSizer( long flags );
287 //void SetModal(bool flag);
289 // is the dialog in modal state right now?
290 virtual bool IsModal() const;
292 // Shows the dialog and starts a nested event loop that returns when
293 // EndModal is called.
294 virtual int ShowModal();
296 // may be called to terminate the dialog with the given return code
297 virtual void EndModal(int retCode);
299 // returns True if we're in a modal loop
301 bool IsModalShowing() {
303 return self->m_modalShowing;
305 return self->IsModalShowing();
311 //---------------------------------------------------------------------------
315 class wxMiniFrame : public wxFrame {
317 %pythonAppend wxMiniFrame "self._setOORInfo(self)"
318 %pythonAppend wxMiniFrame() ""
320 wxMiniFrame(wxWindow* parent, const wxWindowID id, const wxString& title,
321 const wxPoint& pos = wxDefaultPosition,
322 const wxSize& size = wxDefaultSize,
323 long style = wxDEFAULT_FRAME_STYLE,
324 const wxString& name = wxPyFrameNameStr);
325 %name(PreMiniFrame)wxMiniFrame();
327 bool Create(wxWindow* parent, const wxWindowID id, const wxString& title,
328 const wxPoint& pos = wxDefaultPosition,
329 const wxSize& size = wxDefaultSize,
330 long style = wxDEFAULT_FRAME_STYLE,
331 const wxString& name = wxPyFrameNameStr);
336 //---------------------------------------------------------------------------
341 wxSPLASH_CENTRE_ON_PARENT,
342 wxSPLASH_CENTRE_ON_SCREEN,
349 class wxSplashScreenWindow: public wxWindow
352 %pythonAppend wxSplashScreenWindow "self._setOORInfo(self)"
354 wxSplashScreenWindow(const wxBitmap& bitmap,
355 wxWindow* parent, wxWindowID id,
356 const wxPoint& pos = wxDefaultPosition,
357 const wxSize& size = wxDefaultSize,
358 long style = wxNO_BORDER);
360 void SetBitmap(const wxBitmap& bitmap);
361 wxBitmap& GetBitmap();
365 class wxSplashScreen : public wxFrame {
367 %pythonAppend wxSplashScreen "self._setOORInfo(self)"
369 wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds,
370 wxWindow* parent, wxWindowID id,
371 const wxPoint& pos = wxDefaultPosition,
372 const wxSize& size = wxDefaultSize,
373 long style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP);
375 long GetSplashStyle() const;
376 wxSplashScreenWindow* GetSplashWindow() const;
377 int GetTimeout() const;
381 //---------------------------------------------------------------------------