2011-03-20 18:05:19 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/generic/statbmpg.h
|
|
|
|
// Purpose: wxGenericStaticBitmap header
|
|
|
|
// Author: Marcin Wojdyr, Stefan Csomor
|
|
|
|
// Created: 2008-06-16
|
|
|
|
// Copyright: wxWidgets developers
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_GENERIC_STATBMP_H_
|
|
|
|
#define _WX_GENERIC_STATBMP_H_
|
|
|
|
|
|
|
|
#include "wx/statbmp.h"
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_CORE wxGenericStaticBitmap : public wxStaticBitmapBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxGenericStaticBitmap() {}
|
|
|
|
wxGenericStaticBitmap(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxBitmap& bitmap,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxString& name = wxStaticBitmapNameStr)
|
|
|
|
{
|
|
|
|
Create(parent, id, bitmap, pos, size, style, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxBitmap& bitmap,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxString& name = wxStaticBitmapNameStr);
|
|
|
|
|
2016-06-26 05:25:29 +00:00
|
|
|
virtual void SetBitmap(const wxBitmap& bitmap) wxOVERRIDE
|
2011-03-20 18:05:19 +00:00
|
|
|
{
|
|
|
|
m_bitmap = bitmap;
|
|
|
|
SetInitialSize(GetBitmapSize());
|
|
|
|
Refresh();
|
|
|
|
}
|
|
|
|
|
2016-06-26 05:25:29 +00:00
|
|
|
virtual wxBitmap GetBitmap() const wxOVERRIDE { return m_bitmap; }
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2016-06-26 05:25:29 +00:00
|
|
|
virtual void SetIcon(const wxIcon& icon) wxOVERRIDE
|
2011-03-20 18:05:19 +00:00
|
|
|
{
|
|
|
|
m_bitmap.CopyFromIcon(icon);
|
|
|
|
SetInitialSize(GetBitmapSize());
|
|
|
|
Refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(__WXGTK20__) || defined(__WXMAC__)
|
|
|
|
// icons and bitmaps are really the same thing in wxGTK and wxMac
|
2016-06-26 05:25:29 +00:00
|
|
|
wxIcon GetIcon() const wxOVERRIDE { return (const wxIcon &)m_bitmap; }
|
2011-03-20 18:05:19 +00:00
|
|
|
#endif
|
|
|
|
|
2016-06-26 05:25:29 +00:00
|
|
|
virtual void SetScaleMode(ScaleMode scaleMode) wxOVERRIDE
|
|
|
|
{
|
|
|
|
m_scaleMode = scaleMode;
|
|
|
|
Refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ScaleMode GetScaleMode() const wxOVERRIDE { return m_scaleMode; }
|
2011-03-20 18:05:19 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
wxSize GetBitmapSize()
|
|
|
|
{
|
2013-12-08 20:37:10 +00:00
|
|
|
return m_bitmap.IsOk() ? m_bitmap.GetScaledSize()
|
|
|
|
: wxSize(16, 16); // this is completely arbitrary
|
2011-03-20 18:05:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void OnPaint(wxPaintEvent& event);
|
|
|
|
|
|
|
|
wxBitmap m_bitmap;
|
2016-06-26 05:25:29 +00:00
|
|
|
ScaleMode m_scaleMode;
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2016-06-26 05:25:29 +00:00
|
|
|
wxDECLARE_DYNAMIC_CLASS(wxGenericStaticBitmap);
|
2011-03-20 18:05:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif //_WX_GENERIC_STATBMP_H_
|