]>
Commit | Line | Data |
---|---|---|
7bf85405 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: windows2.i | |
3 | // Purpose: SWIG definitions of MORE window classes | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 6/2/98 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 1998 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
03e9bead | 13 | %module windows2 |
7bf85405 | 14 | |
03e9bead | 15 | %{ |
7bf85405 | 16 | #include "helpers.h" |
f6bcfd97 | 17 | #ifdef OLD_GRID |
7bf85405 | 18 | #include <wx/grid.h> |
f6bcfd97 | 19 | #endif |
7bf85405 | 20 | #include <wx/notebook.h> |
9c039d08 | 21 | #include <wx/splitter.h> |
9416aa89 | 22 | #include <wx/imaglist.h> |
b639c3c5 RD |
23 | #ifdef __WXMSW__ |
24 | #include <wx/msw/taskbar.h> | |
25 | #endif | |
7bf85405 RD |
26 | %} |
27 | ||
28 | //---------------------------------------------------------------------- | |
29 | ||
137b5242 RD |
30 | %{ |
31 | // Put some wx default wxChar* values into wxStrings. | |
32 | DECLARE_DEF_STRING(NOTEBOOK_NAME); | |
0b85cc38 | 33 | DECLARE_DEF_STRING(PanelNameStr); |
137b5242 RD |
34 | |
35 | static const wxChar* wxSplitterNameStr = wxT("splitter"); | |
36 | DECLARE_DEF_STRING(SplitterNameStr); | |
37 | static const wxString wxPyEmptyString(wxT("")); | |
38 | %} | |
39 | ||
40 | //---------------------------------------------------------------------- | |
41 | ||
7bf85405 RD |
42 | %include typemaps.i |
43 | %include my_typemaps.i | |
44 | ||
45 | // Import some definitions of other classes, etc. | |
46 | %import _defs.i | |
47 | %import misc.i | |
48 | %import gdi.i | |
49 | %import windows.i | |
50 | %import controls.i | |
51 | %import events.i | |
52 | ||
b8b8dda7 | 53 | %pragma(python) code = "import wx" |
9c039d08 | 54 | |
7bf85405 RD |
55 | //--------------------------------------------------------------------------- |
56 | ||
1b62f00d RD |
57 | enum { |
58 | /* notebook control event types */ | |
59 | wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, | |
60 | wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, | |
61 | }; | |
62 | ||
63 | ||
bb0054cd | 64 | class wxNotebookEvent : public wxNotifyEvent { |
7bf85405 | 65 | public: |
09f3d4e6 RD |
66 | wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, |
67 | int nSel = -1, int nOldSel = -1); | |
68 | ||
7bf85405 RD |
69 | int GetSelection(); |
70 | int GetOldSelection(); | |
bb0054cd RD |
71 | void SetOldSelection(int page); |
72 | void SetSelection(int page); | |
7bf85405 RD |
73 | }; |
74 | ||
75 | ||
76 | ||
77 | class wxNotebook : public wxControl { | |
78 | public: | |
79 | wxNotebook(wxWindow *parent, | |
80 | wxWindowID id, | |
b68dc582 RD |
81 | const wxPoint& pos = wxDefaultPosition, |
82 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 83 | long style = 0, |
137b5242 | 84 | const wxString& name = wxPyNOTEBOOK_NAME); |
09f3d4e6 | 85 | %name(wxPreNotebook)wxNotebook(); |
7bf85405 | 86 | |
09f3d4e6 RD |
87 | bool Create(wxWindow *parent, |
88 | wxWindowID id, | |
89 | const wxPoint& pos = wxDefaultPosition, | |
90 | const wxSize& size = wxDefaultSize, | |
91 | long style = 0, | |
137b5242 | 92 | const wxString& name = wxPyNOTEBOOK_NAME); |
9c039d08 | 93 | |
0122b7e3 | 94 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 95 | %pragma(python) addtomethod = "wxPreNotebook:val._setOORInfo(val)" |
0122b7e3 | 96 | |
7bf85405 RD |
97 | int GetPageCount(); |
98 | int SetSelection(int nPage); | |
99 | void AdvanceSelection(bool bForward = TRUE); | |
100 | int GetSelection(); | |
101 | bool SetPageText(int nPage, const wxString& strText); | |
102 | wxString GetPageText(int nPage) const; | |
949853a4 | 103 | |
7bf85405 | 104 | void SetImageList(wxImageList* imageList); |
949853a4 RD |
105 | void AssignImageList(wxImageList *imageList) ; |
106 | %pragma(python) addtomethod = "AssignImageList:_args[0].thisown = 0" | |
107 | ||
7bf85405 RD |
108 | wxImageList* GetImageList(); |
109 | int GetPageImage(int nPage); | |
110 | bool SetPageImage(int nPage, int nImage); | |
111 | int GetRowCount(); | |
112 | ||
c368d904 RD |
113 | void SetPageSize(const wxSize& size); |
114 | void SetPadding(const wxSize& padding); | |
7bf85405 | 115 | bool DeletePage(int nPage); |
cf694132 | 116 | bool RemovePage(int nPage); |
7bf85405 RD |
117 | bool DeleteAllPages(); |
118 | bool AddPage(/*wxNotebookPage*/ wxWindow *pPage, | |
119 | const wxString& strText, | |
cf694132 | 120 | int bSelect = FALSE, |
7bf85405 RD |
121 | int imageId = -1); |
122 | bool InsertPage(int nPage, | |
123 | /*wxNotebookPage*/ wxWindow *pPage, | |
124 | const wxString& strText, | |
125 | bool bSelect = FALSE, | |
126 | int imageId = -1); | |
bb0054cd | 127 | /*wxNotebookPage*/ wxWindow *GetPage(int nPage); |
7bf85405 | 128 | |
cf694132 RD |
129 | %addmethods { |
130 | void ResizeChildren() { | |
131 | wxSizeEvent evt(self->GetClientSize()); | |
4cd9591a | 132 | self->GetEventHandler()->ProcessEvent(evt); |
cf694132 RD |
133 | } |
134 | } | |
135 | ||
136 | ||
7bf85405 RD |
137 | }; |
138 | ||
9c039d08 RD |
139 | //--------------------------------------------------------------------------- |
140 | ||
f6bcfd97 | 141 | |
1b62f00d RD |
142 | enum { |
143 | /* splitter window events */ | |
144 | wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, | |
145 | wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, | |
146 | wxEVT_COMMAND_SPLITTER_UNSPLIT, | |
147 | wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, | |
148 | }; | |
149 | ||
150 | ||
f6bcfd97 BP |
151 | enum |
152 | { | |
153 | wxSPLIT_HORIZONTAL, | |
154 | wxSPLIT_VERTICAL, | |
155 | wxSPLIT_DRAG_NONE, | |
156 | wxSPLIT_DRAG_DRAGGING, | |
157 | wxSPLIT_DRAG_LEFT_DOWN | |
f6bcfd97 BP |
158 | }; |
159 | ||
160 | ||
756ed80c | 161 | class wxSplitterEvent : public wxNotifyEvent { |
bb0054cd | 162 | public: |
09f3d4e6 RD |
163 | wxSplitterEvent(wxEventType type = wxEVT_NULL, |
164 | wxSplitterWindow *splitter = NULL); | |
165 | ||
bb0054cd RD |
166 | int GetSashPosition(); |
167 | int GetX(); | |
168 | int GetY(); | |
169 | wxWindow* GetWindowBeingRemoved(); | |
170 | void SetSashPosition(int pos); | |
171 | } | |
172 | ||
173 | ||
174 | ||
175 | ||
9c039d08 RD |
176 | class wxSplitterWindow : public wxWindow { |
177 | public: | |
178 | wxSplitterWindow(wxWindow* parent, wxWindowID id, | |
b68dc582 RD |
179 | const wxPoint& point = wxDefaultPosition, |
180 | const wxSize& size = wxDefaultSize, | |
b639c3c5 | 181 | long style=wxSP_3D|wxCLIP_CHILDREN, |
137b5242 | 182 | const wxString& name = wxPySplitterNameStr); |
09f3d4e6 | 183 | %name(wxPreSplitterWindow)wxSplitterWindow(); |
9c039d08 | 184 | |
09f3d4e6 RD |
185 | bool Create(wxWindow* parent, wxWindowID id, |
186 | const wxPoint& point = wxDefaultPosition, | |
187 | const wxSize& size = wxDefaultSize, | |
188 | long style=wxSP_3D|wxCLIP_CHILDREN, | |
137b5242 | 189 | const wxString& name = wxPySplitterNameStr); |
9c039d08 | 190 | |
0122b7e3 | 191 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 192 | %pragma(python) addtomethod = "wxPreSplitterWindow:val._setOORInfo(val)" |
09f3d4e6 RD |
193 | |
194 | // Gets the only or left/top pane | |
195 | wxWindow *GetWindow1(); | |
196 | ||
197 | // Gets the right/bottom pane | |
198 | wxWindow *GetWindow2(); | |
199 | ||
200 | // Sets the split mode | |
201 | void SetSplitMode(int mode); | |
202 | ||
203 | // Gets the split mode | |
9c039d08 | 204 | int GetSplitMode(); |
09f3d4e6 RD |
205 | |
206 | // Initialize with one window | |
207 | void Initialize(wxWindow *window); | |
208 | ||
209 | // Associates the given window with window 2, drawing the appropriate sash | |
210 | // and changing the split mode. | |
211 | // Does nothing and returns FALSE if the window is already split. | |
212 | // A sashPosition of 0 means choose a default sash position, | |
213 | // negative sashPosition specifies the size of right/lower pane as it's | |
214 | // absolute value rather than the size of left/upper pane. | |
215 | virtual bool SplitVertically(wxWindow *window1, | |
216 | wxWindow *window2, | |
217 | int sashPosition = 0); | |
218 | virtual bool SplitHorizontally(wxWindow *window1, | |
219 | wxWindow *window2, | |
220 | int sashPosition = 0); | |
221 | ||
222 | // Removes the specified (or second) window from the view | |
223 | // Doesn't actually delete the window. | |
224 | bool Unsplit(wxWindow *toRemove = NULL); | |
225 | ||
226 | // Replaces one of the windows with another one (neither old nor new | |
227 | // parameter should be NULL) | |
228 | bool ReplaceWindow(wxWindow *winOld, wxWindow *winNew); | |
229 | ||
230 | // Is the window split? | |
9c039d08 RD |
231 | bool IsSplit(); |
232 | ||
09f3d4e6 | 233 | // Sets the sash size |
b639c3c5 | 234 | void SetSashSize(int width); |
09f3d4e6 RD |
235 | |
236 | // Sets the border size | |
237 | void SetBorderSize(int width); | |
238 | ||
239 | // Gets the sash size | |
240 | int GetSashSize(); | |
241 | ||
242 | // Gets the border size | |
243 | int GetBorderSize(); | |
244 | ||
245 | // Set the sash position | |
246 | void SetSashPosition(int position, bool redraw = TRUE); | |
247 | ||
248 | // Gets the sash position | |
249 | int GetSashPosition(); | |
250 | ||
251 | // If this is zero, we can remove panes by dragging the sash. | |
252 | void SetMinimumPaneSize(int min); | |
253 | int GetMinimumPaneSize(); | |
254 | ||
3bd1e033 RD |
255 | // Resizes subwindows |
256 | virtual void SizeWindows(); | |
257 | ||
258 | void SetNeedUpdating(bool needUpdating) { m_needUpdating = needUpdating; } | |
259 | bool GetNeedUpdating() const { return m_needUpdating ; } | |
260 | ||
9c039d08 RD |
261 | }; |
262 | ||
263 | //--------------------------------------------------------------------------- | |
264 | ||
b639c3c5 RD |
265 | #ifdef __WXMSW__ |
266 | ||
267 | enum { | |
268 | wxEVT_TASKBAR_MOVE, | |
269 | wxEVT_TASKBAR_LEFT_DOWN, | |
270 | wxEVT_TASKBAR_LEFT_UP, | |
271 | wxEVT_TASKBAR_RIGHT_DOWN, | |
272 | wxEVT_TASKBAR_RIGHT_UP, | |
273 | wxEVT_TASKBAR_LEFT_DCLICK, | |
274 | wxEVT_TASKBAR_RIGHT_DCLICK | |
275 | }; | |
9c039d08 RD |
276 | |
277 | ||
b639c3c5 RD |
278 | class wxTaskBarIcon : public wxEvtHandler { |
279 | public: | |
280 | wxTaskBarIcon(); | |
281 | ~wxTaskBarIcon(); | |
282 | ||
0122b7e3 RD |
283 | //%pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
284 | ||
c368d904 | 285 | // We still use the magic methods here since that is the way it is documented... |
b8b8dda7 RD |
286 | %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnMouseMove', wxEVT_TASKBAR_MOVE)" |
287 | %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonDown', wxEVT_TASKBAR_LEFT_DOWN)" | |
288 | %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonUp', wxEVT_TASKBAR_LEFT_UP)" | |
289 | %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonDown', wxEVT_TASKBAR_RIGHT_DOWN)" | |
290 | %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonUp', wxEVT_TASKBAR_RIGHT_UP)" | |
291 | %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonDClick',wxEVT_TASKBAR_LEFT_DCLICK)" | |
292 | %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonDClick',wxEVT_TASKBAR_RIGHT_DCLICK)" | |
b639c3c5 | 293 | |
137b5242 | 294 | bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxPyEmptyString); |
b639c3c5 | 295 | bool RemoveIcon(void); |
be4d9c1f | 296 | bool PopupMenu(wxMenu *menu); |
c368d904 RD |
297 | bool IsIconInstalled(); |
298 | bool IsOK(); | |
b639c3c5 RD |
299 | }; |
300 | #endif | |
301 | ||
0b85cc38 RD |
302 | //--------------------------------------------------------------------------- |
303 | //--------------------------------------------------------------------------- | |
304 | // wxPyWindow derives from wxWindow and adds support for overriding many of | |
305 | // the virtual methods in Python derived classes. | |
306 | ||
307 | // Do wxPyControl too. | |
308 | ||
309 | // %{ | |
310 | // class wxPyWindow : public wxWindow | |
311 | // { | |
312 | // DECLARE_DYNAMIC_CLASS(wxPyWindow) | |
313 | // public: | |
314 | // wxPyWindow(wxWindow* parent, const wxWindowID id, | |
315 | // const wxPoint& pos = wxDefaultPosition, | |
316 | // const wxSize& size = wxDefaultSize, | |
317 | // long style = 0, | |
318 | // const wxString& name = wxPyPanelNameStr) | |
319 | // : wxWindow(parent, id, pos, size, style, name) {} | |
320 | ||
321 | ||
322 | // // Which of these should be done??? | |
323 | // DoSetSize | |
324 | // DoGetSize | |
325 | // DoSetClientSize | |
326 | // DoGetClientSize | |
327 | // DoGetPosition | |
328 | // DoSetVirtualSize | |
329 | // DoGetVirtualSize | |
330 | ||
331 | // GetClientAreaOrigin | |
332 | // Fit | |
333 | // SetSizeHints | |
334 | // SetVirtualSizeHints | |
335 | // GetMaxSize | |
336 | // Show | |
337 | // Enable | |
338 | // SetFocus | |
339 | // SetFocusFromKbd | |
340 | // AcceptsFocus | |
341 | // AcceptsFocusFromKeyboard | |
342 | // GetDefaultItem | |
343 | // SetDefaultItem | |
344 | // IsTopLevel | |
345 | // AddChild | |
346 | // RemoveChild | |
347 | // Validate | |
348 | // TransferDataToWindow | |
349 | // TransferDataFromWindow | |
350 | // InitDialog | |
351 | // SetBackgroundColour | |
352 | // SetForegroundColour | |
353 | // GetCharHeight | |
354 | // GetCharWidth | |
355 | // DoClientToScreen | |
356 | // DoScreenToClient | |
357 | // DoHitTest | |
358 | // DoPopupMenu | |
359 | // DoSetToolTip | |
360 | // DoCaptureMouse | |
361 | // DoReleaseMouse | |
362 | // DoMoveWindow | |
363 | ||
364 | ||
365 | // PYPRIVATE; | |
366 | // }; | |
367 | ||
368 | ||
369 | // %} | |
370 | ||
371 | ||
7bf85405 | 372 | //--------------------------------------------------------------------------- |