File: PopupWindow.xsp

package info (click to toggle)
libwx-perl 1%3A0.9932-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,300 kB
  • sloc: cpp: 11,064; perl: 8,603; ansic: 711; makefile: 53
file content (175 lines) | stat: -rw-r--r-- 6,141 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#############################################################################
## Name:        XS/PopupWindow.xsp
## Purpose:     XS++ for Wx::PopupWindow and Wx::PopupTransientWindow
## Author:      Mattia Barbon
## Modified by:
## Created:     18/03/2005
## RCS-ID:      $Id: PopupWindow.xsp 2927 2010-06-06 08:06:10Z mbarbon $
## Copyright:   (c) 2005-2006, 2010 Mattia Barbon
## Licence:     This program is free software; you can redistribute it and/or
##              modify it under the same terms as Perl itself
#############################################################################

%module{Wx};

#if wxUSE_POPUPWIN

%typemap{wxPopupWindow*}{simple};
%typemap{wxPopupTransientWindow*}{simple};
%typemap{wxPlPopupTransientWindow*}{simple};
%typemap{wxMouseEvent&}{reference};

%{
#include "wx/popupwin.h"
#include "xspp/popupwin.h"
%}

%file{xspp/popupwin.h};
%{

#define DEC_V_CBACK_BOOL__WXMOUSEEVENT( METHOD ) \
  bool METHOD( wxMouseEvent& event )

#define DEF_V_CBACK_BOOL__WXMOUSEEVENT( CLASS, BASE, METHOD ) \
  bool CLASS::METHOD( wxMouseEvent& param1 )                                  \
  {                                                                           \
    dTHX;                                                                     \
    if( wxPliFCback( aTHX_ &m_callback, #METHOD ) )                           \
    {                                                                         \
        wxAutoSV evt( aTHX_ wxPli_object_2_sv( aTHX_ newSViv( 0 ), &param1 ));\
        wxAutoSV ret( aTHX_ wxPliCCback( aTHX_ &m_callback, G_SCALAR,         \
                                         "S", (SV*) evt ) );                  \
        sv_setiv( SvRV( evt ), 0 );                                           \
        return SvTRUE( ret );                                                 \
    } else                                                                    \
        return BASE::METHOD( param1 );                                        \
  }

class wxPlPopupTransientWindow : public wxPopupTransientWindow
{
    WXPLI_DECLARE_DYNAMIC_CLASS( wxPlPopupTransientWindow );
    WXPLI_DECLARE_V_CBACK();
public:
    WXPLI_DEFAULT_CONSTRUCTOR( wxPlPopupTransientWindow,
                               "Wx::PlPopupTransientWindow", true );
    WXPLI_CONSTRUCTOR_2( wxPlPopupTransientWindow,
                         "Wx::PlPopupTransientWindow", true,
                         wxWindow*, int );

    DEC_V_CBACK_VOID__WXWINDOW( Popup );
    DEC_V_CBACK_VOID__VOID( Dismiss );
    DEC_V_CBACK_BOOL__VOID( CanDismiss );
    DEC_V_CBACK_BOOL__WXMOUSEEVENT( ProcessLeftDown );
    DEC_V_CBACK_BOOL__BOOL( Show );
};

DEF_V_CBACK_VOID__WXWINDOW( wxPlPopupTransientWindow,
                            wxPopupTransientWindow, Popup );
DEF_V_CBACK_VOID__VOID( wxPlPopupTransientWindow,
                        wxPopupTransientWindow, Dismiss );
DEF_V_CBACK_BOOL__VOID( wxPlPopupTransientWindow,
                        wxPopupTransientWindow, CanDismiss );
DEF_V_CBACK_BOOL__WXMOUSEEVENT( wxPlPopupTransientWindow,
                                wxPopupTransientWindow, ProcessLeftDown );
DEF_V_CBACK_BOOL__BOOL( wxPlPopupTransientWindow,
                        wxPopupTransientWindow, Show );

WXPLI_IMPLEMENT_DYNAMIC_CLASS( wxPlPopupTransientWindow,
                               wxPopupTransientWindow );

%}
%file{-};

%name{Wx::PopupWindow} class wxPopupWindow
{
    %name{newDefault} wxPopupWindow()
        %code{% RETVAL = new wxPopupWindow();
                wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
             %};
    %name{newFull} wxPopupWindow( wxWindow *parent, int flags = wxBORDER_NONE )
        %code{% RETVAL = new wxPopupWindow( parent, flags );
                wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
             %};

    bool Create( wxWindow *parent, int flags = wxBORDER_NONE );

    void Position( const wxPoint& ptOrigin, const wxSize& size );
};

%{
void
new( ... )
  PPCODE:
    BEGIN_OVERLOAD()
        MATCH_VOIDM_REDISP( newDefault )
        MATCH_ANY_REDISP( newFull )
    END_OVERLOAD( "Wx::PopupWindow::new" )
%}

%name{Wx::PopupTransientWindow} class wxPopupTransientWindow
{
    %name{newDefault} wxPopupTransientWindow()
        %code{% RETVAL = new wxPopupTransientWindow();
                wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
             %};
    %name{newFull} wxPopupTransientWindow( wxWindow *parent,
                                           int flags = wxBORDER_NONE )
        %code{% RETVAL = new wxPopupTransientWindow( parent, flags );
                wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
             %};

    void Popup( wxWindow *focus = NULL );
    void Dismiss();
    bool CanDismiss();
    bool ProcessLeftDown( wxMouseEvent& event );
};

%{
void
new( ... )
  PPCODE:
    BEGIN_OVERLOAD()
        MATCH_VOIDM_REDISP( newDefault )
        MATCH_ANY_REDISP( newFull )
    END_OVERLOAD( "Wx::PopupTransientWindow::new" )

#define Popup wxPopupTransientWindow::Popup
#define Dismiss wxPopupTransientWindow::Dismiss
#define CanDismiss wxPopupTransientWindow::CanDismiss
#define ProcessLeftDown wxPopupTransientWindow::ProcessLeftDown
%}

%name{Wx::PlPopupTransientWindow} class wxPlPopupTransientWindow
{
    %name{newDefault} wxPlPopupTransientWindow()
        %code{% RETVAL = new wxPlPopupTransientWindow( CLASS );
                wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
             %};
    %name{newFull} wxPlPopupTransientWindow( wxWindow *parent,
                                           int flags = wxBORDER_NONE )
        %code{% RETVAL = new wxPlPopupTransientWindow( CLASS, parent, flags );
                wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
             %};

    void Popup( wxWindow *focus = NULL );
    void Dismiss();
    bool CanDismiss();
    bool ProcessLeftDown( wxMouseEvent& event );
};

%{
#undef Popup
#undef Dismiss
#undef CanDismiss
#undef ProcessLeftDown

void
new( ... )
  PPCODE:
    BEGIN_OVERLOAD()
        MATCH_VOIDM_REDISP( newDefault )
        MATCH_ANY_REDISP( newFull )
    END_OVERLOAD( "Wx::PlPopupTransientWindow::new" )

#endif // wxUSE_POPUPWIN
%}