1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG definitions of various window classes
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
20 // wxGTK defines wxMenuItem inside menu.h
21 #include <wx/menuitem.h>
25 #include <wx/minifram.h>
29 //----------------------------------------------------------------------
32 %include my_typemaps.i
34 // Import some definitions of other classes, etc.
39 %pragma(python) code = "import wxp"
41 //---------------------------------------------------------------------------
46 void Connect( int id, int lastId, int eventType, PyObject* func) {
47 if (PyCallable_Check(func)) {
48 self->Connect(id, lastId, eventType,
49 (wxObjectEventFunction) &wxPyCallback::EventThunker,
50 new wxPyCallback(func));
57 //----------------------------------------------------------------------
60 class wxWindow : public wxEvtHandler {
63 wxWindow(wxWindow* parent, const wxWindowID id,
64 const wxPoint& pos = wxPyDefaultPosition,
65 const wxSize& size = wxPyDefaultSize,
67 char* name = "panel");
69 %pragma(python) addtomethod = "__init__:wxp._StdWindowCallbacks(self)"
72 void Center(int direction = wxHORIZONTAL);
73 void Centre(int direction = wxHORIZONTAL);
74 void ClientToScreen(int *BOTH, int *BOTH);
75 bool Close(int force = FALSE);
77 void DestroyChildren();
79 void DragAcceptFiles(bool accept);
81 void Enable(bool enable);
82 //bool FakePopupMenu(wxMenu* menu, int x, int y);
83 %name(FindWindowByID) wxWindow* FindWindow(long id);
84 %name(FindWindowByName) wxWindow* FindWindow(const wxString& name);
86 wxColour GetBackgroundColour();
89 void GetClientSize(int *OUTPUT, int *OUTPUT);
90 wxLayoutConstraints * GetConstraints();
92 wxButton* GetDefaultItem();
94 //wxEvtHandler* GetEventHandler();
96 wxColour GetForegroundColour();
97 wxWindow * GetGrandParent();
99 void GetPosition(int *OUTPUT, int *OUTPUT);
102 wxWindow * GetParent();
104 int GetScrollThumb(int orientation);
105 int GetScrollPos(int orientation);
106 int GetScrollRange(int orientation);
107 void GetSize(int *OUTPUT, int *OUTPUT);
108 void GetTextExtent(const wxString& string, int *OUTPUT, int *OUTPUT); // int* descent = NULL, int* externalLeading = NULL, const wxFont* font = NULL, bool use16 = FALSE)
110 long GetWindowStyleFlag();
116 bool LoadFromResource(wxWindow* parent, const wxString& resourceName, const wxResourceTable* resourceTable = NULL);
118 void MakeModal(bool flag);
119 void Move(int x, int y);
121 //wxEvtHandler* PopEventHandler(bool deleteHandler = FALSE);
122 bool PopupMenu(wxMenu *menu, int x, int y);
123 //void PushEventHandler(wxEvtHandler* handler);
126 void Refresh(bool eraseBackground = TRUE, const wxRect* rect = NULL);
128 void ScreenToClient(int *BOTH, int *BOTH);
129 void ScrollWindow(int dx, int dy, const wxRect* rect = NULL);
130 void SetAutoLayout(bool autoLayout);
131 void SetBackgroundColour(const wxColour& colour);
132 void SetConstraints(wxLayoutConstraints *constraints);
133 void SetDoubleClick(bool allowDoubleClick);
135 void SetFont(const wxFont& font);
136 void SetForegroundColour(const wxColour& colour);
138 void SetName(const wxString& name);
139 void SetReturnCode(int retCode);
140 void SetScrollbar(int orientation, int position, int thumbSize, int range, bool refresh = TRUE);
141 void SetScrollPos(int orientation, int pos, bool refresh = TRUE);
143 //void SetSize(int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO);
144 //%name(SetSizeOnly) void SetSize(int width, int height);
146 %name(SetDimensions) void SetSize(int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO);
148 void SetSize(const wxSize& size) {
149 self->SetSize(size.x, size.y);
152 void SetPosition(const wxPoint& pos) {
153 self->SetSize(pos.x, pos.y, -1, -1);
157 void SetSizeHints(int minW=-1, int minH=-1, int maxW=-1, int maxH=-1, int incW=-1, int incH=-1);
158 void SetClientSize(int width, int height);
159 //void SetPalette(wxPalette* palette);
160 //void SetColourMap(wxColourMap *colourMap);
161 void SetCursor(const wxCursor&cursor);
162 //void SetEventHandler(wxEvtHandler* handler);
163 void SetTitle(const wxString& title);
164 bool Show(bool show);
165 bool TransferDataFromWindow();
166 bool TransferDataToWindow();
169 void WarpPointer(int x, int y);
178 wxWindow* wxWindow_FindFocus() {
179 return wxWindow::FindFocus();
185 //---------------------------------------------------------------------------
187 class wxPanel : public wxWindow {
189 wxPanel(wxWindow* parent,
191 const wxPoint& pos = wxPyDefaultPosition,
192 const wxSize& size = wxPyDefaultSize,
193 long style = wxTAB_TRAVERSAL,
194 const char* name = "panel");
196 %pragma(python) addtomethod = "__init__:wxp._StdWindowCallbacks(self)"
201 //---------------------------------------------------------------------------
203 class wxDialog : public wxPanel {
205 wxDialog(wxWindow* parent,
207 const wxString& title,
208 const wxPoint& pos = wxPyDefaultPosition,
209 const wxSize& size = wxPyDefaultSize,
210 long style = wxDEFAULT_DIALOG_STYLE,
211 const char* name = "dialogBox");
213 %pragma(python) addtomethod = "__init__:wxp._StdDialogCallbacks(self)"
215 void Centre(int direction = wxBOTH);
216 void EndModal(int retCode);
218 void Iconize(bool iconize);
220 void SetModal(bool flag);
222 void SetTitle(const wxString& title);
223 bool Show(bool show);
227 //---------------------------------------------------------------------------
229 class wxScrolledWindow : public wxWindow {
231 wxScrolledWindow(wxWindow* parent,
232 const wxWindowID id = -1,
233 const wxPoint& pos = wxPyDefaultPosition,
234 const wxSize& size = wxPyDefaultSize,
235 long style = wxHSCROLL | wxVSCROLL,
236 char* name = "scrolledWindow");
238 %pragma(python) addtomethod = "__init__:wxp._StdWindowCallbacks(self)"
239 %pragma(python) addtomethod = "__init__:wxp._StdOnScrollCallbacks(self)"
241 void EnableScrolling(bool xScrolling, bool yScrolling);
242 void GetScrollPixelsPerUnit(int* OUTPUT, int* OUTPUT);
243 void GetVirtualSize(int* OUTPUT, int* OUTPUT);
245 void PrepareDC(wxDC& dc);
246 void Scroll(int x, int y);
247 void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
248 int noUnitsX, int noUnitsY,
249 int xPos = 0, int yPos = 0);
250 void ViewStart(int* OUTPUT, int* OUTPUT);
253 //----------------------------------------------------------------------
256 class wxMenu : public wxEvtHandler {
258 wxMenu(const wxString& title = wxPyEmptyStr);
260 void Append(int id, const wxString& item,
261 const wxString& helpString = wxPyEmptyStr,
262 int checkable = FALSE);
263 %name(AppendMenu)void Append(int id, const wxString& item, wxMenu *subMenu,
264 const wxString& helpString = wxPyEmptyStr);
265 void AppendSeparator();
267 void Check(int id, bool flag);
268 void Enable(int id, bool enable);
269 int FindItem(const wxString& itemString);
272 void SetTitle(const wxString& title);
274 wxMenuItem* FindItemForId(int id);
275 wxString GetHelpString(int id);
276 wxString GetLabel(int id);
277 void SetHelpString(int id, const wxString& helpString);
278 bool IsChecked(int id);
279 bool IsEnabled(int id);
280 void SetLabel(int id, const wxString& label);
285 // This one knows how to set a callback and handle INC- and DECREFing it. To
286 // be used for PopupMenus, but you must retain a referece to it while using
289 class wxPyMenu : public wxMenu {
291 wxPyMenu(const wxString& title = wxPyEmptyStr, PyObject* func = NULL);
295 //----------------------------------------------------------------------
297 class wxMenuBar : public wxEvtHandler {
301 void Append(wxMenu *menu, const wxString& title);
302 void Check(int id, bool flag);
303 bool Checked(int id);
304 void Enable(int id, bool enable);
305 bool Enabled(int id);
306 int FindMenuItem(const wxString& menuString, const wxString& itemString);
308 %name(FindItemForId) wxMenuItem* FindMenuItemById( int id );
311 wxMenuItem * FindItemForId(int id);
312 void EnableTop(int pos, bool enable);
313 wxString GetHelpString(int id);
314 wxString GetLabel(int id);
315 void SetHelpString(int id, const wxString& helpString);
316 void SetLabel(int id, const wxString& label);
317 wxString GetLabelTop(int pos);
318 void SetLabelTop(int pos, const wxString& label);
321 wxMenu* GetMenu(int i);
325 //----------------------------------------------------------------------
334 wxMenu* GetSubMenu();
336 void SetName(const wxString& strName);
337 void DeleteSubMenu();
338 const wxString& GetName();
340 const wxString& GetHelp();
341 void SetHelp(const wxString& strHelp);
342 void Enable(bool bDoEnable = TRUE);
343 void Check(bool bDoCheck = TRUE);
346 //---------------------------------------------------------------------------
347 /////////////////////////////////////////////////////////////////////////////
350 // Revision 1.6 1998/10/02 06:40:43 RD
351 // Version 0.4 of wxPython for MSW.
353 // Revision 1.5 1998/08/17 18:29:40 RD
354 // Removed an extra method definition
356 // Revision 1.4 1998/08/16 04:31:11 RD
359 // Revision 1.3 1998/08/15 07:36:47 RD
360 // - Moved the header in the .i files out of the code that gets put into
361 // the .cpp files. It caused CVS conflicts because of the RCS ID being
362 // different each time.
364 // - A few minor fixes.
366 // Revision 1.2 1998/08/14 23:36:46 RD
367 // Beginings of wxGTK compatibility
369 // Revision 1.1 1998/08/09 08:25:52 RD