Add libwx-perl
[pkg-perl] / deb-src / libwx-perl / libwx-perl-0.96 / XS / VListBox.xsp
1 #############################################################################
2 ## Name:        XS/VListBox.xsp
3 ## Purpose:     XS++ for Wx::VListBox
4 ## Author:      Mattia Barbon
5 ## Modified by:
6 ## Created:     18/09/2006
7 ## RCS-ID:      $Id: VListBox.xsp 2191 2007-08-21 21:20:59Z 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{wxVListBox*}{simple};
16 %typemap{wxPlVListBox*}{simple};
17
18 #if WXPERL_W_VERSION_GE( 2, 5, 0 )
19
20 #include <wx/vlbox.h>
21
22 %name{Wx::VListBox} class wxVListBox
23 {
24     bool Create( wxWindow *parent, wxWindowID id = wxID_ANY,
25                  const wxPoint& pos = wxDefaultPosition,
26                  const wxSize& size = wxDefaultSize,
27                  long style = 0,
28                  const wxString& name = wxVListBoxNameStr );
29
30     bool IsCurrent(size_t item) const;
31     bool IsSelected(size_t item) const;
32     size_t GetSelectedCount() const;
33     wxPoint GetMargins() const;
34     const wxColour& GetSelectionBackground() const;
35     void SetItemCount( size_t count );
36     void Clear();
37     void SetSelection( int selection );
38     bool Select( size_t item, bool select = true );
39     bool SelectRange( size_t from, size_t to );
40     void Toggle( size_t item );
41     bool SelectAll();
42     bool DeselectAll();
43     void SetMargins( wxCoord x, wxCoord y );
44     void SetSelectionBackground( const wxColour& col );
45 };
46
47 %{
48
49 #!sub wxVListBox
50 #!sub OnDrawItem
51 #!sub OnMeasureItem
52
53 void
54 wxVListBox::GetFirstSelected()
55   CODE:
56     unsigned long cookie;
57     int ret = THIS->GetFirstSelected( cookie );
58     EXTEND( SP, 2 );
59     PUSHs( sv_2mortal( newSViv( ret ) ) );
60     PUSHs( sv_2mortal( newSViv( cookie ) ) );
61
62 void
63 wxVListBox::GetNextSelected( unsigned long cookie )
64   CODE:
65     int ret = THIS->GetFirstSelected( cookie );
66     EXTEND( SP, 2 );
67     PUSHs( sv_2mortal( newSViv( ret ) ) );
68     PUSHs( sv_2mortal( newSViv( cookie ) ) );
69
70 %}
71
72 %file{cpp/vlbox.h};
73 %{
74
75 #include "cpp/v_cback.h"
76
77 // void METH(wxDC&, const wxRect&, size_t)
78 #define DEC_V_CBACK_VOID__WXDC_WXRECT_SIZET_const( METHOD ) \
79     void METHOD( wxDC& p1, const wxRect& p2, size_t p3 ) const
80
81 #define DEF_V_CBACK_VOID__WXDC_WXRECT_SIZET_const_pure( CLASS, BASE, METHOD )\
82     void CLASS::METHOD( wxDC& p1, const wxRect& p2, size_t p3 ) const        \
83     {                                                                        \
84         dTHX;                                                                \
85         if( wxPliFCback( aTHX_ &m_callback, #METHOD ) )                      \
86         {                                                                    \
87             wxAutoSV ret( aTHX_ wxPliCCback( aTHX_ &m_callback,              \
88                                              G_SCALAR|G_DISCARD,             \
89                                              "QoL", &p1,                     \
90                                              new wxRect( p2 ), "Wx::Rect",   \
91                                              p3 ) );                         \
92             return;                                                          \
93         } else                                                               \
94             return;                                                          \
95     }
96
97 class wxPlVListBox : public wxVListBox {
98     WXPLI_DECLARE_DYNAMIC_CLASS( wxPlVListBox );
99     WXPLI_DECLARE_V_CBACK();
100 public:
101     WXPLI_DEFAULT_CONSTRUCTOR( wxPlVListBox, "Wx::VListBox", true );
102     WXPLI_CONSTRUCTOR_6( wxPlVListBox, "Wx::VListBox", true,
103                          wxWindow*, wxWindowID, const wxPoint&,
104                          const wxSize&, long, const wxString& );
105
106     DEC_V_CBACK_WXCOORD__VOID_const( EstimateTotalHeight );
107     DEC_V_CBACK_WXCOORD__SIZET_const( OnMeasureItem );
108     DEC_V_CBACK_VOID__WXDC_WXRECT_SIZET_const( OnDrawItem );
109 };
110
111 DEF_V_CBACK_WXCOORD__VOID_const( wxPlVListBox, wxVListBox,
112                                  EstimateTotalHeight );
113 DEF_V_CBACK_WXCOORD__SIZET_const_pure( wxPlVListBox, wxVListBox,
114                                        OnMeasureItem ); 
115 DEF_V_CBACK_VOID__WXDC_WXRECT_SIZET_const_pure( wxPlVListBox, wxVListBox,
116                                                 OnDrawItem );
117
118 WXPLI_IMPLEMENT_DYNAMIC_CLASS( wxPlVListBox, wxVListBox );
119
120 %}
121 %file{-};
122
123 #include "cpp/overload.h"
124 #include "cpp/vlbox.h"
125
126 %name{Wx::PlVListBox} class wxPlVListBox
127 {
128 %{
129 void
130 new( ... )
131   PPCODE:
132     BEGIN_OVERLOAD()
133         MATCH_VOIDM_REDISP( newDefault )
134         MATCH_ANY_REDISP( newFull )
135     END_OVERLOAD( "Wx::PlVListBox::new" )
136 %}
137
138     %name{newDefault} wxPlVListBox()
139         %code{% RETVAL = new wxPlVListBox( CLASS ); %};
140     %name{newFull} wxPlVListBox( wxWindow *parent,
141                                  wxWindowID id = wxID_ANY,
142                                  const wxPoint& pos = wxDefaultPosition,
143                                  const wxSize& size = wxDefaultSize,
144                                  long style = 0,
145                                  const wxString& name = wxVListBoxNameStr )
146         %code{% RETVAL = new wxPlVListBox( CLASS, parent, id, pos, size,
147                                            style, name );
148              %};
149 };
150
151 #endif