]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/statbmp.h
moved MGL initialization to earlier stage (crashes otherwise...) and implemented...
[wxWidgets.git] / include / wx / os2 / statbmp.h
CommitLineData
0e320a79
DW
1/////////////////////////////////////////////////////////////////////////////
2// Name: statbmp.h
3// Purpose: wxStaticBitmap class
3b9e3455 4// Author: David Webster
0e320a79 5// Modified by:
3b9e3455 6// Created: 11/27/99
0e320a79 7// RCS-ID: $Id$
3b9e3455
DW
8// Copyright: (c) David Webster
9// Licence: wxWindows licence
0e320a79
DW
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"
3b9e3455 20#include "wx/icon.h"
0e320a79
DW
21
22WXDLLEXPORT_DATA(extern const char*) wxStaticBitmapNameStr;
23
210a651b 24class WXDLLEXPORT wxStaticBitmap : public wxStaticBitmapBase
0e320a79 25{
0e320a79 26 public:
3b9e3455
DW
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; }
210a651b 58 wxBitmap GetBitmap() const
3b9e3455
DW
59 { wxASSERT( !m_bIsIcon ); return *(wxBitmap *)m_pImage; }
60
61 // overriden base class virtuals
62 virtual bool AcceptsFocus() const { return FALSE; }
0e320a79 63
409c9842 64protected:
3b9e3455
DW
65 virtual wxSize DoGetBestSize() const;
66
67 void Init() { m_bIsIcon = TRUE; m_pImage = NULL; }
68 void Free();
409c9842 69
3b9e3455
DW
70 // TRUE if icon/bitmap is valid
71 bool ImageIsOk() const;
409c9842 72
3b9e3455 73 void SetImage(const wxGDIImage& rImage);
54da4255 74
3b9e3455
DW
75 // we can have either an icon or a bitmap
76 bool m_bIsIcon;
77 wxGDIImage* m_pImage;
210a651b
DW
78private:
79 DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
0e320a79
DW
80};
81
82#endif
83 // _WX_STATBMP_H_