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 class WXDLLEXPORT wxStaticBitmap
: public wxStaticBitmapBase
25 inline wxStaticBitmap() { Init(); }
27 inline wxStaticBitmap( wxWindow
* pParent
29 ,const wxGDIImage
& rLabel
30 ,const wxPoint
& rPos
= wxDefaultPosition
31 ,const wxSize
& rSize
= wxDefaultSize
33 ,const wxString
& rName
= wxStaticBitmapNameStr
36 Create(pParent
, nId
, rLabel
, rPos
, rSize
, lStyle
, rName
);
39 bool Create( wxWindow
* pParent
41 ,const wxGDIImage
& rLabel
42 ,const wxPoint
& rPos
= wxDefaultPosition
43 ,const wxSize
& rSize
= wxDefaultSize
45 ,const wxString
& rName
= wxStaticBitmapNameStr
47 inline virtual ~wxStaticBitmap() { Free(); }
49 virtual void SetIcon(const wxIcon
& rIcon
) { SetImage(rIcon
); }
50 virtual void SetBitmap(const wxBitmap
& rBitmap
) { SetImage(rBitmap
); };
52 // assert failure is provoked by an attempt to get an icon from bitmap or
54 const wxIcon
& GetIcon() const
55 { wxASSERT( m_bIsIcon
); return *(wxIcon
*)m_pImage
; }
56 wxBitmap
GetBitmap() const
57 { wxASSERT( !m_bIsIcon
); return *(wxBitmap
*)m_pImage
; }
59 // overriden base class virtuals
60 virtual bool AcceptsFocus() const { return FALSE
; }
61 virtual MRESULT
OS2WindowProc( WXUINT uMsg
65 void OnPaint(wxPaintEvent
& rEvent
);
68 virtual wxSize
DoGetBestSize() const;
70 void Init() { m_bIsIcon
= TRUE
; m_pImage
= NULL
; }
73 // TRUE if icon/bitmap is valid
74 bool ImageIsOk() const;
76 void SetImage(const wxGDIImage
& rImage
);
78 // we can have either an icon or a bitmap
82 DECLARE_DYNAMIC_CLASS(wxStaticBitmap
)
84 }; // end of wxStaticBitmap