File: RibbonButtonBar.xsp

package info (click to toggle)
libwx-perl 1%3A0.9928-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,300 kB
  • ctags: 2,322
  • sloc: cpp: 11,044; perl: 8,646; ansic: 710; makefile: 48
file content (290 lines) | stat: -rw-r--r-- 12,333 bytes parent folder | download | duplicates (5)
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
#############################################################################
## Name:        ext/ribbon/XS/RibbonButtonBar.xsp
## Purpose:     XS++ for Wx::RibbonButtonBar
## Author:      Mark Dootson
## Modified by:
## Created:     04/03/2012
## RCS-ID:      $Id: $
## Copyright:   (c) 2012 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 WXPERL_W_VERSION_GE( 2, 9, 3 ) && wxUSE_RIBBON

#include <wx/ribbon/buttonbar.h>
#include <cpp/toolbarbases.h>

%loadplugin{build::Wx::XSP::Overload};
%loadplugin{build::Wx::XSP::Event};

%Event{%EVT_RIBBONBUTTONBAR_CLICKED(id, func)%}
      {wxEVT_COMMAND_RIBBONBUTTON_CLICKED};
%Event{%EVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED(id, func)%}
      {wxEVT_COMMAND_RIBBONBUTTON_DROPDOWN_CLICKED};

%name{Wx::RibbonButtonBarButtonBase} class wxRibbonButtonBarButtonBase
{
public:
    
    wxRibbonButtonBarButtonState GetLargestSize();
    
%{

void
wxRibbonButtonBarButtonBase::GetSmallerSize( size, n = 1 )
    wxRibbonButtonBarButtonState size
    int n
  PPCODE:
    /* return size or undef if !success */
    wxRibbonButtonBarButtonState passsize;
    passsize = size;
    EXTEND( SP, 1 );
    bool result = THIS->GetSmallerSize( &passsize, n);
    if( result ) {
        PUSHs( sv_2mortal( newSVuv( UV(size) ) ) );
    } else {
        PUSHs( &PL_sv_undef );
    }

%}

    wxString  GetLabel() %code{% RETVAL = THIS->label; %};
    wxString  GetHelpString() %code{% RETVAL = THIS->help_string; %};
    wxBitmap* GetBitmapLarge() %code{% RETVAL = new wxBitmap(THIS->bitmap_large); %};
    wxBitmap* GetBitmapLargeDisabled() %code{% RETVAL = new wxBitmap(THIS->bitmap_large_disabled); %};
    wxBitmap* GetBitmapSmall() %code{% RETVAL = new wxBitmap(THIS->bitmap_small); %};
    wxBitmap* GetBitmapSmallDisabled() %code{% RETVAL = new wxBitmap(THIS->bitmap_small_disabled); %};
    
    /* wxRibbonButtonBarButtonSizeInfo sizes[3]; */
    
    Wx_UserDataO* GetClientData() %code{% RETVAL = (Wx_UserDataO*)(THIS->client_data); %};
    int GetId() %code{% RETVAL = THIS->id; %};
    wxRibbonButtonKind GetKind() %code{% RETVAL = THIS->kind; %};
    long GetState() %code{% RETVAL = THIS->state; %};
    
    void SetClientData ( Wx_UserDataO* clientdata )
       %code{%
            delete THIS->client_data;
            THIS->client_data = clientdata;
        %};
    
    /* documented ?? names */
    wxString  label() %code{% RETVAL = THIS->label; %};
    wxString  help_string() %code{% RETVAL = THIS->help_string; %};
    wxBitmap* bitmap_large() %code{% RETVAL = new wxBitmap(THIS->bitmap_large); %};
    wxBitmap* bitmap_large_disabled() %code{% RETVAL = new wxBitmap(THIS->bitmap_large_disabled); %};
    wxBitmap* bitmap_small() %code{% RETVAL = new wxBitmap(THIS->bitmap_small); %};
    wxBitmap* bitmap_small_disabled() %code{% RETVAL = new wxBitmap(THIS->bitmap_small_disabled); %};
    Wx_UserDataO* client_data() %code{% RETVAL = (Wx_UserDataO*)(THIS->client_data); %};
    int id() %code{% RETVAL = THIS->id; %};
    wxRibbonButtonKind kind() %code{% RETVAL = THIS->kind; %};
    long state() %code{% RETVAL = THIS->state; %};
    
};


%name{Wx::RibbonButtonBar} class wxRibbonButtonBar : public %name{Wx::RibbonControl} wxRibbonControl
{
public:
    
    %name{newDefault} wxRibbonButtonBar() %Overload
        %postcall{% wxPli_create_evthandler( aTHX_ RETVAL, CLASS ); %};

    %name{newFull} wxRibbonButtonBar( wxWindow* parent,
                  wxWindowID id = wxID_ANY,
                  const wxPoint& pos = wxDefaultPosition,
                  const wxSize& size = wxDefaultSize,
                  long style = 0) %Overload
        %postcall{% wxPli_create_evthandler( aTHX_ RETVAL, CLASS ); %};

    bool Create(wxWindow* parent,
                wxWindowID id = wxID_ANY,
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& size = wxDefaultSize,
                long style = 0);
    
    /* for add methods assign a buttonid and return it so that it may be used for event functions etc. */

    wxRibbonButtonBarButtonBase* AddDropdownButton(
                int button_id,
                const wxString& label,
                const wxBitmap& bitmap,
                const wxString& help_string = wxEmptyString)
        %code{% int useid = ( button_id == wxID_ANY ) ? wxWindow::NewControlId() : button_id;
              RETVAL = THIS->AddDropdownButton( useid, label, *bitmap, help_string ); %};

    wxRibbonButtonBarButtonBase* AddHybridButton(
                int button_id,
                const wxString& label,
                const wxBitmap& bitmap,
                const wxString& help_string = wxEmptyString)
        %code{% int useid = ( button_id == wxID_ANY ) ? wxWindow::NewControlId() : button_id;
              RETVAL = THIS->AddHybridButton( useid, label, *bitmap, help_string ); %};
    
    wxRibbonButtonBarButtonBase* AddToggleButton(
                int button_id,
                const wxString& label,
                const wxBitmap& bitmap,
                const wxString& help_string = wxEmptyString)
        %code{% int useid = ( button_id == wxID_ANY ) ? wxWindow::NewControlId() : button_id;
              RETVAL = THIS->AddToggleButton( useid, label, *bitmap, help_string ); %};

    %name{AddButtonShortParams} wxRibbonButtonBarButtonBase* AddButton(
                int button_id,
                const wxString& label,
                const wxBitmap& bitmap,
                const wxString& help_string,
                unsigned int kind = wxRIBBON_BUTTON_NORMAL) %Overload
            %code{% int useid = ( button_id == wxID_ANY ) ? wxWindow::NewControlId() : button_id;
                RETVAL = THIS->AddButton(useid, label, *bitmap, help_string, (wxRibbonButtonKind)kind);
                %};              

#if WXPERL_W_VERSION_LE( 2, 9, 5 )

    %name{AddButtonLongParams} wxRibbonButtonBarButtonBase* AddButton(
                int button_id,
                const wxString& label,
                const wxBitmap& bitmap,
                const wxBitmap& bitmap_small = wxNullBitmapPtr,
                const wxBitmap& bitmap_disabled = wxNullBitmapPtr,
                const wxBitmap& bitmap_small_disabled = wxNullBitmapPtr,
                unsigned int kind = wxRIBBON_BUTTON_NORMAL,
                const wxString& help_string = wxEmptyString,
                Wx_UserDataO* client_data = NULL) %Overload
            %code{% int useid = ( button_id == wxID_ANY ) ? wxWindow::NewControlId() : button_id;
                RETVAL = THIS->AddButton(useid, label, *bitmap, *bitmap_small, *bitmap_disabled, *bitmap_small_disabled, (wxRibbonButtonKind)kind, help_string, client_data);
                %};                

#else
    %name{AddButtonLongParams} wxRibbonButtonBarButtonBase* AddButton(
                int button_id,
                const wxString& label,
                const wxBitmap& bitmap,
                const wxBitmap& bitmap_small = wxNullBitmapPtr,
                const wxBitmap& bitmap_disabled = wxNullBitmapPtr,
                const wxBitmap& bitmap_small_disabled = wxNullBitmapPtr,
                unsigned int kind = wxRIBBON_BUTTON_NORMAL,
                const wxString& help_string = wxEmptyString) %Overload
            %code{% int useid = ( button_id == wxID_ANY ) ? wxWindow::NewControlId() : button_id;
                RETVAL = THIS->AddButton(useid, label, *bitmap, *bitmap_small, *bitmap_disabled, *bitmap_small_disabled, (wxRibbonButtonKind)kind, help_string);
                %};       
#endif

    virtual bool Realize();
    
    virtual void ClearButtons();
    
    virtual bool DeleteButton(int button_id);
    
    virtual void EnableButton(int button_id, bool enable = true);
    
    virtual void ToggleButton(int button_id, bool checked);

    virtual void SetArtProvider(wxRibbonArtProvider* art);

    virtual bool IsSizingContinuous() const;

#if WXPERL_W_VERSION_GE( 2, 9, 4 )

    wxRibbonButtonBarButtonBase* InsertDropdownButton(
                size_t pos,
                int button_id,
                const wxString& label,
                const wxBitmap& bitmap,
                const wxString& help_string = wxEmptyString)
        %code{% int useid = ( button_id == wxID_ANY ) ? wxWindow::NewControlId() : button_id;
              RETVAL = THIS->InsertDropdownButton( pos, useid, label, *bitmap, help_string ); %};    

    wxRibbonButtonBarButtonBase* InsertHybridButton(
                size_t pos,
                int button_id,
                const wxString& label,
                const wxBitmap& bitmap,
                const wxString& help_string = wxEmptyString)
        %code{% int useid = ( button_id == wxID_ANY ) ? wxWindow::NewControlId() : button_id;
              RETVAL = THIS->InsertHybridButton( pos, useid, label, *bitmap, help_string ); %}; 

    wxRibbonButtonBarButtonBase* InsertToggleButton(
                size_t pos,
                int button_id,
                const wxString& label,
                const wxBitmap& bitmap,
                const wxString& help_string = wxEmptyString)
        %code{% int useid = ( button_id == wxID_ANY ) ? wxWindow::NewControlId() : button_id;
              RETVAL = THIS->InsertToggleButton( pos, useid, label, *bitmap, help_string ); %}; 
    
    %name{InsertButtonShortParams} wxRibbonButtonBarButtonBase* InsertButton(
                size_t pos,
                int button_id,
                const wxString& label,
                const wxBitmap& bitmap,
                const wxString& help_string,
                unsigned int kind = wxRIBBON_BUTTON_NORMAL) %Overload
                %code{% int useid = ( button_id == wxID_ANY ) ? wxWindow::NewControlId() : button_id;
                    RETVAL = THIS->InsertButton( pos, useid, label, *bitmap, help_string, (wxRibbonButtonKind)kind);
                %};  

#if WXPERL_W_VERSION_LE( 2, 9, 5 )

    %name{InsertButtonLongParams} wxRibbonButtonBarButtonBase* InsertButton(
                size_t pos,
                int button_id,
                const wxString& label,
                const wxBitmap& bitmap,
                const wxBitmap& bitmap_small = wxNullBitmapPtr,
                const wxBitmap& bitmap_disabled = wxNullBitmapPtr,
                const wxBitmap& bitmap_small_disabled = wxNullBitmapPtr,
                unsigned int kind = wxRIBBON_BUTTON_NORMAL,
                const wxString& help_string = wxEmptyString,
                Wx_UserDataO* client_data = NULL) %Overload
                %code{% int useid = ( button_id == wxID_ANY ) ? wxWindow::NewControlId() : button_id;
                    RETVAL = THIS->InsertButton( pos, useid, label, *bitmap, *bitmap_small, *bitmap_disabled, *bitmap_small_disabled, (wxRibbonButtonKind)kind, help_string, client_data);
                %};

#else

    %name{InsertButtonLongParams} wxRibbonButtonBarButtonBase* InsertButton(
                size_t pos,
                int button_id,
                const wxString& label,
                const wxBitmap& bitmap,
                const wxBitmap& bitmap_small = wxNullBitmapPtr,
                const wxBitmap& bitmap_disabled = wxNullBitmapPtr,
                const wxBitmap& bitmap_small_disabled = wxNullBitmapPtr,
                unsigned int kind = wxRIBBON_BUTTON_NORMAL,
                const wxString& help_string = wxEmptyString) %Overload
                %code{% int useid = ( button_id == wxID_ANY ) ? wxWindow::NewControlId() : button_id;
                    RETVAL = THIS->InsertButton( pos, useid, label, *bitmap, *bitmap_small, *bitmap_disabled, *bitmap_small_disabled, (wxRibbonButtonKind)kind, help_string);
                %};

#endif

    virtual size_t GetButtonCount() const;
    virtual wxSize GetMinSize() const;
#endif

};


%name{Wx::RibbonButtonBarEvent} class wxRibbonButtonBarEvent : public %name{Wx::CommandEvent} wxCommandEvent
{
public:
    
    wxRibbonButtonBarEvent(wxEventType command_type = wxEVT_NULL,
                       int win_id = 0,
                       wxRibbonButtonBar* bar = NULL);

    wxRibbonButtonBar* GetBar();
        
    void SetBar(wxRibbonButtonBar* bar);
   
    bool PopupMenu(wxMenu* menu);
    
    wxEvent *Clone();
};

#endif