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