3 /////////////////////////////////////////////////////////////////////////////
5 // Purpose: SWIG definitions of various window classes
11 // Copyright: (c) 1998 by Total Control Software
12 // Licence: wxWindows license
13 /////////////////////////////////////////////////////////////////////////////
19 // wxGTK defines wxMenuItem inside menu.h
20 #include <wx/menuitem.h>
24 #include <wx/minifram.h>
28 //----------------------------------------------------------------------
31 %include my_typemaps.i
33 // Import some definitions of other classes, etc.
39 //---------------------------------------------------------------------------
44 void Connect( int id, int lastId, int eventType, PyObject* func) {
45 if (PyCallable_Check(func)) {
46 self->Connect(id, lastId, eventType,
47 (wxObjectEventFunction) &wxPyCallback::EventThunker,
48 new wxPyCallback(func));
55 //----------------------------------------------------------------------
58 class wxWindow : public wxEvtHandler {
61 wxWindow(wxWindow* parent, const wxWindowID id,
62 const wxPoint& pos = wxPyDefaultPosition,
63 const wxSize& size = wxPyDefaultSize,
65 char* name = "panel");
69 //void Center(int direction = wxHORIZONTAL);
70 void Centre(int direction = wxHORIZONTAL);
71 void ClientToScreen(int *BOTH, int *BOTH);
72 bool Close(int force = FALSE);
74 void DestroyChildren();
76 void DragAcceptFiles(bool accept);
78 void Enable(bool enable);
79 //bool FakePopupMenu(wxMenu* menu, int x, int y);
81 wxColour GetBackgroundColour();
86 void GetClientSize(int *OUTPUT, int *OUTPUT);
87 wxLayoutConstraints * GetConstraints();
89 wxButton* GetDefaultItem();
91 //wxEvtHandler* GetEventHandler();
94 wxColour GetForegroundColour();
95 wxWindow * GetGrandParent();
98 void GetPosition(int *OUTPUT, int *OUTPUT);
100 wxString& GetLabel();
106 wxWindow * GetParent();
108 int GetScrollThumb(int orientation);
109 int GetScrollPos(int orientation);
110 int GetScrollRange(int orientation);
111 void GetSize(int *OUTPUT, int *OUTPUT);
113 void GetTextExtent(const wxString& string, int *OUTPUT, int *OUTPUT); // int* descent = NULL, int* externalLeading = NULL, const wxFont* font = NULL, bool use16 = FALSE)
116 wxString& GetTitle();
120 long GetWindowStyleFlag();
127 bool LoadFromResource(wxWindow* parent, const wxString& resourceName, const wxResourceTable* resourceTable = NULL);
130 void MakeModal(bool flag);
131 void Move(int x, int y);
133 //wxEvtHandler* PopEventHandler(bool deleteHandler = FALSE);
134 bool PopupMenu(wxMenu *menu, int x, int y);
135 //void PushEventHandler(wxEvtHandler* handler);
138 void Refresh(bool eraseBackground = TRUE, const wxRect* rect = NULL);
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);
147 void SetFont(const wxFont& font);
149 void SetForegroundColour(const wxColour& colour);
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);
157 //void SetSize(int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO);
158 //%name(SetSizeOnly) void SetSize(int width, int height);
160 %name(SetDimensions) void SetSize(int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO);
162 void SetSize(const wxSize& size) {
163 self->SetSize(size.x, size.y);
166 void SetPosition(const wxPoint& pos) {
167 self->SetSize(pos.x, pos.y, -1, -1);
172 void SetSizeHints(int minW=-1, int minH=-1, int maxW=-1, int maxH=-1, int incW=-1, int incH=-1);
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();
185 void WarpPointer(int x, int y);
194 wxWindow* wxWindow_FindFocus() {
195 return wxWindow::FindFocus();
200 //----------------------------------------------------------------------
202 class wxFrame : public wxWindow {
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");
210 void Centre(int direction = wxBOTH);
212 void Command(int id);
214 bool CreateStatusBar(int number = 1);
215 wxMenuBar* GetMenuBar();
216 wxStatusBar* GetStatusBar();
218 wxString& GetTitle();
223 void Iconize(bool iconize);
225 void SetAcceleratorTable(const wxAcceleratorTable& accel);
226 void Maximize(bool maximize);
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);
236 //---------------------------------------------------------------------------
239 class wxMiniFrame : public wxFrame {
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");
249 //---------------------------------------------------------------------------
251 class wxPanel : public wxWindow {
253 wxPanel(wxWindow* parent,
255 const wxPoint& pos = wxPyDefaultPosition,
256 const wxSize& size = wxPyDefaultSize,
257 long style = wxTAB_TRAVERSAL,
258 const char* name = "panel");
263 //---------------------------------------------------------------------------
265 class wxDialog : public wxPanel {
267 wxDialog(wxWindow* parent,
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");
275 void Centre(int direction = wxBOTH);
276 void EndModal(int retCode);
279 void Iconize(bool iconize);
281 void SetModal(bool flag);
284 void SetTitle(const wxString& title);
285 bool Show(bool show);
289 //---------------------------------------------------------------------------
291 class wxScrolledWindow : public wxWindow {
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");
300 void EnableScrolling(bool xScrolling, bool yScrolling);
301 void GetScrollPixelsPerUnit(int* OUTPUT, int* OUTPUT);
302 void GetVirtualSize(int* OUTPUT, int* OUTPUT);
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);
312 //----------------------------------------------------------------------
315 class wxMenu : public wxEvtHandler {
317 wxMenu(const wxString& title = wxPyEmptyStr);
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();
326 void Check(int id, bool flag);
327 void Enable(int id, bool enable);
328 int FindItem(const wxString& itemString);
330 wxMenuItem* FindItemForId(int id);
331 wxString& GetHelpString(int id);
332 wxString GetLabel(int id);
334 void SetHelpString(int id, const wxString& helpString);
335 void SetTitle(const wxString& title);
337 bool IsChecked(int id);
338 bool IsEnabled(int id);
339 void SetLabel(int id, const wxString& label);
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
349 class wxPyMenu : public wxMenu {
351 wxPyMenu(const wxString& title = wxPyEmptyStr, PyObject* func = NULL);
356 //----------------------------------------------------------------------
358 class wxMenuBar : public wxEvtHandler {
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);
366 int FindMenuItem(const wxString& menuString, const wxString& itemString);
368 void EnableTop(int pos, bool enable);
369 wxMenuItem * FindItemForId(int id);
370 wxString GetHelpString(int id);
371 wxString GetLabel(int id);
372 void SetHelpString(int id, const wxString& helpString);
373 void SetLabel(int id, const wxString& label);
374 wxString GetLabelTop(int pos);
375 void SetLabelTop(int pos, const wxString& label);
380 //----------------------------------------------------------------------
388 wxMenu* GetSubMenu();
390 const wxString& GetHelp();
391 void SetName(const wxString& strName);
392 void SetHelp(const wxString& strHelp);
394 void Enable(bool bDoEnable = TRUE);
395 void Check(bool bDoCheck = TRUE);
397 void DeleteSubMenu();
398 const wxString& GetName();
403 //---------------------------------------------------------------------------
404 /////////////////////////////////////////////////////////////////////////////
407 // Revision 1.2 1998/08/14 23:36:46 RD
408 // Beginings of wxGTK compatibility
410 // Revision 1.1 1998/08/09 08:25:52 RD