1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG definitions of MORE window classes
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
20 #include <wx/notebook.h>
21 #include <wx/splitter.h>
22 #include <wx/imaglist.h>
24 #include <wx/msw/taskbar.h>
28 //----------------------------------------------------------------------
31 %include my_typemaps.i
33 // Import some definitions of other classes, etc.
41 %pragma(python) code = "import wx"
43 //---------------------------------------------------------------------------
58 wxString& GetTextValue();
59 void SetTextValue(const wxString& str);
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();
68 void SetAlignment(int align);
69 wxBitmap* GetCellBitmap();
70 void SetCellBitmap(wxBitmap* bitmap);
76 class wxGrid : public wxPanel {
78 wxGrid(wxWindow* parent, wxWindowID id,
79 const wxPoint& pos=wxDefaultPosition,
80 const wxSize& size=wxDefaultSize,
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)"
96 void AdjustScrollbars();
97 bool AppendCols(int n=1, int updateLabels=TRUE);
98 bool AppendRows(int n=1, int updateLabels=TRUE);
100 bool CellHitTest(int x, int y, int *OUTPUT, int *OUTPUT);
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);
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);
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();
128 //wxGridCell *** GetCells();
130 PyObject* GetCells() {
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);
138 bool doSave = wxPyRestoreThread();
139 PyObject* pyCell = wxPyConstructObject(cell, "wxGridCell");
140 wxPySaveThread(doSave);
142 if (PyList_Append(rowList, pyCell) == -1)
145 if (PyList_Append(rows, rowList) == -1)
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);
157 int GetColumnWidth(int col);
158 wxRect GetCurrentRect();
159 int GetCursorColumn();
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);
173 wxTextCtrl* GetTextItem();
174 wxScrollBar* GetVertScrollBar();
176 bool InsertCols(int pos=0, int n=1, bool updateLabels=TRUE);
177 bool InsertRows(int pos=0, int n=1, bool updateLabels=TRUE);
179 void OnActivate(bool active);
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);
203 void UpdateDimensions();
205 bool GetEditInPlace();
206 void SetEditInPlace(int edit = TRUE);
211 class wxGridEvent : public wxEvent {
223 wxPoint GetPosition();
226 wxGridCell* GetCell();
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,
244 //---------------------------------------------------------------------------
247 /* notebook control event types */
248 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
249 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING,
253 class wxNotebookEvent : public wxNotifyEvent {
256 int GetOldSelection();
257 void SetOldSelection(int page);
258 void SetSelection(int page);
263 class wxNotebook : public wxControl {
265 wxNotebook(wxWindow *parent,
267 const wxPoint& pos = wxDefaultPosition,
268 const wxSize& size = wxDefaultSize,
270 char* name = "notebook");
272 %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)"
275 int SetSelection(int nPage);
276 void AdvanceSelection(bool bForward = TRUE);
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);
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,
295 bool InsertPage(int nPage,
296 /*wxNotebookPage*/ wxWindow *pPage,
297 const wxString& strText,
298 bool bSelect = FALSE,
300 /*wxNotebookPage*/ wxWindow *GetPage(int nPage);
303 void ResizeChildren() {
304 wxSizeEvent evt(self->GetClientSize());
305 self->GetEventHandler()->ProcessEvent(evt);
312 //---------------------------------------------------------------------------
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,
329 wxSPLIT_DRAG_DRAGGING,
330 wxSPLIT_DRAG_LEFT_DOWN
334 class wxSplitterEvent : public wxCommandEvent {
336 int GetSashPosition();
339 wxWindow* GetWindowBeingRemoved();
340 void SetSashPosition(int pos);
346 class wxSplitterWindow : public wxWindow {
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");
354 %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)"
357 int GetMinimumPaneSize();
358 int GetSashPosition();
361 wxWindow* GetWindow1();
362 wxWindow* GetWindow2();
363 void Initialize(wxWindow* window);
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);
377 //---------------------------------------------------------------------------
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
392 class wxTaskBarIcon : public wxEvtHandler {
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)"
406 bool SetIcon(const wxIcon& icon, const char* tooltip = "");
407 bool RemoveIcon(void);
408 bool PopupMenu(wxMenu *menu);
409 bool IsIconInstalled();
414 //---------------------------------------------------------------------------