]>
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> |
b639c3c5 RD |
22 | #ifdef __WXMSW__ |
23 | #include <wx/msw/taskbar.h> | |
24 | #endif | |
7bf85405 RD |
25 | %} |
26 | ||
27 | //---------------------------------------------------------------------- | |
28 | ||
29 | %include typemaps.i | |
30 | %include my_typemaps.i | |
31 | ||
32 | // Import some definitions of other classes, etc. | |
33 | %import _defs.i | |
34 | %import misc.i | |
35 | %import gdi.i | |
36 | %import windows.i | |
37 | %import controls.i | |
38 | %import events.i | |
39 | ||
b8b8dda7 | 40 | %pragma(python) code = "import wx" |
9c039d08 | 41 | |
7bf85405 RD |
42 | //--------------------------------------------------------------------------- |
43 | ||
f6bcfd97 | 44 | #ifdef OLD_GRID |
b639c3c5 | 45 | |
7bf85405 RD |
46 | enum { |
47 | wxGRID_TEXT_CTRL, | |
48 | wxGRID_HSCROLL, | |
b639c3c5 | 49 | wxGRID_VSCROLL |
7bf85405 RD |
50 | }; |
51 | ||
7bf85405 RD |
52 | class wxGridCell { |
53 | public: | |
b639c3c5 RD |
54 | wxGridCell(); |
55 | ~wxGridCell(); | |
56 | ||
7bf85405 | 57 | wxString& GetTextValue(); |
b639c3c5 | 58 | void SetTextValue(const wxString& str); |
b8b8dda7 RD |
59 | wxFont& GetFont(); |
60 | void SetFont(wxFont& f); | |
7bf85405 | 61 | wxColour& GetTextColour(); |
b639c3c5 | 62 | void SetTextColour(const wxColour& colour); |
7bf85405 | 63 | wxColour& GetBackgroundColour(); |
b639c3c5 | 64 | void SetBackgroundColour(const wxColour& colour); |
b8b8dda7 | 65 | wxBrush& GetBackgroundBrush(); |
b639c3c5 RD |
66 | int GetAlignment(); |
67 | void SetAlignment(int align); | |
68 | wxBitmap* GetCellBitmap(); | |
b8b8dda7 | 69 | void SetCellBitmap(wxBitmap* bitmap); |
7bf85405 RD |
70 | }; |
71 | ||
72 | ||
73 | ||
74 | ||
7bf85405 RD |
75 | class wxGrid : public wxPanel { |
76 | public: | |
77 | wxGrid(wxWindow* parent, wxWindowID id, | |
78 | const wxPoint& pos=wxPyDefaultPosition, | |
79 | const wxSize& size=wxPyDefaultSize, | |
80 | long style=0, | |
81 | char* name="grid"); | |
82 | ||
f6bcfd97 BP |
83 | %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)" |
84 | %pragma(python) addtomethod = "__init__:#wx._checkForCallback(self, 'OnSelectCell', wxEVT_GRID_SELECT_CELL)" | |
85 | %pragma(python) addtomethod = "__init__:#wx._checkForCallback(self, 'OnCreateCell', wxEVT_GRID_CREATE_CELL)" | |
86 | %pragma(python) addtomethod = "__init__:#wx._checkForCallback(self, 'OnChangeLabels', wxEVT_GRID_CHANGE_LABELS)" | |
87 | %pragma(python) addtomethod = "__init__:#wx._checkForCallback(self, 'OnChangeSelectionLabel', wxEVT_GRID_CHANGE_SEL_LABEL)" | |
88 | %pragma(python) addtomethod = "__init__:#wx._checkForCallback(self, 'OnCellChange', wxEVT_GRID_CELL_CHANGE)" | |
89 | %pragma(python) addtomethod = "__init__:#wx._checkForCallback(self, 'OnCellLeftClick', wxEVT_GRID_CELL_LCLICK)" | |
90 | %pragma(python) addtomethod = "__init__:#wx._checkForCallback(self, 'OnCellRightClick', wxEVT_GRID_CELL_RCLICK)" | |
91 | %pragma(python) addtomethod = "__init__:#wx._checkForCallback(self, 'OnLabelLeftClick', wxEVT_GRID_LABEL_LCLICK)" | |
92 | %pragma(python) addtomethod = "__init__:#wx._checkForCallback(self, 'OnLabelRightClick', wxEVT_GRID_LABEL_RCLICK)" | |
b639c3c5 | 93 | |
9c039d08 | 94 | |
7bf85405 | 95 | void AdjustScrollbars(); |
b7e72427 RD |
96 | bool AppendCols(int n=1, int updateLabels=TRUE); |
97 | bool AppendRows(int n=1, int updateLabels=TRUE); | |
7bf85405 RD |
98 | void BeginBatch(); |
99 | bool CellHitTest(int x, int y, int *OUTPUT, int *OUTPUT); | |
100 | ||
101 | %addmethods { | |
102 | // TODO: For now we are just ignoring the initial cellValues | |
103 | // and widths. Add support for loading them from | |
104 | // Python sequence objects. | |
105 | bool CreateGrid(int rows, int cols, | |
106 | //PyObject* cellValues = NULL, | |
107 | //PyObject* widths = NULL, | |
108 | short defaultWidth = wxGRID_DEFAULT_CELL_WIDTH, | |
109 | short defaultHeight = wxGRID_DEFAULT_CELL_HEIGHT) { | |
110 | return self->CreateGrid(rows, cols, NULL, NULL, | |
111 | defaultWidth, defaultHeight); | |
112 | } | |
113 | } | |
114 | ||
115 | bool CurrentCellVisible(); | |
116 | bool DeleteCols(int pos=0, int n=1, bool updateLabels=TRUE); | |
117 | bool DeleteRows(int pos=0, int n=1, bool updateLabels=TRUE); | |
118 | void EndBatch(); | |
119 | ||
120 | int GetBatchCount(); | |
121 | wxGridCell* GetCell(int row, int col); | |
122 | int GetCellAlignment(int row, int col); | |
123 | %name(GetDefCellAlignment)int GetCellAlignment(); | |
124 | wxColour& GetCellBackgroundColour(int row, int col); | |
0699c864 | 125 | %name(GetDefCellBackgroundColour) wxColour& GetCellBackgroundColour(); |
8bf5d46e | 126 | |
7bf85405 | 127 | //wxGridCell *** GetCells(); |
8bf5d46e RD |
128 | %addmethods { |
129 | PyObject* GetCells() { | |
130 | int row, col; | |
131 | PyObject* rows = PyList_New(0); | |
132 | for (row=0; row < self->GetRows(); row++) { | |
133 | PyObject* rowList = PyList_New(0); | |
134 | for (col=0; col < self->GetCols(); col++) { | |
135 | wxGridCell* cell = self->GetCell(row, col); | |
136 | ||
1afc06c2 | 137 | bool doSave = wxPyRestoreThread(); |
8bf5d46e | 138 | PyObject* pyCell = wxPyConstructObject(cell, "wxGridCell"); |
1afc06c2 | 139 | wxPySaveThread(doSave); |
8bf5d46e RD |
140 | |
141 | if (PyList_Append(rowList, pyCell) == -1) | |
142 | return NULL; | |
143 | } | |
144 | if (PyList_Append(rows, rowList) == -1) | |
145 | return NULL; | |
146 | } | |
147 | return rows; | |
148 | } | |
149 | } | |
7bf85405 RD |
150 | wxColour& GetCellTextColour(int row, int col); |
151 | %name(GetDefCellTextColour)wxColour& GetCellTextColour(); | |
b8b8dda7 RD |
152 | wxFont& GetCellTextFont(int row, int col); |
153 | %name(GetDefCellTextFont)wxFont& GetCellTextFont(); | |
7bf85405 RD |
154 | wxString& GetCellValue(int row, int col); |
155 | int GetCols(); | |
156 | int GetColumnWidth(int col); | |
cf694132 | 157 | wxRect GetCurrentRect(); |
7bf85405 RD |
158 | int GetCursorColumn(); |
159 | int GetCursorRow(); | |
160 | bool GetEditable(); | |
161 | wxScrollBar * GetHorizScrollBar(); | |
162 | int GetLabelAlignment(int orientation); | |
163 | wxColour& GetLabelBackgroundColour(); | |
164 | int GetLabelSize(int orientation); | |
165 | wxColour& GetLabelTextColour(); | |
b8b8dda7 | 166 | wxFont& GetLabelTextFont(); |
7bf85405 RD |
167 | wxString& GetLabelValue(int orientation, int pos); |
168 | int GetRowHeight(int row); | |
169 | int GetRows(); | |
170 | int GetScrollPosX(); | |
171 | int GetScrollPosY(); | |
172 | wxTextCtrl* GetTextItem(); | |
173 | wxScrollBar* GetVertScrollBar(); | |
174 | ||
175 | bool InsertCols(int pos=0, int n=1, bool updateLabels=TRUE); | |
176 | bool InsertRows(int pos=0, int n=1, bool updateLabels=TRUE); | |
177 | ||
b639c3c5 | 178 | void OnActivate(bool active); |
7bf85405 RD |
179 | |
180 | void SetCellAlignment(int alignment, int row, int col); | |
181 | %name(SetDefCellAlignment)void SetCellAlignment(int alignment); | |
182 | void SetCellBackgroundColour(const wxColour& colour, int row, int col); | |
183 | %name(SetDefCellBackgroundColour) | |
184 | void SetCellBackgroundColour(const wxColour& colour); | |
185 | void SetCellTextColour(const wxColour& colour, int row, int col); | |
186 | %name(SetDefCellTextColour)void SetCellTextColour(const wxColour& colour); | |
b8b8dda7 RD |
187 | void SetCellTextFont(wxFont& font, int row, int col); |
188 | %name(SetDefCellTextFont)void SetCellTextFont(wxFont& font); | |
7bf85405 RD |
189 | void SetCellValue(const wxString& val, int row, int col); |
190 | void SetColumnWidth(int col, int width); | |
b8b8dda7 | 191 | void SetDividerPen(wxPen& pen); |
7bf85405 RD |
192 | void SetEditable(bool editable); |
193 | void SetGridCursor(int row, int col); | |
194 | void SetLabelAlignment(int orientation, int alignment); | |
195 | void SetLabelBackgroundColour(const wxColour& value); | |
196 | void SetLabelSize(int orientation, int size); | |
197 | void SetLabelTextColour(const wxColour& value); | |
b8b8dda7 | 198 | void SetLabelTextFont(wxFont& font); |
7bf85405 RD |
199 | void SetLabelValue(int orientation, const wxString& value, int pos); |
200 | void SetRowHeight(int row, int height); | |
201 | ||
202 | void UpdateDimensions(); | |
8bf5d46e RD |
203 | |
204 | bool GetEditInPlace(); | |
205 | void SetEditInPlace(int edit = TRUE); | |
206 | ||
7bf85405 RD |
207 | }; |
208 | ||
b639c3c5 RD |
209 | |
210 | class wxGridEvent : public wxEvent { | |
211 | public: | |
212 | int m_row; | |
213 | int m_col; | |
214 | int m_x; | |
215 | int m_y; | |
216 | bool m_control; | |
217 | bool m_shift; | |
218 | wxGridCell* m_cell; | |
1dc2f865 RD |
219 | |
220 | int GetRow(); | |
221 | int GetCol(); | |
222 | wxPoint GetPosition(); | |
223 | bool ControlDown(); | |
224 | bool ShiftDown(); | |
225 | wxGridCell* GetCell(); | |
b639c3c5 RD |
226 | }; |
227 | ||
228 | ||
229 | enum { | |
230 | wxEVT_GRID_SELECT_CELL, | |
231 | wxEVT_GRID_CREATE_CELL, | |
232 | wxEVT_GRID_CHANGE_LABELS, | |
233 | wxEVT_GRID_CHANGE_SEL_LABEL, | |
234 | wxEVT_GRID_CELL_CHANGE, | |
235 | wxEVT_GRID_CELL_LCLICK, | |
236 | wxEVT_GRID_CELL_RCLICK, | |
237 | wxEVT_GRID_LABEL_LCLICK, | |
238 | wxEVT_GRID_LABEL_RCLICK, | |
239 | }; | |
240 | ||
f6bcfd97 | 241 | #endif |
b639c3c5 | 242 | |
7bf85405 RD |
243 | //--------------------------------------------------------------------------- |
244 | ||
bb0054cd | 245 | class wxNotebookEvent : public wxNotifyEvent { |
7bf85405 RD |
246 | public: |
247 | int GetSelection(); | |
248 | int GetOldSelection(); | |
bb0054cd RD |
249 | void SetOldSelection(int page); |
250 | void SetSelection(int page); | |
7bf85405 RD |
251 | }; |
252 | ||
253 | ||
254 | ||
255 | class wxNotebook : public wxControl { | |
256 | public: | |
257 | wxNotebook(wxWindow *parent, | |
258 | wxWindowID id, | |
259 | const wxPoint& pos = wxPyDefaultPosition, | |
260 | const wxSize& size = wxPyDefaultSize, | |
261 | long style = 0, | |
262 | char* name = "notebook"); | |
263 | ||
f6bcfd97 | 264 | %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)" |
9c039d08 | 265 | |
7bf85405 RD |
266 | int GetPageCount(); |
267 | int SetSelection(int nPage); | |
268 | void AdvanceSelection(bool bForward = TRUE); | |
269 | int GetSelection(); | |
270 | bool SetPageText(int nPage, const wxString& strText); | |
271 | wxString GetPageText(int nPage) const; | |
272 | void SetImageList(wxImageList* imageList); | |
273 | wxImageList* GetImageList(); | |
274 | int GetPageImage(int nPage); | |
275 | bool SetPageImage(int nPage, int nImage); | |
276 | int GetRowCount(); | |
277 | ||
278 | // LINK ERROR: void SetPageSize(const wxSize& size); | |
279 | // LINK ERROR: void SetPadding(const wxSize& padding); | |
280 | bool DeletePage(int nPage); | |
cf694132 | 281 | bool RemovePage(int nPage); |
7bf85405 RD |
282 | bool DeleteAllPages(); |
283 | bool AddPage(/*wxNotebookPage*/ wxWindow *pPage, | |
284 | const wxString& strText, | |
cf694132 | 285 | int bSelect = FALSE, |
7bf85405 | 286 | int imageId = -1); |
fb5e0af0 | 287 | #ifdef __WXMSW__ |
7bf85405 RD |
288 | bool InsertPage(int nPage, |
289 | /*wxNotebookPage*/ wxWindow *pPage, | |
290 | const wxString& strText, | |
291 | bool bSelect = FALSE, | |
292 | int imageId = -1); | |
fb5e0af0 | 293 | #endif |
bb0054cd | 294 | /*wxNotebookPage*/ wxWindow *GetPage(int nPage); |
7bf85405 | 295 | |
cf694132 RD |
296 | %addmethods { |
297 | void ResizeChildren() { | |
298 | wxSizeEvent evt(self->GetClientSize()); | |
4cd9591a | 299 | self->GetEventHandler()->ProcessEvent(evt); |
cf694132 RD |
300 | } |
301 | } | |
302 | ||
303 | ||
7bf85405 RD |
304 | }; |
305 | ||
9c039d08 RD |
306 | //--------------------------------------------------------------------------- |
307 | ||
f6bcfd97 BP |
308 | |
309 | enum | |
310 | { | |
311 | wxSPLIT_HORIZONTAL, | |
312 | wxSPLIT_VERTICAL, | |
313 | wxSPLIT_DRAG_NONE, | |
314 | wxSPLIT_DRAG_DRAGGING, | |
315 | wxSPLIT_DRAG_LEFT_DOWN | |
316 | ||
317 | }; | |
318 | ||
319 | ||
bb0054cd RD |
320 | class wxSplitterEvent : public wxCommandEvent { |
321 | public: | |
322 | int GetSashPosition(); | |
323 | int GetX(); | |
324 | int GetY(); | |
325 | wxWindow* GetWindowBeingRemoved(); | |
326 | void SetSashPosition(int pos); | |
327 | } | |
328 | ||
329 | ||
330 | ||
331 | ||
9c039d08 RD |
332 | class wxSplitterWindow : public wxWindow { |
333 | public: | |
334 | wxSplitterWindow(wxWindow* parent, wxWindowID id, | |
335 | const wxPoint& point = wxPyDefaultPosition, | |
336 | const wxSize& size = wxPyDefaultSize, | |
b639c3c5 | 337 | long style=wxSP_3D|wxCLIP_CHILDREN, |
9c039d08 RD |
338 | char* name = "splitterWindow"); |
339 | ||
f6bcfd97 | 340 | %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)" |
9c039d08 | 341 | |
b639c3c5 | 342 | int GetBorderSize(); |
9c039d08 RD |
343 | int GetMinimumPaneSize(); |
344 | int GetSashPosition(); | |
b639c3c5 | 345 | int GetSashSize(); |
9c039d08 RD |
346 | int GetSplitMode(); |
347 | wxWindow* GetWindow1(); | |
348 | wxWindow* GetWindow2(); | |
349 | void Initialize(wxWindow* window); | |
350 | bool IsSplit(); | |
351 | ||
9d8bd15f | 352 | bool ReplaceWindow(wxWindow * winOld, wxWindow * winNew); |
b639c3c5 | 353 | void SetBorderSize(int width); |
9c039d08 | 354 | void SetSashPosition(int position, int redraw = TRUE); |
b639c3c5 | 355 | void SetSashSize(int width); |
9c039d08 RD |
356 | void SetMinimumPaneSize(int paneSize); |
357 | void SetSplitMode(int mode); | |
4464bbee RD |
358 | bool SplitHorizontally(wxWindow* window1, wxWindow* window2, int sashPosition = 0); |
359 | bool SplitVertically(wxWindow* window1, wxWindow* window2, int sashPosition = 0); | |
9c039d08 RD |
360 | bool Unsplit(wxWindow* toRemove = NULL); |
361 | }; | |
362 | ||
363 | //--------------------------------------------------------------------------- | |
364 | ||
b639c3c5 RD |
365 | #ifdef __WXMSW__ |
366 | ||
367 | enum { | |
368 | wxEVT_TASKBAR_MOVE, | |
369 | wxEVT_TASKBAR_LEFT_DOWN, | |
370 | wxEVT_TASKBAR_LEFT_UP, | |
371 | wxEVT_TASKBAR_RIGHT_DOWN, | |
372 | wxEVT_TASKBAR_RIGHT_UP, | |
373 | wxEVT_TASKBAR_LEFT_DCLICK, | |
374 | wxEVT_TASKBAR_RIGHT_DCLICK | |
375 | }; | |
9c039d08 RD |
376 | |
377 | ||
b639c3c5 RD |
378 | class wxTaskBarIcon : public wxEvtHandler { |
379 | public: | |
380 | wxTaskBarIcon(); | |
381 | ~wxTaskBarIcon(); | |
382 | ||
b8b8dda7 RD |
383 | %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnMouseMove', wxEVT_TASKBAR_MOVE)" |
384 | %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonDown', wxEVT_TASKBAR_LEFT_DOWN)" | |
385 | %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonUp', wxEVT_TASKBAR_LEFT_UP)" | |
386 | %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonDown', wxEVT_TASKBAR_RIGHT_DOWN)" | |
387 | %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonUp', wxEVT_TASKBAR_RIGHT_UP)" | |
388 | %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonDClick',wxEVT_TASKBAR_LEFT_DCLICK)" | |
389 | %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonDClick',wxEVT_TASKBAR_RIGHT_DCLICK)" | |
b639c3c5 RD |
390 | |
391 | bool SetIcon(const wxIcon& icon, const char* tooltip = ""); | |
392 | bool RemoveIcon(void); | |
be4d9c1f RD |
393 | bool PopupMenu(wxMenu *menu); |
394 | ||
b639c3c5 RD |
395 | }; |
396 | #endif | |
397 | ||
7bf85405 | 398 | //--------------------------------------------------------------------------- |