]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/windows.i
temporary compilation fix
[wxWidgets.git] / wxPython / src / windows.i
CommitLineData
7bf85405
RD
1/////////////////////////////////////////////////////////////////////////////
2// Name: windows.i
3// Purpose: SWIG definitions of various window classes
4//
5// Author: Robin Dunn
6//
7// Created: 6/24/97
8// RCS-ID: $Id$
9// Copyright: (c) 1998 by Total Control Software
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
13
03e9bead
RD
14%module windows
15
16%{
7bf85405 17#include "helpers.h"
7bf85405 18#include <wx/menuitem.h>
9416aa89 19#include <wx/tooltip.h>
7bf85405
RD
20%}
21
22//----------------------------------------------------------------------
23
24%include typemaps.i
25%include my_typemaps.i
26
27// Import some definitions of other classes, etc.
28%import _defs.i
29%import misc.i
30%import gdi.i
b1462dfa 31%import clip_dnd.i
efc5f224 32
2f90df85 33%pragma(python) code = "import wx"
7bf85405 34
b68dc582 35
137b5242
RD
36//----------------------------------------------------------------------
37
38%{
39 // Put some wx default wxChar* values into wxStrings.
40 DECLARE_DEF_STRING(PanelNameStr);
41 static const wxString wxPyEmptyString(wxT(""));
42%}
43
7bf85405
RD
44//---------------------------------------------------------------------------
45
9416aa89 46class wxEvtHandler : public wxObject {
7bf85405 47public:
c368d904
RD
48 wxEvtHandler();
49
cf694132 50 bool ProcessEvent(wxEvent& event);
f6bcfd97 51 void AddPendingEvent(wxEvent& event);
2f90df85
RD
52 //bool SearchEventTable(wxEventTable& table, wxEvent& event);
53
54 bool GetEvtHandlerEnabled();
55 void SetEvtHandlerEnabled(bool enabled);
56
57 wxEvtHandler* GetNextHandler();
58 wxEvtHandler* GetPreviousHandler();
59 void SetNextHandler(wxEvtHandler* handler);
60 void SetPreviousHandler(wxEvtHandler* handler);
61
62
7bf85405
RD
63 %addmethods {
64 void Connect( int id, int lastId, int eventType, PyObject* func) {
65 if (PyCallable_Check(func)) {
66 self->Connect(id, lastId, eventType,
853b255a 67 (wxObjectEventFunction) &wxPyCallback::EventThunker,
7bf85405
RD
68 new wxPyCallback(func));
69 }
25b00b4e
RD
70 else if (func == Py_None) {
71 self->Disconnect(id, lastId, eventType,
72 (wxObjectEventFunction)
73 &wxPyCallback::EventThunker);
74 }
75 else {
76 PyErr_SetString(PyExc_TypeError, "Expected callable object or None.");
77 }
7bf85405 78 }
6999b0d8
RD
79
80 bool Disconnect(int id, int lastId = -1,
81 wxEventType eventType = wxEVT_NULL) {
82 return self->Disconnect(id, lastId, eventType,
83 (wxObjectEventFunction)
84 &wxPyCallback::EventThunker);
85 }
7bf85405 86 }
f6bcfd97 87
0122b7e3
RD
88 %addmethods {
89 void _setOORInfo(PyObject* _self) {
90 self->SetClientObject(new wxPyClientData(_self));
91 }
92 }
7bf85405
RD
93};
94
95
2f90df85
RD
96//----------------------------------------------------------------------
97
98class wxValidator : public wxEvtHandler {
99public:
100 wxValidator();
101 //~wxValidator();
102
0122b7e3
RD
103 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
104
2f90df85
RD
105 wxValidator* Clone();
106 wxWindow* GetWindow();
107 void SetWindow(wxWindow* window);
f6bcfd97 108
9416aa89
RD
109 static bool IsSilent();
110 static void SetBellOnError(int doIt = TRUE);
111
2f90df85
RD
112};
113
2f90df85
RD
114
115//----------------------------------------------------------------------
116%{
117class wxPyValidator : public wxValidator {
118 DECLARE_DYNAMIC_CLASS(wxPyValidator);
119public:
120 wxPyValidator() {
121 }
2f90df85
RD
122
123 ~wxPyValidator() {
124 }
125
19a97bd6 126 wxObject* Clone() const {
694759cf
RD
127 wxPyValidator* ptr = NULL;
128 wxPyValidator* self = (wxPyValidator*)this;
129
4268f798 130 wxPyBeginBlockThreads();
694759cf
RD
131 if (self->m_myInst.findCallback("Clone")) {
132 PyObject* ro;
133 ro = self->m_myInst.callCallbackObj(Py_BuildValue("()"));
f6bcfd97
BP
134 if (ro) {
135 SWIG_GetPtrObj(ro, (void **)&ptr, "_wxPyValidator_p");
136 Py_DECREF(ro);
137 }
694759cf 138 }
4268f798 139 wxPyEndBlockThreads();
19a97bd6 140
694759cf
RD
141 // This is very dangerous!!! But is the only way I could find
142 // to squash a memory leak. Currently it is okay, but if the
143 // validator architecture in wxWindows ever changes, problems
144 // could arise.
145 delete self;
694759cf 146 return ptr;
2f90df85 147 }
2f90df85 148
9416aa89 149
2f90df85
RD
150 DEC_PYCALLBACK_BOOL_WXWIN(Validate);
151 DEC_PYCALLBACK_BOOL_(TransferToWindow);
152 DEC_PYCALLBACK_BOOL_(TransferFromWindow);
153
154 PYPRIVATE;
2f90df85
RD
155};
156
157IMP_PYCALLBACK_BOOL_WXWIN(wxPyValidator, wxValidator, Validate);
158IMP_PYCALLBACK_BOOL_(wxPyValidator, wxValidator, TransferToWindow);
159IMP_PYCALLBACK_BOOL_(wxPyValidator, wxValidator, TransferFromWindow);
160
161IMPLEMENT_DYNAMIC_CLASS(wxPyValidator, wxValidator);
162
163%}
164
165class wxPyValidator : public wxValidator {
166public:
167 wxPyValidator();
2f90df85 168
0122b7e3
RD
169 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=TRUE);
170 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyValidator, 1)"
2f90df85 171
0122b7e3 172 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
2f90df85
RD
173};
174
7bf85405
RD
175//----------------------------------------------------------------------
176
efc5f224 177%apply int * INOUT { int* x, int* y };
7bf85405
RD
178
179class wxWindow : public wxEvtHandler {
180public:
7bf85405 181 wxWindow(wxWindow* parent, const wxWindowID id,
b68dc582
RD
182 const wxPoint& pos = wxDefaultPosition,
183 const wxSize& size = wxDefaultSize,
7bf85405 184 long style = 0,
137b5242 185 const wxString& name = wxPyPanelNameStr);
09f3d4e6 186 %name(wxPreWindow)wxWindow();
7bf85405 187
09f3d4e6
RD
188 bool Create(wxWindow* parent, const wxWindowID id,
189 const wxPoint& pos = wxDefaultPosition,
190 const wxSize& size = wxDefaultSize,
191 long style = 0,
137b5242 192 const wxString& name = wxPyPanelNameStr);
7bf85405 193
0122b7e3 194 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
17c0e08c 195 %pragma(python) addtomethod = "wxPreWindow:val._setOORInfo(val)"
0122b7e3
RD
196
197
7bf85405 198 void CaptureMouse();
8bf5d46e
RD
199 void Center(int direction = wxBOTH);
200 void Centre(int direction = wxBOTH);
201 void CentreOnParent(int direction = wxBOTH );
202 void CenterOnParent(int direction = wxBOTH );
3ca6a5f0
BP
203 void CentreOnScreen(int direction = wxBOTH );
204 void CenterOnScreen(int direction = wxBOTH );
efc5f224 205
d56cebe7
RD
206 void Clear();
207
efc5f224
RD
208 // (uses apply'ed INOUT typemap, see above)
209 %name(ClientToScreenXY)void ClientToScreen(int* x, int* y);
af309447 210 wxPoint ClientToScreen(const wxPoint& pt);
efc5f224 211
7bf85405
RD
212 bool Close(int force = FALSE);
213 bool Destroy();
214 void DestroyChildren();
10e07c70 215 bool IsBeingDeleted();
853b255a 216#ifdef __WXMSW__
7bf85405 217 void DragAcceptFiles(bool accept);
853b255a 218#endif
7bf85405
RD
219 void Enable(bool enable);
220 //bool FakePopupMenu(wxMenu* menu, int x, int y);
af309447 221 %name(FindWindowById) wxWindow* FindWindow(long id);
714e6a9e 222 %name(FindWindowByName) wxWindow* FindWindow(const wxString& name);
7bf85405
RD
223 void Fit();
224 wxColour GetBackgroundColour();
23bed520 225 wxBorder GetBorder() const;
d426c97e
RD
226
227 //wxList& GetChildren();
228 %addmethods {
229 PyObject* GetChildren() {
230 wxWindowList& list = self->GetChildren();
231 return wxPy_ConvertList(&list, "wxWindow");
232 }
233 }
234
7bf85405
RD
235 int GetCharHeight();
236 int GetCharWidth();
b8b8dda7
RD
237 %name(GetClientSizeTuple) void GetClientSize(int *OUTPUT, int *OUTPUT);
238 wxSize GetClientSize();
23bed520
RD
239
240 // get the origin of the client area of the window relative to the
241 // window top left corner (the client area may be shifted because of
242 // the borders, scrollbars, other decorations...)
243 wxPoint GetClientAreaOrigin() const;
244
245 // get the client rectangle in window (i.e. client) coordinates
246 wxRect GetClientRect() const;
247
7bf85405 248 wxLayoutConstraints * GetConstraints();
3ab72185 249 wxEvtHandler* GetEventHandler();
105e45b9 250
c5943253 251 wxFont GetFont();
7bf85405
RD
252 wxColour GetForegroundColour();
253 wxWindow * GetGrandParent();
2abc0a0f
RD
254 %addmethods {
255 long GetHandle() {
54b96882 256 return wxPyGetWinHandle(self); //(long)self->GetHandle();
2abc0a0f
RD
257 }
258 }
7bf85405 259 int GetId();
853b255a 260 wxString GetLabel();
bb0054cd 261 void SetLabel(const wxString& label);
853b255a 262 wxString GetName();
7bf85405 263 wxWindow * GetParent();
b8b8dda7
RD
264 %name(GetPositionTuple) void GetPosition(int *OUTPUT, int *OUTPUT);
265 wxPoint GetPosition();
266 wxRect GetRect();
7bf85405
RD
267 int GetScrollThumb(int orientation);
268 int GetScrollPos(int orientation);
269 int GetScrollRange(int orientation);
b8b8dda7
RD
270 %name(GetSizeTuple) void GetSize(int *OUTPUT, int *OUTPUT);
271 wxSize GetSize();
af309447
RD
272 void GetTextExtent(const wxString& string, int *OUTPUT, int *OUTPUT);
273 %name(GetFullTextExtent)void GetTextExtent(const wxString& string,
274 int *OUTPUT, int *OUTPUT, int *OUTPUT, int* OUTPUT,
275 const wxFont* font = NULL); //, bool use16 = FALSE)
853b255a 276 wxString GetTitle();
8bf5d46e 277 wxRegion GetUpdateRegion();
7bf85405 278 long GetWindowStyleFlag();
f6bcfd97
BP
279 void SetWindowStyleFlag(long style);
280 void SetWindowStyle(long style);
23bed520 281 bool HasScrollbar(int orient) const;
bb0054cd 282 bool Hide();
23bed520 283 wxHitTest HitTest(const wxPoint& pt);
7bf85405
RD
284 void InitDialog();
285 bool IsEnabled();
1b55cabf
RD
286 bool IsExposed( int x, int y, int w=0, int h=0 );
287 %name(IsExposedPoint) bool IsExposed( const wxPoint& pt );
288 %name(IsExposedRect) bool IsExposed( const wxRect& rect );
7bf85405
RD
289 bool IsRetained();
290 bool IsShown();
bb0054cd 291 bool IsTopLevel();
7bf85405
RD
292 void Layout();
293 bool LoadFromResource(wxWindow* parent, const wxString& resourceName, const wxResourceTable* resourceTable = NULL);
294 void Lower();
ecc08ead 295 void MakeModal(bool flag=TRUE);
23bed520
RD
296 %name(MoveXY)void Move(int x, int y, int flags = wxSIZE_USE_EXISTING);
297 void Move(const wxPoint& point, int flags = wxSIZE_USE_EXISTING);
7bf85405 298
3ab72185
RD
299 wxEvtHandler* PopEventHandler(bool deleteHandler = FALSE);
300 void PushEventHandler(wxEvtHandler* handler);
7bf85405 301
c6c593e8
RD
302 // find the given handler in the event handler chain and remove (but
303 // not delete) it from the event handler chain, return TRUE if it was
304 // found and FALSE otherwise (this also results in an assert failure so
305 // this function should only be called when the handler is supposed to
306 // be there)
307 bool RemoveEventHandler(wxEvtHandler *handler);
308
8bf5d46e
RD
309 %name(PopupMenuXY)bool PopupMenu(wxMenu *menu, int x, int y);
310 bool PopupMenu(wxMenu *menu, const wxPoint& pos);
311
7bf85405
RD
312 void Raise();
313 void Refresh(bool eraseBackground = TRUE, const wxRect* rect = NULL);
09f3d4e6
RD
314 void RefreshRect(const wxRect& rect);
315
7bf85405 316 void ReleaseMouse();
b7e72427 317 void RemoveChild(wxWindow* child);
bb0054cd
RD
318 bool Reparent( wxWindow* newParent );
319
efc5f224
RD
320 // (uses apply'ed INOUT typemap, see above)
321 %name(ScreenToClientXY)void ScreenToClient(int *x, int *y);
af309447
RD
322 wxPoint ScreenToClient(const wxPoint& pt);
323
7bf85405
RD
324 void ScrollWindow(int dx, int dy, const wxRect* rect = NULL);
325 void SetAutoLayout(bool autoLayout);
1dec68aa 326 bool GetAutoLayout();
7bf85405
RD
327 void SetBackgroundColour(const wxColour& colour);
328 void SetConstraints(wxLayoutConstraints *constraints);
2f90df85 329 void UnsetConstraints(wxLayoutConstraints *constraints);
7bf85405 330 void SetFocus();
2f90df85 331 bool AcceptsFocus();
7bf85405
RD
332 void SetFont(const wxFont& font);
333 void SetForegroundColour(const wxColour& colour);
334 void SetId(int id);
335 void SetName(const wxString& name);
eb715945 336 void SetScrollbar(int orientation, int position, int thumbSize, int range, int refresh = TRUE);
7bf85405
RD
337 void SetScrollPos(int orientation, int pos, bool refresh = TRUE);
338
7bf85405
RD
339 %name(SetDimensions) void SetSize(int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO);
340 %addmethods {
341 void SetSize(const wxSize& size) {
b7e72427 342 self->SetSize(size);
7bf85405
RD
343 }
344
23bed520
RD
345 void SetPosition(const wxPoint& pos, int flags = wxSIZE_USE_EXISTING) {
346 self->Move(pos, flags);
7bf85405 347 }
33510773
RD
348
349 void SetRect(const wxRect& rect, int sizeFlags=wxSIZE_AUTO) {
350 self->SetSize(rect, sizeFlags);
351 }
7bf85405
RD
352 }
353
354 void SetSizeHints(int minW=-1, int minH=-1, int maxW=-1, int maxH=-1, int incW=-1, int incH=-1);
af309447
RD
355 %name(SetClientSizeWH)void SetClientSize(int width, int height);
356 void SetClientSize(const wxSize& size);
7bf85405 357 //void SetPalette(wxPalette* palette);
c5943253 358 void SetCursor(const wxCursor& cursor);
3ab72185 359 void SetEventHandler(wxEvtHandler* handler);
83b18bab 360 void SetExtraStyle(long exStyle);
7bf85405 361 void SetTitle(const wxString& title);
7b7ac0ab 362 bool Show(bool show=TRUE);
7bf85405
RD
363 bool TransferDataFromWindow();
364 bool TransferDataToWindow();
23bed520 365 void UpdateWindowUI();
7bf85405
RD
366 bool Validate();
367 void WarpPointer(int x, int y);
368
b8b8dda7
RD
369 %name(ConvertDialogPointToPixels) wxPoint ConvertDialogToPixels(const wxPoint& pt);
370 %name(ConvertDialogSizeToPixels) wxSize ConvertDialogToPixels(const wxSize& sz);
371
cf694132
RD
372 %name(DLG_PNT) wxPoint ConvertDialogToPixels(const wxPoint& pt);
373 %name(DLG_SZE) wxSize ConvertDialogToPixels(const wxSize& sz);
374
b8b8dda7
RD
375 %name(ConvertPixelPointToDialog) wxPoint ConvertPixelsToDialog(const wxPoint& pt);
376 %name(ConvertPixelSizeToDialog) wxSize ConvertPixelsToDialog(const wxSize& sz);
377
af309447
RD
378 %name(SetToolTipString)void SetToolTip(const wxString &tip);
379 void SetToolTip(wxToolTip *tooltip);
380 wxToolTip* GetToolTip();
2f90df85 381
a541c325 382 void SetSizer(wxSizer* sizer, bool deleteOld=TRUE);
f6bcfd97
BP
383 wxSizer* GetSizer();
384
be90c029 385 // Track if this window is a member of a sizer
14afa2cb
RD
386 void SetContainingSizer(wxSizer* sizer);
387 wxSizer *GetContainingSizer() const;
be90c029 388
2f90df85
RD
389 wxValidator* GetValidator();
390 void SetValidator(const wxValidator& validator);
391
e6056257 392#ifndef __WXMAC__
b1462dfa
RD
393 void SetDropTarget(wxDropTarget* target);
394 wxDropTarget* GetDropTarget();
395 %pragma(python) addtomethod = "SetDropTarget:_args[0].thisown = 0"
e6056257 396#endif
694759cf
RD
397
398 wxSize GetBestSize();
a541c325 399 wxSize GetMaxSize();
a1df7a95
RD
400
401 void SetCaret(wxCaret *caret);
402 wxCaret *GetCaret();
9416aa89 403 %pragma(python) addtoclass = "# replaces broken shadow method
a1df7a95
RD
404 def GetCaret(self, *_args, **_kwargs):
405 from misc2 import wxCaretPtr
406 val = apply(windowsc.wxWindow_GetCaret,(self,) + _args, _kwargs)
407 if val: val = wxCaretPtr(val)
408 return val
f6bcfd97 409 "
c368d904 410
3a0958b1
RD
411 void Freeze();
412 void Thaw();
09f3d4e6 413 void Update();
3a0958b1 414
4f3449b4
RD
415 wxString GetHelpText();
416 void SetHelpText(const wxString& helpText);
23bed520 417 void SetHelpTextForId(const wxString& text);
4f3449b4 418
c7e7022c
RD
419 bool ScrollLines(int lines);
420 bool ScrollPages(int pages);
421 bool LineUp();
422 bool LineDown();
423 bool PageUp();
424 bool PageDown();
425
09f3d4e6
RD
426 static wxWindow* FindFocus();
427 static int NewControlId();
428 static int NextControlId(int id);
429 static int PrevControlId(int id);
c7e7022c 430
ecc08ead
RD
431 void SetAcceleratorTable(const wxAcceleratorTable& accel);
432 wxAcceleratorTable *GetAcceleratorTable();
78e8819c 433
74bcba0e 434#ifdef __WXMSW__
07c99b26 435 // A way to do the native draw first... Too bad it isn't in wxGTK too.
74bcba0e
RD
436 void OnPaint(wxPaintEvent& event);
437#endif
5a2930ab 438
26e335b8
RD
439 wxWindow* GetDefaultItem();
440 wxWindow* SetDefaultItem(wxWindow *btn);
7bf85405
RD
441};
442
efc5f224
RD
443
444
445
b8b8dda7 446%pragma(python) code = "
bb0054cd
RD
447def wxDLG_PNT(win, point_or_x, y=None):
448 if y is None:
449 return win.ConvertDialogPointToPixels(point_or_x)
450 else:
451 return win.ConvertDialogPointToPixels(wxPoint(point_or_x, y))
452
453def wxDLG_SZE(win, size_width, height=None):
454 if height is None:
455 return win.ConvertDialogSizeToPixels(size_width)
456 else:
457 return win.ConvertDialogSizeToPixels(wxSize(size_width, height))
b8b8dda7 458"
7bf85405 459
af309447 460
c368d904 461#ifdef __WXMSW__
af309447
RD
462%inline %{
463wxWindow* wxWindow_FromHWND(unsigned long hWnd) {
464 wxWindow* win = new wxWindow;
465 win->SetHWND(hWnd);
466 win->SubclassWin(hWnd);
467 return win;
468}
469%}
853b255a 470#endif
7bf85405 471
efc5f224 472
7bf85405
RD
473//---------------------------------------------------------------------------
474
475class wxPanel : public wxWindow {
476public:
477 wxPanel(wxWindow* parent,
478 const wxWindowID id,
b68dc582
RD
479 const wxPoint& pos = wxDefaultPosition,
480 const wxSize& size = wxDefaultSize,
7bf85405 481 long style = wxTAB_TRAVERSAL,
137b5242 482 const wxString& name = wxPyPanelNameStr);
09f3d4e6 483 %name(wxPrePanel)wxPanel();
7bf85405 484
09f3d4e6
RD
485 bool Create(wxWindow* parent,
486 const wxWindowID id,
487 const wxPoint& pos = wxDefaultPosition,
488 const wxSize& size = wxDefaultSize,
489 long style = wxTAB_TRAVERSAL,
137b5242 490 const wxString& name = wxPyPanelNameStr);
9c039d08 491
0122b7e3 492 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
7b7ac0ab 493 %pragma(python) addtomethod = "wxPrePanel:val._setOORInfo(val)"
0122b7e3 494
7bf85405 495 void InitDialog();
bb0054cd 496
7bf85405
RD
497};
498
499//---------------------------------------------------------------------------
500
0adbc166
RD
501
502// TODO: Add wrappers for the wxScrollHelper class, make wxScrolledWindow
503// derive from it and wxPanel.
504
505
bb0054cd 506class wxScrolledWindow : public wxPanel {
7bf85405
RD
507public:
508 wxScrolledWindow(wxWindow* parent,
509 const wxWindowID id = -1,
b68dc582
RD
510 const wxPoint& pos = wxDefaultPosition,
511 const wxSize& size = wxDefaultSize,
7bf85405 512 long style = wxHSCROLL | wxVSCROLL,
137b5242 513 const wxString& name = wxPyPanelNameStr);
09f3d4e6
RD
514 %name(wxPreScrolledWindow)wxScrolledWindow();
515
516 bool Create(wxWindow* parent,
517 const wxWindowID id = -1,
518 const wxPoint& pos = wxDefaultPosition,
519 const wxSize& size = wxDefaultSize,
520 long style = wxHSCROLL | wxVSCROLL,
137b5242 521 const wxString& name = wxPyPanelNameStr);
9c039d08 522
0122b7e3 523 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
17c0e08c 524 %pragma(python) addtomethod = "wxPreScrolledWindow:val._setOORInfo(val)"
0122b7e3 525
7bf85405 526 void EnableScrolling(bool xScrolling, bool yScrolling);
b7e72427 527 int GetScrollPageSize(int orient);
7bf85405 528 void GetScrollPixelsPerUnit(int* OUTPUT, int* OUTPUT);
b7e72427 529 wxWindow* GetTargetWindow();
7bf85405
RD
530 void GetVirtualSize(int* OUTPUT, int* OUTPUT);
531 bool IsRetained();
532 void PrepareDC(wxDC& dc);
533 void Scroll(int x, int y);
534 void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
535 int noUnitsX, int noUnitsY,
f6bcfd97 536 int xPos = 0, int yPos = 0, int noRefresh=FALSE);
b7e72427 537 void SetScrollPageSize(int orient, int pageSize);
eb715945 538 void SetTargetWindow(wxWindow* window);
4c9993c3 539 void GetViewStart(int* OUTPUT, int* OUTPUT);
0adbc166 540 %pragma(python) addtoclass = "ViewStart = GetViewStart"
9d8bd15f 541
e9159fe8
RD
542 %name(CalcScrolledPosition1)wxPoint CalcScrolledPosition(const wxPoint& pt);
543 %name(CalcScrolledPosition2)void CalcScrolledPosition( int x, int y, int *OUTPUT, int *OUTPUT);
544
545 %name(CalcUnscrolledPosition1)wxPoint CalcUnscrolledPosition(const wxPoint& pt);
546 %name(CalcUnscrolledPosition2)void CalcUnscrolledPosition( int x, int y, int *OUTPUT, int *OUTPUT);
547
548 %pragma(python) addtoclass = "
549 def CalcScrolledPosition(self, *args):
550 if len(args) == 1:
551 return apply(self.CalcScrolledPosition1, args)
552 elif len(args) == 2:
553 return apply(self.CalcScrolledPosition2, args)
554 else:
555 raise TypeError, 'Invalid parameters: only (x,y) or (point) allowed'
556
557 def CalcUnscrolledPosition(self, *args):
558 if len(args) == 1:
559 return apply(self.CalcUnscrolledPosition1, args)
560 elif len(args) == 2:
561 return apply(self.CalcUnscrolledPosition2, args)
562 else:
563 raise TypeError, 'Invalid parameters: only (x,y) or (point) allowed'
564"
9d8bd15f 565
d1679124
RD
566 void SetScale(double xs, double ys);
567 double GetScaleX();
568 double GetScaleY();
569
570 void AdjustScrollbars();
26e335b8
RD
571
572 bool Layout();
7bf85405
RD
573};
574
575//----------------------------------------------------------------------
576
577
578class wxMenu : public wxEvtHandler {
579public:
137b5242 580 wxMenu(const wxString& title = wxPyEmptyString, long style = 0);
7bf85405 581
0122b7e3
RD
582 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
583
7bf85405 584 void Append(int id, const wxString& item,
137b5242 585 const wxString& helpString = wxPyEmptyString,
546bfbea 586 wxItemKind kind = wxITEM_NORMAL);
7bf85405 587 %name(AppendMenu)void Append(int id, const wxString& item, wxMenu *subMenu,
137b5242 588 const wxString& helpString = wxPyEmptyString);
af309447 589 %name(AppendItem)void Append(const wxMenuItem* item);
e9159fe8
RD
590 void AppendCheckItem(int id,
591 const wxString& text,
137b5242 592 const wxString& help = wxPyEmptyString);
e9159fe8
RD
593 void AppendRadioItem(int id,
594 const wxString& text,
137b5242 595 const wxString& help = wxPyEmptyString);
7bf85405 596 void AppendSeparator();
e9159fe8
RD
597
598
599 void Insert(size_t pos,
600 int id,
601 const wxString& text,
137b5242 602 const wxString& help = wxPyEmptyString,
546bfbea 603 wxItemKind kind = wxITEM_NORMAL);
e9159fe8
RD
604 void InsertSeparator(size_t pos);
605 void InsertCheckItem(size_t pos,
606 int id,
607 const wxString& text,
137b5242 608 const wxString& help = wxPyEmptyString);
e9159fe8
RD
609 void InsertRadioItem(size_t pos,
610 int id,
611 const wxString& text,
137b5242 612 const wxString& help = wxPyEmptyString);
e9159fe8
RD
613 %name(InsertMenu)void Insert(size_t pos,
614 int id,
615 const wxString& text,
616 wxMenu *submenu,
137b5242 617 const wxString& help = wxPyEmptyString);
e9159fe8
RD
618 %name(InsertItem)bool Insert(size_t pos, wxMenuItem *item);
619
620
621 void Prepend(int id,
622 const wxString& text,
137b5242 623 const wxString& help = wxPyEmptyString,
546bfbea 624 wxItemKind kind = wxITEM_NORMAL);
e9159fe8
RD
625 void PrependSeparator();
626 void PrependCheckItem(int id,
627 const wxString& text,
137b5242 628 const wxString& help = wxPyEmptyString);
e9159fe8
RD
629 void PrependRadioItem(int id,
630 const wxString& text,
137b5242 631 const wxString& help = wxPyEmptyString);
e9159fe8
RD
632 %name(PrependMenu)void Prepend(int id,
633 const wxString& text,
634 wxMenu *submenu,
137b5242 635 const wxString& help = wxPyEmptyString);
e9159fe8
RD
636 %name(PrependItem)void Prepend(wxMenuItem *item);
637
638
7bf85405
RD
639 void Break();
640 void Check(int id, bool flag);
b1462dfa 641 bool IsChecked(int id);
7bf85405 642 void Enable(int id, bool enable);
b1462dfa
RD
643 bool IsEnabled(int id);
644
7bf85405 645 int FindItem(const wxString& itemString);
b1462dfa
RD
646 %name(FindItemById)wxMenuItem* FindItem(int id/*, wxMenu **menu = NULL*/);
647
7bf85405 648 wxString GetTitle();
7bf85405 649 void SetTitle(const wxString& title);
b1462dfa 650
714e6a9e 651 wxString GetLabel(int id);
853b255a 652 void SetLabel(int id, const wxString& label);
b1462dfa
RD
653
654 wxString GetHelpString(int id);
655 void SetHelpString(int id, const wxString& helpString);
8bf5d46e 656 void UpdateUI(wxEvtHandler* source = NULL);
efc5f224 657
b1462dfa
RD
658 bool Delete(int id);
659 %name(DeleteItem)bool Delete(wxMenuItem *item);
b1462dfa
RD
660 wxMenuItem *Remove(int id);
661 %name(RemoveItem) wxMenuItem *Remove(wxMenuItem *item);
662
e9159fe8
RD
663
664
665
efc5f224 666 %addmethods {
eb715945 667 void Destroy() { delete self; }
efc5f224 668 }
b1462dfa
RD
669 %name(DestroyId)bool Destroy(int id);
670 %name(DestroyItem)bool Destroy(wxMenuItem *item);
efc5f224 671
b1462dfa
RD
672 size_t GetMenuItemCount();
673 //wxMenuItemList& GetMenuItems();
674 %addmethods {
675 PyObject* GetMenuItems() {
676 wxMenuItemList& list = self->GetMenuItems();
677 return wxPy_ConvertList(&list, "wxMenuItem");
678 }
679 }
7bf85405 680
b1462dfa
RD
681 void SetEventHandler(wxEvtHandler *handler);
682 wxEvtHandler *GetEventHandler();
683
684 void SetInvokingWindow(wxWindow *win);
685 wxWindow *GetInvokingWindow();
686
687 long GetStyle();
688
689 bool IsAttached();
690
691 void SetParent(wxMenu *parent);
692 wxMenu *GetParent();
693};
7bf85405 694
7bf85405
RD
695
696//----------------------------------------------------------------------
697
b1462dfa 698class wxMenuBar : public wxWindow {
7bf85405 699public:
c368d904 700 wxMenuBar(long style = 0);
7bf85405 701
0122b7e3
RD
702 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
703
b1462dfa
RD
704 bool Append(wxMenu *menu, const wxString& title);
705 bool Insert(size_t pos, wxMenu *menu, const wxString& title);
706 size_t GetMenuCount();
707 wxMenu *GetMenu(size_t pos);
708 wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title);
709 wxMenu *Remove(size_t pos);
710 void EnableTop(size_t pos, bool enable);
711 void SetLabelTop(size_t pos, const wxString& label);
712 wxString GetLabelTop(size_t pos);
3a0958b1 713 int FindMenu(const wxString& title);
b1462dfa
RD
714 int FindMenuItem(const wxString& menuString, const wxString& itemString);
715 %name(FindItemById)wxMenuItem* FindItem(int id/*, wxMenu **menu = NULL*/);
7bf85405 716 void Enable(int id, bool enable);
b1462dfa 717 void Check(int id, bool check);
2abc0a0f
RD
718 bool IsChecked(int id);
719 bool IsEnabled(int id);
b1462dfa
RD
720
721 void SetLabel(int id, const wxString &label);
7bf85405 722 wxString GetLabel(int id);
b1462dfa 723
7bf85405 724 void SetHelpString(int id, const wxString& helpString);
b1462dfa 725 wxString GetHelpString(int id);
2abc0a0f 726
7bf85405
RD
727};
728
729
730//----------------------------------------------------------------------
731
9416aa89 732class wxMenuItem : public wxObject {
7bf85405 733public:
4c9993c3 734 wxMenuItem(wxMenu* parentMenu=NULL, int id=wxID_SEPARATOR,
137b5242
RD
735 const wxString& text = wxPyEmptyString,
736 const wxString& help = wxPyEmptyString,
546bfbea 737 wxItemKind kind = wxITEM_NORMAL,
e9159fe8 738 wxMenu* subMenu = NULL);
cf694132 739
b1462dfa
RD
740
741 wxMenu *GetMenu();
2abc0a0f 742 void SetId(int id);
b1462dfa
RD
743 int GetId();
744 bool IsSeparator();
2abc0a0f 745 void SetText(const wxString& str);
b1462dfa 746 wxString GetLabel();
2abc0a0f 747 const wxString& GetText();
e9159fe8 748 wxItemKind GetKind();
2abc0a0f 749 void SetCheckable(bool checkable);
b1462dfa
RD
750 bool IsCheckable();
751 bool IsSubMenu();
2abc0a0f 752 void SetSubMenu(wxMenu *menu);
b1462dfa
RD
753 wxMenu *GetSubMenu();
754 void Enable(bool enable = TRUE);
755 bool IsEnabled();
756 void Check(bool check = TRUE);
757 bool IsChecked();
758 void Toggle();
759 void SetHelp(const wxString& str);
760 const wxString& GetHelp();
761 wxAcceleratorEntry *GetAccel();
762 void SetAccel(wxAcceleratorEntry *accel);
763
1b62f00d 764 static wxString GetLabelFromText(const wxString& text);
e9159fe8 765// static wxAcceleratorEntry *GetAccelFromString(const wxString& label);
1b62f00d 766
f3d9dc1d 767 // wxOwnerDrawn methods
4662be59 768#ifdef __WXMSW__
f3d9dc1d 769 void SetFont(const wxFont& font);
c5943253 770 wxFont GetFont();
f3d9dc1d 771 void SetTextColour(const wxColour& colText);
25832b3f 772 wxColour GetTextColour();
f3d9dc1d 773 void SetBackgroundColour(const wxColour& colBack);
25832b3f 774 wxColour GetBackgroundColour();
f3d9dc1d
RD
775 void SetBitmaps(const wxBitmap& bmpChecked,
776 const wxBitmap& bmpUnchecked = wxNullBitmap);
777 void SetBitmap(const wxBitmap& bmpChecked);
c5943253 778 wxBitmap GetBitmap(bool bChecked = TRUE);
f3d9dc1d
RD
779 void SetMarginWidth(int nWidth);
780 int GetMarginWidth();
781 static int GetDefaultMarginWidth();
782 //void SetName(const wxString& strName);
783 //const wxString& GetName();
784 //void SetCheckable(bool checkable);
785 //bool IsCheckable();
786 bool IsOwnerDrawn();
787 void ResetOwnerDrawn();
4662be59 788#endif
7bf85405
RD
789};
790
791//---------------------------------------------------------------------------
7bf85405
RD
792
793
694759cf 794