Add libwx-perl
[pkg-perl] / deb-src / libwx-perl / libwx-perl-0.96 / XS / OwnerDrawnComboBox.xsp
1 #############################################################################
2 ## Name:        XS/OwnerDrawnComboBox.xsp
3 ## Purpose:     XS++ for Wx::OwnerDrawnComboBox
4 ## Author:      Mattia Barbon
5 ## Modified by:
6 ## Created:     13/08/2007
7 ## RCS-ID:      $Id: OwnerDrawnComboBox.xsp 2743 2010-01-08 19:39:53Z mbarbon $
8 ## Copyright:   (c) 2007, 2010 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 WXPERL_W_VERSION_GE( 2, 7, 2 )
16
17 #include <wx/odcombo.h>
18
19 %typemap{wxOwnerDrawnComboBox*}{simple};
20 %typemap{wxPlOwnerDrawnComboBox*}{simple};
21
22 %name{Wx::OwnerDrawnComboBox} class wxOwnerDrawnComboBox
23 {
24     int GetWidestItemWidth();
25     int GetWidestItem();
26 };
27
28 INCLUDE: perl -pe "s/ItemContainerImmutable/OwnerDrawnComboBox/g" XS/ItemContainerImmutable.xs |
29 INCLUDE: perl -pe "s/ItemContainer/OwnerDrawnComboBox/g" XS/ItemContainer.xs |
30
31 %file{cpp/odcombo.h};
32 %{
33
34 #include "cpp/v_cback.h"
35
36 // void METH(wxDC&, const wxRect&, int, int)
37 #define DEC_V_CBACK_VOID__WXDC_WXRECT_INT_INT_const( METHOD ) \
38     void METHOD( wxDC& p1, const wxRect& p2, int p3, int p4 ) const
39
40 #define DEF_V_CBACK_VOID__WXDC_WXRECT_INT_INT_const( CLASS, BASE, METHOD )\
41     void CLASS::METHOD( wxDC& p1, const wxRect& p2, int p3, int p4 ) const   \
42     {                                                                        \
43         dTHX;                                                                \
44         if( wxPliFCback( aTHX_ &m_callback, #METHOD ) )                      \
45         {                                                                    \
46             wxAutoSV ret( aTHX_ wxPliCCback( aTHX_ &m_callback,              \
47                                              G_SCALAR|G_DISCARD,             \
48                                              "Qoii", &p1,                    \
49                                              new wxRect( p2 ), "Wx::Rect",   \
50                                              p3, p4 ) );                     \
51             return;                                                          \
52         } else                                                               \
53             BASE::METHOD( p1, p2, p3, p4 );                                  \
54     }
55
56 class wxPlOwnerDrawnComboBox : public wxOwnerDrawnComboBox {
57     WXPLI_DECLARE_DYNAMIC_CLASS( wxPlOwnerDrawnComboBox );
58     WXPLI_DECLARE_V_CBACK();
59 public:
60     WXPLI_DEFAULT_CONSTRUCTOR( wxPlOwnerDrawnComboBox,
61                                "Wx::OwnerDrawnComboBox", true );
62     WXPLI_CONSTRUCTOR_9( wxPlOwnerDrawnComboBox, "Wx::OwnerDrawnComboBox",
63                          true,
64                          wxWindow*, wxWindowID, const wxString&,
65                          const wxPoint&, const wxSize&, const wxArrayString&,
66                          long, const wxValidator&, const wxString& );
67
68     DEC_V_CBACK_WXCOORD__SIZET_const( OnMeasureItem );
69     DEC_V_CBACK_WXCOORD__SIZET_const( OnMeasureItemWidth );
70     DEC_V_CBACK_VOID__WXDC_WXRECT_INT_INT_const( OnDrawItem );
71     DEC_V_CBACK_VOID__WXDC_WXRECT_INT_INT_const( OnDrawBackground );
72 };
73
74 DEF_V_CBACK_WXCOORD__SIZET_const( wxPlOwnerDrawnComboBox, wxOwnerDrawnComboBox,
75                                   OnMeasureItem ); 
76 DEF_V_CBACK_WXCOORD__SIZET_const( wxPlOwnerDrawnComboBox, wxOwnerDrawnComboBox,
77                                   OnMeasureItemWidth ); 
78 DEF_V_CBACK_VOID__WXDC_WXRECT_INT_INT_const( wxPlOwnerDrawnComboBox,
79                                              wxOwnerDrawnComboBox,
80                                              OnDrawItem );
81 DEF_V_CBACK_VOID__WXDC_WXRECT_INT_INT_const( wxPlOwnerDrawnComboBox,
82                                              wxOwnerDrawnComboBox,
83                                              OnDrawBackground );
84
85 WXPLI_IMPLEMENT_DYNAMIC_CLASS( wxPlOwnerDrawnComboBox, wxOwnerDrawnComboBox );
86 %}
87 %file{-};
88
89 #include "cpp/odcombo.h"
90
91 %name{Wx::PlOwnerDrawnComboBox} class wxPlOwnerDrawnComboBox
92 {
93 %{
94 void
95 new( ... )
96   PPCODE:
97     BEGIN_OVERLOAD()
98         MATCH_VOIDM_REDISP( newDefault )
99         MATCH_ANY_REDISP( newFull )
100     END_OVERLOAD( "Wx::PlOwnerDrawnComboBox::new" )
101 %}
102
103     %name{newDefault} wxPlOwnerDrawnComboBox()
104         %code{% RETVAL = new wxPlOwnerDrawnComboBox( CLASS );
105                 wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
106                 %};
107     %name{newFull} wxPlOwnerDrawnComboBox( wxWindow *parent,
108                                            wxWindowID id,
109                                            const wxString& value,
110                                            const wxPoint& pos,
111                                            const wxSize& size,
112                                            const wxArrayString& choices,
113                                            long style = 0,
114                                            const wxValidator& validator = wxDefaultValidatorPtr,
115                                            const wxString& name = wxEmptyString)
116         %code{% RETVAL = new wxPlOwnerDrawnComboBox( CLASS, parent, id, value,
117                                                      pos, size, choices, style,
118                                                      *validator, name );
119                 wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
120                 %};
121
122     bool Create( wxWindow *parent,
123                  wxWindowID id,
124                  const wxString& value = wxEmptyString,
125                  const wxPoint& pos = wxDefaultPosition,
126                  const wxSize& size = wxDefaultSize,
127                  const wxArrayString& choices,
128                  long style = 0,
129                  const wxValidator& validator = wxDefaultValidatorPtr,
130                  const wxString& name = wxEmptyString );
131 };
132
133 #endif