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