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