]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_toplvl.i
Commented out WM_MOUSELEAVE until it can be fixed
[wxWidgets.git] / wxPython / src / _toplvl.i
CommitLineData
9c039d08 1/////////////////////////////////////////////////////////////////////////////
d14a1e28
RD
2// Name: _toplvl.i
3// Purpose: SWIG definitions for wxTopLevelWindow, wxFrame, wxDialog and etc.
9c039d08
RD
4//
5// Author: Robin Dunn
6//
d14a1e28 7// Created: 27-Aug-1998
9c039d08 8// RCS-ID: $Id$
d14a1e28 9// Copyright: (c) 2003 by Total Control Software
9c039d08
RD
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
d14a1e28 13// Not a %module
9c039d08 14
9c039d08 15
d14a1e28 16//---------------------------------------------------------------------------
9c039d08 17
137b5242
RD
18%{
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);
24%}
25
d14a1e28
RD
26//---------------------------------------------------------------------------
27%newgroup
137b5242 28
d14a1e28
RD
29enum
30{
f6bcfd97
BP
31 wxFULLSCREEN_NOMENUBAR,
32 wxFULLSCREEN_NOTOOLBAR,
33 wxFULLSCREEN_NOSTATUSBAR,
34 wxFULLSCREEN_NOBORDER,
35 wxFULLSCREEN_NOCAPTION,
ecc08ead
RD
36 wxFULLSCREEN_ALL,
37
38 wxTOPLEVEL_EX_DIALOG,
f6bcfd97
BP
39};
40
41
ecc08ead 42
d14a1e28
RD
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;
47}
48
49%typemap(freearg) (int widths, int* widths_field) {
50 if ($2) delete [] $2;
51}
52
53
54//---------------------------------------------------------------------------
ecc08ead
RD
55
56class wxTopLevelWindow : public wxWindow
57{
58public:
ecc08ead 59
d14a1e28 60 // No constructor as it can not be used directly from Python
ecc08ead 61
dd9f7fea
RD
62 // maximize = True => maximize, otherwise - restore
63 virtual void Maximize(bool maximize = True);
ecc08ead
RD
64
65 // undo Maximize() or Iconize()
66 virtual void Restore();
67
dd9f7fea
RD
68 // iconize = True => iconize, otherwise - restore
69 virtual void Iconize(bool iconize = True);
ecc08ead 70
dd9f7fea 71 // return True if the frame is maximized
ecc08ead
RD
72 virtual bool IsMaximized() const;
73
dd9f7fea 74 // return True if the frame is iconized
ecc08ead
RD
75 virtual bool IsIconized() const;
76
77 // get the frame icon
c5943253 78 wxIcon GetIcon() const;
ecc08ead
RD
79
80 // set the frame icon
81 virtual void SetIcon(const wxIcon& icon);
82
0e9b78ce
RD
83 // set the frame icons
84 virtual void SetIcons(const wxIconBundle& icons );
ecc08ead
RD
85
86 // maximize the window to cover entire screen
87 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
88
dd9f7fea 89 // return True if the frame is in fullscreen mode
ecc08ead
RD
90 virtual bool IsFullScreen() const;
91
92 virtual void SetTitle(const wxString& title);
93 virtual wxString GetTitle() const;
1542ea39
RD
94
95 // Set the shape of the window to the given region.
dd9f7fea 96 // Returns True if the platform supports this feature (and the operation
1542ea39
RD
97 // is successful.)
98 virtual bool SetShape(const wxRegion& region);
99
ecc08ead
RD
100};
101
ecc08ead 102
d14a1e28
RD
103//---------------------------------------------------------------------------
104%newgroup
105
106// wxFrame is a top-level window with optional menubar, statusbar and toolbar
107//
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
111// care of manually.
ecc08ead
RD
112
113class wxFrame : public wxTopLevelWindow {
9c039d08 114public:
d14a1e28
RD
115 %addtofunc wxFrame "self._setOORInfo(self)"
116 %addtofunc wxFrame() ""
117
9c039d08 118 wxFrame(wxWindow* parent, const wxWindowID id, const wxString& title,
b68dc582
RD
119 const wxPoint& pos = wxDefaultPosition,
120 const wxSize& size = wxDefaultSize,
9c039d08 121 long style = wxDEFAULT_FRAME_STYLE,
137b5242 122 const wxString& name = wxPyFrameNameStr);
d14a1e28 123 %name(PreFrame)wxFrame();
9c039d08 124
09f3d4e6
RD
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,
137b5242 129 const wxString& name = wxPyFrameNameStr);
9c039d08 130
0122b7e3 131
d14a1e28
RD
132 // frame state
133 // -----------
ecc08ead 134
d14a1e28
RD
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;
138
139 // sends a size event to the window using its current size -- this has an
140 // effect of refreshing the window layout
141 //
142 virtual void SendSizeEvent() { }
143
144
145 // menu bar functions
146 // ------------------
147
148 virtual void SetMenuBar(wxMenuBar *menubar);
149 virtual wxMenuBar *GetMenuBar() const;
ecc08ead
RD
150
151
dd9f7fea 152 // process menu command: returns True if processed
d14a1e28
RD
153 bool ProcessCommand(int winid);
154 %pythoncode { Command = ProcessCommand }
155
ecc08ead 156
d14a1e28
RD
157 // status bar functions
158 // --------------------
159
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,
168// long style,
169// wxWindowID winid,
170// const wxString& name);
ecc08ead
RD
171
172 // get the main status bar
d14a1e28 173 virtual wxStatusBar *GetStatusBar() const;
ecc08ead
RD
174
175 // sets the main status bar
176 void SetStatusBar(wxStatusBar *statBar);
177
178 // forward these to status bar
179 virtual void SetStatusText(const wxString &text, int number = 0);
d14a1e28 180 virtual void SetStatusWidths(int widths, const int* widths_field); //uses typemap above
94e36a51
RD
181 void PushStatusText(const wxString &text, int number = 0);
182 void PopStatusText(int number = 0);
183
94e36a51
RD
184 // set the status bar pane the help will be shown in
185 void SetStatusBarPane(int n);
186 int GetStatusBarPane() const;
ecc08ead
RD
187
188
d14a1e28
RD
189 // toolbar functions
190 // -----------------
191
192 // create main toolbar bycalling OnCreateToolBar()
193 virtual wxToolBar* CreateToolBar(long style = -1,
194 wxWindowID winid = -1,
137b5242 195 const wxString& name = wxPyToolBarNameStr);
d14a1e28
RD
196// TODO: with directors?
197// // return a new toolbar
198// virtual wxToolBar *OnCreateToolBar(long style,
199// wxWindowID winid,
200// const wxString& name );
ecc08ead
RD
201
202 // get/set the main toolbar
d14a1e28
RD
203 virtual wxToolBar *GetToolBar() const;
204 virtual void SetToolBar(wxToolBar *toolbar);
ecc08ead 205
d14a1e28 206
dd9f7fea
RD
207 // show help text (typically in the statusbar); show is False
208 // if you are hiding the help, True otherwise
d14a1e28 209 virtual void DoGiveHelp(const wxString& text, bool show);
3ef86e32
RD
210
211
212 // send wxUpdateUIEvents for all menu items in the menubar,
213 // or just for menu if non-NULL
214 void DoMenuUpdates(wxMenu* menu = NULL);
9c039d08
RD
215};
216
ecc08ead 217//---------------------------------------------------------------------------
d14a1e28 218%newgroup
ecc08ead
RD
219
220class wxDialog : public wxTopLevelWindow {
221public:
d14a1e28
RD
222 %addtofunc wxDialog "self._setOORInfo(self)"
223 %addtofunc wxDialog() ""
224
ecc08ead
RD
225 wxDialog(wxWindow* parent,
226 const wxWindowID id,
227 const wxString& title,
228 const wxPoint& pos = wxDefaultPosition,
229 const wxSize& size = wxDefaultSize,
230 long style = wxDEFAULT_DIALOG_STYLE,
137b5242 231 const wxString& name = wxPyDialogNameStr);
d14a1e28 232 %name(PreDialog)wxDialog();
ecc08ead
RD
233
234 bool Create(wxWindow* parent,
235 const wxWindowID id,
236 const wxString& title,
237 const wxPoint& pos = wxDefaultPosition,
238 const wxSize& size = wxDefaultSize,
239 long style = wxDEFAULT_DIALOG_STYLE,
137b5242 240 const wxString& name = wxPyDialogNameStr);
ecc08ead 241
0122b7e3 242
d14a1e28
RD
243 // the modal dialogs have a return code - usually the id of the last
244 // pressed button
245 void SetReturnCode(int returnCode) { m_returnCode = returnCode; }
246 int GetReturnCode() const { return m_returnCode; }
ecc08ead 247
d14a1e28
RD
248 // splits text up at newlines and places the
249 // lines into a vertical wxBoxSizer
250 wxSizer *CreateTextSizer( const wxString &message );
ecc08ead 251
d14a1e28
RD
252 // places buttons into a horizontal wxBoxSizer
253 wxSizer *CreateButtonSizer( long flags );
ecc08ead 254
ecc08ead 255
d14a1e28
RD
256 void SetModal(bool flag);
257 virtual bool IsModal() const;
258
259 // Shows the dialog and starts a nested event loop that returns when
260 // EndModal is called.
261 virtual int ShowModal();
262
263 // may be called to terminate the dialog with the given return code
264 virtual void EndModal(int retCode);
265
dd9f7fea 266 // returns True if we're in a modal loop
d14a1e28
RD
267 %extend {
268 bool IsModalShowing() {
269 #ifdef __WXGTK__
270 return self->m_modalShowing;
271 #else
272 return self->IsModalShowing();
273 #endif
274 }
275 }
276};
ecc08ead 277
9c039d08 278//---------------------------------------------------------------------------
d14a1e28
RD
279%newgroup
280
9c039d08 281
9c039d08
RD
282class wxMiniFrame : public wxFrame {
283public:
d14a1e28
RD
284 %addtofunc wxMiniFrame "self._setOORInfo(self)"
285 %addtofunc wxMiniFrame() ""
286
9c039d08 287 wxMiniFrame(wxWindow* parent, const wxWindowID id, const wxString& title,
b68dc582
RD
288 const wxPoint& pos = wxDefaultPosition,
289 const wxSize& size = wxDefaultSize,
9c039d08 290 long style = wxDEFAULT_FRAME_STYLE,
137b5242 291 const wxString& name = wxPyFrameNameStr);
d14a1e28 292 %name(PreMiniFrame)wxMiniFrame();
9c039d08 293
09f3d4e6
RD
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,
137b5242 298 const wxString& name = wxPyFrameNameStr);
0122b7e3 299
9c039d08 300};
b8b8dda7
RD
301
302
303//---------------------------------------------------------------------------
d14a1e28
RD
304%newgroup
305
b8b8dda7 306
b5a5d647
RD
307enum {
308 wxSPLASH_CENTRE_ON_PARENT,
309 wxSPLASH_CENTRE_ON_SCREEN,
310 wxSPLASH_NO_CENTRE,
311 wxSPLASH_TIMEOUT,
312 wxSPLASH_NO_TIMEOUT,
313};
314
315
316class wxSplashScreenWindow: public wxWindow
317{
318public:
d14a1e28
RD
319 %addtofunc wxSplashScreenWindow "self._setOORInfo(self)"
320
b5a5d647
RD
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);
326
327 void SetBitmap(const wxBitmap& bitmap);
328 wxBitmap& GetBitmap();
329};
330
331
332class wxSplashScreen : public wxFrame {
333public:
d14a1e28
RD
334 %addtofunc wxSplashScreen "self._setOORInfo(self)"
335
b5a5d647
RD
336 wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds,
337 wxWindow* parent, wxWindowID id,
338 const wxPoint& pos = wxDefaultPosition,
339 const wxSize& size = wxDefaultSize,
479101ca 340 long style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP);
b5a5d647
RD
341
342 long GetSplashStyle() const;
343 wxSplashScreenWindow* GetSplashWindow() const;
344 int GetTimeout() const;
345};
346
347
348//---------------------------------------------------------------------------