1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2001-06-26 16:59:19 -04:00
|
|
|
// Name: wx/msw/statbmp.h
|
|
|
|
// Purpose: wxStaticBitmap class for wxMSW
|
1998-05-20 10:12:05 -04:00
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
1998-08-07 19:52:45 -04:00
|
|
|
// Copyright: (c) Julian Smart
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-07 19:52:45 -04:00
|
|
|
#ifndef _WX_STATBMP_H_
|
|
|
|
#define _WX_STATBMP_H_
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2003-08-09 08:38:21 -04:00
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
1999-01-31 18:30:33 -05:00
|
|
|
#pragma interface "statbmp.h"
|
1998-05-20 10:12:05 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/control.h"
|
1999-08-22 16:16:23 -04:00
|
|
|
#include "wx/icon.h"
|
1999-12-02 09:47:49 -05:00
|
|
|
#include "wx/bitmap.h"
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2005-01-21 13:15:42 -05:00
|
|
|
extern WXDLLEXPORT_DATA(const wxChar*) wxStaticBitmapNameStr;
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-03-24 18:35:16 -05:00
|
|
|
// a control showing an icon or a bitmap
|
2001-06-26 16:59:19 -04:00
|
|
|
class WXDLLEXPORT wxStaticBitmap : public wxStaticBitmapBase
|
1998-05-20 10:12:05 -04:00
|
|
|
{
|
1999-01-31 18:30:33 -05:00
|
|
|
public:
|
1999-03-24 18:35:16 -05:00
|
|
|
wxStaticBitmap() { Init(); }
|
|
|
|
|
|
|
|
wxStaticBitmap(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
1999-11-24 07:30:56 -05:00
|
|
|
const wxGDIImage& label,
|
1999-03-24 18:35:16 -05:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxString& name = wxStaticBitmapNameStr)
|
1999-01-31 18:30:33 -05:00
|
|
|
{
|
2002-12-21 09:35:18 -05:00
|
|
|
Init();
|
|
|
|
|
1999-01-31 18:30:33 -05:00
|
|
|
Create(parent, id, label, pos, size, style, name);
|
|
|
|
}
|
1999-03-24 18:35:16 -05:00
|
|
|
|
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
1999-11-24 07:30:56 -05:00
|
|
|
const wxGDIImage& label,
|
1999-03-24 18:35:16 -05:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxString& name = wxStaticBitmapNameStr);
|
|
|
|
|
|
|
|
virtual ~wxStaticBitmap() { Free(); }
|
|
|
|
|
2001-06-26 16:59:19 -04:00
|
|
|
virtual void SetIcon(const wxIcon& icon) { SetImage(&icon); }
|
|
|
|
virtual void SetBitmap(const wxBitmap& bitmap) { SetImage(&bitmap); }
|
1999-03-24 18:35:16 -05:00
|
|
|
|
|
|
|
// assert failure is provoked by an attempt to get an icon from bitmap or
|
|
|
|
// vice versa
|
2001-06-26 16:59:19 -04:00
|
|
|
wxIcon GetIcon() const
|
2002-12-21 09:35:18 -05:00
|
|
|
{
|
|
|
|
wxASSERT_MSG( m_isIcon, _T("no icon in this wxStaticBitmap") );
|
|
|
|
|
|
|
|
return *(wxIcon *)m_image;
|
|
|
|
}
|
|
|
|
|
2001-06-26 16:59:19 -04:00
|
|
|
wxBitmap GetBitmap() const
|
2002-12-21 09:35:18 -05:00
|
|
|
{
|
|
|
|
wxASSERT_MSG( !m_isIcon, _T("no bitmap in this wxStaticBitmap") );
|
|
|
|
|
|
|
|
return *(wxBitmap *)m_image;
|
|
|
|
}
|
|
|
|
|
|
|
|
// implementation only from now on
|
|
|
|
// -------------------------------
|
1999-03-24 18:35:16 -05:00
|
|
|
|
2005-02-24 03:26:50 -05:00
|
|
|
// implement base class virtuals
|
|
|
|
virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
|
|
|
|
1999-01-31 18:30:33 -05:00
|
|
|
protected:
|
2003-07-06 17:35:32 -04:00
|
|
|
virtual wxBorder GetDefaultBorder() const;
|
2004-04-07 18:41:34 -04:00
|
|
|
virtual wxSize DoGetBestSize() const;
|
2002-12-21 09:35:18 -05:00
|
|
|
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
|
1999-11-24 07:30:56 -05:00
|
|
|
|
2002-12-21 09:35:18 -05:00
|
|
|
// ctor/dtor helpers
|
2004-09-03 21:53:42 -04:00
|
|
|
void Init() { m_isIcon = true; m_image = NULL; }
|
1999-03-24 18:35:16 -05:00
|
|
|
void Free();
|
|
|
|
|
2004-09-03 21:53:42 -04:00
|
|
|
// true if icon/bitmap is valid
|
1999-03-24 18:35:16 -05:00
|
|
|
bool ImageIsOk() const;
|
|
|
|
|
2000-02-01 19:52:06 -05:00
|
|
|
void SetImage(const wxGDIImage* image);
|
2001-11-06 16:16:02 -05:00
|
|
|
void SetImageNoCopy( wxGDIImage* image );
|
1999-11-24 07:30:56 -05:00
|
|
|
|
1999-03-24 18:35:16 -05:00
|
|
|
// we can have either an icon or a bitmap
|
|
|
|
bool m_isIcon;
|
1999-11-24 07:30:56 -05:00
|
|
|
wxGDIImage *m_image;
|
2001-06-26 16:59:19 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
|
2003-01-02 18:38:11 -05:00
|
|
|
DECLARE_NO_COPY_CLASS(wxStaticBitmap)
|
1998-05-20 10:12:05 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
1998-08-07 19:52:45 -04:00
|
|
|
// _WX_STATBMP_H_
|