]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/statbmp.h
Don't define __STRICT_ANSI__, we should build both with and without it.
[wxWidgets.git] / include / wx / os2 / statbmp.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/os2/statbmp.h
3 // Purpose: wxStaticBitmap class
4 // Author: David Webster
5 // Modified by:
6 // Created: 11/27/99
7 // Copyright: (c) David Webster
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_STATBMP_H_
12 #define _WX_STATBMP_H_
13
14 #include "wx/control.h"
15 #include "wx/icon.h"
16
17 class WXDLLIMPEXP_CORE wxStaticBitmap : public wxStaticBitmapBase
18 {
19 public:
20 inline wxStaticBitmap() { Init(); }
21
22 inline wxStaticBitmap( wxWindow* pParent
23 ,wxWindowID nId
24 ,const wxGDIImage& rLabel
25 ,const wxPoint& rPos = wxDefaultPosition
26 ,const wxSize& rSize = wxDefaultSize
27 ,long lStyle = 0
28 ,const wxString& rName = wxStaticBitmapNameStr
29 )
30 {
31 Create(pParent, nId, rLabel, rPos, rSize, lStyle, rName);
32 }
33
34 bool Create( wxWindow* pParent
35 ,wxWindowID nId
36 ,const wxGDIImage& rLabel
37 ,const wxPoint& rPos = wxDefaultPosition
38 ,const wxSize& rSize = wxDefaultSize
39 ,long lStyle = 0
40 ,const wxString& rName = wxStaticBitmapNameStr
41 );
42 inline virtual ~wxStaticBitmap() { Free(); }
43
44 virtual void SetIcon(const wxIcon& rIcon) { SetImage(rIcon); }
45 virtual void SetBitmap(const wxBitmap& rBitmap) { SetImage(rBitmap); }
46
47 // assert failure is provoked by an attempt to get an icon from bitmap or
48 // vice versa
49 wxIcon GetIcon() const
50 { wxASSERT( m_bIsIcon ); return *(wxIcon *)m_pImage; }
51 wxBitmap GetBitmap() const
52 { wxASSERT( !m_bIsIcon ); return *(wxBitmap *)m_pImage; }
53
54 // overridden base class virtuals
55 virtual bool AcceptsFocus() const { return FALSE; }
56 virtual MRESULT OS2WindowProc( WXUINT uMsg
57 ,WXWPARAM wParam
58 ,WXLPARAM lParam
59 );
60 void OnPaint(wxPaintEvent& rEvent);
61
62 protected:
63 virtual wxSize DoGetBestSize() const;
64
65 void Init() { m_bIsIcon = TRUE; m_pImage = NULL; }
66 void Free();
67
68 // TRUE if icon/bitmap is valid
69 bool ImageIsOk() const;
70
71 void SetImage(const wxGDIImage& rImage);
72
73 // we can have either an icon or a bitmap
74 bool m_bIsIcon;
75 wxGDIImage* m_pImage;
76 private:
77 DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
78 DECLARE_EVENT_TABLE()
79 }; // end of wxStaticBitmap
80
81 #endif
82 // _WX_STATBMP_H_