1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxStaticPicture class
4 // Author: Wade Brainerd
8 // Copyright: (c) Wade Brainerd
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_STATPICT_H_
13 #define _WX_STATPICT_H_
15 #include "wx/control.h"
18 #include "wx/bitmap.h"
21 #include "wx/gizmos/gizmos.h"
25 wxSCALE_HORIZONTAL
= 0x1,
26 wxSCALE_VERTICAL
= 0x2,
27 wxSCALE_UNIFORM
= 0x4,
31 WXDLLIMPEXP_GIZMOS
extern const wxChar
* wxStaticPictureNameStr
;
33 class WXDLLIMPEXP_GIZMOS wxStaticPicture
: public wxControl
35 DECLARE_DYNAMIC_CLASS(wxStaticPicture
)
40 wxStaticPicture( wxWindow
* parent
, wxWindowID id
,
41 const wxBitmap
& label
,
42 const wxPoint
& pos
= wxDefaultPosition
,
43 const wxSize
& size
= wxDefaultSize
,
45 const wxString
& name
= wxStaticPictureNameStr
)
47 Create( parent
, id
, label
, pos
, size
, style
, name
);
50 bool Create( wxWindow
* parent
, wxWindowID id
,
51 const wxBitmap
& label
,
52 const wxPoint
& pos
= wxDefaultPosition
,
53 const wxSize
& size
= wxDefaultSize
,
55 const wxString
& name
= wxStaticPictureNameStr
);
57 virtual void Command(wxCommandEvent
& WXUNUSED(event
)) {}
58 virtual bool ProcessCommand(wxCommandEvent
& WXUNUSED(event
)) {return true;}
59 void OnPaint(wxPaintEvent
& event
);
61 void SetBitmap( const wxBitmap
& bmp
);
63 wxBitmap
GetBitmap() const
68 // Icon interface for compatibility with wxStaticBitmap.
69 void SetIcon( const wxIcon
& icon
)
72 bmp
.CopyFromIcon( icon
);
76 wxIcon
GetIcon() const
79 icon
.CopyFromBitmap( Bitmap
);
83 void SetAlignment( int align
)
88 int GetAlignment() const
93 void SetScale( int scale
)
103 void SetCustomScale( float sx
, float sy
)
109 void GetCustomScale( float* sx
, float* sy
) const
125 // When scaling is enabled, measures are taken to improve performance on non-Windows platforms.
126 // - The original bitmap is stored as a wxImage, because conversion from wxBitmap to wxImage is slow.
127 // - The latest scaled bitmap is cached, this improves performance when the control is repainted
128 // but the size hasn't changed (overlapping windows, movement, etc).
129 wxImage OriginalImage
;
132 wxBitmap ScaledBitmap
;
135 DECLARE_EVENT_TABLE()
138 #endif // #ifndef _WX_STATPICT_H_