Add libwx-perl
[pkg-perl] / deb-src / libwx-perl / libwx-perl-0.96 / ext / html / XS / HtmlListBox.xsp
1 #############################################################################
2 ## Name:        ext/html/XS/HtmlListBox.xsp
3 ## Purpose:     XS++ for Wx::HtmlListBox
4 ## Author:      Mattia Barbon
5 ## Modified by:
6 ## Created:     19/09/2006
7 ## RCS-ID:      $Id: HtmlListBox.xsp 2129 2007-08-11 21:29:29Z mbarbon $
8 ## Copyright:   (c) 2006-2007 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 %typemap{wxHtmlListBox*}{simple};
16 %typemap{wxPlHtmlListBox*}{simple};
17 %typemap{wxSimpleHtmlListBox*}{simple};
18 %typemap{wxFileSystem*}{simple};
19
20 #if WXPERL_W_VERSION_GE( 2, 5, 0 )
21
22 %{
23 #include <wx/clntdata.h>
24 #include "cpp/helpers.h"
25 #include <wx/htmllbox.h>
26 #include "cpp/overload.h"
27 #include "cpp/htmllbox.h"
28 %}
29
30 %file{cpp/htmllbox.h};
31 %{
32
33 #include "cpp/v_cback.h"
34
35 // bool METH(size_t)
36 #define DEC_V_CBACK_WXSTRING__SIZET_( METHOD, CONST ) \
37     wxString METHOD( size_t ) CONST
38
39 #define DEF_V_CBACK_WXSTRING__SIZET_( CLASS, CALLBASE, METHOD, CONST )\
40     wxString CLASS::METHOD( size_t p1 ) CONST                                \
41     {                                                                        \
42         dTHX;                                                                \
43         if( wxPliFCback( aTHX_ &m_callback, #METHOD ) )                      \
44         {                                                                    \
45             wxAutoSV ret( aTHX_ wxPliCCback( aTHX_ &m_callback, G_SCALAR,    \
46                                              "L", p1 ) );                    \
47             wxString value;                                                  \
48             WXSTRING_INPUT( value, wxChar*, ret );                           \
49             return value;                                                    \
50         } else                                                               \
51             CALLBASE;                                                        \
52     }
53
54 #define DEC_V_CBACK_WXSTRING__SIZET_const( METHOD ) \
55     DEC_V_CBACK_WXSTRING__SIZET_( METHOD, wxPli_CONST )
56
57 #define DEF_V_CBACK_WXSTRING__SIZET_const_pure( CLASS, BASE, METHOD ) \
58     DEF_V_CBACK_WXSTRING__SIZET_( CLASS, return wxEmptyString, METHOD, wxPli_CONST )
59
60 class wxPlHtmlListBox : public wxHtmlListBox {
61     WXPLI_DECLARE_DYNAMIC_CLASS( wxPlHtmlListBox );
62     WXPLI_DECLARE_V_CBACK();
63 public:
64     WXPLI_DEFAULT_CONSTRUCTOR( wxPlHtmlListBox, "Wx::HtmlListBox", true );
65     WXPLI_CONSTRUCTOR_6( wxPlHtmlListBox, "Wx::HtmlListBox", true,
66                          wxWindow*, wxWindowID, const wxPoint&,
67                          const wxSize&, long, const wxString& );
68
69     DEC_V_CBACK_WXCOORD__VOID_const( EstimateTotalHeight );
70     DEC_V_CBACK_WXSTRING__SIZET_const( OnGetItem );
71 };
72
73 WXPLI_IMPLEMENT_DYNAMIC_CLASS( wxPlHtmlListBox, wxHtmlListBox );
74
75 DEF_V_CBACK_WXCOORD__VOID_const( wxPlHtmlListBox, wxHtmlListBox,
76                                  EstimateTotalHeight );
77 DEF_V_CBACK_WXSTRING__SIZET_const_pure( wxPlHtmlListBox, wxHtmlListBox,
78                                         OnGetItem );
79
80 %}
81 %file{-};
82
83 %name{Wx::HtmlListBox} class wxHtmlListBox
84 {
85     bool Create( wxWindow *parent, wxWindowID id = wxID_ANY,
86                  const wxPoint& pos = wxDefaultPosition,
87                  const wxSize& size = wxDefaultSize,
88                  long style = 0,
89                  const wxString& name = wxVListBoxNameStr );
90 };
91
92 %{
93
94 wxFileSystem*
95 wxHtmlListBox::GetFileSystem()
96   CODE:
97     RETVAL = &THIS->GetFileSystem();
98   OUTPUT: RETVAL
99   CLEANUP:
100     wxPli_object_set_deleteable( aTHX_ ST(0), false );
101
102 %}
103
104 %name{Wx::PlHtmlListBox} class wxPlHtmlListBox
105 {
106     %name{newDefault} wxPlHtmlListBox()
107         %code{% RETVAL = new wxPlHtmlListBox( CLASS ); %};
108     %name{newFull} wxPlHtmlListBox( wxWindow *parent,
109                                     wxWindowID id = wxID_ANY,
110                                     const wxPoint& pos = wxDefaultPosition,
111                                     const wxSize& size = wxDefaultSize,
112                                     long style = 0,
113                                     const wxString& name = wxEmptyString )
114         %code{% RETVAL = new wxPlHtmlListBox( CLASS, parent, id, pos, size,
115                                               style, name );
116              %};
117 };
118
119 %{
120
121 void
122 new( ... )
123   PPCODE:
124     BEGIN_OVERLOAD()
125         MATCH_VOIDM_REDISP( newDefault )
126         MATCH_ANY_REDISP( newFull )
127     END_OVERLOAD( "Wx::PlHtmlListBox::new" )
128
129 %}
130
131 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
132
133 %name{Wx::SimpleHtmlListBox} class wxSimpleHtmlListBox
134 {
135     %name{newDefault} wxSimpleHtmlListBox()
136         %code{% RETVAL = new wxSimpleHtmlListBox;
137                 wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
138                 %};
139     %name{newFull} wxSimpleHtmlListBox( wxWindow *parent,
140                                         wxWindowID id = wxID_ANY,
141                                         const wxPoint& pos = wxDefaultPosition,
142                                         const wxSize& size = wxDefaultSize,
143                                         wxArrayString choices,
144                                         long style = 0,
145                                         const wxValidator& validator = wxDefaultValidatorPtr,
146                                         const wxString& name = wxSimpleHtmlListBoxNameStr )
147         %code{% RETVAL = new wxSimpleHtmlListBox( parent, id, pos, size,
148                                                   choices, style, *validator,
149                                                   name );
150                 wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
151                 %};
152     bool Create( wxWindow *parent,
153                  wxWindowID id = wxID_ANY,
154                  const wxPoint& pos = wxDefaultPosition,
155                  const wxSize& size = wxDefaultSize,
156                  wxArrayString choices,
157                  long style = 0,
158                  const wxValidator& validator = wxDefaultValidatorPtr,
159                  const wxString& name = wxSimpleHtmlListBoxNameStr );
160
161     void SetSelection( int n );
162     int GetSelection() const;
163     unsigned int GetCount() const;
164     wxString GetString( unsigned int n ) const;
165 ##    wxArrayString GetStrings() const;
166     void SetString( unsigned int n, const wxString& s );
167 ##    void Clear();
168
169 %{
170 void
171 wxSimpleHtmlListBox::Clear()
172   CODE:
173     THIS->wxVListBox::Clear();
174 %}
175
176     void Delete( unsigned int n );
177     %name{AppendStrings} void Append( const wxArrayString& strings );
178     %name{AppendString} void Append( const wxString& item );
179     %name{AppendData} void Append( const wxString& item,
180                                    wxPliUserDataCD* data );
181 };
182
183 %{
184
185 void
186 new( ... )
187   PPCODE:
188     BEGIN_OVERLOAD()
189         MATCH_VOIDM_REDISP( newDefault )
190         MATCH_ANY_REDISP( newFull )
191     END_OVERLOAD( "Wx::SimpleHtmlListBox::new" )
192
193 void
194 Append( ... )
195   PPCODE:
196     BEGIN_OVERLOAD()
197         MATCH_REDISP( wxPliOvl_arr, AppendStrings )
198         MATCH_REDISP( wxPliOvl_s_s, AppendData )
199         MATCH_REDISP( wxPliOvl_s, AppendString )
200     END_OVERLOAD( Wx::SimpleHtmlListBox::Append )
201
202 %}
203
204 #endif
205
206 #endif