1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/os2/statbmp.h
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_
15 #include "wx/control.h"
18 class WXDLLIMPEXP_CORE wxStaticBitmap
: public wxStaticBitmapBase
21 inline wxStaticBitmap() { Init(); }
23 inline wxStaticBitmap( wxWindow
* pParent
25 ,const wxGDIImage
& rLabel
26 ,const wxPoint
& rPos
= wxDefaultPosition
27 ,const wxSize
& rSize
= wxDefaultSize
29 ,const wxString
& rName
= wxStaticBitmapNameStr
32 Create(pParent
, nId
, rLabel
, rPos
, rSize
, lStyle
, rName
);
35 bool Create( wxWindow
* pParent
37 ,const wxGDIImage
& rLabel
38 ,const wxPoint
& rPos
= wxDefaultPosition
39 ,const wxSize
& rSize
= wxDefaultSize
41 ,const wxString
& rName
= wxStaticBitmapNameStr
43 inline virtual ~wxStaticBitmap() { Free(); }
45 virtual void SetIcon(const wxIcon
& rIcon
) { SetImage(rIcon
); }
46 virtual void SetBitmap(const wxBitmap
& rBitmap
) { SetImage(rBitmap
); };
48 // assert failure is provoked by an attempt to get an icon from bitmap or
50 wxIcon
GetIcon() const
51 { wxASSERT( m_bIsIcon
); return *(wxIcon
*)m_pImage
; }
52 wxBitmap
GetBitmap() const
53 { wxASSERT( !m_bIsIcon
); return *(wxBitmap
*)m_pImage
; }
55 // overridden base class virtuals
56 virtual bool AcceptsFocus() const { return FALSE
; }
57 virtual MRESULT
OS2WindowProc( WXUINT uMsg
61 void OnPaint(wxPaintEvent
& rEvent
);
64 virtual wxSize
DoGetBestSize() const;
66 void Init() { m_bIsIcon
= TRUE
; m_pImage
= NULL
; }
69 // TRUE if icon/bitmap is valid
70 bool ImageIsOk() const;
72 void SetImage(const wxGDIImage
& rImage
);
74 // we can have either an icon or a bitmap
78 DECLARE_DYNAMIC_CLASS(wxStaticBitmap
)
80 }; // end of wxStaticBitmap