]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/windows2.i
An implementation of wxPen.GetDashes.
[wxWidgets.git] / 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 #ifdef OLD_GRID
18 #include <wx/grid.h>
19 #endif
20 #include <wx/notebook.h>
21 #include <wx/splitter.h>
22 #include <wx/imaglist.h>
23 #ifdef __WXMSW__
24 #include <wx/msw/taskbar.h>
25 #endif
26 %}
27
28 //----------------------------------------------------------------------
29
30 %{
31 // Put some wx default wxChar* values into wxStrings.
32 DECLARE_DEF_STRING(NOTEBOOK_NAME);
33 DECLARE_DEF_STRING(PanelNameStr);
34
35 static const wxChar* wxSplitterNameStr = wxT("splitter");
36 DECLARE_DEF_STRING(SplitterNameStr);
37 static const wxString wxPyEmptyString(wxT(""));
38 %}
39
40 //----------------------------------------------------------------------
41
42 %include typemaps.i
43 %include my_typemaps.i
44
45 // Import some definitions of other classes, etc.
46 %import _defs.i
47 %import misc.i
48 %import gdi.i
49 %import windows.i
50 %import controls.i
51 %import events.i
52
53 %pragma(python) code = "import wx"
54
55 //---------------------------------------------------------------------------
56
57 enum {
58 /* notebook control event types */
59 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
60 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING,
61 };
62
63
64 class wxNotebookEvent : public wxNotifyEvent {
65 public:
66 wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
67 int nSel = -1, int nOldSel = -1);
68
69 int GetSelection();
70 int GetOldSelection();
71 void SetOldSelection(int page);
72 void SetSelection(int page);
73 };
74
75
76
77 class wxNotebook : public wxControl {
78 public:
79 wxNotebook(wxWindow *parent,
80 wxWindowID id,
81 const wxPoint& pos = wxDefaultPosition,
82 const wxSize& size = wxDefaultSize,
83 long style = 0,
84 const wxString& name = wxPyNOTEBOOK_NAME);
85 %name(wxPreNotebook)wxNotebook();
86
87 bool Create(wxWindow *parent,
88 wxWindowID id,
89 const wxPoint& pos = wxDefaultPosition,
90 const wxSize& size = wxDefaultSize,
91 long style = 0,
92 const wxString& name = wxPyNOTEBOOK_NAME);
93
94 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
95 %pragma(python) addtomethod = "wxPreNotebook:val._setOORInfo(val)"
96
97 int GetPageCount();
98 int SetSelection(int nPage);
99 void AdvanceSelection(bool bForward = TRUE);
100 int GetSelection();
101 bool SetPageText(int nPage, const wxString& strText);
102 wxString GetPageText(int nPage) const;
103
104 void SetImageList(wxImageList* imageList);
105 void AssignImageList(wxImageList *imageList) ;
106 %pragma(python) addtomethod = "AssignImageList:_args[0].thisown = 0"
107
108 wxImageList* GetImageList();
109 int GetPageImage(int nPage);
110 bool SetPageImage(int nPage, int nImage);
111 int GetRowCount();
112
113 void SetPageSize(const wxSize& size);
114 void SetPadding(const wxSize& padding);
115 bool DeletePage(int nPage);
116 bool RemovePage(int nPage);
117 bool DeleteAllPages();
118 bool AddPage(/*wxNotebookPage*/ wxWindow *pPage,
119 const wxString& strText,
120 int bSelect = FALSE,
121 int imageId = -1);
122 bool InsertPage(int nPage,
123 /*wxNotebookPage*/ wxWindow *pPage,
124 const wxString& strText,
125 bool bSelect = FALSE,
126 int imageId = -1);
127 /*wxNotebookPage*/ wxWindow *GetPage(int nPage);
128
129 %addmethods {
130 void ResizeChildren() {
131 wxSizeEvent evt(self->GetClientSize());
132 self->GetEventHandler()->ProcessEvent(evt);
133 }
134 }
135
136
137 };
138
139 //---------------------------------------------------------------------------
140
141
142 enum {
143 /* splitter window events */
144 wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING,
145 wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED,
146 wxEVT_COMMAND_SPLITTER_UNSPLIT,
147 wxEVT_COMMAND_SPLITTER_DOUBLECLICKED,
148 };
149
150
151 enum
152 {
153 wxSPLIT_HORIZONTAL,
154 wxSPLIT_VERTICAL,
155 wxSPLIT_DRAG_NONE,
156 wxSPLIT_DRAG_DRAGGING,
157 wxSPLIT_DRAG_LEFT_DOWN
158 };
159
160
161 class wxSplitterEvent : public wxNotifyEvent {
162 public:
163 wxSplitterEvent(wxEventType type = wxEVT_NULL,
164 wxSplitterWindow *splitter = NULL);
165
166 int GetSashPosition();
167 int GetX();
168 int GetY();
169 wxWindow* GetWindowBeingRemoved();
170 void SetSashPosition(int pos);
171 }
172
173
174
175
176 class wxSplitterWindow : public wxWindow {
177 public:
178 wxSplitterWindow(wxWindow* parent, wxWindowID id,
179 const wxPoint& point = wxDefaultPosition,
180 const wxSize& size = wxDefaultSize,
181 long style=wxSP_3D|wxCLIP_CHILDREN,
182 const wxString& name = wxPySplitterNameStr);
183 %name(wxPreSplitterWindow)wxSplitterWindow();
184
185 bool Create(wxWindow* parent, wxWindowID id,
186 const wxPoint& point = wxDefaultPosition,
187 const wxSize& size = wxDefaultSize,
188 long style=wxSP_3D|wxCLIP_CHILDREN,
189 const wxString& name = wxPySplitterNameStr);
190
191 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
192 %pragma(python) addtomethod = "wxPreSplitterWindow:val._setOORInfo(val)"
193
194 // Gets the only or left/top pane
195 wxWindow *GetWindow1();
196
197 // Gets the right/bottom pane
198 wxWindow *GetWindow2();
199
200 // Sets the split mode
201 void SetSplitMode(int mode);
202
203 // Gets the split mode
204 int GetSplitMode();
205
206 // Initialize with one window
207 void Initialize(wxWindow *window);
208
209 // Associates the given window with window 2, drawing the appropriate sash
210 // and changing the split mode.
211 // Does nothing and returns FALSE if the window is already split.
212 // A sashPosition of 0 means choose a default sash position,
213 // negative sashPosition specifies the size of right/lower pane as it's
214 // absolute value rather than the size of left/upper pane.
215 virtual bool SplitVertically(wxWindow *window1,
216 wxWindow *window2,
217 int sashPosition = 0);
218 virtual bool SplitHorizontally(wxWindow *window1,
219 wxWindow *window2,
220 int sashPosition = 0);
221
222 // Removes the specified (or second) window from the view
223 // Doesn't actually delete the window.
224 bool Unsplit(wxWindow *toRemove = NULL);
225
226 // Replaces one of the windows with another one (neither old nor new
227 // parameter should be NULL)
228 bool ReplaceWindow(wxWindow *winOld, wxWindow *winNew);
229
230 // Is the window split?
231 bool IsSplit();
232
233 // Sets the sash size
234 void SetSashSize(int width);
235
236 // Sets the border size
237 void SetBorderSize(int width);
238
239 // Gets the sash size
240 int GetSashSize();
241
242 // Gets the border size
243 int GetBorderSize();
244
245 // Set the sash position
246 void SetSashPosition(int position, bool redraw = TRUE);
247
248 // Gets the sash position
249 int GetSashPosition();
250
251 // If this is zero, we can remove panes by dragging the sash.
252 void SetMinimumPaneSize(int min);
253 int GetMinimumPaneSize();
254
255 // Resizes subwindows
256 virtual void SizeWindows();
257
258 void SetNeedUpdating(bool needUpdating) { m_needUpdating = needUpdating; }
259 bool GetNeedUpdating() const { return m_needUpdating ; }
260
261 };
262
263 //---------------------------------------------------------------------------
264
265 #ifdef __WXMSW__
266
267 enum {
268 wxEVT_TASKBAR_MOVE,
269 wxEVT_TASKBAR_LEFT_DOWN,
270 wxEVT_TASKBAR_LEFT_UP,
271 wxEVT_TASKBAR_RIGHT_DOWN,
272 wxEVT_TASKBAR_RIGHT_UP,
273 wxEVT_TASKBAR_LEFT_DCLICK,
274 wxEVT_TASKBAR_RIGHT_DCLICK
275 };
276
277
278 class wxTaskBarIcon : public wxEvtHandler {
279 public:
280 wxTaskBarIcon();
281 ~wxTaskBarIcon();
282
283 //%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
284
285 // We still use the magic methods here since that is the way it is documented...
286 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnMouseMove', wxEVT_TASKBAR_MOVE)"
287 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonDown', wxEVT_TASKBAR_LEFT_DOWN)"
288 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonUp', wxEVT_TASKBAR_LEFT_UP)"
289 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonDown', wxEVT_TASKBAR_RIGHT_DOWN)"
290 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonUp', wxEVT_TASKBAR_RIGHT_UP)"
291 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonDClick',wxEVT_TASKBAR_LEFT_DCLICK)"
292 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonDClick',wxEVT_TASKBAR_RIGHT_DCLICK)"
293
294 bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxPyEmptyString);
295 bool RemoveIcon(void);
296 bool PopupMenu(wxMenu *menu);
297 bool IsIconInstalled();
298 bool IsOK();
299 };
300 #endif
301
302 //---------------------------------------------------------------------------
303 //---------------------------------------------------------------------------
304 // wxPyWindow derives from wxWindow and adds support for overriding many of
305 // the virtual methods in Python derived classes.
306
307 // Do wxPyControl too.
308
309 // %{
310 // class wxPyWindow : public wxWindow
311 // {
312 // DECLARE_DYNAMIC_CLASS(wxPyWindow)
313 // public:
314 // wxPyWindow(wxWindow* parent, const wxWindowID id,
315 // const wxPoint& pos = wxDefaultPosition,
316 // const wxSize& size = wxDefaultSize,
317 // long style = 0,
318 // const wxString& name = wxPyPanelNameStr)
319 // : wxWindow(parent, id, pos, size, style, name) {}
320
321
322 // // Which of these should be done???
323 // DoSetSize
324 // DoGetSize
325 // DoSetClientSize
326 // DoGetClientSize
327 // DoGetPosition
328 // DoSetVirtualSize
329 // DoGetVirtualSize
330
331 // GetClientAreaOrigin
332 // Fit
333 // SetSizeHints
334 // SetVirtualSizeHints
335 // GetMaxSize
336 // Show
337 // Enable
338 // SetFocus
339 // SetFocusFromKbd
340 // AcceptsFocus
341 // AcceptsFocusFromKeyboard
342 // GetDefaultItem
343 // SetDefaultItem
344 // IsTopLevel
345 // AddChild
346 // RemoveChild
347 // Validate
348 // TransferDataToWindow
349 // TransferDataFromWindow
350 // InitDialog
351 // SetBackgroundColour
352 // SetForegroundColour
353 // GetCharHeight
354 // GetCharWidth
355 // DoClientToScreen
356 // DoScreenToClient
357 // DoHitTest
358 // DoPopupMenu
359 // DoSetToolTip
360 // DoCaptureMouse
361 // DoReleaseMouse
362 // DoMoveWindow
363
364
365 // PYPRIVATE;
366 // };
367
368
369 // %}
370
371
372 //---------------------------------------------------------------------------