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 //---------------------------------------------------------------------------
55 wxString& GetTextValue();
56 void SetTextValue(const wxString& str);
58 void SetFont(wxFont& f);
59 wxColour& GetTextColour();
60 void SetTextColour(const wxColour& colour);
61 wxColour& GetBackgroundColour();
62 void SetBackgroundColour(const wxColour& colour);
63 wxBrush& GetBackgroundBrush();
65 void SetAlignment(int align);
66 wxBitmap* GetCellBitmap();
67 void SetCellBitmap(wxBitmap* bitmap);
73 class wxGrid : public wxPanel {
75 wxGrid(wxWindow* parent, wxWindowID id,
76 const wxPoint& pos=wxPyDefaultPosition,
77 const wxSize& size=wxPyDefaultSize,
81 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
82 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnSelectCell', wxEVT_GRID_SELECT_CELL)"
83 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnCreateCell', wxEVT_GRID_CREATE_CELL)"
84 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnChangeLabels', wxEVT_GRID_CHANGE_LABELS)"
85 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnChangeSelectionLabel', wxEVT_GRID_CHANGE_SEL_LABEL)"
86 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnCellChange', wxEVT_GRID_CELL_CHANGE)"
87 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnCellLeftClick', wxEVT_GRID_CELL_LCLICK)"
88 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnCellRightClick', wxEVT_GRID_CELL_RCLICK)"
89 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLabelLeftClick', wxEVT_GRID_LABEL_LCLICK)"
90 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLabelRightClick', wxEVT_GRID_LABEL_RCLICK)"
93 void AdjustScrollbars();
94 bool AppendCols(int n=1, int updateLabels=TRUE);
95 bool AppendRows(int n=1, int updateLabels=TRUE);
97 bool CellHitTest(int x, int y, int *OUTPUT, int *OUTPUT);
100 // TODO: For now we are just ignoring the initial cellValues
101 // and widths. Add support for loading them from
102 // Python sequence objects.
103 bool CreateGrid(int rows, int cols,
104 //PyObject* cellValues = NULL,
105 //PyObject* widths = NULL,
106 short defaultWidth = wxGRID_DEFAULT_CELL_WIDTH,
107 short defaultHeight = wxGRID_DEFAULT_CELL_HEIGHT) {
108 return self->CreateGrid(rows, cols, NULL, NULL,
109 defaultWidth, defaultHeight);
113 bool CurrentCellVisible();
114 bool DeleteCols(int pos=0, int n=1, bool updateLabels=TRUE);
115 bool DeleteRows(int pos=0, int n=1, bool updateLabels=TRUE);
119 wxGridCell* GetCell(int row, int col);
120 int GetCellAlignment(int row, int col);
121 %name(GetDefCellAlignment)int GetCellAlignment();
122 wxColour& GetCellBackgroundColour(int row, int col);
123 %name(GetDefCellBackgroundColour) wxColour& GetCellBackgroundColour();
125 //wxGridCell *** GetCells();
127 PyObject* GetCells() {
129 PyObject* rows = PyList_New(0);
130 for (row=0; row < self->GetRows(); row++) {
131 PyObject* rowList = PyList_New(0);
132 for (col=0; col < self->GetCols(); col++) {
133 wxGridCell* cell = self->GetCell(row, col);
135 bool doSave = wxPyRestoreThread();
136 PyObject* pyCell = wxPyConstructObject(cell, "wxGridCell");
137 wxPySaveThread(doSave);
139 if (PyList_Append(rowList, pyCell) == -1)
142 if (PyList_Append(rows, rowList) == -1)
148 wxColour& GetCellTextColour(int row, int col);
149 %name(GetDefCellTextColour)wxColour& GetCellTextColour();
150 wxFont& GetCellTextFont(int row, int col);
151 %name(GetDefCellTextFont)wxFont& GetCellTextFont();
152 wxString& GetCellValue(int row, int col);
154 int GetColumnWidth(int col);
155 wxRect GetCurrentRect();
156 int GetCursorColumn();
159 wxScrollBar * GetHorizScrollBar();
160 int GetLabelAlignment(int orientation);
161 wxColour& GetLabelBackgroundColour();
162 int GetLabelSize(int orientation);
163 wxColour& GetLabelTextColour();
164 wxFont& GetLabelTextFont();
165 wxString& GetLabelValue(int orientation, int pos);
166 int GetRowHeight(int row);
170 wxTextCtrl* GetTextItem();
171 wxScrollBar* GetVertScrollBar();
173 bool InsertCols(int pos=0, int n=1, bool updateLabels=TRUE);
174 bool InsertRows(int pos=0, int n=1, bool updateLabels=TRUE);
176 void OnActivate(bool active);
178 void SetCellAlignment(int alignment, int row, int col);
179 %name(SetDefCellAlignment)void SetCellAlignment(int alignment);
180 void SetCellBackgroundColour(const wxColour& colour, int row, int col);
181 %name(SetDefCellBackgroundColour)
182 void SetCellBackgroundColour(const wxColour& colour);
183 void SetCellTextColour(const wxColour& colour, int row, int col);
184 %name(SetDefCellTextColour)void SetCellTextColour(const wxColour& colour);
185 void SetCellTextFont(wxFont& font, int row, int col);
186 %name(SetDefCellTextFont)void SetCellTextFont(wxFont& font);
187 void SetCellValue(const wxString& val, int row, int col);
188 void SetColumnWidth(int col, int width);
189 void SetDividerPen(wxPen& pen);
190 void SetEditable(bool editable);
191 void SetGridCursor(int row, int col);
192 void SetLabelAlignment(int orientation, int alignment);
193 void SetLabelBackgroundColour(const wxColour& value);
194 void SetLabelSize(int orientation, int size);
195 void SetLabelTextColour(const wxColour& value);
196 void SetLabelTextFont(wxFont& font);
197 void SetLabelValue(int orientation, const wxString& value, int pos);
198 void SetRowHeight(int row, int height);
200 void UpdateDimensions();
202 bool GetEditInPlace();
203 void SetEditInPlace(int edit = TRUE);
208 class wxGridEvent : public wxEvent {
220 wxPoint GetPosition();
223 wxGridCell* GetCell();
228 wxEVT_GRID_SELECT_CELL,
229 wxEVT_GRID_CREATE_CELL,
230 wxEVT_GRID_CHANGE_LABELS,
231 wxEVT_GRID_CHANGE_SEL_LABEL,
232 wxEVT_GRID_CELL_CHANGE,
233 wxEVT_GRID_CELL_LCLICK,
234 wxEVT_GRID_CELL_RCLICK,
235 wxEVT_GRID_LABEL_LCLICK,
236 wxEVT_GRID_LABEL_RCLICK,
241 //---------------------------------------------------------------------------
243 class wxNotebookEvent : public wxNotifyEvent {
246 int GetOldSelection();
247 void SetOldSelection(int page);
248 void SetSelection(int page);
253 class wxNotebook : public wxControl {
255 wxNotebook(wxWindow *parent,
257 const wxPoint& pos = wxPyDefaultPosition,
258 const wxSize& size = wxPyDefaultSize,
260 char* name = "notebook");
262 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
265 int SetSelection(int nPage);
266 void AdvanceSelection(bool bForward = TRUE);
268 bool SetPageText(int nPage, const wxString& strText);
269 wxString GetPageText(int nPage) const;
270 void SetImageList(wxImageList* imageList);
271 wxImageList* GetImageList();
272 int GetPageImage(int nPage);
273 bool SetPageImage(int nPage, int nImage);
276 // LINK ERROR: void SetPageSize(const wxSize& size);
277 // LINK ERROR: void SetPadding(const wxSize& padding);
278 bool DeletePage(int nPage);
279 bool RemovePage(int nPage);
280 bool DeleteAllPages();
281 bool AddPage(/*wxNotebookPage*/ wxWindow *pPage,
282 const wxString& strText,
286 bool InsertPage(int nPage,
287 /*wxNotebookPage*/ wxWindow *pPage,
288 const wxString& strText,
289 bool bSelect = FALSE,
292 /*wxNotebookPage*/ wxWindow *GetPage(int nPage);
295 void ResizeChildren() {
296 wxSizeEvent evt(self->GetClientSize());
297 self->GetEventHandler()->ProcessEvent(evt);
304 //---------------------------------------------------------------------------
306 class wxSplitterEvent : public wxCommandEvent {
308 int GetSashPosition();
311 wxWindow* GetWindowBeingRemoved();
312 void SetSashPosition(int pos);
318 class wxSplitterWindow : public wxWindow {
320 wxSplitterWindow(wxWindow* parent, wxWindowID id,
321 const wxPoint& point = wxPyDefaultPosition,
322 const wxSize& size = wxPyDefaultSize,
323 long style=wxSP_3D|wxCLIP_CHILDREN,
324 char* name = "splitterWindow");
326 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
329 int GetMinimumPaneSize();
330 int GetSashPosition();
333 wxWindow* GetWindow1();
334 wxWindow* GetWindow2();
335 void Initialize(wxWindow* window);
338 bool ReplaceWindow(wxWindow * winOld, wxWindow * winNew);
339 void SetBorderSize(int width);
340 void SetSashPosition(int position, int redraw = TRUE);
341 void SetSashSize(int width);
342 void SetMinimumPaneSize(int paneSize);
343 void SetSplitMode(int mode);
344 bool SplitHorizontally(wxWindow* window1, wxWindow* window2, int sashPosition = 0);
345 bool SplitVertically(wxWindow* window1, wxWindow* window2, int sashPosition = 0);
346 bool Unsplit(wxWindow* toRemove = NULL);
349 //---------------------------------------------------------------------------
355 wxEVT_TASKBAR_LEFT_DOWN,
356 wxEVT_TASKBAR_LEFT_UP,
357 wxEVT_TASKBAR_RIGHT_DOWN,
358 wxEVT_TASKBAR_RIGHT_UP,
359 wxEVT_TASKBAR_LEFT_DCLICK,
360 wxEVT_TASKBAR_RIGHT_DCLICK
364 class wxTaskBarIcon : public wxEvtHandler {
369 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnMouseMove', wxEVT_TASKBAR_MOVE)"
370 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonDown', wxEVT_TASKBAR_LEFT_DOWN)"
371 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonUp', wxEVT_TASKBAR_LEFT_UP)"
372 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonDown', wxEVT_TASKBAR_RIGHT_DOWN)"
373 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonUp', wxEVT_TASKBAR_RIGHT_UP)"
374 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonDClick',wxEVT_TASKBAR_LEFT_DCLICK)"
375 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonDClick',wxEVT_TASKBAR_RIGHT_DCLICK)"
377 bool SetIcon(const wxIcon& icon, const char* tooltip = "");
378 bool RemoveIcon(void);
379 bool PopupMenu(wxMenu *menu);
384 //---------------------------------------------------------------------------