]>
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); | |
33 | ||
34 | static const wxChar* wxSplitterNameStr = wxT("splitter"); | |
35 | DECLARE_DEF_STRING(SplitterNameStr); | |
36 | static const wxString wxPyEmptyString(wxT("")); | |
37 | %} | |
38 | ||
39 | //---------------------------------------------------------------------- | |
40 | ||
7bf85405 RD |
41 | %include typemaps.i |
42 | %include my_typemaps.i | |
43 | ||
44 | // Import some definitions of other classes, etc. | |
45 | %import _defs.i | |
46 | %import misc.i | |
47 | %import gdi.i | |
48 | %import windows.i | |
49 | %import controls.i | |
50 | %import events.i | |
51 | ||
b8b8dda7 | 52 | %pragma(python) code = "import wx" |
9c039d08 | 53 | |
7bf85405 RD |
54 | //--------------------------------------------------------------------------- |
55 | ||
1b62f00d RD |
56 | enum { |
57 | /* notebook control event types */ | |
58 | wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, | |
59 | wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, | |
60 | }; | |
61 | ||
62 | ||
bb0054cd | 63 | class wxNotebookEvent : public wxNotifyEvent { |
7bf85405 | 64 | public: |
09f3d4e6 RD |
65 | wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, |
66 | int nSel = -1, int nOldSel = -1); | |
67 | ||
7bf85405 RD |
68 | int GetSelection(); |
69 | int GetOldSelection(); | |
bb0054cd RD |
70 | void SetOldSelection(int page); |
71 | void SetSelection(int page); | |
7bf85405 RD |
72 | }; |
73 | ||
74 | ||
75 | ||
76 | class wxNotebook : public wxControl { | |
77 | public: | |
78 | wxNotebook(wxWindow *parent, | |
79 | wxWindowID id, | |
b68dc582 RD |
80 | const wxPoint& pos = wxDefaultPosition, |
81 | const wxSize& size = wxDefaultSize, | |
7bf85405 | 82 | long style = 0, |
137b5242 | 83 | const wxString& name = wxPyNOTEBOOK_NAME); |
09f3d4e6 | 84 | %name(wxPreNotebook)wxNotebook(); |
7bf85405 | 85 | |
09f3d4e6 RD |
86 | bool Create(wxWindow *parent, |
87 | wxWindowID id, | |
88 | const wxPoint& pos = wxDefaultPosition, | |
89 | const wxSize& size = wxDefaultSize, | |
90 | long style = 0, | |
137b5242 | 91 | const wxString& name = wxPyNOTEBOOK_NAME); |
9c039d08 | 92 | |
0122b7e3 | 93 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 94 | %pragma(python) addtomethod = "wxPreNotebook:val._setOORInfo(val)" |
0122b7e3 | 95 | |
7bf85405 RD |
96 | int GetPageCount(); |
97 | int SetSelection(int nPage); | |
98 | void AdvanceSelection(bool bForward = TRUE); | |
99 | int GetSelection(); | |
100 | bool SetPageText(int nPage, const wxString& strText); | |
101 | wxString GetPageText(int nPage) const; | |
949853a4 | 102 | |
7bf85405 | 103 | void SetImageList(wxImageList* imageList); |
949853a4 RD |
104 | void AssignImageList(wxImageList *imageList) ; |
105 | %pragma(python) addtomethod = "AssignImageList:_args[0].thisown = 0" | |
106 | ||
7bf85405 RD |
107 | wxImageList* GetImageList(); |
108 | int GetPageImage(int nPage); | |
109 | bool SetPageImage(int nPage, int nImage); | |
110 | int GetRowCount(); | |
111 | ||
c368d904 RD |
112 | void SetPageSize(const wxSize& size); |
113 | void SetPadding(const wxSize& padding); | |
7bf85405 | 114 | bool DeletePage(int nPage); |
cf694132 | 115 | bool RemovePage(int nPage); |
7bf85405 RD |
116 | bool DeleteAllPages(); |
117 | bool AddPage(/*wxNotebookPage*/ wxWindow *pPage, | |
118 | const wxString& strText, | |
cf694132 | 119 | int bSelect = FALSE, |
7bf85405 RD |
120 | int imageId = -1); |
121 | bool InsertPage(int nPage, | |
122 | /*wxNotebookPage*/ wxWindow *pPage, | |
123 | const wxString& strText, | |
124 | bool bSelect = FALSE, | |
125 | int imageId = -1); | |
bb0054cd | 126 | /*wxNotebookPage*/ wxWindow *GetPage(int nPage); |
7bf85405 | 127 | |
cf694132 RD |
128 | %addmethods { |
129 | void ResizeChildren() { | |
130 | wxSizeEvent evt(self->GetClientSize()); | |
4cd9591a | 131 | self->GetEventHandler()->ProcessEvent(evt); |
cf694132 RD |
132 | } |
133 | } | |
134 | ||
135 | ||
7bf85405 RD |
136 | }; |
137 | ||
9c039d08 RD |
138 | //--------------------------------------------------------------------------- |
139 | ||
f6bcfd97 | 140 | |
1b62f00d RD |
141 | enum { |
142 | /* splitter window events */ | |
143 | wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, | |
144 | wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, | |
145 | wxEVT_COMMAND_SPLITTER_UNSPLIT, | |
146 | wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, | |
147 | }; | |
148 | ||
149 | ||
f6bcfd97 BP |
150 | enum |
151 | { | |
152 | wxSPLIT_HORIZONTAL, | |
153 | wxSPLIT_VERTICAL, | |
154 | wxSPLIT_DRAG_NONE, | |
155 | wxSPLIT_DRAG_DRAGGING, | |
156 | wxSPLIT_DRAG_LEFT_DOWN | |
f6bcfd97 BP |
157 | }; |
158 | ||
159 | ||
bb0054cd RD |
160 | class wxSplitterEvent : public wxCommandEvent { |
161 | public: | |
09f3d4e6 RD |
162 | wxSplitterEvent(wxEventType type = wxEVT_NULL, |
163 | wxSplitterWindow *splitter = NULL); | |
164 | ||
bb0054cd RD |
165 | int GetSashPosition(); |
166 | int GetX(); | |
167 | int GetY(); | |
168 | wxWindow* GetWindowBeingRemoved(); | |
169 | void SetSashPosition(int pos); | |
170 | } | |
171 | ||
172 | ||
173 | ||
174 | ||
9c039d08 RD |
175 | class wxSplitterWindow : public wxWindow { |
176 | public: | |
177 | wxSplitterWindow(wxWindow* parent, wxWindowID id, | |
b68dc582 RD |
178 | const wxPoint& point = wxDefaultPosition, |
179 | const wxSize& size = wxDefaultSize, | |
b639c3c5 | 180 | long style=wxSP_3D|wxCLIP_CHILDREN, |
137b5242 | 181 | const wxString& name = wxPySplitterNameStr); |
09f3d4e6 | 182 | %name(wxPreSplitterWindow)wxSplitterWindow(); |
9c039d08 | 183 | |
09f3d4e6 RD |
184 | bool Create(wxWindow* parent, wxWindowID id, |
185 | const wxPoint& point = wxDefaultPosition, | |
186 | const wxSize& size = wxDefaultSize, | |
187 | long style=wxSP_3D|wxCLIP_CHILDREN, | |
137b5242 | 188 | const wxString& name = wxPySplitterNameStr); |
9c039d08 | 189 | |
0122b7e3 | 190 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 191 | %pragma(python) addtomethod = "wxPreSplitterWindow:val._setOORInfo(val)" |
09f3d4e6 RD |
192 | |
193 | // Gets the only or left/top pane | |
194 | wxWindow *GetWindow1(); | |
195 | ||
196 | // Gets the right/bottom pane | |
197 | wxWindow *GetWindow2(); | |
198 | ||
199 | // Sets the split mode | |
200 | void SetSplitMode(int mode); | |
201 | ||
202 | // Gets the split mode | |
9c039d08 | 203 | int GetSplitMode(); |
09f3d4e6 RD |
204 | |
205 | // Initialize with one window | |
206 | void Initialize(wxWindow *window); | |
207 | ||
208 | // Associates the given window with window 2, drawing the appropriate sash | |
209 | // and changing the split mode. | |
210 | // Does nothing and returns FALSE if the window is already split. | |
211 | // A sashPosition of 0 means choose a default sash position, | |
212 | // negative sashPosition specifies the size of right/lower pane as it's | |
213 | // absolute value rather than the size of left/upper pane. | |
214 | virtual bool SplitVertically(wxWindow *window1, | |
215 | wxWindow *window2, | |
216 | int sashPosition = 0); | |
217 | virtual bool SplitHorizontally(wxWindow *window1, | |
218 | wxWindow *window2, | |
219 | int sashPosition = 0); | |
220 | ||
221 | // Removes the specified (or second) window from the view | |
222 | // Doesn't actually delete the window. | |
223 | bool Unsplit(wxWindow *toRemove = NULL); | |
224 | ||
225 | // Replaces one of the windows with another one (neither old nor new | |
226 | // parameter should be NULL) | |
227 | bool ReplaceWindow(wxWindow *winOld, wxWindow *winNew); | |
228 | ||
229 | // Is the window split? | |
9c039d08 RD |
230 | bool IsSplit(); |
231 | ||
09f3d4e6 | 232 | // Sets the sash size |
b639c3c5 | 233 | void SetSashSize(int width); |
09f3d4e6 RD |
234 | |
235 | // Sets the border size | |
236 | void SetBorderSize(int width); | |
237 | ||
238 | // Gets the sash size | |
239 | int GetSashSize(); | |
240 | ||
241 | // Gets the border size | |
242 | int GetBorderSize(); | |
243 | ||
244 | // Set the sash position | |
245 | void SetSashPosition(int position, bool redraw = TRUE); | |
246 | ||
247 | // Gets the sash position | |
248 | int GetSashPosition(); | |
249 | ||
250 | // If this is zero, we can remove panes by dragging the sash. | |
251 | void SetMinimumPaneSize(int min); | |
252 | int GetMinimumPaneSize(); | |
253 | ||
9c039d08 RD |
254 | }; |
255 | ||
256 | //--------------------------------------------------------------------------- | |
257 | ||
b639c3c5 RD |
258 | #ifdef __WXMSW__ |
259 | ||
260 | enum { | |
261 | wxEVT_TASKBAR_MOVE, | |
262 | wxEVT_TASKBAR_LEFT_DOWN, | |
263 | wxEVT_TASKBAR_LEFT_UP, | |
264 | wxEVT_TASKBAR_RIGHT_DOWN, | |
265 | wxEVT_TASKBAR_RIGHT_UP, | |
266 | wxEVT_TASKBAR_LEFT_DCLICK, | |
267 | wxEVT_TASKBAR_RIGHT_DCLICK | |
268 | }; | |
9c039d08 RD |
269 | |
270 | ||
b639c3c5 RD |
271 | class wxTaskBarIcon : public wxEvtHandler { |
272 | public: | |
273 | wxTaskBarIcon(); | |
274 | ~wxTaskBarIcon(); | |
275 | ||
0122b7e3 RD |
276 | //%pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
277 | ||
c368d904 | 278 | // We still use the magic methods here since that is the way it is documented... |
b8b8dda7 RD |
279 | %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnMouseMove', wxEVT_TASKBAR_MOVE)" |
280 | %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonDown', wxEVT_TASKBAR_LEFT_DOWN)" | |
281 | %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonUp', wxEVT_TASKBAR_LEFT_UP)" | |
282 | %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonDown', wxEVT_TASKBAR_RIGHT_DOWN)" | |
283 | %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonUp', wxEVT_TASKBAR_RIGHT_UP)" | |
284 | %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonDClick',wxEVT_TASKBAR_LEFT_DCLICK)" | |
285 | %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonDClick',wxEVT_TASKBAR_RIGHT_DCLICK)" | |
b639c3c5 | 286 | |
137b5242 | 287 | bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxPyEmptyString); |
b639c3c5 | 288 | bool RemoveIcon(void); |
be4d9c1f | 289 | bool PopupMenu(wxMenu *menu); |
c368d904 RD |
290 | bool IsIconInstalled(); |
291 | bool IsOK(); | |
b639c3c5 RD |
292 | }; |
293 | #endif | |
294 | ||
7bf85405 | 295 | //--------------------------------------------------------------------------- |