]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/statbmp.h
preemptive fix for wxPython compilation. It will break otherwise when
[wxWidgets.git] / include / wx / os2 / statbmp.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: statbmp.h
3 // Purpose: wxStaticBitmap class
4 // Author: David Webster
5 // Modified by:
6 // Created: 11/27/99
7 // RCS-ID: $Id$
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_STATBMP_H_
13 #define _WX_STATBMP_H_
14
15 #ifdef __GNUG__
16 #pragma interface "statbmp.h"
17 #endif
18
19 #include "wx/control.h"
20 #include "wx/icon.h"
21
22 WXDLLEXPORT_DATA(extern const char*) wxStaticBitmapNameStr;
23
24 class WXDLLEXPORT wxStaticBitmap : public wxStaticBitmapBase
25 {
26 public:
27 inline wxStaticBitmap() { Init(); }
28
29 inline wxStaticBitmap( wxWindow* pParent
30 ,wxWindowID nId
31 ,const wxGDIImage& rLabel
32 ,const wxPoint& rPos = wxDefaultPosition
33 ,const wxSize& rSize = wxDefaultSize
34 ,long lStyle = 0
35 ,const wxString& rName = wxStaticBitmapNameStr
36 )
37 {
38 Create(pParent, nId, rLabel, rPos, rSize, lStyle, rName);
39 }
40
41 bool Create( wxWindow* pParent
42 ,wxWindowID nId
43 ,const wxGDIImage& rLabel
44 ,const wxPoint& rPos = wxDefaultPosition
45 ,const wxSize& rSize = wxDefaultSize
46 ,long lStyle = 0
47 ,const wxString& rName = wxStaticBitmapNameStr
48 );
49 inline virtual ~wxStaticBitmap() { Free(); }
50
51 virtual void SetIcon(const wxIcon& rIcon) { SetImage(rIcon); }
52 virtual void SetBitmap(const wxBitmap& rBitmap) { SetImage(rBitmap); };
53
54 // assert failure is provoked by an attempt to get an icon from bitmap or
55 // vice versa
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; }
60
61 // overriden base class virtuals
62 virtual bool AcceptsFocus() const { return FALSE; }
63
64 protected:
65 virtual wxSize DoGetBestSize() const;
66
67 void Init() { m_bIsIcon = TRUE; m_pImage = NULL; }
68 void Free();
69
70 // TRUE if icon/bitmap is valid
71 bool ImageIsOk() const;
72
73 void SetImage(const wxGDIImage& rImage);
74
75 // we can have either an icon or a bitmap
76 bool m_bIsIcon;
77 wxGDIImage* m_pImage;
78 private:
79 DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
80 };
81
82 #endif
83 // _WX_STATBMP_H_