1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG definitions of MORE window classes
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
18 #include <wx/notebook.h>
19 #include <wx/splitter.h>
21 #include <wx/msw/taskbar.h>
25 //----------------------------------------------------------------------
28 %include my_typemaps.i
30 // Import some definitions of other classes, etc.
38 %pragma(python) code = "import wx"
40 //---------------------------------------------------------------------------
54 wxString& GetTextValue();
55 void SetTextValue(const wxString& str);
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();
64 void SetAlignment(int align);
65 wxBitmap* GetCellBitmap();
66 void SetCellBitmap(wxBitmap* bitmap);
72 class wxGrid : public wxPanel {
74 wxGrid(wxWindow* parent, wxWindowID id,
75 const wxPoint& pos=wxPyDefaultPosition,
76 const wxSize& size=wxPyDefaultSize,
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)"
92 void AdjustScrollbars();
93 bool AppendCols(int n=1, bool updateLabels=TRUE);
94 bool AppendRows(int n=1, bool updateLabels=TRUE);
96 bool CellHitTest(int x, int y, int *OUTPUT, int *OUTPUT);
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);
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);
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();
124 //wxGridCell *** GetCells();
126 PyObject* GetCells() {
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);
134 bool doSave = wxPyRestoreThread();
135 PyObject* pyCell = wxPyConstructObject(cell, "wxGridCell");
136 wxPySaveThread(doSave);
138 if (PyList_Append(rowList, pyCell) == -1)
141 if (PyList_Append(rows, rowList) == -1)
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);
153 int GetColumnWidth(int col);
154 wxRect GetCurrentRect();
155 int GetCursorColumn();
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);
169 wxTextCtrl* GetTextItem();
170 wxScrollBar* GetVertScrollBar();
172 bool InsertCols(int pos=0, int n=1, bool updateLabels=TRUE);
173 bool InsertRows(int pos=0, int n=1, bool updateLabels=TRUE);
175 void OnActivate(bool active);
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);
199 void UpdateDimensions();
201 bool GetEditInPlace();
202 void SetEditInPlace(int edit = TRUE);
207 class wxGridEvent : public wxEvent {
219 wxPoint GetPosition();
222 wxGridCell* GetCell();
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,
239 //---------------------------------------------------------------------------
241 class wxNotebookEvent : public wxNotifyEvent {
244 int GetOldSelection();
245 void SetOldSelection(int page);
246 void SetSelection(int page);
251 class wxNotebook : public wxControl {
253 wxNotebook(wxWindow *parent,
255 const wxPoint& pos = wxPyDefaultPosition,
256 const wxSize& size = wxPyDefaultSize,
258 char* name = "notebook");
260 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
263 int SetSelection(int nPage);
264 void AdvanceSelection(bool bForward = TRUE);
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);
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,
284 bool InsertPage(int nPage,
285 /*wxNotebookPage*/ wxWindow *pPage,
286 const wxString& strText,
287 bool bSelect = FALSE,
290 /*wxNotebookPage*/ wxWindow *GetPage(int nPage);
293 void ResizeChildren() {
294 wxSizeEvent evt(self->GetClientSize());
295 self->GetEventHandler()->ProcessEvent(evt);
302 //---------------------------------------------------------------------------
304 class wxSplitterEvent : public wxCommandEvent {
306 int GetSashPosition();
309 wxWindow* GetWindowBeingRemoved();
310 void SetSashPosition(int pos);
316 class wxSplitterWindow : public wxWindow {
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");
324 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
327 int GetMinimumPaneSize();
328 int GetSashPosition();
331 wxWindow* GetWindow1();
332 wxWindow* GetWindow2();
333 void Initialize(wxWindow* window);
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);
347 //---------------------------------------------------------------------------
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
362 class wxTaskBarIcon : public wxEvtHandler {
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)"
375 bool SetIcon(const wxIcon& icon, const char* tooltip = "");
376 bool RemoveIcon(void);
377 bool PopupMenu(wxMenu *menu);
382 //---------------------------------------------------------------------------