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 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "statpict.h"
19 #include "wx/control.h"
22 #include "wx/bitmap.h"
25 #include "wx/gizmos/gizmos.h"
29 wxSCALE_HORIZONTAL
= 0x1,
30 wxSCALE_VERTICAL
= 0x2,
31 wxSCALE_UNIFORM
= 0x4,
35 //WXDLLEXPORT_DATA(extern const wxChar*) wxStaticBitmapNameStr;
36 extern const wxChar
* wxStaticPictureNameStr
;
38 class WXDLLIMPEXP_GIZMOS wxStaticPicture
: public wxControl
40 DECLARE_DYNAMIC_CLASS(wxStaticPicture
)
45 wxStaticPicture( wxWindow
* parent
, wxWindowID id
,
46 const wxBitmap
& label
,
47 const wxPoint
& pos
= wxDefaultPosition
,
48 const wxSize
& size
= wxDefaultSize
,
50 const wxString
& name
= wxStaticPictureNameStr
)
52 Create( parent
, id
, label
, pos
, size
, style
, name
);
55 bool Create( wxWindow
* parent
, wxWindowID id
,
56 const wxBitmap
& label
,
57 const wxPoint
& pos
= wxDefaultPosition
,
58 const wxSize
& size
= wxDefaultSize
,
60 const wxString
& name
= wxStaticPictureNameStr
);
62 virtual void Command(wxCommandEvent
& WXUNUSED(event
)) {}
63 virtual bool ProcessCommand(wxCommandEvent
& WXUNUSED(event
)) {return true;}
64 void OnPaint(wxPaintEvent
& event
);
66 void SetBitmap( const wxBitmap
& bmp
);
68 wxBitmap
GetBitmap() const
73 // Icon interface for compatibility with wxStaticBitmap.
74 void SetIcon( const wxIcon
& icon
)
77 bmp
.CopyFromIcon( icon
);
81 wxIcon
GetIcon() const
84 icon
.CopyFromBitmap( Bitmap
);
88 void SetAlignment( int align
)
93 int GetAlignment() const
98 void SetScale( int scale
)
108 void SetCustomScale( float sx
, float sy
)
114 void GetCustomScale( float* sx
, float* sy
) const
130 // When scaling is enabled, measures are taken to improve performance on non-Windows platforms.
131 // - The original bitmap is stored as a wxImage, because conversion from wxBitmap to wxImage is slow.
132 // - The latest scaled bitmap is cached, this improves performance when the control is repainted
133 // but the size hasn't changed (overlapping windows, movement, etc).
134 wxImage OriginalImage
;
137 wxBitmap ScaledBitmap
;
140 DECLARE_EVENT_TABLE()
143 #endif // #ifndef _WX_STATPICT_H_