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
; }
63 virtual MRESULT
OS2WindowProc( WXUINT uMsg
69 virtual wxSize
DoGetBestSize() const;
71 void Init() { m_bIsIcon
= TRUE
; m_pImage
= NULL
; }
74 // TRUE if icon/bitmap is valid
75 bool ImageIsOk() const;
77 void SetImage(const wxGDIImage
& rImage
);
79 // we can have either an icon or a bitmap
83 DECLARE_DYNAMIC_CLASS(wxStaticBitmap
)
84 }; // end of wxStaticBitmap