File: statbmp.h

package info (click to toggle)
wxpython4.0 4.2.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 221,752 kB
  • sloc: cpp: 962,555; python: 230,573; ansic: 170,731; makefile: 51,756; sh: 9,342; perl: 1,564; javascript: 584; php: 326; xml: 200
file content (168 lines) | stat: -rw-r--r-- 4,897 bytes parent folder | download | duplicates (4)
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
/////////////////////////////////////////////////////////////////////////////
// Name:        statbmp.h
// Purpose:     interface of wxStaticBitmap
// Author:      wxWidgets team
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

/**
    @class wxStaticBitmap

    A static bitmap control displays a bitmap. Native implementations on some
    platforms are only meant for display of the small icons in the dialog
    boxes.

    If you want to display larger images portably, you may use generic
    implementation wxGenericStaticBitmap declared in \<wx/generic/statbmpg.h\>.

    Notice that for the best results, the size of the control should be the
    same as the size of the image displayed in it, as happens by default if
    it's not resized explicitly. Otherwise, behaviour depends on the
    platform: under MSW, the bitmap is drawn centred inside the control, while
    elsewhere it is drawn at the origin of the control. You can use
    SetScaleMode() to control how the image is scaled inside the control.

    @library{wxcore}
    @category{ctrl}
    @appearance{staticbitmap}

    @see wxBitmap
*/
class wxStaticBitmap : public wxControl
{
public:
    /**
        Specify how the bitmap should be scaled in the control.

        @see SetScaleMode(), GetScaleMode()
    */
    enum ScaleMode
    {
        /**
            The bitmap is displayed in original size. Portions larger then the
            control will be cut off.
        */
        Scale_None,

        /**
            Scale the bitmap to fit the size of the control by changing the
            aspect ratio of the bitmap if necessary.
        */
        Scale_Fill,

        /**
            Scale the bitmap to fit the size of the control by maintaining the
            aspect ratio. Any remaining area of the control will use the background.
        */
        Scale_AspectFit,

        /**
            Scale the bitmap to fill the size of the control. Some portion of
            the bitmap may be clipped to fill the control.
        */
        Scale_AspectFill
    };

    /**
      Default constructor
    */
    wxStaticBitmap();

    /**
        Constructor, creating and showing a static bitmap control.

        @param parent
            Parent window. Should not be @NULL.
        @param id
            Control identifier. A value of -1 denotes a default value.
        @param label
            Bitmap label.
        @param pos
            Window position.
        @param size
            Window size.
        @param style
            Window style. See wxStaticBitmap.
        @param name
            Window name.

        @see Create()
    */
    wxStaticBitmap(wxWindow* parent, wxWindowID id,
                   const wxBitmapBundle& label,
                   const wxPoint& pos = wxDefaultPosition,
                   const wxSize& size = wxDefaultSize,
                   long style = 0,
                   const wxString& name = wxStaticBitmapNameStr);

    /**
        Creation function, for two-step construction. For details see wxStaticBitmap().
    */
    bool Create(wxWindow* parent, wxWindowID id, const wxBitmapBundle& label,
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& size = wxDefaultSize, long style = 0,
                const wxString& name = wxStaticBitmapNameStr);

    /**
        Returns the bitmap currently used in the control.
        Notice that this method can be called even if SetIcon() had been used.

        @see SetBitmap()
    */
    virtual wxBitmap GetBitmap() const;

    /**
        Returns the icon currently used in the control.
        Notice that this method can only be called if SetIcon() had been used: an icon
        can't be retrieved from the control if a bitmap had been set
        (using wxStaticBitmap::SetBitmap).

        @see SetIcon()
    */
    virtual wxIcon GetIcon() const;

    /**
        Sets the bitmap label.

        @param label
            The new bitmap.

        @see GetBitmap()
    */
    virtual void SetBitmap(const wxBitmapBundle& label);

    /**
        Sets the label to the given icon.

        @param label
            The new icon.
    */
    virtual void SetIcon(const wxIcon& label);

    /**
        Sets the scale mode.

        @param scaleMode
            Controls how the bitmap is scaled inside the control.

        @note Currently only the generic implementation supports all scaling modes.
            You may use generic implementation wxGenericStaticBitmap declared in
            \<wx/generic/statbmpg.h\> in all ports.

        @see GetScaleMode()

        @since 3.1.0
    */
    virtual void SetScaleMode(ScaleMode scaleMode);

    /**
        Returns the scale mode currently used in the control.

        @see SetScaleMode()

        @since 3.1.0
    */
    virtual ScaleMode GetScaleMode() const;

};