3 /////////////////////////////////////////////////////////////////////////////
5 // Purpose: SWIG definitions of various window classes
11 // Copyright: (c) 1998 by Total Control Software
12 // Licence: wxWindows license
13 /////////////////////////////////////////////////////////////////////////////
17 #include <wx/minifram.h>
18 #include <wx/menuitem.h>
21 //----------------------------------------------------------------------
24 %include my_typemaps.i
26 // Import some definitions of other classes, etc.
32 //---------------------------------------------------------------------------
37 void Connect( int id, int lastId, int eventType, PyObject* func) {
38 if (PyCallable_Check(func)) {
39 self->Connect(id, lastId, eventType,
40 (wxObjectEventFunction) wxPyCallback::EventThunker,
41 new wxPyCallback(func));
48 //----------------------------------------------------------------------
51 class wxWindow : public wxEvtHandler {
54 wxWindow(wxWindow* parent, const wxWindowID id,
55 const wxPoint& pos = wxPyDefaultPosition,
56 const wxSize& size = wxPyDefaultSize,
58 char* name = "panel");
62 void Center(int direction = wxHORIZONTAL);
63 void Centre(int direction = wxHORIZONTAL);
64 void ClientToScreen(int *BOTH, int *BOTH);
65 bool Close(int force = FALSE);
67 void DestroyChildren();
68 void DragAcceptFiles(bool accept);
69 void Enable(bool enable);
70 //bool FakePopupMenu(wxMenu* menu, int x, int y);
72 wxColour GetBackgroundColour();
75 void GetClientSize(int *OUTPUT, int *OUTPUT);
76 wxLayoutConstraints * GetConstraints();
77 wxButton* GetDefaultItem();
78 //wxEvtHandler* GetEventHandler();
80 wxColour GetForegroundColour();
81 wxWindow * GetGrandParent();
83 void GetPosition(int *OUTPUT, int *OUTPUT);
86 wxWindow * GetParent();
88 int GetScrollThumb(int orientation);
89 int GetScrollPos(int orientation);
90 int GetScrollRange(int orientation);
91 void GetSize(int *OUTPUT, int *OUTPUT);
92 void GetTextExtent(const wxString& string, int *OUTPUT, int *OUTPUT); // int* descent = NULL, int* externalLeading = NULL, const wxFont* font = NULL, bool use16 = FALSE)
94 long GetWindowStyleFlag();
100 bool LoadFromResource(wxWindow* parent, const wxString& resourceName, const wxResourceTable* resourceTable = NULL);
102 void MakeModal(bool flag);
103 void Move(int x, int y);
105 //wxEvtHandler* PopEventHandler(bool deleteHandler = FALSE);
106 bool PopupMenu(wxMenu *menu, int x, int y);
107 //void PushEventHandler(wxEvtHandler* handler);
110 void Refresh(bool eraseBackground = TRUE, const wxRect* rect = NULL);
112 void ScreenToClient(int *BOTH, int *BOTH);
113 void ScrollWindow(int dx, int dy, const wxRect* rect = NULL);
114 void SetAutoLayout(bool autoLayout);
115 void SetBackgroundColour(const wxColour& colour);
116 void SetConstraints(wxLayoutConstraints *constraints);
117 void SetDoubleClick(bool allowDoubleClick);
119 void SetFont(const wxFont& font);
120 void SetForegroundColour(const wxColour& colour);
122 void SetName(const wxString& name);
123 void SetReturnCode(int retCode);
124 void SetScrollbar(int orientation, int position, int thumbSize, int range, bool refresh = TRUE);
125 void SetScrollPos(int orientation, int pos, bool refresh = TRUE);
127 //void SetSize(int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO);
128 //%name(SetSizeOnly) void SetSize(int width, int height);
130 %name(SetDimensions) void SetSize(int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO);
132 void SetSize(const wxSize& size) {
133 self->SetSize(size.x, size.y);
136 void SetPosition(const wxPoint& pos) {
137 self->SetSize(pos.x, pos.y, -1, -1);
141 void SetSizeHints(int minW=-1, int minH=-1, int maxW=-1, int maxH=-1, int incW=-1, int incH=-1);
142 void SetClientSize(int width, int height);
143 //void SetPalette(wxPalette* palette);
144 //void SetColourMap(wxColourMap *colourMap);
145 void SetCursor(const wxCursor&cursor);
146 //void SetEventHandler(wxEvtHandler* handler);
147 void SetTitle(const wxString& title);
148 bool Show(bool show);
149 bool TransferDataFromWindow();
150 bool TransferDataToWindow();
152 void WarpPointer(int x, int y);
159 wxWindow* wxWindow_FindFocus() {
160 return wxWindow::FindFocus();
165 //----------------------------------------------------------------------
167 class wxFrame : public wxWindow {
169 wxFrame(wxWindow* parent, const wxWindowID id, const wxString& title,
170 const wxPoint& pos = wxPyDefaultPosition,
171 const wxSize& size = wxPyDefaultSize,
172 long style = wxDEFAULT_FRAME_STYLE,
173 char* name = "frame");
175 void Centre(int direction = wxBOTH);
176 void Command(int id);
177 bool CreateStatusBar(int number = 1);
178 wxMenuBar* GetMenuBar();
179 wxStatusBar* GetStatusBar();
180 wxString& GetTitle();
181 void Iconize(bool iconize);
183 // *** removed *** void LoadAccelerators(const wxString& table);
184 void SetAcceleratorTable(const wxAcceleratorTable& accel);
186 void Maximize(bool maximize);
187 void SetIcon(const wxIcon& icon);
188 void SetMenuBar(wxMenuBar* menuBar);
189 void SetStatusText(const wxString& text, int number = 0);
190 void SetStatusWidths(int LCOUNT, int* LIST); // use typemap
191 void SetTitle(const wxString& title);
195 //---------------------------------------------------------------------------
197 class wxMiniFrame : public wxFrame {
199 wxMiniFrame(wxWindow* parent, const wxWindowID id, const wxString& title,
200 const wxPoint& pos = wxPyDefaultPosition,
201 const wxSize& size = wxPyDefaultSize,
202 long style = wxDEFAULT_FRAME_STYLE,
203 char* name = "frame");
207 //---------------------------------------------------------------------------
209 class wxPanel : public wxWindow {
211 wxPanel(wxWindow* parent,
213 const wxPoint& pos = wxPyDefaultPosition,
214 const wxSize& size = wxPyDefaultSize,
215 long style = wxTAB_TRAVERSAL,
216 const char* name = "panel");
221 //---------------------------------------------------------------------------
223 class wxDialog : public wxPanel {
225 wxDialog(wxWindow* parent,
227 const wxString& title,
228 const wxPoint& pos = wxPyDefaultPosition,
229 const wxSize& size = wxPyDefaultSize,
230 long style = wxDEFAULT_DIALOG_STYLE,
231 const char* name = "dialogBox");
233 void Centre(int direction = wxBOTH);
234 void EndModal(int retCode);
236 void Iconize(bool iconize);
239 void SetModal(bool flag);
240 void SetTitle(const wxString& title);
241 bool Show(bool show);
245 //---------------------------------------------------------------------------
247 class wxScrolledWindow : public wxWindow {
249 wxScrolledWindow(wxWindow* parent,
250 const wxWindowID id = -1,
251 const wxPoint& pos = wxPyDefaultPosition,
252 const wxSize& size = wxPyDefaultSize,
253 long style = wxHSCROLL | wxVSCROLL,
254 char* name = "scrolledWindow");
256 void EnableScrolling(bool xScrolling, bool yScrolling);
257 void GetScrollPixelsPerUnit(int* OUTPUT, int* OUTPUT);
258 void GetVirtualSize(int* OUTPUT, int* OUTPUT);
260 void PrepareDC(wxDC& dc);
261 void Scroll(int x, int y);
262 void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
263 int noUnitsX, int noUnitsY,
264 int xPos = 0, int yPos = 0);
265 void ViewStart(int* OUTPUT, int* OUTPUT);
268 //----------------------------------------------------------------------
271 class wxMenu : public wxEvtHandler {
273 wxMenu(const wxString& title = wxPyEmptyStr);
275 void Append(int id, const wxString& item,
276 const wxString& helpString = wxPyEmptyStr,
277 int checkable = FALSE);
278 %name(AppendMenu)void Append(int id, const wxString& item, wxMenu *subMenu,
279 const wxString& helpString = wxPyEmptyStr);
280 void AppendSeparator();
282 void Check(int id, bool flag);
283 bool Checked(int id);
284 void Enable(int id, bool enable);
285 int FindItem(const wxString& itemString);
286 wxMenuItem* FindItemForId(int id);
287 wxString& GetHelpString(int id);
288 wxString GetLabel(int id);
290 void SetHelpString(int id, const wxString& helpString);
291 void SetLabel(int id, const wxString& label);
292 void SetTitle(const wxString& title);
298 // This one knows how to set a callback and handle INC- and DECREFing it. To
299 // be used for PopupMenus, but you must retain a referece to it while using
302 class wxPyMenu : public wxMenu {
304 wxPyMenu(const wxString& title = wxPyEmptyStr, PyObject* func = NULL);
308 //----------------------------------------------------------------------
310 class wxMenuBar : public wxEvtHandler {
314 void Append(wxMenu *menu, const wxString& title);
315 void Check(int id, bool flag);
316 bool Checked(int id);
317 void Enable(int id, bool enable);
318 void EnableTop(int pos, bool enable);
319 int FindMenuItem(const wxString& menuString, const wxString& itemString);
320 wxMenuItem * FindItemForId(int id);
321 wxString GetHelpString(int id);
322 wxString GetLabel(int id);
323 wxString GetLabelTop(int pos);
324 void SetHelpString(int id, const wxString& helpString);
325 void SetLabel(int id, const wxString& label);
326 void SetLabelTop(int pos, const wxString& label);
330 //----------------------------------------------------------------------
338 const wxString& GetHelp();
339 wxMenu* GetSubMenu();
340 void SetName(const wxString& strName);
341 void SetHelp(const wxString& strHelp);
342 void Enable(bool bDoEnable = TRUE);
343 void Check(bool bDoCheck = TRUE);
344 void DeleteSubMenu();
345 const wxString& GetName();
349 //---------------------------------------------------------------------------
350 /////////////////////////////////////////////////////////////////////////////
353 // Revision 1.1 1998/08/09 08:25:52 RD