]> git.saurik.com Git - wxWidgets.git/blame - utils/wxPython/src/windows2.i
wxPython 0.5.2
[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);
122 %name(GetDefCellBackgroundColour)
123 wxColour& GetCellBackgroundColour();
124 //wxGridCell *** GetCells();
125 wxColour& GetCellTextColour(int row, int col);
126 %name(GetDefCellTextColour)wxColour& GetCellTextColour();
b8b8dda7
RD
127 wxFont& GetCellTextFont(int row, int col);
128 %name(GetDefCellTextFont)wxFont& GetCellTextFont();
7bf85405
RD
129 wxString& GetCellValue(int row, int col);
130 int GetCols();
131 int GetColumnWidth(int col);
132 wxRect& GetCurrentRect();
133 int GetCursorColumn();
134 int GetCursorRow();
135 bool GetEditable();
136 wxScrollBar * GetHorizScrollBar();
137 int GetLabelAlignment(int orientation);
138 wxColour& GetLabelBackgroundColour();
139 int GetLabelSize(int orientation);
140 wxColour& GetLabelTextColour();
b8b8dda7 141 wxFont& GetLabelTextFont();
7bf85405
RD
142 wxString& GetLabelValue(int orientation, int pos);
143 int GetRowHeight(int row);
144 int GetRows();
145 int GetScrollPosX();
146 int GetScrollPosY();
147 wxTextCtrl* GetTextItem();
148 wxScrollBar* GetVertScrollBar();
149
150 bool InsertCols(int pos=0, int n=1, bool updateLabels=TRUE);
151 bool InsertRows(int pos=0, int n=1, bool updateLabels=TRUE);
152
b639c3c5 153 void OnActivate(bool active);
7bf85405
RD
154
155 void SetCellAlignment(int alignment, int row, int col);
156 %name(SetDefCellAlignment)void SetCellAlignment(int alignment);
157 void SetCellBackgroundColour(const wxColour& colour, int row, int col);
158 %name(SetDefCellBackgroundColour)
159 void SetCellBackgroundColour(const wxColour& colour);
160 void SetCellTextColour(const wxColour& colour, int row, int col);
161 %name(SetDefCellTextColour)void SetCellTextColour(const wxColour& colour);
b8b8dda7
RD
162 void SetCellTextFont(wxFont& font, int row, int col);
163 %name(SetDefCellTextFont)void SetCellTextFont(wxFont& font);
7bf85405
RD
164 void SetCellValue(const wxString& val, int row, int col);
165 void SetColumnWidth(int col, int width);
b8b8dda7 166 void SetDividerPen(wxPen& pen);
7bf85405
RD
167 void SetEditable(bool editable);
168 void SetGridCursor(int row, int col);
169 void SetLabelAlignment(int orientation, int alignment);
170 void SetLabelBackgroundColour(const wxColour& value);
171 void SetLabelSize(int orientation, int size);
172 void SetLabelTextColour(const wxColour& value);
b8b8dda7 173 void SetLabelTextFont(wxFont& font);
7bf85405
RD
174 void SetLabelValue(int orientation, const wxString& value, int pos);
175 void SetRowHeight(int row, int height);
176
177 void UpdateDimensions();
178};
179
b639c3c5
RD
180
181class wxGridEvent : public wxEvent {
182public:
183 int m_row;
184 int m_col;
185 int m_x;
186 int m_y;
187 bool m_control;
188 bool m_shift;
189 wxGridCell* m_cell;
190};
191
192
193enum {
194 wxEVT_GRID_SELECT_CELL,
195 wxEVT_GRID_CREATE_CELL,
196 wxEVT_GRID_CHANGE_LABELS,
197 wxEVT_GRID_CHANGE_SEL_LABEL,
198 wxEVT_GRID_CELL_CHANGE,
199 wxEVT_GRID_CELL_LCLICK,
200 wxEVT_GRID_CELL_RCLICK,
201 wxEVT_GRID_LABEL_LCLICK,
202 wxEVT_GRID_LABEL_RCLICK,
203};
204
205
7bf85405
RD
206//---------------------------------------------------------------------------
207
208class wxNotebookEvent : public wxCommandEvent {
209public:
210 int GetSelection();
211 int GetOldSelection();
212};
213
214
215
216class wxNotebook : public wxControl {
217public:
218 wxNotebook(wxWindow *parent,
219 wxWindowID id,
220 const wxPoint& pos = wxPyDefaultPosition,
221 const wxSize& size = wxPyDefaultSize,
222 long style = 0,
223 char* name = "notebook");
224
b8b8dda7 225 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 226
7bf85405
RD
227 int GetPageCount();
228 int SetSelection(int nPage);
229 void AdvanceSelection(bool bForward = TRUE);
230 int GetSelection();
231 bool SetPageText(int nPage, const wxString& strText);
232 wxString GetPageText(int nPage) const;
233 void SetImageList(wxImageList* imageList);
234 wxImageList* GetImageList();
235 int GetPageImage(int nPage);
236 bool SetPageImage(int nPage, int nImage);
237 int GetRowCount();
238
239 // LINK ERROR: void SetPageSize(const wxSize& size);
240 // LINK ERROR: void SetPadding(const wxSize& padding);
241 bool DeletePage(int nPage);
242 bool DeleteAllPages();
243 bool AddPage(/*wxNotebookPage*/ wxWindow *pPage,
244 const wxString& strText,
245 bool bSelect = FALSE,
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
256};
257
9c039d08
RD
258//---------------------------------------------------------------------------
259
260class wxSplitterWindow : public wxWindow {
261public:
262 wxSplitterWindow(wxWindow* parent, wxWindowID id,
263 const wxPoint& point = wxPyDefaultPosition,
264 const wxSize& size = wxPyDefaultSize,
b639c3c5 265 long style=wxSP_3D|wxCLIP_CHILDREN,
9c039d08
RD
266 char* name = "splitterWindow");
267
b8b8dda7 268 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 269
b639c3c5 270 int GetBorderSize();
9c039d08
RD
271 int GetMinimumPaneSize();
272 int GetSashPosition();
b639c3c5 273 int GetSashSize();
9c039d08
RD
274 int GetSplitMode();
275 wxWindow* GetWindow1();
276 wxWindow* GetWindow2();
277 void Initialize(wxWindow* window);
278 bool IsSplit();
279
280 // TODO: How to handle callbacks that don't come from
281 // event system???
282 //
283 //void OnDoubleClickSash(int x, int y);
b639c3c5 284 //bool OnSashPositionChange(int newSashPosition);
9c039d08
RD
285 //void OnUnsplit(wxWindow* removed);
286
b639c3c5 287 void SetBorderSize(int width);
9c039d08 288 void SetSashPosition(int position, int redraw = TRUE);
b639c3c5 289 void SetSashSize(int width);
9c039d08
RD
290 void SetMinimumPaneSize(int paneSize);
291 void SetSplitMode(int mode);
4464bbee
RD
292 bool SplitHorizontally(wxWindow* window1, wxWindow* window2, int sashPosition = 0);
293 bool SplitVertically(wxWindow* window1, wxWindow* window2, int sashPosition = 0);
9c039d08
RD
294 bool Unsplit(wxWindow* toRemove = NULL);
295};
296
297//---------------------------------------------------------------------------
298
b639c3c5
RD
299#ifdef __WXMSW__
300
301enum {
302 wxEVT_TASKBAR_MOVE,
303 wxEVT_TASKBAR_LEFT_DOWN,
304 wxEVT_TASKBAR_LEFT_UP,
305 wxEVT_TASKBAR_RIGHT_DOWN,
306 wxEVT_TASKBAR_RIGHT_UP,
307 wxEVT_TASKBAR_LEFT_DCLICK,
308 wxEVT_TASKBAR_RIGHT_DCLICK
309};
9c039d08
RD
310
311
b639c3c5
RD
312class wxTaskBarIcon : public wxEvtHandler {
313public:
314 wxTaskBarIcon();
315 ~wxTaskBarIcon();
316
b8b8dda7
RD
317 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnMouseMove', wxEVT_TASKBAR_MOVE)"
318 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonDown', wxEVT_TASKBAR_LEFT_DOWN)"
319 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonUp', wxEVT_TASKBAR_LEFT_UP)"
320 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonDown', wxEVT_TASKBAR_RIGHT_DOWN)"
321 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonUp', wxEVT_TASKBAR_RIGHT_UP)"
322 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonDClick',wxEVT_TASKBAR_LEFT_DCLICK)"
323 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonDClick',wxEVT_TASKBAR_RIGHT_DCLICK)"
b639c3c5
RD
324
325 bool SetIcon(const wxIcon& icon, const char* tooltip = "");
326 bool RemoveIcon(void);
327};
328#endif
329
7bf85405
RD
330//---------------------------------------------------------------------------
331/////////////////////////////////////////////////////////////////////////////
332//
333// $Log$
b8b8dda7
RD
334// Revision 1.7 1998/12/15 20:41:25 RD
335// Changed the import semantics from "from wxPython import *" to "from
336// wxPython.wx import *" This is for people who are worried about
337// namespace pollution, they can use "from wxPython import wx" and then
338// prefix all the wxPython identifiers with "wx."
339//
340// Added wxTaskbarIcon for wxMSW.
341//
342// Made the events work for wxGrid.
343//
344// Added wxConfig.
345//
346// Added wxMiniFrame for wxGTK, (untested.)
347//
348// Changed many of the args and return values that were pointers to gdi
349// objects to references to reflect changes in the wxWindows API.
350//
351// Other assorted fixes and additions.
352//
b639c3c5 353// Revision 1.6 1998/11/25 08:45:28 RD
b8b8dda7 354//
b639c3c5
RD
355// Added wxPalette, wxRegion, wxRegionIterator, wxTaskbarIcon
356// Added events for wxGrid
357// Other various fixes and additions
358//
4464bbee
RD
359// Revision 1.5 1998/11/03 09:21:57 RD
360// fixed a typo
361//
9c039d08 362// Revision 1.4 1998/10/02 06:40:43 RD
4464bbee 363//
9c039d08
RD
364// Version 0.4 of wxPython for MSW.
365//
fb5e0af0
RD
366// Revision 1.3 1998/08/18 19:48:20 RD
367// more wxGTK compatibility things.
368//
369// It builds now but there are serious runtime problems...
370//
03e9bead
RD
371// Revision 1.2 1998/08/15 07:36:50 RD
372// - Moved the header in the .i files out of the code that gets put into
373// the .cpp files. It caused CVS conflicts because of the RCS ID being
374// different each time.
375//
376// - A few minor fixes.
377//
7bf85405
RD
378// Revision 1.1 1998/08/09 08:25:52 RD
379// Initial version
380//
381//