]> git.saurik.com Git - wxWidgets.git/blame - utils/wxPython/src/windows2.i
it is now possible to add custom buttons into wxHtmlHelpFrame's toolbar
[wxWidgets.git] / utils / wxPython / src / windows2.i
CommitLineData
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
43enum {
44 wxGRID_TEXT_CTRL,
45 wxGRID_HSCROLL,
b639c3c5 46 wxGRID_VSCROLL
7bf85405
RD
47};
48
7bf85405
RD
49class wxGridCell {
50public:
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
72class wxGrid : public wxPanel {
73public:
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 92 void AdjustScrollbars();
b7e72427
RD
93 bool AppendCols(int n=1, int updateLabels=TRUE);
94 bool AppendRows(int n=1, int updateLabels=TRUE);
7bf85405
RD
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
1afc06c2 134 bool doSave = wxPyRestoreThread();
8bf5d46e 135 PyObject* pyCell = wxPyConstructObject(cell, "wxGridCell");
1afc06c2 136 wxPySaveThread(doSave);
8bf5d46e
RD
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 }
7bf85405
RD
147 wxColour& GetCellTextColour(int row, int col);
148 %name(GetDefCellTextColour)wxColour& GetCellTextColour();
b8b8dda7
RD
149 wxFont& GetCellTextFont(int row, int col);
150 %name(GetDefCellTextFont)wxFont& GetCellTextFont();
7bf85405
RD
151 wxString& GetCellValue(int row, int col);
152 int GetCols();
153 int GetColumnWidth(int col);
cf694132 154 wxRect GetCurrentRect();
7bf85405
RD
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();
b8b8dda7 163 wxFont& GetLabelTextFont();
7bf85405
RD
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
b639c3c5 175 void OnActivate(bool active);
7bf85405
RD
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);
b8b8dda7
RD
184 void SetCellTextFont(wxFont& font, int row, int col);
185 %name(SetDefCellTextFont)void SetCellTextFont(wxFont& font);
7bf85405
RD
186 void SetCellValue(const wxString& val, int row, int col);
187 void SetColumnWidth(int col, int width);
b8b8dda7 188 void SetDividerPen(wxPen& pen);
7bf85405
RD
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);
b8b8dda7 195 void SetLabelTextFont(wxFont& font);
7bf85405
RD
196 void SetLabelValue(int orientation, const wxString& value, int pos);
197 void SetRowHeight(int row, int height);
198
199 void UpdateDimensions();
8bf5d46e
RD
200
201 bool GetEditInPlace();
202 void SetEditInPlace(int edit = TRUE);
203
7bf85405
RD
204};
205
b639c3c5
RD
206
207class wxGridEvent : public wxEvent {
208public:
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;
1dc2f865
RD
216
217 int GetRow();
218 int GetCol();
219 wxPoint GetPosition();
220 bool ControlDown();
221 bool ShiftDown();
222 wxGridCell* GetCell();
b639c3c5
RD
223};
224
225
226enum {
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
7bf85405
RD
239//---------------------------------------------------------------------------
240
bb0054cd 241class wxNotebookEvent : public wxNotifyEvent {
7bf85405
RD
242public:
243 int GetSelection();
244 int GetOldSelection();
bb0054cd
RD
245 void SetOldSelection(int page);
246 void SetSelection(int page);
7bf85405
RD
247};
248
249
250
251class wxNotebook : public wxControl {
252public:
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
b8b8dda7 260 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 261
7bf85405
RD
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);
cf694132 277 bool RemovePage(int nPage);
7bf85405
RD
278 bool DeleteAllPages();
279 bool AddPage(/*wxNotebookPage*/ wxWindow *pPage,
280 const wxString& strText,
cf694132 281 int bSelect = FALSE,
7bf85405 282 int imageId = -1);
fb5e0af0 283#ifdef __WXMSW__
7bf85405
RD
284 bool InsertPage(int nPage,
285 /*wxNotebookPage*/ wxWindow *pPage,
286 const wxString& strText,
287 bool bSelect = FALSE,
288 int imageId = -1);
fb5e0af0 289#endif
bb0054cd 290 /*wxNotebookPage*/ wxWindow *GetPage(int nPage);
7bf85405 291
cf694132
RD
292 %addmethods {
293 void ResizeChildren() {
294 wxSizeEvent evt(self->GetClientSize());
4cd9591a 295 self->GetEventHandler()->ProcessEvent(evt);
cf694132
RD
296 }
297 }
298
299
7bf85405
RD
300};
301
9c039d08
RD
302//---------------------------------------------------------------------------
303
bb0054cd
RD
304class wxSplitterEvent : public wxCommandEvent {
305public:
306 int GetSashPosition();
307 int GetX();
308 int GetY();
309 wxWindow* GetWindowBeingRemoved();
310 void SetSashPosition(int pos);
311}
312
313
314
315
9c039d08
RD
316class wxSplitterWindow : public wxWindow {
317public:
318 wxSplitterWindow(wxWindow* parent, wxWindowID id,
319 const wxPoint& point = wxPyDefaultPosition,
320 const wxSize& size = wxPyDefaultSize,
b639c3c5 321 long style=wxSP_3D|wxCLIP_CHILDREN,
9c039d08
RD
322 char* name = "splitterWindow");
323
b8b8dda7 324 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 325
b639c3c5 326 int GetBorderSize();
9c039d08
RD
327 int GetMinimumPaneSize();
328 int GetSashPosition();
b639c3c5 329 int GetSashSize();
9c039d08
RD
330 int GetSplitMode();
331 wxWindow* GetWindow1();
332 wxWindow* GetWindow2();
333 void Initialize(wxWindow* window);
334 bool IsSplit();
335
9d8bd15f 336 bool ReplaceWindow(wxWindow * winOld, wxWindow * winNew);
b639c3c5 337 void SetBorderSize(int width);
9c039d08 338 void SetSashPosition(int position, int redraw = TRUE);
b639c3c5 339 void SetSashSize(int width);
9c039d08
RD
340 void SetMinimumPaneSize(int paneSize);
341 void SetSplitMode(int mode);
4464bbee
RD
342 bool SplitHorizontally(wxWindow* window1, wxWindow* window2, int sashPosition = 0);
343 bool SplitVertically(wxWindow* window1, wxWindow* window2, int sashPosition = 0);
9c039d08
RD
344 bool Unsplit(wxWindow* toRemove = NULL);
345};
346
347//---------------------------------------------------------------------------
348
b639c3c5
RD
349#ifdef __WXMSW__
350
351enum {
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};
9c039d08
RD
360
361
b639c3c5
RD
362class wxTaskBarIcon : public wxEvtHandler {
363public:
364 wxTaskBarIcon();
365 ~wxTaskBarIcon();
366
b8b8dda7
RD
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)"
b639c3c5
RD
374
375 bool SetIcon(const wxIcon& icon, const char* tooltip = "");
376 bool RemoveIcon(void);
be4d9c1f
RD
377 bool PopupMenu(wxMenu *menu);
378
b639c3c5
RD
379};
380#endif
381
7bf85405 382//---------------------------------------------------------------------------