]>
Commit | Line | Data |
---|---|---|
0e320a79 | 1 | ///////////////////////////////////////////////////////////////////////////// |
80fdcdb9 | 2 | // Name: wx/os2/statbmp.h |
0e320a79 | 3 | // Purpose: wxStaticBitmap class |
3b9e3455 | 4 | // Author: David Webster |
0e320a79 | 5 | // Modified by: |
3b9e3455 | 6 | // Created: 11/27/99 |
3b9e3455 | 7 | // Copyright: (c) David Webster |
65571936 | 8 | // Licence: wxWindows licence |
0e320a79 DW |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
11 | #ifndef _WX_STATBMP_H_ | |
12 | #define _WX_STATBMP_H_ | |
13 | ||
0e320a79 | 14 | #include "wx/control.h" |
3b9e3455 | 15 | #include "wx/icon.h" |
0e320a79 | 16 | |
53a2db12 | 17 | class WXDLLIMPEXP_CORE wxStaticBitmap : public wxStaticBitmapBase |
0e320a79 | 18 | { |
0e320a79 | 19 | public: |
3b9e3455 DW |
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); } | |
6dd0883d | 45 | virtual void SetBitmap(const wxBitmap& rBitmap) { SetImage(rBitmap); } |
3b9e3455 DW |
46 | |
47 | // assert failure is provoked by an attempt to get an icon from bitmap or | |
48 | // vice versa | |
ea8ca011 | 49 | wxIcon GetIcon() const |
3b9e3455 | 50 | { wxASSERT( m_bIsIcon ); return *(wxIcon *)m_pImage; } |
210a651b | 51 | wxBitmap GetBitmap() const |
3b9e3455 DW |
52 | { wxASSERT( !m_bIsIcon ); return *(wxBitmap *)m_pImage; } |
53 | ||
4c51a665 | 54 | // overridden base class virtuals |
3b9e3455 | 55 | virtual bool AcceptsFocus() const { return FALSE; } |
3c299c3a DW |
56 | virtual MRESULT OS2WindowProc( WXUINT uMsg |
57 | ,WXWPARAM wParam | |
58 | ,WXLPARAM lParam | |
59 | ); | |
1de4baa3 | 60 | void OnPaint(wxPaintEvent& rEvent); |
0e320a79 | 61 | |
409c9842 | 62 | protected: |
3b9e3455 DW |
63 | virtual wxSize DoGetBestSize() const; |
64 | ||
65 | void Init() { m_bIsIcon = TRUE; m_pImage = NULL; } | |
66 | void Free(); | |
409c9842 | 67 | |
3b9e3455 DW |
68 | // TRUE if icon/bitmap is valid |
69 | bool ImageIsOk() const; | |
409c9842 | 70 | |
3b9e3455 | 71 | void SetImage(const wxGDIImage& rImage); |
54da4255 | 72 | |
3b9e3455 DW |
73 | // we can have either an icon or a bitmap |
74 | bool m_bIsIcon; | |
75 | wxGDIImage* m_pImage; | |
210a651b DW |
76 | private: |
77 | DECLARE_DYNAMIC_CLASS(wxStaticBitmap) | |
1de4baa3 | 78 | DECLARE_EVENT_TABLE() |
3c299c3a | 79 | }; // end of wxStaticBitmap |
0e320a79 DW |
80 | |
81 | #endif | |
82 | // _WX_STATBMP_H_ |