]>
Commit | Line | Data |
---|---|---|
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 |
43 | enum { |
44 | wxGRID_TEXT_CTRL, | |
45 | wxGRID_HSCROLL, | |
b639c3c5 | 46 | wxGRID_VSCROLL |
7bf85405 RD |
47 | }; |
48 | ||
7bf85405 RD |
49 | class wxGridCell { |
50 | public: | |
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 |
72 | class wxGrid : public wxPanel { |
73 | public: | |
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 RD |
92 | void AdjustScrollbars(); |
93 | bool AppendCols(int n=1, bool updateLabels=TRUE); | |
94 | bool AppendRows(int n=1, bool updateLabels=TRUE); | |
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(); |
7bf85405 RD |
123 | //wxGridCell *** GetCells(); |
124 | wxColour& GetCellTextColour(int row, int col); | |
125 | %name(GetDefCellTextColour)wxColour& GetCellTextColour(); | |
b8b8dda7 RD |
126 | wxFont& GetCellTextFont(int row, int col); |
127 | %name(GetDefCellTextFont)wxFont& GetCellTextFont(); | |
7bf85405 RD |
128 | wxString& GetCellValue(int row, int col); |
129 | int GetCols(); | |
130 | int GetColumnWidth(int col); | |
cf694132 | 131 | wxRect GetCurrentRect(); |
7bf85405 RD |
132 | int GetCursorColumn(); |
133 | int GetCursorRow(); | |
134 | bool GetEditable(); | |
135 | wxScrollBar * GetHorizScrollBar(); | |
136 | int GetLabelAlignment(int orientation); | |
137 | wxColour& GetLabelBackgroundColour(); | |
138 | int GetLabelSize(int orientation); | |
139 | wxColour& GetLabelTextColour(); | |
b8b8dda7 | 140 | wxFont& GetLabelTextFont(); |
7bf85405 RD |
141 | wxString& GetLabelValue(int orientation, int pos); |
142 | int GetRowHeight(int row); | |
143 | int GetRows(); | |
144 | int GetScrollPosX(); | |
145 | int GetScrollPosY(); | |
146 | wxTextCtrl* GetTextItem(); | |
147 | wxScrollBar* GetVertScrollBar(); | |
148 | ||
149 | bool InsertCols(int pos=0, int n=1, bool updateLabels=TRUE); | |
150 | bool InsertRows(int pos=0, int n=1, bool updateLabels=TRUE); | |
151 | ||
b639c3c5 | 152 | void OnActivate(bool active); |
7bf85405 RD |
153 | |
154 | void SetCellAlignment(int alignment, int row, int col); | |
155 | %name(SetDefCellAlignment)void SetCellAlignment(int alignment); | |
156 | void SetCellBackgroundColour(const wxColour& colour, int row, int col); | |
157 | %name(SetDefCellBackgroundColour) | |
158 | void SetCellBackgroundColour(const wxColour& colour); | |
159 | void SetCellTextColour(const wxColour& colour, int row, int col); | |
160 | %name(SetDefCellTextColour)void SetCellTextColour(const wxColour& colour); | |
b8b8dda7 RD |
161 | void SetCellTextFont(wxFont& font, int row, int col); |
162 | %name(SetDefCellTextFont)void SetCellTextFont(wxFont& font); | |
7bf85405 RD |
163 | void SetCellValue(const wxString& val, int row, int col); |
164 | void SetColumnWidth(int col, int width); | |
b8b8dda7 | 165 | void SetDividerPen(wxPen& pen); |
7bf85405 RD |
166 | void SetEditable(bool editable); |
167 | void SetGridCursor(int row, int col); | |
168 | void SetLabelAlignment(int orientation, int alignment); | |
169 | void SetLabelBackgroundColour(const wxColour& value); | |
170 | void SetLabelSize(int orientation, int size); | |
171 | void SetLabelTextColour(const wxColour& value); | |
b8b8dda7 | 172 | void SetLabelTextFont(wxFont& font); |
7bf85405 RD |
173 | void SetLabelValue(int orientation, const wxString& value, int pos); |
174 | void SetRowHeight(int row, int height); | |
175 | ||
176 | void UpdateDimensions(); | |
177 | }; | |
178 | ||
b639c3c5 RD |
179 | |
180 | class wxGridEvent : public wxEvent { | |
181 | public: | |
182 | int m_row; | |
183 | int m_col; | |
184 | int m_x; | |
185 | int m_y; | |
186 | bool m_control; | |
187 | bool m_shift; | |
188 | wxGridCell* m_cell; | |
189 | }; | |
190 | ||
191 | ||
192 | enum { | |
193 | wxEVT_GRID_SELECT_CELL, | |
194 | wxEVT_GRID_CREATE_CELL, | |
195 | wxEVT_GRID_CHANGE_LABELS, | |
196 | wxEVT_GRID_CHANGE_SEL_LABEL, | |
197 | wxEVT_GRID_CELL_CHANGE, | |
198 | wxEVT_GRID_CELL_LCLICK, | |
199 | wxEVT_GRID_CELL_RCLICK, | |
200 | wxEVT_GRID_LABEL_LCLICK, | |
201 | wxEVT_GRID_LABEL_RCLICK, | |
202 | }; | |
203 | ||
204 | ||
7bf85405 RD |
205 | //--------------------------------------------------------------------------- |
206 | ||
bb0054cd | 207 | class wxNotebookEvent : public wxNotifyEvent { |
7bf85405 RD |
208 | public: |
209 | int GetSelection(); | |
210 | int GetOldSelection(); | |
bb0054cd RD |
211 | void SetOldSelection(int page); |
212 | void SetSelection(int page); | |
7bf85405 RD |
213 | }; |
214 | ||
215 | ||
216 | ||
217 | class wxNotebook : public wxControl { | |
218 | public: | |
219 | wxNotebook(wxWindow *parent, | |
220 | wxWindowID id, | |
221 | const wxPoint& pos = wxPyDefaultPosition, | |
222 | const wxSize& size = wxPyDefaultSize, | |
223 | long style = 0, | |
224 | char* name = "notebook"); | |
225 | ||
b8b8dda7 | 226 | %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" |
9c039d08 | 227 | |
7bf85405 RD |
228 | int GetPageCount(); |
229 | int SetSelection(int nPage); | |
230 | void AdvanceSelection(bool bForward = TRUE); | |
231 | int GetSelection(); | |
232 | bool SetPageText(int nPage, const wxString& strText); | |
233 | wxString GetPageText(int nPage) const; | |
234 | void SetImageList(wxImageList* imageList); | |
235 | wxImageList* GetImageList(); | |
236 | int GetPageImage(int nPage); | |
237 | bool SetPageImage(int nPage, int nImage); | |
238 | int GetRowCount(); | |
239 | ||
240 | // LINK ERROR: void SetPageSize(const wxSize& size); | |
241 | // LINK ERROR: void SetPadding(const wxSize& padding); | |
242 | bool DeletePage(int nPage); | |
cf694132 | 243 | bool RemovePage(int nPage); |
7bf85405 RD |
244 | bool DeleteAllPages(); |
245 | bool AddPage(/*wxNotebookPage*/ wxWindow *pPage, | |
246 | const wxString& strText, | |
cf694132 | 247 | int bSelect = FALSE, |
7bf85405 | 248 | int imageId = -1); |
fb5e0af0 | 249 | #ifdef __WXMSW__ |
7bf85405 RD |
250 | bool InsertPage(int nPage, |
251 | /*wxNotebookPage*/ wxWindow *pPage, | |
252 | const wxString& strText, | |
253 | bool bSelect = FALSE, | |
254 | int imageId = -1); | |
fb5e0af0 | 255 | #endif |
bb0054cd | 256 | /*wxNotebookPage*/ wxWindow *GetPage(int nPage); |
7bf85405 | 257 | |
cf694132 RD |
258 | %addmethods { |
259 | void ResizeChildren() { | |
260 | wxSizeEvent evt(self->GetClientSize()); | |
4cd9591a | 261 | self->GetEventHandler()->ProcessEvent(evt); |
cf694132 RD |
262 | } |
263 | } | |
264 | ||
265 | ||
7bf85405 RD |
266 | }; |
267 | ||
9c039d08 RD |
268 | //--------------------------------------------------------------------------- |
269 | ||
bb0054cd RD |
270 | class wxSplitterEvent : public wxCommandEvent { |
271 | public: | |
272 | int GetSashPosition(); | |
273 | int GetX(); | |
274 | int GetY(); | |
275 | wxWindow* GetWindowBeingRemoved(); | |
276 | void SetSashPosition(int pos); | |
277 | } | |
278 | ||
279 | ||
280 | ||
281 | ||
9c039d08 RD |
282 | class wxSplitterWindow : public wxWindow { |
283 | public: | |
284 | wxSplitterWindow(wxWindow* parent, wxWindowID id, | |
285 | const wxPoint& point = wxPyDefaultPosition, | |
286 | const wxSize& size = wxPyDefaultSize, | |
b639c3c5 | 287 | long style=wxSP_3D|wxCLIP_CHILDREN, |
9c039d08 RD |
288 | char* name = "splitterWindow"); |
289 | ||
b8b8dda7 | 290 | %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" |
9c039d08 | 291 | |
b639c3c5 | 292 | int GetBorderSize(); |
9c039d08 RD |
293 | int GetMinimumPaneSize(); |
294 | int GetSashPosition(); | |
b639c3c5 | 295 | int GetSashSize(); |
9c039d08 RD |
296 | int GetSplitMode(); |
297 | wxWindow* GetWindow1(); | |
298 | wxWindow* GetWindow2(); | |
299 | void Initialize(wxWindow* window); | |
300 | bool IsSplit(); | |
301 | ||
9c039d08 | 302 | |
b639c3c5 | 303 | void SetBorderSize(int width); |
9c039d08 | 304 | void SetSashPosition(int position, int redraw = TRUE); |
b639c3c5 | 305 | void SetSashSize(int width); |
9c039d08 RD |
306 | void SetMinimumPaneSize(int paneSize); |
307 | void SetSplitMode(int mode); | |
4464bbee RD |
308 | bool SplitHorizontally(wxWindow* window1, wxWindow* window2, int sashPosition = 0); |
309 | bool SplitVertically(wxWindow* window1, wxWindow* window2, int sashPosition = 0); | |
9c039d08 RD |
310 | bool Unsplit(wxWindow* toRemove = NULL); |
311 | }; | |
312 | ||
313 | //--------------------------------------------------------------------------- | |
314 | ||
b639c3c5 RD |
315 | #ifdef __WXMSW__ |
316 | ||
317 | enum { | |
318 | wxEVT_TASKBAR_MOVE, | |
319 | wxEVT_TASKBAR_LEFT_DOWN, | |
320 | wxEVT_TASKBAR_LEFT_UP, | |
321 | wxEVT_TASKBAR_RIGHT_DOWN, | |
322 | wxEVT_TASKBAR_RIGHT_UP, | |
323 | wxEVT_TASKBAR_LEFT_DCLICK, | |
324 | wxEVT_TASKBAR_RIGHT_DCLICK | |
325 | }; | |
9c039d08 RD |
326 | |
327 | ||
b639c3c5 RD |
328 | class wxTaskBarIcon : public wxEvtHandler { |
329 | public: | |
330 | wxTaskBarIcon(); | |
331 | ~wxTaskBarIcon(); | |
332 | ||
b8b8dda7 RD |
333 | %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnMouseMove', wxEVT_TASKBAR_MOVE)" |
334 | %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonDown', wxEVT_TASKBAR_LEFT_DOWN)" | |
335 | %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonUp', wxEVT_TASKBAR_LEFT_UP)" | |
336 | %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonDown', wxEVT_TASKBAR_RIGHT_DOWN)" | |
337 | %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonUp', wxEVT_TASKBAR_RIGHT_UP)" | |
338 | %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonDClick',wxEVT_TASKBAR_LEFT_DCLICK)" | |
339 | %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonDClick',wxEVT_TASKBAR_RIGHT_DCLICK)" | |
b639c3c5 RD |
340 | |
341 | bool SetIcon(const wxIcon& icon, const char* tooltip = ""); | |
342 | bool RemoveIcon(void); | |
be4d9c1f RD |
343 | bool PopupMenu(wxMenu *menu); |
344 | ||
b639c3c5 RD |
345 | }; |
346 | #endif | |
347 | ||
7bf85405 | 348 | //--------------------------------------------------------------------------- |