1999-07-29 01:11:30 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: statbmp.h
|
|
|
|
// Purpose: wxStaticBitmap class
|
1999-12-03 00:03:55 -05:00
|
|
|
// Author: David Webster
|
1999-07-29 01:11:30 -04:00
|
|
|
// Modified by:
|
1999-12-03 00:03:55 -05:00
|
|
|
// Created: 11/27/99
|
1999-07-29 01:11:30 -04:00
|
|
|
// RCS-ID: $Id$
|
1999-12-03 00:03:55 -05:00
|
|
|
// Copyright: (c) David Webster
|
|
|
|
// Licence: wxWindows licence
|
1999-07-29 01:11:30 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_STATBMP_H_
|
|
|
|
#define _WX_STATBMP_H_
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface "statbmp.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/control.h"
|
1999-12-03 00:03:55 -05:00
|
|
|
#include "wx/icon.h"
|
1999-07-29 01:11:30 -04:00
|
|
|
|
2001-07-06 17:45:11 -04:00
|
|
|
class WXDLLEXPORT wxStaticBitmap : public wxStaticBitmapBase
|
1999-07-29 01:11:30 -04:00
|
|
|
{
|
|
|
|
public:
|
1999-12-03 00:03:55 -05:00
|
|
|
inline wxStaticBitmap() { Init(); }
|
|
|
|
|
|
|
|
inline wxStaticBitmap( wxWindow* pParent
|
|
|
|
,wxWindowID nId
|
|
|
|
,const wxGDIImage& rLabel
|
|
|
|
,const wxPoint& rPos = wxDefaultPosition
|
|
|
|
,const wxSize& rSize = wxDefaultSize
|
|
|
|
,long lStyle = 0
|
|
|
|
,const wxString& rName = wxStaticBitmapNameStr
|
|
|
|
)
|
|
|
|
{
|
|
|
|
Create(pParent, nId, rLabel, rPos, rSize, lStyle, rName);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Create( wxWindow* pParent
|
|
|
|
,wxWindowID nId
|
|
|
|
,const wxGDIImage& rLabel
|
|
|
|
,const wxPoint& rPos = wxDefaultPosition
|
|
|
|
,const wxSize& rSize = wxDefaultSize
|
|
|
|
,long lStyle = 0
|
|
|
|
,const wxString& rName = wxStaticBitmapNameStr
|
|
|
|
);
|
|
|
|
inline virtual ~wxStaticBitmap() { Free(); }
|
|
|
|
|
|
|
|
virtual void SetIcon(const wxIcon& rIcon) { SetImage(rIcon); }
|
|
|
|
virtual void SetBitmap(const wxBitmap& rBitmap) { SetImage(rBitmap); };
|
|
|
|
|
|
|
|
// assert failure is provoked by an attempt to get an icon from bitmap or
|
|
|
|
// vice versa
|
|
|
|
const wxIcon& GetIcon() const
|
|
|
|
{ wxASSERT( m_bIsIcon ); return *(wxIcon *)m_pImage; }
|
2001-07-06 17:45:11 -04:00
|
|
|
wxBitmap GetBitmap() const
|
1999-12-03 00:03:55 -05:00
|
|
|
{ wxASSERT( !m_bIsIcon ); return *(wxBitmap *)m_pImage; }
|
|
|
|
|
|
|
|
// overriden base class virtuals
|
|
|
|
virtual bool AcceptsFocus() const { return FALSE; }
|
2001-12-17 17:56:41 -05:00
|
|
|
virtual MRESULT OS2WindowProc( WXUINT uMsg
|
|
|
|
,WXWPARAM wParam
|
|
|
|
,WXLPARAM lParam
|
|
|
|
);
|
2002-09-03 00:47:39 -04:00
|
|
|
void OnPaint(wxPaintEvent& rEvent);
|
1999-07-29 01:11:30 -04:00
|
|
|
|
1999-10-15 17:00:38 -04:00
|
|
|
protected:
|
1999-12-03 00:03:55 -05:00
|
|
|
virtual wxSize DoGetBestSize() const;
|
|
|
|
|
|
|
|
void Init() { m_bIsIcon = TRUE; m_pImage = NULL; }
|
|
|
|
void Free();
|
1999-10-15 17:00:38 -04:00
|
|
|
|
1999-12-03 00:03:55 -05:00
|
|
|
// TRUE if icon/bitmap is valid
|
|
|
|
bool ImageIsOk() const;
|
1999-10-15 17:00:38 -04:00
|
|
|
|
1999-12-03 00:03:55 -05:00
|
|
|
void SetImage(const wxGDIImage& rImage);
|
1999-08-02 00:44:01 -04:00
|
|
|
|
1999-12-03 00:03:55 -05:00
|
|
|
// we can have either an icon or a bitmap
|
|
|
|
bool m_bIsIcon;
|
|
|
|
wxGDIImage* m_pImage;
|
2001-07-06 17:45:11 -04:00
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
|
2002-09-03 00:47:39 -04:00
|
|
|
DECLARE_EVENT_TABLE()
|
2001-12-17 17:56:41 -05:00
|
|
|
}; // end of wxStaticBitmap
|
1999-07-29 01:11:30 -04:00
|
|
|
|
|
|
|
#endif
|
|
|
|
// _WX_STATBMP_H_
|