]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/statbmp.h
*** empty log message ***
[wxWidgets.git] / include / wx / os2 / statbmp.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: statbmp.h
3 // Purpose: wxStaticBitmap class
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
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
21 WXDLLEXPORT_DATA(extern const char*) wxStaticBitmapNameStr;
22
23 class WXDLLEXPORT wxStaticBitmap: public wxControl
24 {
25 DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
26 public:
27 inline wxStaticBitmap() { }
28
29 inline wxStaticBitmap(wxWindow *parent, wxWindowID id,
30 const wxBitmap& label,
31 const wxPoint& pos = wxDefaultPosition,
32 const wxSize& size = wxDefaultSize,
33 long style = 0,
34 const wxString& name = wxStaticBitmapNameStr)
35 {
36 Create(parent, id, label, pos, size, style, name);
37 }
38
39 bool Create(wxWindow *parent, wxWindowID id,
40 const wxBitmap& label,
41 const wxPoint& pos = wxDefaultPosition,
42 const wxSize& size = wxDefaultSize,
43 long style = 0,
44 const wxString& name = wxStaticBitmapNameStr);
45
46 virtual void SetIcon(const wxIcon& icon) { SetBitmap(icon); }
47 virtual void SetBitmap(const wxBitmap& bitmap);
48
49 // assert failure is provoked by an attempt to get an icon from bitmap or
50 // vice versa
51 const wxIcon& GetIcon() const
52 { wxASSERT( m_isIcon ); return *m_image.icon; }
53 const wxBitmap& GetBitmap() const
54 { wxASSERT( !m_isIcon ); return *m_image.bitmap; }
55
56 // overriden base class virtuals
57 virtual bool AcceptsFocus() const { return FALSE; }
58
59 protected:
60 void Init() { m_isIcon = TRUE; m_image.icon = NULL; }
61 void Free();
62
63 // TRUE if icon/bitmap is valid
64 bool ImageIsOk() const;
65
66 // we can have either an icon or a bitmap
67 bool m_isIcon;
68 union
69 {
70 wxIcon *icon;
71 wxBitmap *bitmap;
72 } m_image;
73
74 virtual wxSize DoGetBestSize();
75 };
76
77 #endif
78 // _WX_STATBMP_H_