]> git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/src/windows2.i
minimal now works in Unicode mode
[wxWidgets.git] / utils / wxPython / src / windows2.i
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
13 %module windows2
14
15 %{
16 #include "helpers.h"
17 #include <wx/grid.h>
18 #include <wx/notebook.h>
19 #include <wx/splitter.h>
20 #ifdef __WXMSW__
21 #include <wx/msw/taskbar.h>
22 #endif
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
38 %pragma(python) code = "import wx"
39
40 //---------------------------------------------------------------------------
41
42
43 enum {
44 wxGRID_TEXT_CTRL,
45 wxGRID_HSCROLL,
46 wxGRID_VSCROLL
47 };
48
49 class wxGridCell {
50 public:
51 wxGridCell();
52 ~wxGridCell();
53
54 wxString& GetTextValue();
55 void SetTextValue(const wxString& str);
56 wxFont& GetFont();
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();
63 int GetAlignment();
64 void SetAlignment(int align);
65 wxBitmap* GetCellBitmap();
66 void SetCellBitmap(wxBitmap* bitmap);
67 };
68
69
70
71
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
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)"
90
91
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);
122 %name(GetDefCellBackgroundColour) wxColour& GetCellBackgroundColour();
123 //wxGridCell *** GetCells();
124 wxColour& GetCellTextColour(int row, int col);
125 %name(GetDefCellTextColour)wxColour& GetCellTextColour();
126 wxFont& GetCellTextFont(int row, int col);
127 %name(GetDefCellTextFont)wxFont& GetCellTextFont();
128 wxString& GetCellValue(int row, int col);
129 int GetCols();
130 int GetColumnWidth(int col);
131 wxRect& GetCurrentRect();
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();
140 wxFont& GetLabelTextFont();
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
152 void OnActivate(bool active);
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);
161 void SetCellTextFont(wxFont& font, int row, int col);
162 %name(SetDefCellTextFont)void SetCellTextFont(wxFont& font);
163 void SetCellValue(const wxString& val, int row, int col);
164 void SetColumnWidth(int col, int width);
165 void SetDividerPen(wxPen& pen);
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);
172 void SetLabelTextFont(wxFont& font);
173 void SetLabelValue(int orientation, const wxString& value, int pos);
174 void SetRowHeight(int row, int height);
175
176 void UpdateDimensions();
177 };
178
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
205 //---------------------------------------------------------------------------
206
207 class wxNotebookEvent : public wxCommandEvent {
208 public:
209 int GetSelection();
210 int GetOldSelection();
211 };
212
213
214
215 class wxNotebook : public wxControl {
216 public:
217 wxNotebook(wxWindow *parent,
218 wxWindowID id,
219 const wxPoint& pos = wxPyDefaultPosition,
220 const wxSize& size = wxPyDefaultSize,
221 long style = 0,
222 char* name = "notebook");
223
224 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
225
226 int GetPageCount();
227 int SetSelection(int nPage);
228 void AdvanceSelection(bool bForward = TRUE);
229 int GetSelection();
230 bool SetPageText(int nPage, const wxString& strText);
231 wxString GetPageText(int nPage) const;
232 void SetImageList(wxImageList* imageList);
233 wxImageList* GetImageList();
234 int GetPageImage(int nPage);
235 bool SetPageImage(int nPage, int nImage);
236 int GetRowCount();
237
238 // LINK ERROR: void SetPageSize(const wxSize& size);
239 // LINK ERROR: void SetPadding(const wxSize& padding);
240 bool DeletePage(int nPage);
241 bool DeleteAllPages();
242 bool AddPage(/*wxNotebookPage*/ wxWindow *pPage,
243 const wxString& strText,
244 bool bSelect = FALSE,
245 int imageId = -1);
246 #ifdef __WXMSW__
247 bool InsertPage(int nPage,
248 /*wxNotebookPage*/ wxWindow *pPage,
249 const wxString& strText,
250 bool bSelect = FALSE,
251 int imageId = -1);
252 #endif
253 wxNotebookPage *GetPage(int nPage);
254
255 };
256
257 //---------------------------------------------------------------------------
258
259 class wxSplitterWindow : public wxWindow {
260 public:
261 wxSplitterWindow(wxWindow* parent, wxWindowID id,
262 const wxPoint& point = wxPyDefaultPosition,
263 const wxSize& size = wxPyDefaultSize,
264 long style=wxSP_3D|wxCLIP_CHILDREN,
265 char* name = "splitterWindow");
266
267 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
268
269 int GetBorderSize();
270 int GetMinimumPaneSize();
271 int GetSashPosition();
272 int GetSashSize();
273 int GetSplitMode();
274 wxWindow* GetWindow1();
275 wxWindow* GetWindow2();
276 void Initialize(wxWindow* window);
277 bool IsSplit();
278
279 // TODO: How to handle callbacks that don't come from
280 // event system???
281 //
282 //void OnDoubleClickSash(int x, int y);
283 //bool OnSashPositionChange(int newSashPosition);
284 //void OnUnsplit(wxWindow* removed);
285
286 void SetBorderSize(int width);
287 void SetSashPosition(int position, int redraw = TRUE);
288 void SetSashSize(int width);
289 void SetMinimumPaneSize(int paneSize);
290 void SetSplitMode(int mode);
291 bool SplitHorizontally(wxWindow* window1, wxWindow* window2, int sashPosition = 0);
292 bool SplitVertically(wxWindow* window1, wxWindow* window2, int sashPosition = 0);
293 bool Unsplit(wxWindow* toRemove = NULL);
294 };
295
296 //---------------------------------------------------------------------------
297
298 #ifdef __WXMSW__
299
300 enum {
301 wxEVT_TASKBAR_MOVE,
302 wxEVT_TASKBAR_LEFT_DOWN,
303 wxEVT_TASKBAR_LEFT_UP,
304 wxEVT_TASKBAR_RIGHT_DOWN,
305 wxEVT_TASKBAR_RIGHT_UP,
306 wxEVT_TASKBAR_LEFT_DCLICK,
307 wxEVT_TASKBAR_RIGHT_DCLICK
308 };
309
310
311 class wxTaskBarIcon : public wxEvtHandler {
312 public:
313 wxTaskBarIcon();
314 ~wxTaskBarIcon();
315
316 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnMouseMove', wxEVT_TASKBAR_MOVE)"
317 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonDown', wxEVT_TASKBAR_LEFT_DOWN)"
318 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonUp', wxEVT_TASKBAR_LEFT_UP)"
319 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonDown', wxEVT_TASKBAR_RIGHT_DOWN)"
320 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonUp', wxEVT_TASKBAR_RIGHT_UP)"
321 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonDClick',wxEVT_TASKBAR_LEFT_DCLICK)"
322 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonDClick',wxEVT_TASKBAR_RIGHT_DCLICK)"
323
324 bool SetIcon(const wxIcon& icon, const char* tooltip = "");
325 bool RemoveIcon(void);
326 bool PopupMenu(wxMenu *menu);
327
328 };
329 #endif
330
331 //---------------------------------------------------------------------------
332 /////////////////////////////////////////////////////////////////////////////
333 //
334 // $Log$
335 // Revision 1.9 1999/02/25 07:08:36 RD
336 // wxPython version 2.0b5
337 //
338 // Revision 1.8 1998/12/17 18:05:53 RD
339 //
340 // wxPython 0.5.2
341 // Minor fixes and SWIG code generation for RR's changes. MSW and GTK
342 // versions are much closer now!
343 //
344 // Revision 1.7 1998/12/15 20:41:25 RD
345 // Changed the import semantics from "from wxPython import *" to "from
346 // wxPython.wx import *" This is for people who are worried about
347 // namespace pollution, they can use "from wxPython import wx" and then
348 // prefix all the wxPython identifiers with "wx."
349 //
350 // Added wxTaskbarIcon for wxMSW.
351 //
352 // Made the events work for wxGrid.
353 //
354 // Added wxConfig.
355 //
356 // Added wxMiniFrame for wxGTK, (untested.)
357 //
358 // Changed many of the args and return values that were pointers to gdi
359 // objects to references to reflect changes in the wxWindows API.
360 //
361 // Other assorted fixes and additions.
362 //
363 // Revision 1.6 1998/11/25 08:45:28 RD
364 //
365 // Added wxPalette, wxRegion, wxRegionIterator, wxTaskbarIcon
366 // Added events for wxGrid
367 // Other various fixes and additions
368 //
369 // Revision 1.5 1998/11/03 09:21:57 RD
370 // fixed a typo
371 //
372 // Revision 1.4 1998/10/02 06:40:43 RD
373 //
374 // Version 0.4 of wxPython for MSW.
375 //
376 // Revision 1.3 1998/08/18 19:48:20 RD
377 // more wxGTK compatibility things.
378 //
379 // It builds now but there are serious runtime problems...
380 //
381 // Revision 1.2 1998/08/15 07:36:50 RD
382 // - Moved the header in the .i files out of the code that gets put into
383 // the .cpp files. It caused CVS conflicts because of the RCS ID being
384 // different each time.
385 //
386 // - A few minor fixes.
387 //
388 // Revision 1.1 1998/08/09 08:25:52 RD
389 // Initial version
390 //
391 //