]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: windows.i | |
3 | // Purpose: SWIG definitions of various window classes | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 6/24/97 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 1998 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | ||
14 | %module windows | |
15 | ||
16 | %{ | |
17 | #include "helpers.h" | |
18 | ||
19 | #ifdef __WXMSW__ | |
20 | // wxGTK defines wxMenuItem inside menu.h | |
21 | #include <wx/menuitem.h> | |
22 | #endif | |
23 | ||
24 | #ifdef __WXMSW__ | |
25 | #include <wx/minifram.h> | |
26 | #endif | |
27 | %} | |
28 | ||
29 | //---------------------------------------------------------------------- | |
30 | ||
31 | %include typemaps.i | |
32 | %include my_typemaps.i | |
33 | ||
34 | // Import some definitions of other classes, etc. | |
35 | %import _defs.i | |
36 | %import misc.i | |
37 | %import gdi.i | |
38 | ||
39 | ||
40 | //--------------------------------------------------------------------------- | |
41 | ||
42 | class wxEvtHandler { | |
43 | public: | |
44 | %addmethods { | |
45 | void Connect( int id, int lastId, int eventType, PyObject* func) { | |
46 | if (PyCallable_Check(func)) { | |
47 | self->Connect(id, lastId, eventType, | |
48 | (wxObjectEventFunction) &wxPyCallback::EventThunker, | |
49 | new wxPyCallback(func)); | |
50 | } | |
51 | } | |
52 | } | |
53 | }; | |
54 | ||
55 | ||
56 | //---------------------------------------------------------------------- | |
57 | ||
58 | ||
59 | class wxWindow : public wxEvtHandler { | |
60 | public: | |
61 | ||
62 | wxWindow(wxWindow* parent, const wxWindowID id, | |
63 | const wxPoint& pos = wxPyDefaultPosition, | |
64 | const wxSize& size = wxPyDefaultSize, | |
65 | long style = 0, | |
66 | char* name = "panel"); | |
67 | ||
68 | ||
69 | void CaptureMouse(); | |
70 | void Center(int direction = wxHORIZONTAL); | |
71 | void Centre(int direction = wxHORIZONTAL); | |
72 | void ClientToScreen(int *BOTH, int *BOTH); | |
73 | bool Close(int force = FALSE); | |
74 | bool Destroy(); | |
75 | void DestroyChildren(); | |
76 | #ifdef __WXMSW__ | |
77 | void DragAcceptFiles(bool accept); | |
78 | #endif | |
79 | void Enable(bool enable); | |
80 | //bool FakePopupMenu(wxMenu* menu, int x, int y); | |
81 | %name(FindWindowByID) wxWindow* FindWindow(long id); | |
82 | %name(FindWindowByName) wxWindow* FindWindow(const wxString& name); | |
83 | void Fit(); | |
84 | wxColour GetBackgroundColour(); | |
85 | int GetCharHeight(); | |
86 | int GetCharWidth(); | |
87 | void GetClientSize(int *OUTPUT, int *OUTPUT); | |
88 | wxLayoutConstraints * GetConstraints(); | |
89 | #ifdef __WXMSW__ | |
90 | wxButton* GetDefaultItem(); | |
91 | #endif | |
92 | //wxEvtHandler* GetEventHandler(); | |
93 | wxFont* GetFont(); | |
94 | wxColour GetForegroundColour(); | |
95 | wxWindow * GetGrandParent(); | |
96 | int GetId(); | |
97 | void GetPosition(int *OUTPUT, int *OUTPUT); | |
98 | wxString GetLabel(); | |
99 | wxString GetName(); | |
100 | wxWindow * GetParent(); | |
101 | int GetReturnCode(); | |
102 | int GetScrollThumb(int orientation); | |
103 | int GetScrollPos(int orientation); | |
104 | int GetScrollRange(int orientation); | |
105 | void GetSize(int *OUTPUT, int *OUTPUT); | |
106 | void GetTextExtent(const wxString& string, int *OUTPUT, int *OUTPUT); // int* descent = NULL, int* externalLeading = NULL, const wxFont* font = NULL, bool use16 = FALSE) | |
107 | wxString GetTitle(); | |
108 | long GetWindowStyleFlag(); | |
109 | void InitDialog(); | |
110 | bool IsEnabled(); | |
111 | bool IsRetained(); | |
112 | bool IsShown(); | |
113 | void Layout(); | |
114 | bool LoadFromResource(wxWindow* parent, const wxString& resourceName, const wxResourceTable* resourceTable = NULL); | |
115 | void Lower(); | |
116 | void MakeModal(bool flag); | |
117 | void Move(int x, int y); | |
118 | ||
119 | //wxEvtHandler* PopEventHandler(bool deleteHandler = FALSE); | |
120 | bool PopupMenu(wxMenu *menu, int x, int y); | |
121 | //void PushEventHandler(wxEvtHandler* handler); | |
122 | ||
123 | void Raise(); | |
124 | void Refresh(bool eraseBackground = TRUE, const wxRect* rect = NULL); | |
125 | void ReleaseMouse(); | |
126 | void ScreenToClient(int *BOTH, int *BOTH); | |
127 | void ScrollWindow(int dx, int dy, const wxRect* rect = NULL); | |
128 | void SetAutoLayout(bool autoLayout); | |
129 | void SetBackgroundColour(const wxColour& colour); | |
130 | void SetConstraints(wxLayoutConstraints *constraints); | |
131 | void SetDoubleClick(bool allowDoubleClick); | |
132 | void SetFocus(); | |
133 | void SetFont(const wxFont& font); | |
134 | void SetForegroundColour(const wxColour& colour); | |
135 | void SetId(int id); | |
136 | void SetName(const wxString& name); | |
137 | void SetReturnCode(int retCode); | |
138 | void SetScrollbar(int orientation, int position, int thumbSize, int range, bool refresh = TRUE); | |
139 | void SetScrollPos(int orientation, int pos, bool refresh = TRUE); | |
140 | ||
141 | //void SetSize(int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO); | |
142 | //%name(SetSizeOnly) void SetSize(int width, int height); | |
143 | ||
144 | %name(SetDimensions) void SetSize(int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO); | |
145 | %addmethods { | |
146 | void SetSize(const wxSize& size) { | |
147 | self->SetSize(size.x, size.y); | |
148 | } | |
149 | ||
150 | void SetPosition(const wxPoint& pos) { | |
151 | self->SetSize(pos.x, pos.y, -1, -1); | |
152 | } | |
153 | } | |
154 | ||
155 | void SetSizeHints(int minW=-1, int minH=-1, int maxW=-1, int maxH=-1, int incW=-1, int incH=-1); | |
156 | void SetClientSize(int width, int height); | |
157 | //void SetPalette(wxPalette* palette); | |
158 | //void SetColourMap(wxColourMap *colourMap); | |
159 | void SetCursor(const wxCursor&cursor); | |
160 | //void SetEventHandler(wxEvtHandler* handler); | |
161 | void SetTitle(const wxString& title); | |
162 | bool Show(bool show); | |
163 | bool TransferDataFromWindow(); | |
164 | bool TransferDataToWindow(); | |
165 | bool Validate(); | |
166 | #ifdef __WXMSW__ | |
167 | void WarpPointer(int x, int y); | |
168 | #endif | |
169 | ||
170 | }; | |
171 | ||
172 | ||
173 | // Static method(s) | |
174 | #ifdef __WXMSW__ | |
175 | %inline %{ | |
176 | wxWindow* wxWindow_FindFocus() { | |
177 | return wxWindow::FindFocus(); | |
178 | } | |
179 | %} | |
180 | #endif | |
181 | ||
182 | //---------------------------------------------------------------------- | |
183 | ||
184 | class wxFrame : public wxWindow { | |
185 | public: | |
186 | wxFrame(wxWindow* parent, const wxWindowID id, const wxString& title, | |
187 | const wxPoint& pos = wxPyDefaultPosition, | |
188 | const wxSize& size = wxPyDefaultSize, | |
189 | long style = wxDEFAULT_FRAME_STYLE, | |
190 | char* name = "frame"); | |
191 | ||
192 | void Centre(int direction = wxBOTH); | |
193 | #ifdef __WXMSW__ | |
194 | void Command(int id); | |
195 | #endif | |
196 | bool CreateStatusBar(int number = 1); | |
197 | wxMenuBar* GetMenuBar(); | |
198 | wxStatusBar* GetStatusBar(); | |
199 | wxString GetTitle(); | |
200 | void Iconize(bool iconize); | |
201 | bool IsIconized(); | |
202 | void Maximize(bool maximize); | |
203 | #ifdef __WXMSW__ | |
204 | void SetAcceleratorTable(const wxAcceleratorTable& accel); | |
205 | #endif | |
206 | void SetIcon(const wxIcon& icon); | |
207 | void SetMenuBar(wxMenuBar* menuBar); | |
208 | void SetStatusText(const wxString& text, int number = 0); | |
209 | void SetStatusWidths(int LCOUNT, int* LIST); // use typemap | |
210 | void SetTitle(const wxString& title); | |
211 | ||
212 | }; | |
213 | ||
214 | //--------------------------------------------------------------------------- | |
215 | ||
216 | #ifdef __WXMSW__ | |
217 | class wxMiniFrame : public wxFrame { | |
218 | public: | |
219 | wxMiniFrame(wxWindow* parent, const wxWindowID id, const wxString& title, | |
220 | const wxPoint& pos = wxPyDefaultPosition, | |
221 | const wxSize& size = wxPyDefaultSize, | |
222 | long style = wxDEFAULT_FRAME_STYLE, | |
223 | char* name = "frame"); | |
224 | }; | |
225 | #endif | |
226 | ||
227 | //--------------------------------------------------------------------------- | |
228 | ||
229 | class wxPanel : public wxWindow { | |
230 | public: | |
231 | wxPanel(wxWindow* parent, | |
232 | const wxWindowID id, | |
233 | const wxPoint& pos = wxPyDefaultPosition, | |
234 | const wxSize& size = wxPyDefaultSize, | |
235 | long style = wxTAB_TRAVERSAL, | |
236 | const char* name = "panel"); | |
237 | ||
238 | void InitDialog(); | |
239 | }; | |
240 | ||
241 | //--------------------------------------------------------------------------- | |
242 | ||
243 | class wxDialog : public wxPanel { | |
244 | public: | |
245 | wxDialog(wxWindow* parent, | |
246 | const wxWindowID id, | |
247 | const wxString& title, | |
248 | const wxPoint& pos = wxPyDefaultPosition, | |
249 | const wxSize& size = wxPyDefaultSize, | |
250 | long style = wxDEFAULT_DIALOG_STYLE, | |
251 | const char* name = "dialogBox"); | |
252 | ||
253 | void Centre(int direction = wxBOTH); | |
254 | void EndModal(int retCode); | |
255 | wxString GetTitle(); | |
256 | void Iconize(bool iconize); | |
257 | bool IsIconized(); | |
258 | void SetModal(bool flag); | |
259 | bool IsModal(); | |
260 | void SetTitle(const wxString& title); | |
261 | bool Show(bool show); | |
262 | int ShowModal(); | |
263 | }; | |
264 | ||
265 | //--------------------------------------------------------------------------- | |
266 | ||
267 | class wxScrolledWindow : public wxWindow { | |
268 | public: | |
269 | wxScrolledWindow(wxWindow* parent, | |
270 | const wxWindowID id = -1, | |
271 | const wxPoint& pos = wxPyDefaultPosition, | |
272 | const wxSize& size = wxPyDefaultSize, | |
273 | long style = wxHSCROLL | wxVSCROLL, | |
274 | char* name = "scrolledWindow"); | |
275 | ||
276 | void EnableScrolling(bool xScrolling, bool yScrolling); | |
277 | void GetScrollPixelsPerUnit(int* OUTPUT, int* OUTPUT); | |
278 | void GetVirtualSize(int* OUTPUT, int* OUTPUT); | |
279 | bool IsRetained(); | |
280 | void PrepareDC(wxDC& dc); | |
281 | void Scroll(int x, int y); | |
282 | void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY, | |
283 | int noUnitsX, int noUnitsY, | |
284 | int xPos = 0, int yPos = 0); | |
285 | void ViewStart(int* OUTPUT, int* OUTPUT); | |
286 | }; | |
287 | ||
288 | //---------------------------------------------------------------------- | |
289 | ||
290 | ||
291 | class wxMenu : public wxEvtHandler { | |
292 | public: | |
293 | wxMenu(const wxString& title = wxPyEmptyStr); | |
294 | ||
295 | void Append(int id, const wxString& item, | |
296 | const wxString& helpString = wxPyEmptyStr, | |
297 | int checkable = FALSE); | |
298 | %name(AppendMenu)void Append(int id, const wxString& item, wxMenu *subMenu, | |
299 | const wxString& helpString = wxPyEmptyStr); | |
300 | void AppendSeparator(); | |
301 | void Break(); | |
302 | void Check(int id, bool flag); | |
303 | void Enable(int id, bool enable); | |
304 | int FindItem(const wxString& itemString); | |
305 | #ifdef __WXMSW__ | |
306 | wxString GetTitle(); | |
307 | void SetTitle(const wxString& title); | |
308 | #endif | |
309 | wxMenuItem* FindItemForId(int id); | |
310 | wxString GetHelpString(int id); | |
311 | wxString GetLabel(int id); | |
312 | void SetHelpString(int id, const wxString& helpString); | |
313 | bool IsChecked(int id); | |
314 | bool IsEnabled(int id); | |
315 | void SetLabel(int id, const wxString& label); | |
316 | }; | |
317 | ||
318 | ||
319 | // | |
320 | // This one knows how to set a callback and handle INC- and DECREFing it. To | |
321 | // be used for PopupMenus, but you must retain a referece to it while using | |
322 | // it. | |
323 | // | |
324 | class wxPyMenu : public wxMenu { | |
325 | public: | |
326 | wxPyMenu(const wxString& title = wxPyEmptyStr, PyObject* func = NULL); | |
327 | ~wxPyMenu(); | |
328 | }; | |
329 | ||
330 | //---------------------------------------------------------------------- | |
331 | ||
332 | class wxMenuBar : public wxEvtHandler { | |
333 | public: | |
334 | wxMenuBar(); | |
335 | ||
336 | void Append(wxMenu *menu, const wxString& title); | |
337 | void Check(int id, bool flag); | |
338 | bool Checked(int id); | |
339 | void Enable(int id, bool enable); | |
340 | bool Enabled(int id); | |
341 | int FindMenuItem(const wxString& menuString, const wxString& itemString); | |
342 | #ifdef __WXGTK__ | |
343 | %name(FindItemForId) wxMenuItem* FindMenuItemById( int id ); | |
344 | #endif | |
345 | #ifdef __WXMSW__ | |
346 | wxMenuItem * FindItemForId(int id); | |
347 | void EnableTop(int pos, bool enable); | |
348 | wxString GetHelpString(int id); | |
349 | wxString GetLabel(int id); | |
350 | void SetHelpString(int id, const wxString& helpString); | |
351 | void SetLabel(int id, const wxString& label); | |
352 | wxString GetLabelTop(int pos); | |
353 | void SetLabelTop(int pos, const wxString& label); | |
354 | #endif | |
355 | int GetMenuCount(); | |
356 | wxMenu* GetMenu(int i); | |
357 | }; | |
358 | ||
359 | ||
360 | //---------------------------------------------------------------------- | |
361 | ||
362 | class wxMenuItem { | |
363 | public: | |
364 | bool IsSeparator(); | |
365 | bool IsEnabled(); | |
366 | bool IsChecked(); | |
367 | bool IsCheckable(); | |
368 | int GetId(); | |
369 | wxMenu* GetSubMenu(); | |
370 | #ifdef __WXMSW__ | |
371 | void SetName(const wxString& strName); | |
372 | void DeleteSubMenu(); | |
373 | const wxString& GetName(); | |
374 | #endif | |
375 | const wxString& GetHelp(); | |
376 | void SetHelp(const wxString& strHelp); | |
377 | void Enable(bool bDoEnable = TRUE); | |
378 | void Check(bool bDoCheck = TRUE); | |
379 | }; | |
380 | ||
381 | //--------------------------------------------------------------------------- | |
382 | ///////////////////////////////////////////////////////////////////////////// | |
383 | // | |
384 | // $Log$ | |
385 | // Revision 1.5 1998/08/17 18:29:40 RD | |
386 | // Removed an extra method definition | |
387 | // | |
388 | // Revision 1.4 1998/08/16 04:31:11 RD | |
389 | // More wxGTK work. | |
390 | // | |
391 | // Revision 1.3 1998/08/15 07:36:47 RD | |
392 | // - Moved the header in the .i files out of the code that gets put into | |
393 | // the .cpp files. It caused CVS conflicts because of the RCS ID being | |
394 | // different each time. | |
395 | // | |
396 | // - A few minor fixes. | |
397 | // | |
398 | // Revision 1.2 1998/08/14 23:36:46 RD | |
399 | // Beginings of wxGTK compatibility | |
400 | // | |
401 | // Revision 1.1 1998/08/09 08:25:52 RD | |
402 | // Initial version | |
403 | // | |
404 | // | |
405 | ||
406 |