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 WXDLLIMPEXP_GIZMOS
extern const wxChar
* wxStaticPictureNameStr
;
37 class WXDLLIMPEXP_GIZMOS wxStaticPicture
: public wxControl
39 DECLARE_DYNAMIC_CLASS(wxStaticPicture
)
44 wxStaticPicture( wxWindow
* parent
, wxWindowID id
,
45 const wxBitmap
& label
,
46 const wxPoint
& pos
= wxDefaultPosition
,
47 const wxSize
& size
= wxDefaultSize
,
49 const wxString
& name
= wxStaticPictureNameStr
)
51 Create( parent
, id
, label
, pos
, size
, style
, name
);
54 bool Create( wxWindow
* parent
, wxWindowID id
,
55 const wxBitmap
& label
,
56 const wxPoint
& pos
= wxDefaultPosition
,
57 const wxSize
& size
= wxDefaultSize
,
59 const wxString
& name
= wxStaticPictureNameStr
);
61 virtual void Command(wxCommandEvent
& WXUNUSED(event
)) {}
62 virtual bool ProcessCommand(wxCommandEvent
& WXUNUSED(event
)) {return true;}
63 void OnPaint(wxPaintEvent
& event
);
65 void SetBitmap( const wxBitmap
& bmp
);
67 wxBitmap
GetBitmap() const
72 // Icon interface for compatibility with wxStaticBitmap.
73 void SetIcon( const wxIcon
& icon
)
76 bmp
.CopyFromIcon( icon
);
80 wxIcon
GetIcon() const
83 icon
.CopyFromBitmap( Bitmap
);
87 void SetAlignment( int align
)
92 int GetAlignment() const
97 void SetScale( int scale
)
107 void SetCustomScale( float sx
, float sy
)
113 void GetCustomScale( float* sx
, float* sy
) const
129 // When scaling is enabled, measures are taken to improve performance on non-Windows platforms.
130 // - The original bitmap is stored as a wxImage, because conversion from wxBitmap to wxImage is slow.
131 // - The latest scaled bitmap is cached, this improves performance when the control is repainted
132 // but the size hasn't changed (overlapping windows, movement, etc).
133 wxImage OriginalImage
;
136 wxBitmap ScaledBitmap
;
139 DECLARE_EVENT_TABLE()
142 #endif // #ifndef _WX_STATPICT_H_