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