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