1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/os2/statbmp.h
3 // Purpose: wxStaticBitmap class
4 // Author: David Webster
7 // Copyright: (c) David Webster
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_STATBMP_H_
12 #define _WX_STATBMP_H_
14 #include "wx/control.h"
17 class WXDLLIMPEXP_CORE wxStaticBitmap
: public wxStaticBitmapBase
20 inline wxStaticBitmap() { Init(); }
22 inline wxStaticBitmap( wxWindow
* pParent
24 ,const wxGDIImage
& rLabel
25 ,const wxPoint
& rPos
= wxDefaultPosition
26 ,const wxSize
& rSize
= wxDefaultSize
28 ,const wxString
& rName
= wxStaticBitmapNameStr
31 Create(pParent
, nId
, rLabel
, rPos
, rSize
, lStyle
, rName
);
34 bool Create( wxWindow
* pParent
36 ,const wxGDIImage
& rLabel
37 ,const wxPoint
& rPos
= wxDefaultPosition
38 ,const wxSize
& rSize
= wxDefaultSize
40 ,const wxString
& rName
= wxStaticBitmapNameStr
42 inline virtual ~wxStaticBitmap() { Free(); }
44 virtual void SetIcon(const wxIcon
& rIcon
) { SetImage(rIcon
); }
45 virtual void SetBitmap(const wxBitmap
& rBitmap
) { SetImage(rBitmap
); }
47 // assert failure is provoked by an attempt to get an icon from bitmap or
49 wxIcon
GetIcon() const
50 { wxASSERT( m_bIsIcon
); return *(wxIcon
*)m_pImage
; }
51 wxBitmap
GetBitmap() const
52 { wxASSERT( !m_bIsIcon
); return *(wxBitmap
*)m_pImage
; }
54 // overridden base class virtuals
55 virtual bool AcceptsFocus() const { return FALSE
; }
56 virtual MRESULT
OS2WindowProc( WXUINT uMsg
60 void OnPaint(wxPaintEvent
& rEvent
);
63 virtual wxSize
DoGetBestSize() const;
65 void Init() { m_bIsIcon
= TRUE
; m_pImage
= NULL
; }
68 // TRUE if icon/bitmap is valid
69 bool ImageIsOk() const;
71 void SetImage(const wxGDIImage
& rImage
);
73 // we can have either an icon or a bitmap
77 DECLARE_DYNAMIC_CLASS(wxStaticBitmap
)
79 }; // end of wxStaticBitmap