]> git.saurik.com Git - wxWidgets.git/blame - utils/wxPython/src/windows2.i
wxPython documentation updates
[wxWidgets.git] / utils / wxPython / src / windows2.i
CommitLineData
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
43enum {
44 wxGRID_TEXT_CTRL,
45 wxGRID_HSCROLL,
b639c3c5 46 wxGRID_VSCROLL
7bf85405
RD
47};
48
7bf85405
RD
49class wxGridCell {
50public:
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
72class wxGrid : public wxPanel {
73public:
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
180class wxGridEvent : public wxEvent {
181public:
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
192enum {
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
207class wxNotebookEvent : public wxCommandEvent {
208public:
209 int GetSelection();
210 int GetOldSelection();
211};
212
213
214
215class wxNotebook : public wxControl {
216public:
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
b8b8dda7 224 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 225
7bf85405
RD
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);
cf694132 241 bool RemovePage(int nPage);
7bf85405
RD
242 bool DeleteAllPages();
243 bool AddPage(/*wxNotebookPage*/ wxWindow *pPage,
244 const wxString& strText,
cf694132 245 int bSelect = FALSE,
7bf85405 246 int imageId = -1);
fb5e0af0 247#ifdef __WXMSW__
7bf85405
RD
248 bool InsertPage(int nPage,
249 /*wxNotebookPage*/ wxWindow *pPage,
250 const wxString& strText,
251 bool bSelect = FALSE,
252 int imageId = -1);
fb5e0af0 253#endif
7bf85405
RD
254 wxNotebookPage *GetPage(int nPage);
255
cf694132
RD
256 %addmethods {
257 void ResizeChildren() {
258 wxSizeEvent evt(self->GetClientSize());
4cd9591a 259 self->GetEventHandler()->ProcessEvent(evt);
cf694132
RD
260 }
261 }
262
263
7bf85405
RD
264};
265
9c039d08
RD
266//---------------------------------------------------------------------------
267
268class wxSplitterWindow : public wxWindow {
269public:
270 wxSplitterWindow(wxWindow* parent, wxWindowID id,
271 const wxPoint& point = wxPyDefaultPosition,
272 const wxSize& size = wxPyDefaultSize,
b639c3c5 273 long style=wxSP_3D|wxCLIP_CHILDREN,
9c039d08
RD
274 char* name = "splitterWindow");
275
b8b8dda7 276 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 277
b639c3c5 278 int GetBorderSize();
9c039d08
RD
279 int GetMinimumPaneSize();
280 int GetSashPosition();
b639c3c5 281 int GetSashSize();
9c039d08
RD
282 int GetSplitMode();
283 wxWindow* GetWindow1();
284 wxWindow* GetWindow2();
285 void Initialize(wxWindow* window);
286 bool IsSplit();
287
288 // TODO: How to handle callbacks that don't come from
289 // event system???
290 //
291 //void OnDoubleClickSash(int x, int y);
b639c3c5 292 //bool OnSashPositionChange(int newSashPosition);
9c039d08
RD
293 //void OnUnsplit(wxWindow* removed);
294
b639c3c5 295 void SetBorderSize(int width);
9c039d08 296 void SetSashPosition(int position, int redraw = TRUE);
b639c3c5 297 void SetSashSize(int width);
9c039d08
RD
298 void SetMinimumPaneSize(int paneSize);
299 void SetSplitMode(int mode);
4464bbee
RD
300 bool SplitHorizontally(wxWindow* window1, wxWindow* window2, int sashPosition = 0);
301 bool SplitVertically(wxWindow* window1, wxWindow* window2, int sashPosition = 0);
9c039d08
RD
302 bool Unsplit(wxWindow* toRemove = NULL);
303};
304
305//---------------------------------------------------------------------------
306
b639c3c5
RD
307#ifdef __WXMSW__
308
309enum {
310 wxEVT_TASKBAR_MOVE,
311 wxEVT_TASKBAR_LEFT_DOWN,
312 wxEVT_TASKBAR_LEFT_UP,
313 wxEVT_TASKBAR_RIGHT_DOWN,
314 wxEVT_TASKBAR_RIGHT_UP,
315 wxEVT_TASKBAR_LEFT_DCLICK,
316 wxEVT_TASKBAR_RIGHT_DCLICK
317};
9c039d08
RD
318
319
b639c3c5
RD
320class wxTaskBarIcon : public wxEvtHandler {
321public:
322 wxTaskBarIcon();
323 ~wxTaskBarIcon();
324
b8b8dda7
RD
325 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnMouseMove', wxEVT_TASKBAR_MOVE)"
326 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonDown', wxEVT_TASKBAR_LEFT_DOWN)"
327 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonUp', wxEVT_TASKBAR_LEFT_UP)"
328 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonDown', wxEVT_TASKBAR_RIGHT_DOWN)"
329 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonUp', wxEVT_TASKBAR_RIGHT_UP)"
330 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonDClick',wxEVT_TASKBAR_LEFT_DCLICK)"
331 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonDClick',wxEVT_TASKBAR_RIGHT_DCLICK)"
b639c3c5
RD
332
333 bool SetIcon(const wxIcon& icon, const char* tooltip = "");
334 bool RemoveIcon(void);
be4d9c1f
RD
335 bool PopupMenu(wxMenu *menu);
336
b639c3c5
RD
337};
338#endif
339
7bf85405
RD
340//---------------------------------------------------------------------------
341/////////////////////////////////////////////////////////////////////////////
342//
343// $Log$
4cd9591a
RD
344// Revision 1.11 1999/05/15 00:56:05 RD
345// fixes for GetReturnCode/SetReturnCode
346//
cf694132 347// Revision 1.10 1999/04/30 03:29:19 RD
4cd9591a 348//
cf694132
RD
349// wxPython 2.0b9, first phase (win32)
350// Added gobs of stuff, see wxPython/README.txt for details
351//
352// Revision 1.9.4.1 1999/03/16 06:04:05 RD
353//
354// wxPython 2.0b7
355//
0699c864 356// Revision 1.9 1999/02/25 07:08:36 RD
cf694132 357//
0699c864
RD
358// wxPython version 2.0b5
359//
be4d9c1f 360// Revision 1.8 1998/12/17 18:05:53 RD
0699c864 361//
be4d9c1f
RD
362// wxPython 0.5.2
363// Minor fixes and SWIG code generation for RR's changes. MSW and GTK
364// versions are much closer now!
365//
b8b8dda7
RD
366// Revision 1.7 1998/12/15 20:41:25 RD
367// Changed the import semantics from "from wxPython import *" to "from
368// wxPython.wx import *" This is for people who are worried about
369// namespace pollution, they can use "from wxPython import wx" and then
370// prefix all the wxPython identifiers with "wx."
371//
372// Added wxTaskbarIcon for wxMSW.
373//
374// Made the events work for wxGrid.
375//
376// Added wxConfig.
377//
378// Added wxMiniFrame for wxGTK, (untested.)
379//
380// Changed many of the args and return values that were pointers to gdi
381// objects to references to reflect changes in the wxWindows API.
382//
383// Other assorted fixes and additions.
384//
b639c3c5 385// Revision 1.6 1998/11/25 08:45:28 RD
b8b8dda7 386//
b639c3c5
RD
387// Added wxPalette, wxRegion, wxRegionIterator, wxTaskbarIcon
388// Added events for wxGrid
389// Other various fixes and additions
390//
4464bbee
RD
391// Revision 1.5 1998/11/03 09:21:57 RD
392// fixed a typo
393//
9c039d08 394// Revision 1.4 1998/10/02 06:40:43 RD
4464bbee 395//
9c039d08
RD
396// Version 0.4 of wxPython for MSW.
397//
fb5e0af0
RD
398// Revision 1.3 1998/08/18 19:48:20 RD
399// more wxGTK compatibility things.
400//
401// It builds now but there are serious runtime problems...
402//
03e9bead
RD
403// Revision 1.2 1998/08/15 07:36:50 RD
404// - Moved the header in the .i files out of the code that gets put into
405// the .cpp files. It caused CVS conflicts because of the RCS ID being
406// different each time.
407//
408// - A few minor fixes.
409//
7bf85405
RD
410// Revision 1.1 1998/08/09 08:25:52 RD
411// Initial version
412//
413//