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