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