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.
40 //---------------------------------------------------------------------------
45 void Connect( int id, int lastId, int eventType, PyObject* func) {
46 if (PyCallable_Check(func)) {
47 self->Connect(id, lastId, eventType,
48 (wxObjectEventFunction) &wxPyCallback::EventThunker,
49 new wxPyCallback(func));
56 //----------------------------------------------------------------------
59 class wxWindow : public wxEvtHandler {
62 wxWindow(wxWindow* parent, const wxWindowID id,
63 const wxPoint& pos = wxPyDefaultPosition,
64 const wxSize& size = wxPyDefaultSize,
66 char* name = "panel");
70 //void Center(int direction = wxHORIZONTAL);
71 void Centre(int direction = wxHORIZONTAL);
72 void ClientToScreen(int *BOTH, int *BOTH);
73 bool Close(int force = FALSE);
75 void DestroyChildren();
77 void DragAcceptFiles(bool accept);
79 void Enable(bool enable);
80 //bool FakePopupMenu(wxMenu* menu, int x, int y);
82 wxColour GetBackgroundColour();
87 void GetClientSize(int *OUTPUT, int *OUTPUT);
88 wxLayoutConstraints * GetConstraints();
90 wxButton* GetDefaultItem();
92 //wxEvtHandler* GetEventHandler();
95 wxColour GetForegroundColour();
96 wxWindow * GetGrandParent();
99 void GetPosition(int *OUTPUT, int *OUTPUT);
101 wxString& GetLabel();
107 wxWindow * GetParent();
109 int GetScrollThumb(int orientation);
110 int GetScrollPos(int orientation);
111 int GetScrollRange(int orientation);
112 void GetSize(int *OUTPUT, int *OUTPUT);
114 void GetTextExtent(const wxString& string, int *OUTPUT, int *OUTPUT); // int* descent = NULL, int* externalLeading = NULL, const wxFont* font = NULL, bool use16 = FALSE)
117 wxString& GetTitle();
121 long GetWindowStyleFlag();
128 bool LoadFromResource(wxWindow* parent, const wxString& resourceName, const wxResourceTable* resourceTable = NULL);
131 void MakeModal(bool flag);
132 void Move(int x, int y);
134 //wxEvtHandler* PopEventHandler(bool deleteHandler = FALSE);
135 bool PopupMenu(wxMenu *menu, int x, int y);
136 //void PushEventHandler(wxEvtHandler* handler);
139 void Refresh(bool eraseBackground = TRUE, const wxRect* rect = NULL);
141 void ScreenToClient(int *BOTH, int *BOTH);
142 void ScrollWindow(int dx, int dy, const wxRect* rect = NULL);
143 void SetAutoLayout(bool autoLayout);
144 void SetBackgroundColour(const wxColour& colour);
145 void SetConstraints(wxLayoutConstraints *constraints);
146 void SetDoubleClick(bool allowDoubleClick);
148 void SetFont(const wxFont& font);
150 void SetForegroundColour(const wxColour& colour);
153 void SetName(const wxString& name);
154 void SetReturnCode(int retCode);
155 void SetScrollbar(int orientation, int position, int thumbSize, int range, bool refresh = TRUE);
156 void SetScrollPos(int orientation, int pos, bool refresh = TRUE);
158 //void SetSize(int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO);
159 //%name(SetSizeOnly) void SetSize(int width, int height);
161 %name(SetDimensions) void SetSize(int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO);
163 void SetSize(const wxSize& size) {
164 self->SetSize(size.x, size.y);
167 void SetPosition(const wxPoint& pos) {
168 self->SetSize(pos.x, pos.y, -1, -1);
173 void SetSizeHints(int minW=-1, int minH=-1, int maxW=-1, int maxH=-1, int incW=-1, int incH=-1);
175 void SetClientSize(int width, int height);
176 //void SetPalette(wxPalette* palette);
177 //void SetColourMap(wxColourMap *colourMap);
178 void SetCursor(const wxCursor&cursor);
179 //void SetEventHandler(wxEvtHandler* handler);
180 void SetTitle(const wxString& title);
181 bool Show(bool show);
182 bool TransferDataFromWindow();
183 bool TransferDataToWindow();
186 void WarpPointer(int x, int y);
195 wxWindow* wxWindow_FindFocus() {
196 return wxWindow::FindFocus();
201 //----------------------------------------------------------------------
203 class wxFrame : public wxWindow {
205 wxFrame(wxWindow* parent, const wxWindowID id, const wxString& title,
206 const wxPoint& pos = wxPyDefaultPosition,
207 const wxSize& size = wxPyDefaultSize,
208 long style = wxDEFAULT_FRAME_STYLE,
209 char* name = "frame");
211 void Centre(int direction = wxBOTH);
213 void Command(int id);
215 bool CreateStatusBar(int number = 1);
216 wxMenuBar* GetMenuBar();
217 wxStatusBar* GetStatusBar();
219 wxString& GetTitle();
224 void Iconize(bool iconize);
226 void SetAcceleratorTable(const wxAcceleratorTable& accel);
227 void Maximize(bool maximize);
229 void SetIcon(const wxIcon& icon);
230 void SetMenuBar(wxMenuBar* menuBar);
231 void SetStatusText(const wxString& text, int number = 0);
232 void SetStatusWidths(int LCOUNT, int* LIST); // use typemap
233 void SetTitle(const wxString& title);
237 //---------------------------------------------------------------------------
240 class wxMiniFrame : public wxFrame {
242 wxMiniFrame(wxWindow* parent, const wxWindowID id, const wxString& title,
243 const wxPoint& pos = wxPyDefaultPosition,
244 const wxSize& size = wxPyDefaultSize,
245 long style = wxDEFAULT_FRAME_STYLE,
246 char* name = "frame");
250 //---------------------------------------------------------------------------
252 class wxPanel : public wxWindow {
254 wxPanel(wxWindow* parent,
256 const wxPoint& pos = wxPyDefaultPosition,
257 const wxSize& size = wxPyDefaultSize,
258 long style = wxTAB_TRAVERSAL,
259 const char* name = "panel");
264 //---------------------------------------------------------------------------
266 class wxDialog : public wxPanel {
268 wxDialog(wxWindow* parent,
270 const wxString& title,
271 const wxPoint& pos = wxPyDefaultPosition,
272 const wxSize& size = wxPyDefaultSize,
273 long style = wxDEFAULT_DIALOG_STYLE,
274 const char* name = "dialogBox");
276 void Centre(int direction = wxBOTH);
277 void EndModal(int retCode);
280 void Iconize(bool iconize);
282 void SetModal(bool flag);
285 void SetTitle(const wxString& title);
286 bool Show(bool show);
290 //---------------------------------------------------------------------------
292 class wxScrolledWindow : public wxWindow {
294 wxScrolledWindow(wxWindow* parent,
295 const wxWindowID id = -1,
296 const wxPoint& pos = wxPyDefaultPosition,
297 const wxSize& size = wxPyDefaultSize,
298 long style = wxHSCROLL | wxVSCROLL,
299 char* name = "scrolledWindow");
301 void EnableScrolling(bool xScrolling, bool yScrolling);
302 void GetScrollPixelsPerUnit(int* OUTPUT, int* OUTPUT);
303 void GetVirtualSize(int* OUTPUT, int* OUTPUT);
305 void PrepareDC(wxDC& dc);
306 void Scroll(int x, int y);
307 void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
308 int noUnitsX, int noUnitsY,
309 int xPos = 0, int yPos = 0);
310 void ViewStart(int* OUTPUT, int* OUTPUT);
313 //----------------------------------------------------------------------
316 class wxMenu : public wxEvtHandler {
318 wxMenu(const wxString& title = wxPyEmptyStr);
320 void Append(int id, const wxString& item,
321 const wxString& helpString = wxPyEmptyStr,
322 int checkable = FALSE);
323 %name(AppendMenu)void Append(int id, const wxString& item, wxMenu *subMenu,
324 const wxString& helpString = wxPyEmptyStr);
325 void AppendSeparator();
327 void Check(int id, bool flag);
328 void Enable(int id, bool enable);
329 int FindItem(const wxString& itemString);
331 wxMenuItem* FindItemForId(int id);
332 wxString& GetHelpString(int id);
333 wxString GetLabel(int id);
335 void SetHelpString(int id, const wxString& helpString);
336 void SetTitle(const wxString& title);
338 bool IsChecked(int id);
339 bool IsEnabled(int id);
340 void SetLabel(int id, const wxString& label);
346 // This one knows how to set a callback and handle INC- and DECREFing it. To
347 // be used for PopupMenus, but you must retain a referece to it while using
350 class wxPyMenu : public wxMenu {
352 wxPyMenu(const wxString& title = wxPyEmptyStr, PyObject* func = NULL);
357 //----------------------------------------------------------------------
359 class wxMenuBar : public wxEvtHandler {
363 void Append(wxMenu *menu, const wxString& title);
364 void Check(int id, bool flag);
365 bool Checked(int id);
366 void Enable(int id, bool enable);
367 int FindMenuItem(const wxString& menuString, const wxString& itemString);
369 void EnableTop(int pos, bool enable);
370 wxMenuItem * FindItemForId(int id);
371 wxString GetHelpString(int id);
372 wxString GetLabel(int id);
373 void SetHelpString(int id, const wxString& helpString);
374 void SetLabel(int id, const wxString& label);
375 wxString GetLabelTop(int pos);
376 void SetLabelTop(int pos, const wxString& label);
381 //----------------------------------------------------------------------
389 wxMenu* GetSubMenu();
391 const wxString& GetHelp();
392 void SetName(const wxString& strName);
393 void SetHelp(const wxString& strHelp);
395 void Enable(bool bDoEnable = TRUE);
396 void Check(bool bDoCheck = TRUE);
398 void DeleteSubMenu();
399 const wxString& GetName();
404 //---------------------------------------------------------------------------
405 /////////////////////////////////////////////////////////////////////////////
408 // Revision 1.3 1998/08/15 07:36:47 RD
409 // - Moved the header in the .i files out of the code that gets put into
410 // the .cpp files. It caused CVS conflicts because of the RCS ID being
411 // different each time.
413 // - A few minor fixes.
415 // Revision 1.2 1998/08/14 23:36:46 RD
416 // Beginings of wxGTK compatibility
418 // Revision 1.1 1998/08/09 08:25:52 RD