1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxStaticBitmap class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_STATBMP_H_
13 #define _WX_STATBMP_H_
16 #pragma interface "statbmp.h"
19 #include "wx/control.h"
21 WXDLLEXPORT_DATA(extern const char*) wxStaticBitmapNameStr
;
23 // a control showing an icon or a bitmap
24 class WXDLLEXPORT wxStaticBitmap
: public wxControl
26 DECLARE_DYNAMIC_CLASS(wxStaticBitmap
)
29 wxStaticBitmap() { Init(); }
31 wxStaticBitmap(wxWindow
*parent
,
33 const wxBitmap
& label
,
34 const wxPoint
& pos
= wxDefaultPosition
,
35 const wxSize
& size
= wxDefaultSize
,
37 const wxString
& name
= wxStaticBitmapNameStr
)
39 Create(parent
, id
, label
, pos
, size
, style
, name
);
42 bool Create(wxWindow
*parent
,
44 const wxBitmap
& label
,
45 const wxPoint
& pos
= wxDefaultPosition
,
46 const wxSize
& size
= wxDefaultSize
,
48 const wxString
& name
= wxStaticBitmapNameStr
);
50 virtual ~wxStaticBitmap() { Free(); }
52 virtual void SetIcon(const wxIcon
& icon
) { SetBitmap(icon
); }
53 virtual void SetBitmap(const wxBitmap
& bitmap
);
55 // assert failure is provoked by an attempt to get an icon from bitmap or
57 const wxIcon
& GetIcon() const
58 { wxASSERT( m_isIcon
); return *m_image
.icon
; }
59 const wxBitmap
& GetBitmap() const
60 { wxASSERT( !m_isIcon
); return *m_image
.bitmap
; }
62 // overriden base class virtuals
63 virtual bool AcceptsFocus() const { return FALSE
; }
67 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT
*item
);
68 virtual long MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
72 void Init() { m_isIcon
= TRUE
; m_image
.icon
= NULL
; }
75 // TRUE if icon/bitmap is valid
76 bool ImageIsOk() const;
78 // we can have either an icon or a bitmap
86 virtual void DoSetSize(int x
, int y
,
87 int width
, int height
,
88 int sizeFlags
= wxSIZE_AUTO
);