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