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);
81 %name(FindWindowByID) wxWindow* FindWindow(long id);
82 %name(FindWindowByName) wxWindow* FindWindow(const wxString& name);
84 wxColour GetBackgroundColour();
87 void GetClientSize(int *OUTPUT, int *OUTPUT);
88 wxLayoutConstraints * GetConstraints();
90 wxButton* GetDefaultItem();
92 //wxEvtHandler* GetEventHandler();
94 wxColour GetForegroundColour();
95 wxWindow * GetGrandParent();
97 void GetPosition(int *OUTPUT, int *OUTPUT);
100 wxWindow * GetParent();
102 int GetScrollThumb(int orientation);
103 int GetScrollPos(int orientation);
104 int GetScrollRange(int orientation);
105 void GetSize(int *OUTPUT, int *OUTPUT);
106 void GetTextExtent(const wxString& string, int *OUTPUT, int *OUTPUT); // int* descent = NULL, int* externalLeading = NULL, const wxFont* font = NULL, bool use16 = FALSE)
108 long GetWindowStyleFlag();
114 bool LoadFromResource(wxWindow* parent, const wxString& resourceName, const wxResourceTable* resourceTable = NULL);
116 void MakeModal(bool flag);
117 void Move(int x, int y);
119 //wxEvtHandler* PopEventHandler(bool deleteHandler = FALSE);
120 bool PopupMenu(wxMenu *menu, int x, int y);
121 //void PushEventHandler(wxEvtHandler* handler);
124 void Refresh(bool eraseBackground = TRUE, const wxRect* rect = NULL);
126 void ScreenToClient(int *BOTH, int *BOTH);
127 void ScrollWindow(int dx, int dy, const wxRect* rect = NULL);
128 void SetAutoLayout(bool autoLayout);
129 void SetBackgroundColour(const wxColour& colour);
130 void SetConstraints(wxLayoutConstraints *constraints);
131 void SetDoubleClick(bool allowDoubleClick);
133 void SetFont(const wxFont& font);
134 void SetForegroundColour(const wxColour& colour);
136 void SetName(const wxString& name);
137 void SetReturnCode(int retCode);
138 void SetScrollbar(int orientation, int position, int thumbSize, int range, bool refresh = TRUE);
139 void SetScrollPos(int orientation, int pos, bool refresh = TRUE);
141 //void SetSize(int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO);
142 //%name(SetSizeOnly) void SetSize(int width, int height);
144 %name(SetDimensions) void SetSize(int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO);
146 void SetSize(const wxSize& size) {
147 self->SetSize(size.x, size.y);
150 void SetPosition(const wxPoint& pos) {
151 self->SetSize(pos.x, pos.y, -1, -1);
155 void SetSizeHints(int minW=-1, int minH=-1, int maxW=-1, int maxH=-1, int incW=-1, int incH=-1);
156 void SetClientSize(int width, int height);
157 //void SetPalette(wxPalette* palette);
158 //void SetColourMap(wxColourMap *colourMap);
159 void SetCursor(const wxCursor&cursor);
160 //void SetEventHandler(wxEvtHandler* handler);
161 void SetTitle(const wxString& title);
162 bool Show(bool show);
163 bool TransferDataFromWindow();
164 bool TransferDataToWindow();
167 void WarpPointer(int x, int y);
176 wxWindow* wxWindow_FindFocus() {
177 return wxWindow::FindFocus();
182 //----------------------------------------------------------------------
184 class wxFrame : public wxWindow {
186 wxFrame(wxWindow* parent, const wxWindowID id, const wxString& title,
187 const wxPoint& pos = wxPyDefaultPosition,
188 const wxSize& size = wxPyDefaultSize,
189 long style = wxDEFAULT_FRAME_STYLE,
190 char* name = "frame");
192 void Centre(int direction = wxBOTH);
194 void Command(int id);
196 bool CreateStatusBar(int number = 1);
197 wxMenuBar* GetMenuBar();
198 wxStatusBar* GetStatusBar();
200 void Iconize(bool iconize);
202 void Maximize(bool maximize);
204 void SetAcceleratorTable(const wxAcceleratorTable& accel);
206 void SetIcon(const wxIcon& icon);
207 void SetMenuBar(wxMenuBar* menuBar);
208 void SetStatusText(const wxString& text, int number = 0);
209 void SetStatusWidths(int LCOUNT, int* LIST); // use typemap
210 void SetTitle(const wxString& title);
214 //---------------------------------------------------------------------------
217 class wxMiniFrame : public wxFrame {
219 wxMiniFrame(wxWindow* parent, const wxWindowID id, const wxString& title,
220 const wxPoint& pos = wxPyDefaultPosition,
221 const wxSize& size = wxPyDefaultSize,
222 long style = wxDEFAULT_FRAME_STYLE,
223 char* name = "frame");
227 //---------------------------------------------------------------------------
229 class wxPanel : public wxWindow {
231 wxPanel(wxWindow* parent,
233 const wxPoint& pos = wxPyDefaultPosition,
234 const wxSize& size = wxPyDefaultSize,
235 long style = wxTAB_TRAVERSAL,
236 const char* name = "panel");
241 //---------------------------------------------------------------------------
243 class wxDialog : public wxPanel {
245 wxDialog(wxWindow* parent,
247 const wxString& title,
248 const wxPoint& pos = wxPyDefaultPosition,
249 const wxSize& size = wxPyDefaultSize,
250 long style = wxDEFAULT_DIALOG_STYLE,
251 const char* name = "dialogBox");
253 void Centre(int direction = wxBOTH);
254 void EndModal(int retCode);
256 void Iconize(bool iconize);
258 void SetModal(bool flag);
260 void SetTitle(const wxString& title);
261 bool Show(bool show);
265 //---------------------------------------------------------------------------
267 class wxScrolledWindow : public wxWindow {
269 wxScrolledWindow(wxWindow* parent,
270 const wxWindowID id = -1,
271 const wxPoint& pos = wxPyDefaultPosition,
272 const wxSize& size = wxPyDefaultSize,
273 long style = wxHSCROLL | wxVSCROLL,
274 char* name = "scrolledWindow");
276 void EnableScrolling(bool xScrolling, bool yScrolling);
277 void GetScrollPixelsPerUnit(int* OUTPUT, int* OUTPUT);
278 void GetVirtualSize(int* OUTPUT, int* OUTPUT);
280 void PrepareDC(wxDC& dc);
281 void Scroll(int x, int y);
282 void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
283 int noUnitsX, int noUnitsY,
284 int xPos = 0, int yPos = 0);
285 void ViewStart(int* OUTPUT, int* OUTPUT);
288 //----------------------------------------------------------------------
291 class wxMenu : public wxEvtHandler {
293 wxMenu(const wxString& title = wxPyEmptyStr);
295 void Append(int id, const wxString& item,
296 const wxString& helpString = wxPyEmptyStr,
297 int checkable = FALSE);
298 %name(AppendMenu)void Append(int id, const wxString& item, wxMenu *subMenu,
299 const wxString& helpString = wxPyEmptyStr);
300 void AppendSeparator();
302 void Check(int id, bool flag);
303 void Enable(int id, bool enable);
304 int FindItem(const wxString& itemString);
307 void SetTitle(const wxString& title);
309 wxMenuItem* FindItemForId(int id);
310 wxString GetHelpString(int id);
311 wxString GetLabel(int id);
312 void SetHelpString(int id, const wxString& helpString);
313 bool IsChecked(int id);
314 bool IsEnabled(int id);
315 void SetLabel(int id, const wxString& label);
320 // This one knows how to set a callback and handle INC- and DECREFing it. To
321 // be used for PopupMenus, but you must retain a referece to it while using
324 class wxPyMenu : public wxMenu {
326 wxPyMenu(const wxString& title = wxPyEmptyStr, PyObject* func = NULL);
330 //----------------------------------------------------------------------
332 class wxMenuBar : public wxEvtHandler {
336 void Append(wxMenu *menu, const wxString& title);
337 void Check(int id, bool flag);
338 bool Checked(int id);
339 void Enable(int id, bool enable);
340 bool Enabled(int id);
341 int FindMenuItem(const wxString& menuString, const wxString& itemString);
343 %name(FindItemForId) wxMenuItem* FindMenuItemById( int id );
346 wxMenuItem * FindItemForId(int id);
347 void EnableTop(int pos, bool enable);
348 wxString GetHelpString(int id);
349 wxString GetLabel(int id);
350 void SetHelpString(int id, const wxString& helpString);
351 void SetLabel(int id, const wxString& label);
352 wxString GetLabelTop(int pos);
353 void SetLabelTop(int pos, const wxString& label);
356 wxMenu* GetMenu(int i);
360 //----------------------------------------------------------------------
369 wxMenu* GetSubMenu();
371 void SetName(const wxString& strName);
372 void DeleteSubMenu();
373 const wxString& GetName();
375 const wxString& GetHelp();
376 void SetHelp(const wxString& strHelp);
377 void Enable(bool bDoEnable = TRUE);
378 void Check(bool bDoCheck = TRUE);
381 //---------------------------------------------------------------------------
382 /////////////////////////////////////////////////////////////////////////////
385 // Revision 1.5 1998/08/17 18:29:40 RD
386 // Removed an extra method definition
388 // Revision 1.4 1998/08/16 04:31:11 RD
391 // Revision 1.3 1998/08/15 07:36:47 RD
392 // - Moved the header in the .i files out of the code that gets put into
393 // the .cpp files. It caused CVS conflicts because of the RCS ID being
394 // different each time.
396 // - A few minor fixes.
398 // Revision 1.2 1998/08/14 23:36:46 RD
399 // Beginings of wxGTK compatibility
401 // Revision 1.1 1998/08/09 08:25:52 RD