File: bmpbuttn.h

package info (click to toggle)
libwx-perl 1%3A0.9932-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,300 kB
  • sloc: cpp: 11,064; perl: 8,603; ansic: 711; makefile: 53
file content (234 lines) | stat: -rw-r--r-- 7,061 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
%module{Wx};

/////////////////////////////////////////////////////////////////////////////
// Name:        bmpbuttn.h
// Purpose:     interface of wxBitmapButton
// Author:      wxWidgets team
// RCS-ID:      $Id: bmpbuttn.h 3405 2012-10-01 15:45:12Z mdootson $
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

#include <wx/bmpbuttn.h>

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

/**
    @class wxBitmapButton

    A bitmap button is a control that contains a bitmap.

    Notice that since wxWidgets 2.9.1 bitmap display is supported by the base
    wxButton class itself and the only tiny advantage of using this class is
    that it allows to specify the bitmap in its constructor, unlike wxButton.
    Please see the base class documentation for more information about images
    support in wxButton.

    @beginStyleTable
    @style{wxBU_LEFT}
           Left-justifies the bitmap label.
    @style{wxBU_TOP}
           Aligns the bitmap label to the top of the button.
    @style{wxBU_RIGHT}
           Right-justifies the bitmap label.
    @style{wxBU_BOTTOM}
           Aligns the bitmap label to the bottom of the button.
    @endStyleTable

    Note that the wxBU_EXACTFIT style supported by wxButton is not used by this
    class as bitmap buttons don't have any minimal standard size by default.

    @beginEventEmissionTable{wxCommandEvent}
    @event{EVT_BUTTON(id, func)}
           Process a @c wxEVT_COMMAND_BUTTON_CLICKED event, when the button is clicked.
    @endEventTable

    @library{wxcore}
    @category{ctrl}
    @appearance{bitmapbutton.png}

    @see wxButton
*/
%name{Wx::BitmapButton} class wxBitmapButton : public %name{Wx::Button} wxButton
{
public:
    
    /**
      Static Constructors
    */
#if WXPERL_W_VERSION_GE( 2, 9, 5 )
    
    static wxBitmapButton* NewCloseButton(wxWindow* parent, wxWindowID winid);

#endif    
    /**
        Default ctor.
    */
    %name{newDefault} wxBitmapButton() %Overload
        %postcall{% wxPli_create_evthandler( aTHX_ RETVAL, CLASS ); %};

    /**
        Constructor, creating and showing a button.

        @param parent
            Parent window. Must not be @NULL.
        @param id
            Button identifier. The value wxID_ANY indicates a default value.
        @param bitmap
            Bitmap to be displayed.
        @param pos
            Button position.
            If ::wxDefaultPosition is specified then a default position is chosen.
        @param size
            Button size. 
            If ::wxDefaultSize is specified then the button is sized appropriately 
            for the bitmap.
        @param style
            Window style. See wxBitmapButton.
        @param validator
            Window validator.
        @param name
            Window name.

        @remarks The bitmap parameter is normally the only bitmap you need to provide,
                 and wxWidgets will draw the button correctly in its different states.
                 If you want more control, call any of the functions SetBitmapPressed(),
                 SetBitmapFocus(), SetBitmapDisabled().

        @see Create(), wxValidator
    */
    %name{newFull}
    wxBitmapButton(wxWindow* parent, wxWindowID id,
                   const wxBitmap& bitmap,
                   const wxPoint& pos = wxDefaultPosition,
                   const wxSize& size = wxDefaultSize,
                   long style = wxBU_AUTODRAW,
                   const wxValidator& validator = wxDefaultValidatorPtr,
                   const wxString& name = wxButtonNameStr) %Overload
        %postcall{% wxPli_create_evthandler( aTHX_ RETVAL, CLASS ); %};

    /**
        Button creation function for two-step creation.
        For more details, see wxBitmapButton().
    */
    bool Create(wxWindow* parent, wxWindowID id,
                const wxBitmap& bitmap,
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& size = wxDefaultSize,
                long style = wxBU_AUTODRAW,
                const wxValidator& validator = wxDefaultValidatorPtr,
                const wxString& name = wxButtonNameStr);

    //@{
    /**
        Returns the bitmap for the disabled state, which may be invalid.

        @return A reference to the disabled state bitmap.

        @see SetBitmapDisabled()
    */
    const wxBitmap& GetBitmapDisabled() const;
    // wxBitmap& GetBitmapDisabled(); TODO add %Skip annotation
    //@}

    //@{
    /**
        Returns the bitmap for the focused state, which may be invalid.

        @return A reference to the focused state bitmap.

        @see SetBitmapFocus()
    */
    const wxBitmap& GetBitmapFocus() const;
    // wxBitmap& GetBitmapFocus(); TODO add %Skip annotation
    //@}

#if WXPERL_W_VERSION_GE( 2, 7, 0 )
    //@{
    /**
        Returns the bitmap used when the mouse is over the button, which may be invalid.

        @see SetBitmapHover()
    */
    const wxBitmap& GetBitmapHover() const;
    // wxBitmap& GetBitmapHover(); TODO add %Skip annotation
    //@}
#endif

    //@{
    /**
        Returns the label bitmap (the one passed to the constructor), always valid.

        @return A reference to the button's label bitmap.

        @see SetBitmapLabel()
    */
    const wxBitmap& GetBitmapLabel() const;
    // wxBitmap& GetBitmapLabel(); TODO add %Skip annotation
    //@}

    /**
        Returns the bitmap for the selected state.

        @return A reference to the selected state bitmap.

        @see SetBitmapSelected()
    */
    const wxBitmap& GetBitmapSelected() const;

    /**
        Sets the bitmap for the disabled button appearance.

        @param bitmap
            The bitmap to set.

        @see GetBitmapDisabled(), SetBitmapLabel(),
             SetBitmapSelected(), SetBitmapFocus()
    */
    virtual void SetBitmapDisabled(const wxBitmap& bitmap);

    /**
        Sets the bitmap for the button appearance when it has the keyboard focus.

        @param bitmap
            The bitmap to set.

        @see GetBitmapFocus(), SetBitmapLabel(),
             SetBitmapSelected(), SetBitmapDisabled()
    */
    virtual void SetBitmapFocus(const wxBitmap& bitmap);

#if WXPERL_W_VERSION_GE( 2, 7, 0 )
    /**
        Sets the bitmap to be shown when the mouse is over the button.

        @since 2.7.0

        The hover bitmap is currently only supported in wxMSW.

        @see GetBitmapHover()
    */
    virtual void SetBitmapHover(const wxBitmap& bitmap);
#endif

    /**
        Sets the bitmap label for the button.

        @param bitmap
            The bitmap label to set.

        @remarks This is the bitmap used for the unselected state, and for all
                 other states if no other bitmaps are provided.

        @see GetBitmapLabel()
    */
    virtual void SetBitmapLabel(const wxBitmap& bitmap);

    /**
        Sets the bitmap for the selected (depressed) button appearance.

        @param bitmap
            The bitmap to set.
    */
    virtual void SetBitmapSelected(const wxBitmap& bitmap);
};