1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/statbmp.h
3 // Purpose: wxStaticBitmap class for wxMSW
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 #include "wx/bitmap.h"
23 WXDLLEXPORT_DATA(extern const wxChar
*) wxStaticBitmapNameStr
;
25 // a control showing an icon or a bitmap
26 class WXDLLEXPORT wxStaticBitmap
: public wxStaticBitmapBase
29 wxStaticBitmap() { Init(); }
31 wxStaticBitmap(wxWindow
*parent
,
33 const wxGDIImage
& 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 wxGDIImage
& 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
) { SetImage(&icon
); }
53 virtual void SetBitmap(const wxBitmap
& bitmap
) { SetImage(&bitmap
); }
55 // assert failure is provoked by an attempt to get an icon from bitmap or
57 wxIcon
GetIcon() const
58 { wxASSERT( m_isIcon
); return *(wxIcon
*)m_image
; }
59 wxBitmap
GetBitmap() const
60 { wxASSERT( !m_isIcon
); return *(wxBitmap
*)m_image
; }
64 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT
*item
);
66 virtual long MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
69 virtual wxSize
DoGetBestSize() const;
71 void Init() { m_isIcon
= TRUE
; m_image
= NULL
; }
74 // TRUE if icon/bitmap is valid
75 bool ImageIsOk() const;
77 void SetImage(const wxGDIImage
* image
);
79 // we can have either an icon or a bitmap
84 DECLARE_DYNAMIC_CLASS(wxStaticBitmap
)