]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_toplvl.i
Added new encoding, new methods
[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
b2dc1044
RD
18MAKE_CONST_WXSTRING(FrameNameStr);
19MAKE_CONST_WXSTRING(DialogNameStr);
20MAKE_CONST_WXSTRING(StatusLineNameStr);
21MAKE_CONST_WXSTRING(ToolBarNameStr);
137b5242 22
d14a1e28
RD
23//---------------------------------------------------------------------------
24%newgroup
137b5242 25
447f48ba
RD
26enum
27{
28 wxSTAY_ON_TOP,
29 wxICONIZE,
30 wxMINIMIZE,
31 wxMAXIMIZE,
32 wxCLOSE_BOX,
33 wxTHICK_FRAME,
34 wxSYSTEM_MENU,
35 wxMINIMIZE_BOX,
36 wxMAXIMIZE_BOX,
37 wxTINY_CAPTION_HORIZ,
38 wxTINY_CAPTION_VERT,
39 wxRESIZE_BOX,
40 wxRESIZE_BORDER,
41
42 wxDIALOG_NO_PARENT,
43
44 wxDEFAULT_FRAME_STYLE,
45 wxDEFAULT_DIALOG_STYLE,
46
47 wxFRAME_TOOL_WINDOW,
48 wxFRAME_FLOAT_ON_PARENT,
49 wxFRAME_NO_WINDOW_MENU,
50 wxFRAME_NO_TASKBAR,
51 wxFRAME_SHAPED,
52
53 // Obsolete
54 //wxDIALOG_MODAL,
55 //wxDIALOG_MODELESS,
56 //wxUSER_COLOURS,
57 //wxNO_3D,
58};
59
d14a1e28
RD
60enum
61{
f6bcfd97
BP
62 wxFULLSCREEN_NOMENUBAR,
63 wxFULLSCREEN_NOTOOLBAR,
64 wxFULLSCREEN_NOSTATUSBAR,
65 wxFULLSCREEN_NOBORDER,
66 wxFULLSCREEN_NOCAPTION,
ecc08ead
RD
67 wxFULLSCREEN_ALL,
68
69 wxTOPLEVEL_EX_DIALOG,
f6bcfd97
BP
70};
71
72
ecc08ead 73
d14a1e28
RD
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;
78}
79
80%typemap(freearg) (int widths, int* widths_field) {
81 if ($2) delete [] $2;
82}
83
84
85//---------------------------------------------------------------------------
ecc08ead
RD
86
87class wxTopLevelWindow : public wxWindow
88{
89public:
ecc08ead 90
d14a1e28 91 // No constructor as it can not be used directly from Python
ecc08ead 92
dd9f7fea
RD
93 // maximize = True => maximize, otherwise - restore
94 virtual void Maximize(bool maximize = True);
ecc08ead
RD
95
96 // undo Maximize() or Iconize()
97 virtual void Restore();
98
dd9f7fea
RD
99 // iconize = True => iconize, otherwise - restore
100 virtual void Iconize(bool iconize = True);
ecc08ead 101
dd9f7fea 102 // return True if the frame is maximized
ecc08ead
RD
103 virtual bool IsMaximized() const;
104
dd9f7fea 105 // return True if the frame is iconized
ecc08ead
RD
106 virtual bool IsIconized() const;
107
108 // get the frame icon
c5943253 109 wxIcon GetIcon() const;
ecc08ead
RD
110
111 // set the frame icon
112 virtual void SetIcon(const wxIcon& icon);
113
0e9b78ce
RD
114 // set the frame icons
115 virtual void SetIcons(const wxIconBundle& icons );
ecc08ead
RD
116
117 // maximize the window to cover entire screen
118 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
119
dd9f7fea 120 // return True if the frame is in fullscreen mode
ecc08ead
RD
121 virtual bool IsFullScreen() const;
122
123 virtual void SetTitle(const wxString& title);
124 virtual wxString GetTitle() const;
1542ea39
RD
125
126 // Set the shape of the window to the given region.
dd9f7fea 127 // Returns True if the platform supports this feature (and the operation
1542ea39
RD
128 // is successful.)
129 virtual bool SetShape(const wxRegion& region);
130
ecc08ead
RD
131};
132
ecc08ead 133
d14a1e28
RD
134//---------------------------------------------------------------------------
135%newgroup
136
137// wxFrame is a top-level window with optional menubar, statusbar and toolbar
138//
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
142// care of manually.
ecc08ead
RD
143
144class wxFrame : public wxTopLevelWindow {
9c039d08 145public:
2b9048c5
RD
146 %pythonAppend wxFrame "self._setOORInfo(self)"
147 %pythonAppend wxFrame() ""
d14a1e28 148
9c039d08 149 wxFrame(wxWindow* parent, const wxWindowID id, const wxString& title,
b68dc582
RD
150 const wxPoint& pos = wxDefaultPosition,
151 const wxSize& size = wxDefaultSize,
9c039d08 152 long style = wxDEFAULT_FRAME_STYLE,
137b5242 153 const wxString& name = wxPyFrameNameStr);
d14a1e28 154 %name(PreFrame)wxFrame();
9c039d08 155
09f3d4e6
RD
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,
137b5242 160 const wxString& name = wxPyFrameNameStr);
9c039d08 161
0122b7e3 162
d14a1e28
RD
163 // frame state
164 // -----------
ecc08ead 165
d14a1e28
RD
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;
169
170 // sends a size event to the window using its current size -- this has an
171 // effect of refreshing the window layout
172 //
173 virtual void SendSizeEvent() { }
174
175
176 // menu bar functions
177 // ------------------
178
179 virtual void SetMenuBar(wxMenuBar *menubar);
180 virtual wxMenuBar *GetMenuBar() const;
ecc08ead
RD
181
182
dd9f7fea 183 // process menu command: returns True if processed
d14a1e28
RD
184 bool ProcessCommand(int winid);
185 %pythoncode { Command = ProcessCommand }
186
ecc08ead 187
d14a1e28
RD
188 // status bar functions
189 // --------------------
190
191 // create the main status bar by calling OnCreateStatusBar()
192 virtual wxStatusBar* CreateStatusBar(int number = 1,
69d81895 193 long style = wxDEFAULT_STATUSBAR_STYLE,
d14a1e28
RD
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,
199// long style,
200// wxWindowID winid,
201// const wxString& name);
ecc08ead
RD
202
203 // get the main status bar
d14a1e28 204 virtual wxStatusBar *GetStatusBar() const;
ecc08ead
RD
205
206 // sets the main status bar
207 void SetStatusBar(wxStatusBar *statBar);
208
209 // forward these to status bar
210 virtual void SetStatusText(const wxString &text, int number = 0);
d14a1e28 211 virtual void SetStatusWidths(int widths, const int* widths_field); //uses typemap above
94e36a51
RD
212 void PushStatusText(const wxString &text, int number = 0);
213 void PopStatusText(int number = 0);
214
94e36a51
RD
215 // set the status bar pane the help will be shown in
216 void SetStatusBarPane(int n);
217 int GetStatusBarPane() const;
ecc08ead
RD
218
219
d14a1e28
RD
220 // toolbar functions
221 // -----------------
222
223 // create main toolbar bycalling OnCreateToolBar()
224 virtual wxToolBar* CreateToolBar(long style = -1,
225 wxWindowID winid = -1,
137b5242 226 const wxString& name = wxPyToolBarNameStr);
d14a1e28
RD
227// TODO: with directors?
228// // return a new toolbar
229// virtual wxToolBar *OnCreateToolBar(long style,
230// wxWindowID winid,
231// const wxString& name );
ecc08ead
RD
232
233 // get/set the main toolbar
d14a1e28
RD
234 virtual wxToolBar *GetToolBar() const;
235 virtual void SetToolBar(wxToolBar *toolbar);
ecc08ead 236
d14a1e28 237
dd9f7fea
RD
238 // show help text (typically in the statusbar); show is False
239 // if you are hiding the help, True otherwise
d14a1e28 240 virtual void DoGiveHelp(const wxString& text, bool show);
3ef86e32
RD
241
242
243 // send wxUpdateUIEvents for all menu items in the menubar,
244 // or just for menu if non-NULL
245 void DoMenuUpdates(wxMenu* menu = NULL);
9c039d08
RD
246};
247
ecc08ead 248//---------------------------------------------------------------------------
d14a1e28 249%newgroup
ecc08ead
RD
250
251class wxDialog : public wxTopLevelWindow {
252public:
2b9048c5
RD
253 %pythonAppend wxDialog "self._setOORInfo(self)"
254 %pythonAppend wxDialog() ""
d14a1e28 255
ecc08ead
RD
256 wxDialog(wxWindow* parent,
257 const wxWindowID id,
258 const wxString& title,
259 const wxPoint& pos = wxDefaultPosition,
260 const wxSize& size = wxDefaultSize,
261 long style = wxDEFAULT_DIALOG_STYLE,
137b5242 262 const wxString& name = wxPyDialogNameStr);
d14a1e28 263 %name(PreDialog)wxDialog();
ecc08ead
RD
264
265 bool Create(wxWindow* parent,
266 const wxWindowID id,
267 const wxString& title,
268 const wxPoint& pos = wxDefaultPosition,
269 const wxSize& size = wxDefaultSize,
270 long style = wxDEFAULT_DIALOG_STYLE,
137b5242 271 const wxString& name = wxPyDialogNameStr);
ecc08ead 272
0122b7e3 273
d14a1e28
RD
274 // the modal dialogs have a return code - usually the id of the last
275 // pressed button
276 void SetReturnCode(int returnCode) { m_returnCode = returnCode; }
277 int GetReturnCode() const { return m_returnCode; }
ecc08ead 278
d14a1e28
RD
279 // splits text up at newlines and places the
280 // lines into a vertical wxBoxSizer
281 wxSizer *CreateTextSizer( const wxString &message );
ecc08ead 282
d14a1e28
RD
283 // places buttons into a horizontal wxBoxSizer
284 wxSizer *CreateButtonSizer( long flags );
ecc08ead 285
ecc08ead 286
f87da722
RD
287 //void SetModal(bool flag);
288
289 // is the dialog in modal state right now?
d14a1e28
RD
290 virtual bool IsModal() const;
291
292 // Shows the dialog and starts a nested event loop that returns when
293 // EndModal is called.
294 virtual int ShowModal();
295
296 // may be called to terminate the dialog with the given return code
297 virtual void EndModal(int retCode);
298
dd9f7fea 299 // returns True if we're in a modal loop
d14a1e28
RD
300 %extend {
301 bool IsModalShowing() {
302 #ifdef __WXGTK__
303 return self->m_modalShowing;
304 #else
305 return self->IsModalShowing();
306 #endif
307 }
308 }
309};
ecc08ead 310
9c039d08 311//---------------------------------------------------------------------------
d14a1e28
RD
312%newgroup
313
9c039d08 314
9c039d08
RD
315class wxMiniFrame : public wxFrame {
316public:
2b9048c5
RD
317 %pythonAppend wxMiniFrame "self._setOORInfo(self)"
318 %pythonAppend wxMiniFrame() ""
d14a1e28 319
9c039d08 320 wxMiniFrame(wxWindow* parent, const wxWindowID id, const wxString& title,
b68dc582
RD
321 const wxPoint& pos = wxDefaultPosition,
322 const wxSize& size = wxDefaultSize,
9c039d08 323 long style = wxDEFAULT_FRAME_STYLE,
137b5242 324 const wxString& name = wxPyFrameNameStr);
d14a1e28 325 %name(PreMiniFrame)wxMiniFrame();
9c039d08 326
09f3d4e6
RD
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,
137b5242 331 const wxString& name = wxPyFrameNameStr);
0122b7e3 332
9c039d08 333};
b8b8dda7
RD
334
335
336//---------------------------------------------------------------------------
d14a1e28
RD
337%newgroup
338
b8b8dda7 339
b5a5d647
RD
340enum {
341 wxSPLASH_CENTRE_ON_PARENT,
342 wxSPLASH_CENTRE_ON_SCREEN,
343 wxSPLASH_NO_CENTRE,
344 wxSPLASH_TIMEOUT,
345 wxSPLASH_NO_TIMEOUT,
346};
347
348
349class wxSplashScreenWindow: public wxWindow
350{
351public:
2b9048c5 352 %pythonAppend wxSplashScreenWindow "self._setOORInfo(self)"
d14a1e28 353
b5a5d647
RD
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);
359
360 void SetBitmap(const wxBitmap& bitmap);
361 wxBitmap& GetBitmap();
362};
363
364
365class wxSplashScreen : public wxFrame {
366public:
2b9048c5 367 %pythonAppend wxSplashScreen "self._setOORInfo(self)"
d14a1e28 368
b5a5d647
RD
369 wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds,
370 wxWindow* parent, wxWindowID id,
371 const wxPoint& pos = wxDefaultPosition,
372 const wxSize& size = wxDefaultSize,
479101ca 373 long style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP);
b5a5d647
RD
374
375 long GetSplashStyle() const;
376 wxSplashScreenWindow* GetSplashWindow() const;
377 int GetTimeout() const;
378};
379
380
381//---------------------------------------------------------------------------