File: VListBox.xsp

package info (click to toggle)
libwx-perl 0.9702-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 3,240 kB
  • ctags: 1,812
  • sloc: cpp: 8,988; perl: 6,366; makefile: 38; ansic: 1
file content (151 lines) | stat: -rwxr-xr-x 5,335 bytes parent folder | download
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
#############################################################################
## Name:        XS/VListBox.xsp
## Purpose:     XS++ for Wx::VListBox
## Author:      Mattia Barbon
## Modified by:
## Created:     18/09/2006
## RCS-ID:      $Id: VListBox.xsp 2191 2007-08-21 21:20:59Z mbarbon $
## Copyright:   (c) 2006-2007 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};

%typemap{wxVListBox*}{simple};
%typemap{wxPlVListBox*}{simple};

#if WXPERL_W_VERSION_GE( 2, 5, 0 )

#include <wx/vlbox.h>

%name{Wx::VListBox} class wxVListBox
{
    bool Create( wxWindow *parent, wxWindowID id = wxID_ANY,
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
                 long style = 0,
                 const wxString& name = wxVListBoxNameStr );

    bool IsCurrent(size_t item) const;
    bool IsSelected(size_t item) const;
    size_t GetSelectedCount() const;
    wxPoint GetMargins() const;
    const wxColour& GetSelectionBackground() const;
    void SetItemCount( size_t count );
    void Clear();
    void SetSelection( int selection );
    bool Select( size_t item, bool select = true );
    bool SelectRange( size_t from, size_t to );
    void Toggle( size_t item );
    bool SelectAll();
    bool DeselectAll();
    void SetMargins( wxCoord x, wxCoord y );
    void SetSelectionBackground( const wxColour& col );
};

%{

#!sub wxVListBox
#!sub OnDrawItem
#!sub OnMeasureItem

void
wxVListBox::GetFirstSelected()
  CODE:
    unsigned long cookie;
    int ret = THIS->GetFirstSelected( cookie );
    EXTEND( SP, 2 );
    PUSHs( sv_2mortal( newSViv( ret ) ) );
    PUSHs( sv_2mortal( newSViv( cookie ) ) );

void
wxVListBox::GetNextSelected( unsigned long cookie )
  CODE:
    int ret = THIS->GetFirstSelected( cookie );
    EXTEND( SP, 2 );
    PUSHs( sv_2mortal( newSViv( ret ) ) );
    PUSHs( sv_2mortal( newSViv( cookie ) ) );

%}

%file{cpp/vlbox.h};
%{

#include "cpp/v_cback.h"

// void METH(wxDC&, const wxRect&, size_t)
#define DEC_V_CBACK_VOID__WXDC_WXRECT_SIZET_const( METHOD ) \
    void METHOD( wxDC& p1, const wxRect& p2, size_t p3 ) const

#define DEF_V_CBACK_VOID__WXDC_WXRECT_SIZET_const_pure( CLASS, BASE, METHOD )\
    void CLASS::METHOD( wxDC& p1, const wxRect& p2, size_t p3 ) const        \
    {                                                                        \
        dTHX;                                                                \
        if( wxPliFCback( aTHX_ &m_callback, #METHOD ) )                      \
        {                                                                    \
            wxAutoSV ret( aTHX_ wxPliCCback( aTHX_ &m_callback,              \
                                             G_SCALAR|G_DISCARD,             \
                                             "QoL", &p1,                     \
                                             new wxRect( p2 ), "Wx::Rect",   \
                                             p3 ) );                         \
            return;                                                          \
        } else                                                               \
            return;                                                          \
    }

class wxPlVListBox : public wxVListBox {
    WXPLI_DECLARE_DYNAMIC_CLASS( wxPlVListBox );
    WXPLI_DECLARE_V_CBACK();
public:
    WXPLI_DEFAULT_CONSTRUCTOR( wxPlVListBox, "Wx::VListBox", true );
    WXPLI_CONSTRUCTOR_6( wxPlVListBox, "Wx::VListBox", true,
                         wxWindow*, wxWindowID, const wxPoint&,
                         const wxSize&, long, const wxString& );

    DEC_V_CBACK_WXCOORD__VOID_const( EstimateTotalHeight );
    DEC_V_CBACK_WXCOORD__SIZET_const( OnMeasureItem );
    DEC_V_CBACK_VOID__WXDC_WXRECT_SIZET_const( OnDrawItem );
};

DEF_V_CBACK_WXCOORD__VOID_const( wxPlVListBox, wxVListBox,
                                 EstimateTotalHeight );
DEF_V_CBACK_WXCOORD__SIZET_const_pure( wxPlVListBox, wxVListBox,
                                       OnMeasureItem ); 
DEF_V_CBACK_VOID__WXDC_WXRECT_SIZET_const_pure( wxPlVListBox, wxVListBox,
                                                OnDrawItem );

WXPLI_IMPLEMENT_DYNAMIC_CLASS( wxPlVListBox, wxVListBox );

%}
%file{-};

#include "cpp/overload.h"
#include "cpp/vlbox.h"

%name{Wx::PlVListBox} class wxPlVListBox
{
%{
void
new( ... )
  PPCODE:
    BEGIN_OVERLOAD()
        MATCH_VOIDM_REDISP( newDefault )
        MATCH_ANY_REDISP( newFull )
    END_OVERLOAD( "Wx::PlVListBox::new" )
%}

    %name{newDefault} wxPlVListBox()
        %code{% RETVAL = new wxPlVListBox( CLASS ); %};
    %name{newFull} wxPlVListBox( wxWindow *parent,
                                 wxWindowID id = wxID_ANY,
                                 const wxPoint& pos = wxDefaultPosition,
                                 const wxSize& size = wxDefaultSize,
                                 long style = 0,
                                 const wxString& name = wxVListBoxNameStr )
        %code{% RETVAL = new wxPlVListBox( CLASS, parent, id, pos, size,
                                           style, name );
             %};
};

#endif