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"
27 wxSCALE_HORIZONTAL
= 0x1,
28 wxSCALE_VERTICAL
= 0x2,
29 wxSCALE_UNIFORM
= 0x4,
33 //WXDLLEXPORT_DATA(extern const wxChar*) wxStaticBitmapNameStr;
34 extern const wxChar
* wxStaticPictureNameStr
;
36 class WXDLLIMPEXP_GIZMOS wxStaticPicture
: public wxControl
38 DECLARE_DYNAMIC_CLASS(wxStaticPicture
)
43 wxStaticPicture( wxWindow
* parent
, wxWindowID id
,
44 const wxBitmap
& label
,
45 const wxPoint
& pos
= wxDefaultPosition
,
46 const wxSize
& size
= wxDefaultSize
,
48 const wxString
& name
= wxStaticPictureNameStr
)
50 Create( parent
, id
, label
, pos
, size
, style
, name
);
53 bool Create( wxWindow
* parent
, wxWindowID id
,
54 const wxBitmap
& label
,
55 const wxPoint
& pos
= wxDefaultPosition
,
56 const wxSize
& size
= wxDefaultSize
,
58 const wxString
& name
= wxStaticPictureNameStr
);
60 virtual void Command(wxCommandEvent
& WXUNUSED(event
)) {}
61 virtual bool ProcessCommand(wxCommandEvent
& WXUNUSED(event
)) {return true;}
62 void OnPaint(wxPaintEvent
& event
);
64 void SetBitmap( const wxBitmap
& bmp
);
66 wxBitmap
GetBitmap() const
71 // Icon interface for compatibility with wxStaticBitmap.
72 void SetIcon( const wxIcon
& icon
)
75 bmp
.CopyFromIcon( icon
);
79 wxIcon
GetIcon() const
82 icon
.CopyFromBitmap( Bitmap
);
86 void SetAlignment( int align
)
91 int GetAlignment() const
96 void SetScale( int scale
)
106 void SetCustomScale( float sx
, float sy
)
112 void GetCustomScale( float* sx
, float* sy
) const
128 // When scaling is enabled, measures are taken to improve performance on non-Windows platforms.
129 // - The original bitmap is stored as a wxImage, because conversion from wxBitmap to wxImage is slow.
130 // - The latest scaled bitmap is cached, this improves performance when the control is repainted
131 // but the size hasn't changed (overlapping windows, movement, etc).
132 wxImage OriginalImage
;
135 wxBitmap ScaledBitmap
;
138 DECLARE_EVENT_TABLE()
141 #endif // #ifndef _WX_STATPICT_H_