]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/windows2.i
As per the wx-dev discussion in early Jan, replaced
[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 %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
41 %pragma(python) code = "import wx"
42
43 //---------------------------------------------------------------------------
44
45 enum {
46 /* notebook control event types */
47 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
48 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING,
49 };
50
51
52 class wxNotebookEvent : public wxNotifyEvent {
53 public:
54 wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
55 int nSel = -1, int nOldSel = -1);
56
57 int GetSelection();
58 int GetOldSelection();
59 void SetOldSelection(int page);
60 void SetSelection(int page);
61 };
62
63
64
65 class wxNotebook : public wxControl {
66 public:
67 wxNotebook(wxWindow *parent,
68 wxWindowID id,
69 const wxPoint& pos = wxDefaultPosition,
70 const wxSize& size = wxDefaultSize,
71 long style = 0,
72 char* name = "notebook");
73 %name(wxPreNotebook)wxNotebook();
74
75 bool Create(wxWindow *parent,
76 wxWindowID id,
77 const wxPoint& pos = wxDefaultPosition,
78 const wxSize& size = wxDefaultSize,
79 long style = 0,
80 char* name = "notebook");
81
82 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
83 %pragma(python) addtomethod = "wxPreNotebook:val._setOORInfo(val)"
84
85 int GetPageCount();
86 int SetSelection(int nPage);
87 void AdvanceSelection(bool bForward = TRUE);
88 int GetSelection();
89 bool SetPageText(int nPage, const wxString& strText);
90 wxString GetPageText(int nPage) const;
91
92 void SetImageList(wxImageList* imageList);
93 void AssignImageList(wxImageList *imageList) ;
94 %pragma(python) addtomethod = "AssignImageList:_args[0].thisown = 0"
95
96 wxImageList* GetImageList();
97 int GetPageImage(int nPage);
98 bool SetPageImage(int nPage, int nImage);
99 int GetRowCount();
100
101 void SetPageSize(const wxSize& size);
102 void SetPadding(const wxSize& padding);
103 bool DeletePage(int nPage);
104 bool RemovePage(int nPage);
105 bool DeleteAllPages();
106 bool AddPage(/*wxNotebookPage*/ wxWindow *pPage,
107 const wxString& strText,
108 int bSelect = FALSE,
109 int imageId = -1);
110 bool InsertPage(int nPage,
111 /*wxNotebookPage*/ wxWindow *pPage,
112 const wxString& strText,
113 bool bSelect = FALSE,
114 int imageId = -1);
115 /*wxNotebookPage*/ wxWindow *GetPage(int nPage);
116
117 %addmethods {
118 void ResizeChildren() {
119 wxSizeEvent evt(self->GetClientSize());
120 self->GetEventHandler()->ProcessEvent(evt);
121 }
122 }
123
124
125 };
126
127 //---------------------------------------------------------------------------
128
129
130 enum {
131 /* splitter window events */
132 wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING,
133 wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED,
134 wxEVT_COMMAND_SPLITTER_UNSPLIT,
135 wxEVT_COMMAND_SPLITTER_DOUBLECLICKED,
136 };
137
138
139 enum
140 {
141 wxSPLIT_HORIZONTAL,
142 wxSPLIT_VERTICAL,
143 wxSPLIT_DRAG_NONE,
144 wxSPLIT_DRAG_DRAGGING,
145 wxSPLIT_DRAG_LEFT_DOWN
146 };
147
148
149 class wxSplitterEvent : public wxCommandEvent {
150 public:
151 wxSplitterEvent(wxEventType type = wxEVT_NULL,
152 wxSplitterWindow *splitter = NULL);
153
154 int GetSashPosition();
155 int GetX();
156 int GetY();
157 wxWindow* GetWindowBeingRemoved();
158 void SetSashPosition(int pos);
159 }
160
161
162
163
164 class wxSplitterWindow : public wxWindow {
165 public:
166 wxSplitterWindow(wxWindow* parent, wxWindowID id,
167 const wxPoint& point = wxDefaultPosition,
168 const wxSize& size = wxDefaultSize,
169 long style=wxSP_3D|wxCLIP_CHILDREN,
170 char* name = "splitterWindow");
171 %name(wxPreSplitterWindow)wxSplitterWindow();
172
173 bool Create(wxWindow* parent, wxWindowID id,
174 const wxPoint& point = wxDefaultPosition,
175 const wxSize& size = wxDefaultSize,
176 long style=wxSP_3D|wxCLIP_CHILDREN,
177 char* name = "splitterWindow");
178
179 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
180 %pragma(python) addtomethod = "wxPreSplitterWindow:val._setOORInfo(val)"
181
182 // Gets the only or left/top pane
183 wxWindow *GetWindow1();
184
185 // Gets the right/bottom pane
186 wxWindow *GetWindow2();
187
188 // Sets the split mode
189 void SetSplitMode(int mode);
190
191 // Gets the split mode
192 int GetSplitMode();
193
194 // Initialize with one window
195 void Initialize(wxWindow *window);
196
197 // Associates the given window with window 2, drawing the appropriate sash
198 // and changing the split mode.
199 // Does nothing and returns FALSE if the window is already split.
200 // A sashPosition of 0 means choose a default sash position,
201 // negative sashPosition specifies the size of right/lower pane as it's
202 // absolute value rather than the size of left/upper pane.
203 virtual bool SplitVertically(wxWindow *window1,
204 wxWindow *window2,
205 int sashPosition = 0);
206 virtual bool SplitHorizontally(wxWindow *window1,
207 wxWindow *window2,
208 int sashPosition = 0);
209
210 // Removes the specified (or second) window from the view
211 // Doesn't actually delete the window.
212 bool Unsplit(wxWindow *toRemove = NULL);
213
214 // Replaces one of the windows with another one (neither old nor new
215 // parameter should be NULL)
216 bool ReplaceWindow(wxWindow *winOld, wxWindow *winNew);
217
218 // Is the window split?
219 bool IsSplit();
220
221 // Sets the sash size
222 void SetSashSize(int width);
223
224 // Sets the border size
225 void SetBorderSize(int width);
226
227 // Gets the sash size
228 int GetSashSize();
229
230 // Gets the border size
231 int GetBorderSize();
232
233 // Set the sash position
234 void SetSashPosition(int position, bool redraw = TRUE);
235
236 // Gets the sash position
237 int GetSashPosition();
238
239 // If this is zero, we can remove panes by dragging the sash.
240 void SetMinimumPaneSize(int min);
241 int GetMinimumPaneSize();
242
243 };
244
245 //---------------------------------------------------------------------------
246
247 #ifdef __WXMSW__
248
249 enum {
250 wxEVT_TASKBAR_MOVE,
251 wxEVT_TASKBAR_LEFT_DOWN,
252 wxEVT_TASKBAR_LEFT_UP,
253 wxEVT_TASKBAR_RIGHT_DOWN,
254 wxEVT_TASKBAR_RIGHT_UP,
255 wxEVT_TASKBAR_LEFT_DCLICK,
256 wxEVT_TASKBAR_RIGHT_DCLICK
257 };
258
259
260 class wxTaskBarIcon : public wxEvtHandler {
261 public:
262 wxTaskBarIcon();
263 ~wxTaskBarIcon();
264
265 //%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
266
267 // We still use the magic methods here since that is the way it is documented...
268 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnMouseMove', wxEVT_TASKBAR_MOVE)"
269 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonDown', wxEVT_TASKBAR_LEFT_DOWN)"
270 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonUp', wxEVT_TASKBAR_LEFT_UP)"
271 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonDown', wxEVT_TASKBAR_RIGHT_DOWN)"
272 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonUp', wxEVT_TASKBAR_RIGHT_UP)"
273 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnLButtonDClick',wxEVT_TASKBAR_LEFT_DCLICK)"
274 %pragma(python) addtomethod = "__init__:wx._checkForCallback(self, 'OnRButtonDClick',wxEVT_TASKBAR_RIGHT_DCLICK)"
275
276 bool SetIcon(const wxIcon& icon, const char* tooltip = "");
277 bool RemoveIcon(void);
278 bool PopupMenu(wxMenu *menu);
279 bool IsIconInstalled();
280 bool IsOK();
281 };
282 #endif
283
284 //---------------------------------------------------------------------------