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