]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/os2/statbmp.h
added wxConvFileName which is a variable, not define as wxConvFile; added comments...
[wxWidgets.git] / include / wx / os2 / statbmp.h
... / ...
CommitLineData
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
22class WXDLLEXPORT wxStaticBitmap : public wxStaticBitmapBase
23{
24 public:
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; }
56 wxBitmap GetBitmap() const
57 { wxASSERT( !m_bIsIcon ); return *(wxBitmap *)m_pImage; }
58
59 // overriden base class virtuals
60 virtual bool AcceptsFocus() const { return FALSE; }
61 virtual MRESULT OS2WindowProc( WXUINT uMsg
62 ,WXWPARAM wParam
63 ,WXLPARAM lParam
64 );
65 void OnPaint(wxPaintEvent& rEvent);
66
67protected:
68 virtual wxSize DoGetBestSize() const;
69
70 void Init() { m_bIsIcon = TRUE; m_pImage = NULL; }
71 void Free();
72
73 // TRUE if icon/bitmap is valid
74 bool ImageIsOk() const;
75
76 void SetImage(const wxGDIImage& rImage);
77
78 // we can have either an icon or a bitmap
79 bool m_bIsIcon;
80 wxGDIImage* m_pImage;
81private:
82 DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
83 DECLARE_EVENT_TABLE()
84}; // end of wxStaticBitmap
85
86#endif
87 // _WX_STATBMP_H_