1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxStaticBitmap class
4 // Author: David Webster
8 // Copyright: (c) David Webster
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"
22 WXDLLEXPORT_DATA(extern const char*) wxStaticBitmapNameStr
;
24 class WXDLLEXPORT wxStaticBitmap
: public wxStaticBitmapBase
27 inline wxStaticBitmap() { Init(); }
29 inline wxStaticBitmap( wxWindow
* pParent
31 ,const wxGDIImage
& rLabel
32 ,const wxPoint
& rPos
= wxDefaultPosition
33 ,const wxSize
& rSize
= wxDefaultSize
35 ,const wxString
& rName
= wxStaticBitmapNameStr
38 Create(pParent
, nId
, rLabel
, rPos
, rSize
, lStyle
, rName
);
41 bool Create( wxWindow
* pParent
43 ,const wxGDIImage
& rLabel
44 ,const wxPoint
& rPos
= wxDefaultPosition
45 ,const wxSize
& rSize
= wxDefaultSize
47 ,const wxString
& rName
= wxStaticBitmapNameStr
49 inline virtual ~wxStaticBitmap() { Free(); }
51 virtual void SetIcon(const wxIcon
& rIcon
) { SetImage(rIcon
); }
52 virtual void SetBitmap(const wxBitmap
& rBitmap
) { SetImage(rBitmap
); };
54 // assert failure is provoked by an attempt to get an icon from bitmap or
56 const wxIcon
& GetIcon() const
57 { wxASSERT( m_bIsIcon
); return *(wxIcon
*)m_pImage
; }
58 wxBitmap
GetBitmap() const
59 { wxASSERT( !m_bIsIcon
); return *(wxBitmap
*)m_pImage
; }
61 // overriden base class virtuals
62 virtual bool AcceptsFocus() const { return FALSE
; }
65 virtual wxSize
DoGetBestSize() const;
67 void Init() { m_bIsIcon
= TRUE
; m_pImage
= NULL
; }
70 // TRUE if icon/bitmap is valid
71 bool ImageIsOk() const;
73 void SetImage(const wxGDIImage
& rImage
);
75 // we can have either an icon or a bitmap
79 DECLARE_DYNAMIC_CLASS(wxStaticBitmap
)