]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/statbmp.h
fixed wxComboBox::Clear to clear stored value
[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 8// Copyright: (c) David Webster
65571936 9// Licence: wxWindows licence
0e320a79
DW
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_STATBMP_H_
13#define _WX_STATBMP_H_
14
0e320a79 15#include "wx/control.h"
3b9e3455 16#include "wx/icon.h"
0e320a79 17
210a651b 18class WXDLLEXPORT wxStaticBitmap : public wxStaticBitmapBase
0e320a79 19{
0e320a79 20 public:
3b9e3455
DW
21 inline wxStaticBitmap() { Init(); }
22
23 inline wxStaticBitmap( wxWindow* pParent
24 ,wxWindowID nId
25 ,const wxGDIImage& rLabel
26 ,const wxPoint& rPos = wxDefaultPosition
27 ,const wxSize& rSize = wxDefaultSize
28 ,long lStyle = 0
29 ,const wxString& rName = wxStaticBitmapNameStr
30 )
31 {
32 Create(pParent, nId, rLabel, rPos, rSize, lStyle, rName);
33 }
34
35 bool Create( wxWindow* pParent
36 ,wxWindowID nId
37 ,const wxGDIImage& rLabel
38 ,const wxPoint& rPos = wxDefaultPosition
39 ,const wxSize& rSize = wxDefaultSize
40 ,long lStyle = 0
41 ,const wxString& rName = wxStaticBitmapNameStr
42 );
43 inline virtual ~wxStaticBitmap() { Free(); }
44
45 virtual void SetIcon(const wxIcon& rIcon) { SetImage(rIcon); }
46 virtual void SetBitmap(const wxBitmap& rBitmap) { SetImage(rBitmap); };
47
48 // assert failure is provoked by an attempt to get an icon from bitmap or
49 // vice versa
50 const wxIcon& GetIcon() const
51 { wxASSERT( m_bIsIcon ); return *(wxIcon *)m_pImage; }
210a651b 52 wxBitmap GetBitmap() const
3b9e3455
DW
53 { wxASSERT( !m_bIsIcon ); return *(wxBitmap *)m_pImage; }
54
55 // overriden base class virtuals
56 virtual bool AcceptsFocus() const { return FALSE; }
3c299c3a
DW
57 virtual MRESULT OS2WindowProc( WXUINT uMsg
58 ,WXWPARAM wParam
59 ,WXLPARAM lParam
60 );
1de4baa3 61 void OnPaint(wxPaintEvent& rEvent);
0e320a79 62
409c9842 63protected:
3b9e3455
DW
64 virtual wxSize DoGetBestSize() const;
65
66 void Init() { m_bIsIcon = TRUE; m_pImage = NULL; }
67 void Free();
409c9842 68
3b9e3455
DW
69 // TRUE if icon/bitmap is valid
70 bool ImageIsOk() const;
409c9842 71
3b9e3455 72 void SetImage(const wxGDIImage& rImage);
54da4255 73
3b9e3455
DW
74 // we can have either an icon or a bitmap
75 bool m_bIsIcon;
76 wxGDIImage* m_pImage;
210a651b
DW
77private:
78 DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
1de4baa3 79 DECLARE_EVENT_TABLE()
3c299c3a 80}; // end of wxStaticBitmap
0e320a79
DW
81
82#endif
83 // _WX_STATBMP_H_