]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_popupwin.i
Added bool typemap so Py_True and Py_False are returned instead of integers.
[wxWidgets.git] / wxPython / src / _popupwin.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: _popupwin.i
3 // Purpose: SWIG interface defs for wxPopupWindow and derived classes
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 22-Dec-1998
8 // RCS-ID: $Id$
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 // Not a %module
14
15
16 //---------------------------------------------------------------------------
17
18 %{
19 #include <wx/popupwin.h>
20 %}
21
22 //---------------------------------------------------------------------------
23 #ifndef __WXMAC__
24 %newgroup;
25
26
27 // wxPopupWindow: a special kind of top level window used for popup menus,
28 // combobox popups and such.
29 class wxPopupWindow : public wxWindow {
30 public:
31 %pythonAppend wxPopupWindow "self._setOORInfo(self)"
32 %pythonAppend wxPopupWindow() ""
33
34 wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE);
35 %name(PrePopupWindow)wxPopupWindow();
36
37 bool Create(wxWindow *parent, int flags = wxBORDER_NONE);
38
39 // move the popup window to the right position, i.e. such that it is
40 // entirely visible
41 //
42 // the popup is positioned at ptOrigin + size if it opens below and to the
43 // right (default), at ptOrigin - sizePopup if it opens above and to the
44 // left &c
45 //
46 // the point must be given in screen coordinates!
47 void Position(const wxPoint& ptOrigin,
48 const wxSize& size);
49 };
50
51
52 //---------------------------------------------------------------------------
53 %newgroup;
54
55 %{
56 class wxPyPopupTransientWindow : public wxPopupTransientWindow
57 {
58 public:
59 wxPyPopupTransientWindow() : wxPopupTransientWindow() {}
60 wxPyPopupTransientWindow(wxWindow* parent, int style = wxBORDER_NONE)
61 : wxPopupTransientWindow(parent, style) {}
62
63 DEC_PYCALLBACK_BOOL_ME(ProcessLeftDown);
64 DEC_PYCALLBACK__(OnDismiss);
65 DEC_PYCALLBACK_BOOL_(CanDismiss);
66 PYPRIVATE;
67 };
68
69
70 IMP_PYCALLBACK_BOOL_ME(wxPyPopupTransientWindow, wxPopupTransientWindow, ProcessLeftDown);
71 IMP_PYCALLBACK__(wxPyPopupTransientWindow, wxPopupTransientWindow, OnDismiss);
72 IMP_PYCALLBACK_BOOL_(wxPyPopupTransientWindow, wxPopupTransientWindow, CanDismiss);
73 %}
74
75
76
77 // wxPopupTransientWindow: a wxPopupWindow which disappears automatically
78 // when the user clicks mouse outside it or if it loses focus in any other way
79 %name(PopupTransientWindow) class wxPyPopupTransientWindow : public wxPopupWindow
80 {
81 public:
82 %pythonAppend wxPyPopupTransientWindow "self._setOORInfo(self);self._setCallbackInfo(self, PopupTransientWindow)"
83 %pythonAppend wxPyPopupTransientWindow() ""
84
85 wxPyPopupTransientWindow(wxWindow *parent, int style = wxBORDER_NONE);
86 %name(PrePopupTransientWindow)wxPyPopupTransientWindow();
87
88 void _setCallbackInfo(PyObject* self, PyObject* _class);
89
90 // popup the window (this will show it too) and keep focus at winFocus
91 // (or itself if it's NULL), dismiss the popup if we lose focus
92 virtual void Popup(wxWindow *focus = NULL);
93
94 // hide the window
95 virtual void Dismiss();
96 };
97
98 //---------------------------------------------------------------------------
99
100
101
102 #else // On Mac we need to provide dummy classes to keep the renamers in sync
103 %{
104 class wxPopupWindow : public wxWindow {
105 public:
106 wxPopupWindow(wxWindow *, int) { wxPyRaiseNotImplemented(); }
107 wxPopupWindow() { wxPyRaiseNotImplemented(); }
108 };
109
110 class wxPyPopupTransientWindow : public wxPopupWindow
111 {
112 public:
113 wxPyPopupTransientWindow(wxWindow *, int) { wxPyRaiseNotImplemented(); }
114 wxPyPopupTransientWindow() { wxPyRaiseNotImplemented(); }
115 };
116 %}
117
118
119 class wxPopupWindow : public wxWindow {
120 public:
121 wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE);
122 %name(PrePopupWindow)wxPopupWindow();
123 };
124
125 %name(PopupTransientWindow) class wxPyPopupTransientWindow : public wxPopupWindow
126 {
127 public:
128 wxPyPopupTransientWindow(wxWindow *parent, int style = wxBORDER_NONE);
129 %name(PrePopupTransientWindow)wxPyPopupTransientWindow();
130 };
131
132
133 #endif
134 //---------------------------------------------------------------------------