Add libwx-perl
[pkg-perl] / deb-src / libwx-perl / libwx-perl-0.96 / XS / PopupWindow.xsp
1 #############################################################################
2 ## Name:        XS/PopupWindow.xsp
3 ## Purpose:     XS++ for Wx::PopupWindow and Wx::PopupTransientWindow
4 ## Author:      Mattia Barbon
5 ## Modified by:
6 ## Created:     18/03/2005
7 ## RCS-ID:      $Id: PopupWindow.xsp 2079 2007-07-08 21:18:04Z mbarbon $
8 ## Copyright:   (c) 2005-2006 Mattia Barbon
9 ## Licence:     This program is free software; you can redistribute it and/or
10 ##              modify it under the same terms as Perl itself
11 #############################################################################
12
13 %module{Wx};
14
15 #if wxUSE_POPUPWIN
16
17 %typemap{wxPopupWindow*}{simple};
18 %typemap{wxPopupTransientWindow*}{simple};
19 %typemap{wxPlPopupTransientWindow*}{simple};
20 %typemap{wxMouseEvent&}{reference};
21
22 %{
23 #include "wx/popupwin.h"
24 #include "cpp/popupwin.h"
25 %}
26
27 %file{cpp/popupwin.h};
28 %{
29
30 #define DEC_V_CBACK_BOOL__WXMOUSEEVENT( METHOD ) \
31   bool METHOD( wxMouseEvent& event )
32
33 #define DEF_V_CBACK_BOOL__WXMOUSEEVENT( CLASS, BASE, METHOD ) \
34   bool CLASS::METHOD( wxMouseEvent& param1 )                                  \
35   {                                                                           \
36     dTHX;                                                                     \
37     if( wxPliFCback( aTHX_ &m_callback, #METHOD ) )                           \
38     {                                                                         \
39         wxAutoSV evt( aTHX_ wxPli_object_2_sv( aTHX_ newSViv( 0 ), &param1 ));\
40         wxAutoSV ret( aTHX_ wxPliCCback( aTHX_ &m_callback, G_SCALAR,         \
41                                          "S", (SV*) evt ) );                  \
42         sv_setiv( SvRV( evt ), 0 );                                           \
43         return SvTRUE( ret );                                                 \
44     } else                                                                    \
45         return BASE::METHOD( param1 );                                        \
46   }
47
48 class wxPlPopupTransientWindow : public wxPopupTransientWindow
49 {
50     WXPLI_DECLARE_DYNAMIC_CLASS( wxPlPopupTransientWindow );
51     WXPLI_DECLARE_V_CBACK();
52 public:
53     WXPLI_DEFAULT_CONSTRUCTOR( wxPlPopupTransientWindow,
54                                "Wx::PlPopupTransientWindow", true );
55     WXPLI_CONSTRUCTOR_2( wxPlPopupTransientWindow,
56                          "Wx::PlPopupTransientWindow", true,
57                          wxWindow*, int );
58
59     DEC_V_CBACK_VOID__WXWINDOW( Popup );
60     DEC_V_CBACK_VOID__VOID( Dismiss );
61     DEC_V_CBACK_BOOL__VOID( CanDismiss );
62     DEC_V_CBACK_BOOL__WXMOUSEEVENT( ProcessLeftDown );
63     DEC_V_CBACK_BOOL__BOOL( Show );
64 };
65
66 DEF_V_CBACK_VOID__WXWINDOW( wxPlPopupTransientWindow,
67                             wxPopupTransientWindow, Popup );
68 DEF_V_CBACK_VOID__VOID( wxPlPopupTransientWindow,
69                         wxPopupTransientWindow, Dismiss );
70 DEF_V_CBACK_BOOL__VOID( wxPlPopupTransientWindow,
71                         wxPopupTransientWindow, CanDismiss );
72 DEF_V_CBACK_BOOL__WXMOUSEEVENT( wxPlPopupTransientWindow,
73                                 wxPopupTransientWindow, ProcessLeftDown );
74 DEF_V_CBACK_BOOL__BOOL( wxPlPopupTransientWindow,
75                         wxPopupTransientWindow, Show );
76
77 WXPLI_IMPLEMENT_DYNAMIC_CLASS( wxPlPopupTransientWindow,
78                                wxPopupTransientWindow );
79
80 %}
81 %file{-};
82
83 %name{Wx::PopupWindow} class wxPopupWindow
84 {
85     %name{newDefault} wxPopupWindow()
86         %code{% RETVAL = new wxPopupWindow();
87                 wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
88              %};
89     %name{newFull} wxPopupWindow( wxWindow *parent, int flags = wxBORDER_NONE )
90         %code{% RETVAL = new wxPopupWindow( parent, flags );
91                 wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
92              %};
93
94     bool Create( wxWindow *parent, int flags = wxBORDER_NONE );
95
96     void Position( const wxPoint& ptOrigin, const wxSize& size );
97 };
98
99 %{
100 void
101 new( ... )
102   PPCODE:
103     BEGIN_OVERLOAD()
104         MATCH_VOIDM_REDISP( newDefault )
105         MATCH_ANY_REDISP( newFull )
106     END_OVERLOAD( "Wx::PopupWindow::new" )
107 %}
108
109 %name{Wx::PopupTransientWindow} class wxPopupTransientWindow
110 {
111     %name{newDefault} wxPopupTransientWindow()
112         %code{% RETVAL = new wxPopupTransientWindow();
113                 wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
114              %};
115     %name{newFull} wxPopupTransientWindow( wxWindow *parent,
116                                            int flags = wxBORDER_NONE )
117         %code{% RETVAL = new wxPopupTransientWindow( parent, flags );
118                 wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
119              %};
120
121     void Popup( wxWindow *focus = NULL );
122     void Dismiss();
123     bool CanDismiss();
124     bool ProcessLeftDown( wxMouseEvent& event );
125 };
126
127 %{
128 void
129 new( ... )
130   PPCODE:
131     BEGIN_OVERLOAD()
132         MATCH_VOIDM_REDISP( newDefault )
133         MATCH_ANY_REDISP( newFull )
134     END_OVERLOAD( "Wx::PopupTransientWindow::new" )
135
136 #define Popup wxPopupTransientWindow::Popup
137 #define Dismiss wxPopupTransientWindow::Dismiss
138 #define CanDismiss wxPopupTransientWindow::CanDismiss
139 #define ProcessLeftDown wxPopupTransientWindow::ProcessLeftDown
140 %}
141
142 %name{Wx::PlPopupTransientWindow} class wxPlPopupTransientWindow
143 {
144     %name{newDefault} wxPlPopupTransientWindow()
145         %code{% RETVAL = new wxPlPopupTransientWindow( CLASS );
146                 wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
147              %};
148     %name{newFull} wxPlPopupTransientWindow( wxWindow *parent,
149                                            int flags = wxBORDER_NONE )
150         %code{% RETVAL = new wxPlPopupTransientWindow( CLASS, parent, flags );
151                 wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
152              %};
153
154     void Popup( wxWindow *focus = NULL );
155     void Dismiss();
156     bool CanDismiss();
157     bool ProcessLeftDown( wxMouseEvent& event );
158 };
159
160 %{
161 #undef Popup
162 #undef Dismiss
163 #undef CanDismiss
164 #undef ProcessLeftDown
165
166 void
167 new( ... )
168   PPCODE:
169     BEGIN_OVERLOAD()
170         MATCH_VOIDM_REDISP( newDefault )
171         MATCH_ANY_REDISP( newFull )
172     END_OVERLOAD( "Wx::PlPopupTransientWindow::new" )
173
174 #endif // wxUSE_POPUPWIN
175 %}