]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/statbmp.h
removed relic: GetMaxLineWidth
[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 wxControl
25 {
26 DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
27 public:
28 inline wxStaticBitmap() { Init(); }
29
30 inline wxStaticBitmap( wxWindow* pParent
31 ,wxWindowID nId
32 ,const wxGDIImage& rLabel
33 ,const wxPoint& rPos = wxDefaultPosition
34 ,const wxSize& rSize = wxDefaultSize
35 ,long lStyle = 0
36 ,const wxString& rName = wxStaticBitmapNameStr
37 )
38 {
39 Create(pParent, nId, rLabel, rPos, rSize, lStyle, rName);
40 }
41
42 bool Create( wxWindow* pParent
43 ,wxWindowID nId
44 ,const wxGDIImage& rLabel
45 ,const wxPoint& rPos = wxDefaultPosition
46 ,const wxSize& rSize = wxDefaultSize
47 ,long lStyle = 0
48 ,const wxString& rName = wxStaticBitmapNameStr
49 );
50 inline virtual ~wxStaticBitmap() { Free(); }
51
52 virtual void SetIcon(const wxIcon& rIcon) { SetImage(rIcon); }
53 virtual void SetBitmap(const wxBitmap& rBitmap) { SetImage(rBitmap); };
54
55 // assert failure is provoked by an attempt to get an icon from bitmap or
56 // vice versa
57 const wxIcon& GetIcon() const
58 { wxASSERT( m_bIsIcon ); return *(wxIcon *)m_pImage; }
59 const wxBitmap& GetBitmap() const
60 { wxASSERT( !m_bIsIcon ); return *(wxBitmap *)m_pImage; }
61
62 // overriden base class virtuals
63 virtual bool AcceptsFocus() const { return FALSE; }
64
65 protected:
66 virtual wxSize DoGetBestSize() const;
67
68 void Init() { m_bIsIcon = TRUE; m_pImage = NULL; }
69 void Free();
70
71 // TRUE if icon/bitmap is valid
72 bool ImageIsOk() const;
73
74 void SetImage(const wxGDIImage& rImage);
75
76 // we can have either an icon or a bitmap
77 bool m_bIsIcon;
78 wxGDIImage* m_pImage;
79 };
80
81 #endif
82 // _WX_STATBMP_H_