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>
23 #include <wx/msw/taskbar.h>
27 //----------------------------------------------------------------------
30 %include my_typemaps.i
32 // Import some definitions of other classes, etc.
40 %pragma(python) code = "import wx"
42 //---------------------------------------------------------------------------
57 wxString& GetTextValue();
58 void SetTextValue(const wxString& str);
60 void SetFont(wxFont& f);
61 wxColour& GetTextColour();
62 void SetTextColour(const wxColour& colour);
63 wxColour& GetBackgroundColour();
64 void SetBackgroundColour(const wxColour& colour);
65 wxBrush& GetBackgroundBrush();
67 void SetAlignment(int align);
68 wxBitmap* GetCellBitmap();
69 void SetCellBitmap(wxBitmap* bitmap);
75 class wxGrid : public wxPanel {
77 wxGrid(wxWindow* parent, wxWindowID id,
78 const wxPoint& pos=wxDefaultPosition,
79 const wxSize& size=wxDefaultSize,
83 %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)"
84 %pragma(python) addtomethod = "__init__:#wx._checkForCallback(self, 'OnSelectCell', wxEVT_GRID_SELECT_CELL)"
85 %pragma(python) addtomethod = "__init__:#wx._checkForCallback(self, 'OnCreateCell', wxEVT_GRID_CREATE_CELL)"
86 %pragma(python) addtomethod = "__init__:#wx._checkForCallback(self, 'OnChangeLabels', wxEVT_GRID_CHANGE_LABELS)"
87 %pragma(python) addtomethod = "__init__:#wx._checkForCallback(self, 'OnChangeSelectionLabel', wxEVT_GRID_CHANGE_SEL_LABEL)"
88 %pragma(python) addtomethod = "__init__:#wx._checkForCallback(self, 'OnCellChange', wxEVT_GRID_CELL_CHANGE)"
89 %pragma(python) addtomethod = "__init__:#wx._checkForCallback(self, 'OnCellLeftClick', wxEVT_GRID_CELL_LCLICK)"
90 %pragma(python) addtomethod = "__init__:#wx._checkForCallback(self, 'OnCellRightClick', wxEVT_GRID_CELL_RCLICK)"
91 %pragma(python) addtomethod = "__init__:#wx._checkForCallback(self, 'OnLabelLeftClick', wxEVT_GRID_LABEL_LCLICK)"
92 %pragma(python) addtomethod = "__init__:#wx._checkForCallback(self, 'OnLabelRightClick', wxEVT_GRID_LABEL_RCLICK)"
95 void AdjustScrollbars();
96 bool AppendCols(int n=1, int updateLabels=TRUE);
97 bool AppendRows(int n=1, int updateLabels=TRUE);
99 bool CellHitTest(int x, int y, int *OUTPUT, int *OUTPUT);
102 // TODO: For now we are just ignoring the initial cellValues
103 // and widths. Add support for loading them from
104 // Python sequence objects.
105 bool CreateGrid(int rows, int cols,
106 //PyObject* cellValues = NULL,
107 //PyObject* widths = NULL,
108 short defaultWidth = wxGRID_DEFAULT_CELL_WIDTH,
109 short defaultHeight = wxGRID_DEFAULT_CELL_HEIGHT) {
110 return self->CreateGrid(rows, cols, NULL, NULL,
111 defaultWidth, defaultHeight);
115 bool CurrentCellVisible();
116 bool DeleteCols(int pos=0, int n=1, bool updateLabels=TRUE);
117 bool DeleteRows(int pos=0, int n=1, bool updateLabels=TRUE);
121 wxGridCell* GetCell(int row, int col);
122 int GetCellAlignment(int row, int col);
123 %name(GetDefCellAlignment)int GetCellAlignment();
124 wxColour& GetCellBackgroundColour(int row, int col);
125 %name(GetDefCellBackgroundColour) wxColour& GetCellBackgroundColour();
127 //wxGridCell *** GetCells();
129 PyObject* GetCells() {
131 PyObject* rows = PyList_New(0);
132 for (row=0; row < self->GetRows(); row++) {
133 PyObject* rowList = PyList_New(0);
134 for (col=0; col < self->GetCols(); col++) {
135 wxGridCell* cell = self->GetCell(row, col);
137 bool doSave = wxPyRestoreThread();
138 PyObject* pyCell = wxPyConstructObject(cell, "wxGridCell");
139 wxPySaveThread(doSave);
141 if (PyList_Append(rowList, pyCell) == -1)
144 if (PyList_Append(rows, rowList) == -1)
150 wxColour& GetCellTextColour(int row, int col);
151 %name(GetDefCellTextColour)wxColour& GetCellTextColour();
152 wxFont& GetCellTextFont(int row, int col);
153 %name(GetDefCellTextFont)wxFont& GetCellTextFont();
154 wxString& GetCellValue(int row, int col);
156 int GetColumnWidth(int col);
157 wxRect GetCurrentRect();
158 int GetCursorColumn();
161 wxScrollBar * GetHorizScrollBar();
162 int GetLabelAlignment(int orientation);
163 wxColour& GetLabelBackgroundColour();
164 int GetLabelSize(int orientation);
165 wxColour& GetLabelTextColour();
166 wxFont& GetLabelTextFont();
167 wxString& GetLabelValue(int orientation, int pos);
168 int GetRowHeight(int row);
172 wxTextCtrl* GetTextItem();
173 wxScrollBar* GetVertScrollBar();
175 bool InsertCols(int pos=0, int n=1, bool updateLabels=TRUE);
176 bool InsertRows(int pos=0, int n=1, bool updateLabels=TRUE);
178 void OnActivate(bool active);
180 void SetCellAlignment(int alignment, int row, int col);
181 %name(SetDefCellAlignment)void SetCellAlignment(int alignment);
182 void SetCellBackgroundColour(const wxColour& colour, int row, int col);
183 %name(SetDefCellBackgroundColour)
184 void SetCellBackgroundColour(const wxColour& colour);
185 void SetCellTextColour(const wxColour& colour, int row, int col);
186 %name(SetDefCellTextColour)void SetCellTextColour(const wxColour& colour);
187 void SetCellTextFont(wxFont& font, int row, int col);
188 %name(SetDefCellTextFont)void SetCellTextFont(wxFont& font);
189 void SetCellValue(const wxString& val, int row, int col);
190 void SetColumnWidth(int col, int width);
191 void SetDividerPen(wxPen& pen);
192 void SetEditable(bool editable);
193 void SetGridCursor(int row, int col);
194 void SetLabelAlignment(int orientation, int alignment);
195 void SetLabelBackgroundColour(const wxColour& value);
196 void SetLabelSize(int orientation, int size);
197 void SetLabelTextColour(const wxColour& value);
198 void SetLabelTextFont(wxFont& font);
199 void SetLabelValue(int orientation, const wxString& value, int pos);
200 void SetRowHeight(int row, int height);
202 void UpdateDimensions();
204 bool GetEditInPlace();
205 void SetEditInPlace(int edit = TRUE);
210 class wxGridEvent : public wxEvent {
222 wxPoint GetPosition();
225 wxGridCell* GetCell();
230 wxEVT_GRID_SELECT_CELL,
231 wxEVT_GRID_CREATE_CELL,
232 wxEVT_GRID_CHANGE_LABELS,
233 wxEVT_GRID_CHANGE_SEL_LABEL,
234 wxEVT_GRID_CELL_CHANGE,
235 wxEVT_GRID_CELL_LCLICK,
236 wxEVT_GRID_CELL_RCLICK,
237 wxEVT_GRID_LABEL_LCLICK,
238 wxEVT_GRID_LABEL_RCLICK,
243 //---------------------------------------------------------------------------
245 class wxNotebookEvent : public wxNotifyEvent {
248 int GetOldSelection();
249 void SetOldSelection(int page);
250 void SetSelection(int page);
255 class wxNotebook : public wxControl {
257 wxNotebook(wxWindow *parent,
259 const wxPoint& pos = wxDefaultPosition,
260 const wxSize& size = wxDefaultSize,
262 char* name = "notebook");
264 %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)"
267 int SetSelection(int nPage);
268 void AdvanceSelection(bool bForward = TRUE);
270 bool SetPageText(int nPage, const wxString& strText);
271 wxString GetPageText(int nPage) const;
272 void SetImageList(wxImageList* imageList);
273 wxImageList* GetImageList();
274 int GetPageImage(int nPage);
275 bool SetPageImage(int nPage, int nImage);
278 void SetPageSize(const wxSize& size);
279 void SetPadding(const wxSize& padding);
280 bool DeletePage(int nPage);
281 bool RemovePage(int nPage);
282 bool DeleteAllPages();
283 bool AddPage(/*wxNotebookPage*/ wxWindow *pPage,
284 const wxString& strText,
287 bool InsertPage(int nPage,
288 /*wxNotebookPage*/ wxWindow *pPage,
289 const wxString& strText,
290 bool bSelect = FALSE,
292 /*wxNotebookPage*/ wxWindow *GetPage(int nPage);
295 void ResizeChildren() {
296 wxSizeEvent evt(self->GetClientSize());
297 self->GetEventHandler()->ProcessEvent(evt);
304 //---------------------------------------------------------------------------
312 wxSPLIT_DRAG_DRAGGING,
313 wxSPLIT_DRAG_LEFT_DOWN
318 class wxSplitterEvent : public wxCommandEvent {
320 int GetSashPosition();
323 wxWindow* GetWindowBeingRemoved();
324 void SetSashPosition(int pos);
330 class wxSplitterWindow : public wxWindow {
332 wxSplitterWindow(wxWindow* parent, wxWindowID id,
333 const wxPoint& point = wxDefaultPosition,
334 const wxSize& size = wxDefaultSize,
335 long style=wxSP_3D|wxCLIP_CHILDREN,
336 char* name = "splitterWindow");
338 %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)"
341 int GetMinimumPaneSize();
342 int GetSashPosition();
345 wxWindow* GetWindow1();
346 wxWindow* GetWindow2();
347 void Initialize(wxWindow* window);
350 bool ReplaceWindow(wxWindow * winOld, wxWindow * winNew);
351 void SetBorderSize(int width);
352 void SetSashPosition(int position, int redraw = TRUE);
353 void SetSashSize(int width);
354 void SetMinimumPaneSize(int paneSize);
355 void SetSplitMode(int mode);
356 bool SplitHorizontally(wxWindow* window1, wxWindow* window2, int sashPosition = 0);
357 bool SplitVertically(wxWindow* window1, wxWindow* window2, int sashPosition = 0);
358 bool Unsplit(wxWindow* toRemove = NULL);
361 //---------------------------------------------------------------------------
367 wxEVT_TASKBAR_LEFT_DOWN,
368 wxEVT_TASKBAR_LEFT_UP,
369 wxEVT_TASKBAR_RIGHT_DOWN,
370 wxEVT_TASKBAR_RIGHT_UP,
371 wxEVT_TASKBAR_LEFT_DCLICK,
372 wxEVT_TASKBAR_RIGHT_DCLICK
376 class wxTaskBarIcon : public wxEvtHandler {
381 // We still use the magic methods here since that is the way it is documented...
382 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnMouseMove', wxEVT_TASKBAR_MOVE)"
383 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonDown', wxEVT_TASKBAR_LEFT_DOWN)"
384 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonUp', wxEVT_TASKBAR_LEFT_UP)"
385 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonDown', wxEVT_TASKBAR_RIGHT_DOWN)"
386 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonUp', wxEVT_TASKBAR_RIGHT_UP)"
387 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonDClick',wxEVT_TASKBAR_LEFT_DCLICK)"
388 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonDClick',wxEVT_TASKBAR_RIGHT_DCLICK)"
390 bool SetIcon(const wxIcon& icon, const char* tooltip = "");
391 bool RemoveIcon(void);
392 bool PopupMenu(wxMenu *menu);
393 bool IsIconInstalled();
398 //---------------------------------------------------------------------------