]>
Commit | Line | Data |
---|---|---|
7bf85405 RD |
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 | ||
03e9bead RD |
14 | %module windows |
15 | ||
16 | %{ | |
7bf85405 | 17 | #include "helpers.h" |
853b255a RD |
18 | |
19 | #ifdef __WXMSW__ | |
20 | // wxGTK defines wxMenuItem inside menu.h | |
7bf85405 | 21 | #include <wx/menuitem.h> |
853b255a RD |
22 | #endif |
23 | ||
24 | #ifdef __WXMSW__ | |
25 | #include <wx/minifram.h> | |
26 | #endif | |
7bf85405 RD |
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, | |
853b255a | 48 | (wxObjectEventFunction) &wxPyCallback::EventThunker, |
7bf85405 RD |
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(); | |
714e6a9e | 70 | void Center(int direction = wxHORIZONTAL); |
7bf85405 RD |
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(); | |
853b255a | 76 | #ifdef __WXMSW__ |
7bf85405 | 77 | void DragAcceptFiles(bool accept); |
853b255a | 78 | #endif |
7bf85405 RD |
79 | void Enable(bool enable); |
80 | //bool FakePopupMenu(wxMenu* menu, int x, int y); | |
714e6a9e RD |
81 | %name(FindWindowByID) wxWindow* FindWindow(long id); |
82 | %name(FindWindowByName) wxWindow* FindWindow(const wxString& name); | |
7bf85405 RD |
83 | void Fit(); |
84 | wxColour GetBackgroundColour(); | |
85 | int GetCharHeight(); | |
86 | int GetCharWidth(); | |
87 | void GetClientSize(int *OUTPUT, int *OUTPUT); | |
88 | wxLayoutConstraints * GetConstraints(); | |
853b255a | 89 | #ifdef __WXMSW__ |
7bf85405 | 90 | wxButton* GetDefaultItem(); |
853b255a | 91 | #endif |
7bf85405 RD |
92 | //wxEvtHandler* GetEventHandler(); |
93 | wxFont* GetFont(); | |
94 | wxColour GetForegroundColour(); | |
95 | wxWindow * GetGrandParent(); | |
96 | int GetId(); | |
97 | void GetPosition(int *OUTPUT, int *OUTPUT); | |
853b255a RD |
98 | wxString GetLabel(); |
99 | wxString GetName(); | |
7bf85405 RD |
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) | |
853b255a | 107 | wxString GetTitle(); |
7bf85405 RD |
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(); | |
853b255a | 166 | #ifdef __WXMSW__ |
7bf85405 | 167 | void WarpPointer(int x, int y); |
853b255a | 168 | #endif |
7bf85405 RD |
169 | |
170 | }; | |
171 | ||
172 | ||
173 | // Static method(s) | |
853b255a | 174 | #ifdef __WXMSW__ |
7bf85405 RD |
175 | %inline %{ |
176 | wxWindow* wxWindow_FindFocus() { | |
177 | return wxWindow::FindFocus(); | |
178 | } | |
179 | %} | |
853b255a | 180 | #endif |
7bf85405 RD |
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); | |
853b255a | 193 | #ifdef __WXMSW__ |
7bf85405 | 194 | void Command(int id); |
853b255a | 195 | #endif |
7bf85405 RD |
196 | bool CreateStatusBar(int number = 1); |
197 | wxMenuBar* GetMenuBar(); | |
198 | wxStatusBar* GetStatusBar(); | |
853b255a | 199 | wxString GetTitle(); |
7bf85405 RD |
200 | void Iconize(bool iconize); |
201 | bool IsIconized(); | |
7bf85405 | 202 | void Maximize(bool maximize); |
714e6a9e RD |
203 | #ifdef __WXMSW__ |
204 | void SetAcceleratorTable(const wxAcceleratorTable& accel); | |
853b255a | 205 | #endif |
7bf85405 RD |
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 | ||
853b255a | 216 | #ifdef __WXMSW__ |
7bf85405 RD |
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"); | |
7bf85405 | 224 | }; |
853b255a | 225 | #endif |
7bf85405 RD |
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(); | |
7bf85405 | 258 | void SetModal(bool flag); |
853b255a | 259 | bool IsModal(); |
7bf85405 RD |
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); | |
7bf85405 RD |
303 | void Enable(int id, bool enable); |
304 | int FindItem(const wxString& itemString); | |
853b255a | 305 | #ifdef __WXMSW__ |
7bf85405 | 306 | wxString GetTitle(); |
7bf85405 | 307 | void SetTitle(const wxString& title); |
853b255a | 308 | #endif |
714e6a9e RD |
309 | wxMenuItem* FindItemForId(int id); |
310 | wxString GetHelpString(int id); | |
311 | wxString GetLabel(int id); | |
312 | void SetHelpString(int id, const wxString& helpString); | |
853b255a RD |
313 | bool IsChecked(int id); |
314 | bool IsEnabled(int id); | |
315 | void SetLabel(int id, const wxString& label); | |
7bf85405 RD |
316 | }; |
317 | ||
318 | ||
7bf85405 RD |
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); | |
714e6a9e | 340 | bool Enabled(int id); |
7bf85405 | 341 | int FindMenuItem(const wxString& menuString, const wxString& itemString); |
714e6a9e RD |
342 | #ifdef __WXGTK__ |
343 | %name(FindItemForId) wxMenuItem* FindMenuItemById( int id ); | |
344 | #endif | |
853b255a | 345 | #ifdef __WXMSW__ |
7bf85405 | 346 | wxMenuItem * FindItemForId(int id); |
714e6a9e | 347 | void EnableTop(int pos, bool enable); |
7bf85405 RD |
348 | wxString GetHelpString(int id); |
349 | wxString GetLabel(int id); | |
7bf85405 RD |
350 | void SetHelpString(int id, const wxString& helpString); |
351 | void SetLabel(int id, const wxString& label); | |
853b255a | 352 | wxString GetLabelTop(int pos); |
7bf85405 | 353 | void SetLabelTop(int pos, const wxString& label); |
853b255a | 354 | #endif |
714e6a9e RD |
355 | int GetMenuCount(); |
356 | wxMenu* GetMenu(int i); | |
7bf85405 RD |
357 | }; |
358 | ||
359 | ||
360 | //---------------------------------------------------------------------- | |
361 | ||
362 | class wxMenuItem { | |
363 | public: | |
364 | bool IsSeparator(); | |
365 | bool IsEnabled(); | |
366 | bool IsChecked(); | |
714e6a9e | 367 | bool IsCheckable(); |
7bf85405 | 368 | int GetId(); |
7bf85405 | 369 | wxMenu* GetSubMenu(); |
853b255a | 370 | #ifdef __WXMSW__ |
7bf85405 | 371 | void SetName(const wxString& strName); |
7bf85405 RD |
372 | void DeleteSubMenu(); |
373 | const wxString& GetName(); | |
853b255a | 374 | #endif |
714e6a9e RD |
375 | const wxString& GetHelp(); |
376 | void SetHelp(const wxString& strHelp); | |
377 | void Enable(bool bDoEnable = TRUE); | |
378 | void Check(bool bDoCheck = TRUE); | |
7bf85405 RD |
379 | }; |
380 | ||
381 | //--------------------------------------------------------------------------- | |
382 | ///////////////////////////////////////////////////////////////////////////// | |
383 | // | |
384 | // $Log$ | |
652e7bb4 RD |
385 | // Revision 1.5 1998/08/17 18:29:40 RD |
386 | // Removed an extra method definition | |
387 | // | |
714e6a9e RD |
388 | // Revision 1.4 1998/08/16 04:31:11 RD |
389 | // More wxGTK work. | |
390 | // | |
03e9bead RD |
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 | // | |
853b255a RD |
398 | // Revision 1.2 1998/08/14 23:36:46 RD |
399 | // Beginings of wxGTK compatibility | |
400 | // | |
7bf85405 RD |
401 | // Revision 1.1 1998/08/09 08:25:52 RD |
402 | // Initial version | |
403 | // | |
404 | // | |
405 | ||
406 |