]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/windows2.i
tried to fix the accel string drawing in the owner drawn menu items
[wxWidgets.git] / 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 16#include "helpers.h"
f6bcfd97 17#ifdef OLD_GRID
7bf85405 18#include <wx/grid.h>
f6bcfd97 19#endif
7bf85405 20#include <wx/notebook.h>
9c039d08 21#include <wx/splitter.h>
9416aa89 22#include <wx/imaglist.h>
b639c3c5
RD
23#ifdef __WXMSW__
24#include <wx/msw/taskbar.h>
25#endif
7bf85405
RD
26%}
27
28//----------------------------------------------------------------------
29
30%include typemaps.i
31%include my_typemaps.i
32
33// Import some definitions of other classes, etc.
34%import _defs.i
35%import misc.i
36%import gdi.i
37%import windows.i
38%import controls.i
39%import events.i
40
b8b8dda7 41%pragma(python) code = "import wx"
9c039d08 42
7bf85405
RD
43//---------------------------------------------------------------------------
44
f6bcfd97 45#ifdef OLD_GRID
b639c3c5 46
7bf85405
RD
47enum {
48 wxGRID_TEXT_CTRL,
49 wxGRID_HSCROLL,
b639c3c5 50 wxGRID_VSCROLL
7bf85405
RD
51};
52
7bf85405
RD
53class wxGridCell {
54public:
b639c3c5
RD
55 wxGridCell();
56 ~wxGridCell();
57
7bf85405 58 wxString& GetTextValue();
b639c3c5 59 void SetTextValue(const wxString& str);
b8b8dda7
RD
60 wxFont& GetFont();
61 void SetFont(wxFont& f);
7bf85405 62 wxColour& GetTextColour();
b639c3c5 63 void SetTextColour(const wxColour& colour);
7bf85405 64 wxColour& GetBackgroundColour();
b639c3c5 65 void SetBackgroundColour(const wxColour& colour);
b8b8dda7 66 wxBrush& GetBackgroundBrush();
b639c3c5
RD
67 int GetAlignment();
68 void SetAlignment(int align);
69 wxBitmap* GetCellBitmap();
b8b8dda7 70 void SetCellBitmap(wxBitmap* bitmap);
7bf85405
RD
71};
72
73
74
75
7bf85405
RD
76class wxGrid : public wxPanel {
77public:
78 wxGrid(wxWindow* parent, wxWindowID id,
b68dc582
RD
79 const wxPoint& pos=wxDefaultPosition,
80 const wxSize& size=wxDefaultSize,
7bf85405
RD
81 long style=0,
82 char* name="grid");
83
f6bcfd97
BP
84 %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)"
85 %pragma(python) addtomethod = "__init__:#wx._checkForCallback(self, 'OnSelectCell', wxEVT_GRID_SELECT_CELL)"
86 %pragma(python) addtomethod = "__init__:#wx._checkForCallback(self, 'OnCreateCell', wxEVT_GRID_CREATE_CELL)"
87 %pragma(python) addtomethod = "__init__:#wx._checkForCallback(self, 'OnChangeLabels', wxEVT_GRID_CHANGE_LABELS)"
88 %pragma(python) addtomethod = "__init__:#wx._checkForCallback(self, 'OnChangeSelectionLabel', wxEVT_GRID_CHANGE_SEL_LABEL)"
89 %pragma(python) addtomethod = "__init__:#wx._checkForCallback(self, 'OnCellChange', wxEVT_GRID_CELL_CHANGE)"
90 %pragma(python) addtomethod = "__init__:#wx._checkForCallback(self, 'OnCellLeftClick', wxEVT_GRID_CELL_LCLICK)"
91 %pragma(python) addtomethod = "__init__:#wx._checkForCallback(self, 'OnCellRightClick', wxEVT_GRID_CELL_RCLICK)"
92 %pragma(python) addtomethod = "__init__:#wx._checkForCallback(self, 'OnLabelLeftClick', wxEVT_GRID_LABEL_LCLICK)"
93 %pragma(python) addtomethod = "__init__:#wx._checkForCallback(self, 'OnLabelRightClick', wxEVT_GRID_LABEL_RCLICK)"
b639c3c5 94
9c039d08 95
7bf85405 96 void AdjustScrollbars();
b7e72427
RD
97 bool AppendCols(int n=1, int updateLabels=TRUE);
98 bool AppendRows(int n=1, int updateLabels=TRUE);
7bf85405
RD
99 void BeginBatch();
100 bool CellHitTest(int x, int y, int *OUTPUT, int *OUTPUT);
101
102 %addmethods {
103 // TODO: For now we are just ignoring the initial cellValues
104 // and widths. Add support for loading them from
105 // Python sequence objects.
106 bool CreateGrid(int rows, int cols,
107 //PyObject* cellValues = NULL,
108 //PyObject* widths = NULL,
109 short defaultWidth = wxGRID_DEFAULT_CELL_WIDTH,
110 short defaultHeight = wxGRID_DEFAULT_CELL_HEIGHT) {
111 return self->CreateGrid(rows, cols, NULL, NULL,
112 defaultWidth, defaultHeight);
113 }
114 }
115
116 bool CurrentCellVisible();
117 bool DeleteCols(int pos=0, int n=1, bool updateLabels=TRUE);
118 bool DeleteRows(int pos=0, int n=1, bool updateLabels=TRUE);
119 void EndBatch();
120
121 int GetBatchCount();
122 wxGridCell* GetCell(int row, int col);
123 int GetCellAlignment(int row, int col);
124 %name(GetDefCellAlignment)int GetCellAlignment();
125 wxColour& GetCellBackgroundColour(int row, int col);
0699c864 126 %name(GetDefCellBackgroundColour) wxColour& GetCellBackgroundColour();
8bf5d46e 127
7bf85405 128 //wxGridCell *** GetCells();
8bf5d46e
RD
129 %addmethods {
130 PyObject* GetCells() {
131 int row, col;
132 PyObject* rows = PyList_New(0);
133 for (row=0; row < self->GetRows(); row++) {
134 PyObject* rowList = PyList_New(0);
135 for (col=0; col < self->GetCols(); col++) {
136 wxGridCell* cell = self->GetCell(row, col);
137
1afc06c2 138 bool doSave = wxPyRestoreThread();
8bf5d46e 139 PyObject* pyCell = wxPyConstructObject(cell, "wxGridCell");
1afc06c2 140 wxPySaveThread(doSave);
8bf5d46e
RD
141
142 if (PyList_Append(rowList, pyCell) == -1)
143 return NULL;
144 }
145 if (PyList_Append(rows, rowList) == -1)
146 return NULL;
147 }
148 return rows;
149 }
150 }
7bf85405
RD
151 wxColour& GetCellTextColour(int row, int col);
152 %name(GetDefCellTextColour)wxColour& GetCellTextColour();
b8b8dda7
RD
153 wxFont& GetCellTextFont(int row, int col);
154 %name(GetDefCellTextFont)wxFont& GetCellTextFont();
7bf85405
RD
155 wxString& GetCellValue(int row, int col);
156 int GetCols();
157 int GetColumnWidth(int col);
cf694132 158 wxRect GetCurrentRect();
7bf85405
RD
159 int GetCursorColumn();
160 int GetCursorRow();
161 bool GetEditable();
162 wxScrollBar * GetHorizScrollBar();
163 int GetLabelAlignment(int orientation);
164 wxColour& GetLabelBackgroundColour();
165 int GetLabelSize(int orientation);
166 wxColour& GetLabelTextColour();
b8b8dda7 167 wxFont& GetLabelTextFont();
7bf85405
RD
168 wxString& GetLabelValue(int orientation, int pos);
169 int GetRowHeight(int row);
170 int GetRows();
171 int GetScrollPosX();
172 int GetScrollPosY();
173 wxTextCtrl* GetTextItem();
174 wxScrollBar* GetVertScrollBar();
175
176 bool InsertCols(int pos=0, int n=1, bool updateLabels=TRUE);
177 bool InsertRows(int pos=0, int n=1, bool updateLabels=TRUE);
178
b639c3c5 179 void OnActivate(bool active);
7bf85405
RD
180
181 void SetCellAlignment(int alignment, int row, int col);
182 %name(SetDefCellAlignment)void SetCellAlignment(int alignment);
183 void SetCellBackgroundColour(const wxColour& colour, int row, int col);
184 %name(SetDefCellBackgroundColour)
185 void SetCellBackgroundColour(const wxColour& colour);
186 void SetCellTextColour(const wxColour& colour, int row, int col);
187 %name(SetDefCellTextColour)void SetCellTextColour(const wxColour& colour);
b8b8dda7
RD
188 void SetCellTextFont(wxFont& font, int row, int col);
189 %name(SetDefCellTextFont)void SetCellTextFont(wxFont& font);
7bf85405
RD
190 void SetCellValue(const wxString& val, int row, int col);
191 void SetColumnWidth(int col, int width);
b8b8dda7 192 void SetDividerPen(wxPen& pen);
7bf85405
RD
193 void SetEditable(bool editable);
194 void SetGridCursor(int row, int col);
195 void SetLabelAlignment(int orientation, int alignment);
196 void SetLabelBackgroundColour(const wxColour& value);
197 void SetLabelSize(int orientation, int size);
198 void SetLabelTextColour(const wxColour& value);
b8b8dda7 199 void SetLabelTextFont(wxFont& font);
7bf85405
RD
200 void SetLabelValue(int orientation, const wxString& value, int pos);
201 void SetRowHeight(int row, int height);
202
203 void UpdateDimensions();
8bf5d46e
RD
204
205 bool GetEditInPlace();
206 void SetEditInPlace(int edit = TRUE);
207
7bf85405
RD
208};
209
b639c3c5
RD
210
211class wxGridEvent : public wxEvent {
212public:
213 int m_row;
214 int m_col;
215 int m_x;
216 int m_y;
217 bool m_control;
218 bool m_shift;
219 wxGridCell* m_cell;
1dc2f865
RD
220
221 int GetRow();
222 int GetCol();
223 wxPoint GetPosition();
224 bool ControlDown();
225 bool ShiftDown();
226 wxGridCell* GetCell();
b639c3c5
RD
227};
228
229
230enum {
231 wxEVT_GRID_SELECT_CELL,
232 wxEVT_GRID_CREATE_CELL,
233 wxEVT_GRID_CHANGE_LABELS,
234 wxEVT_GRID_CHANGE_SEL_LABEL,
235 wxEVT_GRID_CELL_CHANGE,
236 wxEVT_GRID_CELL_LCLICK,
237 wxEVT_GRID_CELL_RCLICK,
238 wxEVT_GRID_LABEL_LCLICK,
239 wxEVT_GRID_LABEL_RCLICK,
240};
241
f6bcfd97 242#endif
b639c3c5 243
7bf85405
RD
244//---------------------------------------------------------------------------
245
1b62f00d
RD
246enum {
247 /* notebook control event types */
248 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
249 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING,
250};
251
252
bb0054cd 253class wxNotebookEvent : public wxNotifyEvent {
7bf85405
RD
254public:
255 int GetSelection();
256 int GetOldSelection();
bb0054cd
RD
257 void SetOldSelection(int page);
258 void SetSelection(int page);
7bf85405
RD
259};
260
261
262
263class wxNotebook : public wxControl {
264public:
265 wxNotebook(wxWindow *parent,
266 wxWindowID id,
b68dc582
RD
267 const wxPoint& pos = wxDefaultPosition,
268 const wxSize& size = wxDefaultSize,
7bf85405
RD
269 long style = 0,
270 char* name = "notebook");
271
f6bcfd97 272 %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)"
9c039d08 273
7bf85405
RD
274 int GetPageCount();
275 int SetSelection(int nPage);
276 void AdvanceSelection(bool bForward = TRUE);
277 int GetSelection();
278 bool SetPageText(int nPage, const wxString& strText);
279 wxString GetPageText(int nPage) const;
280 void SetImageList(wxImageList* imageList);
281 wxImageList* GetImageList();
282 int GetPageImage(int nPage);
283 bool SetPageImage(int nPage, int nImage);
284 int GetRowCount();
285
c368d904
RD
286 void SetPageSize(const wxSize& size);
287 void SetPadding(const wxSize& padding);
7bf85405 288 bool DeletePage(int nPage);
cf694132 289 bool RemovePage(int nPage);
7bf85405
RD
290 bool DeleteAllPages();
291 bool AddPage(/*wxNotebookPage*/ wxWindow *pPage,
292 const wxString& strText,
cf694132 293 int bSelect = FALSE,
7bf85405
RD
294 int imageId = -1);
295 bool InsertPage(int nPage,
296 /*wxNotebookPage*/ wxWindow *pPage,
297 const wxString& strText,
298 bool bSelect = FALSE,
299 int imageId = -1);
bb0054cd 300 /*wxNotebookPage*/ wxWindow *GetPage(int nPage);
7bf85405 301
cf694132
RD
302 %addmethods {
303 void ResizeChildren() {
304 wxSizeEvent evt(self->GetClientSize());
4cd9591a 305 self->GetEventHandler()->ProcessEvent(evt);
cf694132
RD
306 }
307 }
308
309
7bf85405
RD
310};
311
9c039d08
RD
312//---------------------------------------------------------------------------
313
f6bcfd97 314
1b62f00d
RD
315enum {
316 /* splitter window events */
317 wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING,
318 wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED,
319 wxEVT_COMMAND_SPLITTER_UNSPLIT,
320 wxEVT_COMMAND_SPLITTER_DOUBLECLICKED,
321};
322
323
f6bcfd97
BP
324enum
325{
326 wxSPLIT_HORIZONTAL,
327 wxSPLIT_VERTICAL,
328 wxSPLIT_DRAG_NONE,
329 wxSPLIT_DRAG_DRAGGING,
330 wxSPLIT_DRAG_LEFT_DOWN
f6bcfd97
BP
331};
332
333
bb0054cd
RD
334class wxSplitterEvent : public wxCommandEvent {
335public:
336 int GetSashPosition();
337 int GetX();
338 int GetY();
339 wxWindow* GetWindowBeingRemoved();
340 void SetSashPosition(int pos);
341}
342
343
344
345
9c039d08
RD
346class wxSplitterWindow : public wxWindow {
347public:
348 wxSplitterWindow(wxWindow* parent, wxWindowID id,
b68dc582
RD
349 const wxPoint& point = wxDefaultPosition,
350 const wxSize& size = wxDefaultSize,
b639c3c5 351 long style=wxSP_3D|wxCLIP_CHILDREN,
9c039d08
RD
352 char* name = "splitterWindow");
353
f6bcfd97 354 %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)"
9c039d08 355
b639c3c5 356 int GetBorderSize();
9c039d08
RD
357 int GetMinimumPaneSize();
358 int GetSashPosition();
b639c3c5 359 int GetSashSize();
9c039d08
RD
360 int GetSplitMode();
361 wxWindow* GetWindow1();
362 wxWindow* GetWindow2();
363 void Initialize(wxWindow* window);
364 bool IsSplit();
365
9d8bd15f 366 bool ReplaceWindow(wxWindow * winOld, wxWindow * winNew);
b639c3c5 367 void SetBorderSize(int width);
9c039d08 368 void SetSashPosition(int position, int redraw = TRUE);
b639c3c5 369 void SetSashSize(int width);
9c039d08
RD
370 void SetMinimumPaneSize(int paneSize);
371 void SetSplitMode(int mode);
4464bbee
RD
372 bool SplitHorizontally(wxWindow* window1, wxWindow* window2, int sashPosition = 0);
373 bool SplitVertically(wxWindow* window1, wxWindow* window2, int sashPosition = 0);
9c039d08
RD
374 bool Unsplit(wxWindow* toRemove = NULL);
375};
376
377//---------------------------------------------------------------------------
378
b639c3c5
RD
379#ifdef __WXMSW__
380
381enum {
382 wxEVT_TASKBAR_MOVE,
383 wxEVT_TASKBAR_LEFT_DOWN,
384 wxEVT_TASKBAR_LEFT_UP,
385 wxEVT_TASKBAR_RIGHT_DOWN,
386 wxEVT_TASKBAR_RIGHT_UP,
387 wxEVT_TASKBAR_LEFT_DCLICK,
388 wxEVT_TASKBAR_RIGHT_DCLICK
389};
9c039d08
RD
390
391
b639c3c5
RD
392class wxTaskBarIcon : public wxEvtHandler {
393public:
394 wxTaskBarIcon();
395 ~wxTaskBarIcon();
396
c368d904 397 // We still use the magic methods here since that is the way it is documented...
b8b8dda7
RD
398 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnMouseMove', wxEVT_TASKBAR_MOVE)"
399 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonDown', wxEVT_TASKBAR_LEFT_DOWN)"
400 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonUp', wxEVT_TASKBAR_LEFT_UP)"
401 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonDown', wxEVT_TASKBAR_RIGHT_DOWN)"
402 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonUp', wxEVT_TASKBAR_RIGHT_UP)"
403 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonDClick',wxEVT_TASKBAR_LEFT_DCLICK)"
404 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonDClick',wxEVT_TASKBAR_RIGHT_DCLICK)"
b639c3c5
RD
405
406 bool SetIcon(const wxIcon& icon, const char* tooltip = "");
407 bool RemoveIcon(void);
be4d9c1f 408 bool PopupMenu(wxMenu *menu);
c368d904
RD
409 bool IsIconInstalled();
410 bool IsOK();
b639c3c5
RD
411};
412#endif
413
7bf85405 414//---------------------------------------------------------------------------