Add common implementations of wxStaticBitmap icon methods
Instead of defining them, slightly differently, in all the non-MSW ports, define them once in wxStaticBitmapBase. No real changes, this is just a simplification.
This commit is contained in:
@@ -44,18 +44,6 @@ public:
|
||||
|
||||
virtual wxBitmap GetBitmap() const wxOVERRIDE { return m_bitmap; }
|
||||
|
||||
virtual void SetIcon(const wxIcon& icon) wxOVERRIDE
|
||||
{
|
||||
m_bitmap.CopyFromIcon(icon);
|
||||
SetInitialSize(GetBitmapSize());
|
||||
Refresh();
|
||||
}
|
||||
|
||||
#if defined(__WXGTK20__) || defined(__WXMAC__)
|
||||
// icons and bitmaps are really the same thing in wxGTK and wxMac
|
||||
wxIcon GetIcon() const wxOVERRIDE { return (const wxIcon &)m_bitmap; }
|
||||
#endif
|
||||
|
||||
virtual void SetScaleMode(ScaleMode scaleMode) wxOVERRIDE
|
||||
{
|
||||
m_scaleMode = scaleMode;
|
||||
|
@@ -34,18 +34,9 @@ public:
|
||||
long style = 0,
|
||||
const wxString& name = wxASCII_STR(wxStaticBitmapNameStr));
|
||||
|
||||
virtual void SetIcon(const wxIcon& icon) wxOVERRIDE { SetBitmap( icon ); }
|
||||
virtual void SetBitmap( const wxBitmap& bitmap ) wxOVERRIDE;
|
||||
virtual wxBitmap GetBitmap() const wxOVERRIDE { return m_bitmap; }
|
||||
|
||||
// for compatibility with wxMSW
|
||||
wxIcon GetIcon() const wxOVERRIDE
|
||||
{
|
||||
// don't use wxDynamicCast, icons and bitmaps are really the same thing
|
||||
// in wxGTK
|
||||
return (const wxIcon &)m_bitmap;
|
||||
}
|
||||
|
||||
static wxVisualAttributes
|
||||
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
||||
|
||||
|
@@ -34,18 +34,9 @@ public:
|
||||
long style = 0,
|
||||
const wxString& name = wxASCII_STR(wxStaticBitmapNameStr));
|
||||
|
||||
virtual void SetIcon(const wxIcon& icon) { SetBitmap( icon ); }
|
||||
virtual void SetBitmap( const wxBitmap& bitmap );
|
||||
virtual wxBitmap GetBitmap() const { return m_bitmap; }
|
||||
|
||||
// for compatibility with wxMSW
|
||||
wxIcon GetIcon() const
|
||||
{
|
||||
// don't use wxDynamicCast, icons and bitmaps are really the same thing
|
||||
// in wxGTK
|
||||
return (const wxIcon &)m_bitmap;
|
||||
}
|
||||
|
||||
static wxVisualAttributes
|
||||
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
||||
|
||||
|
@@ -48,19 +48,6 @@ public:
|
||||
|
||||
wxBitmap GetBitmap() const { return m_messageBitmap; }
|
||||
|
||||
// for compatibility with wxMSW
|
||||
wxIcon GetIcon() const
|
||||
{
|
||||
// don't use wxDynamicCast, icons and bitmaps are really the same thing
|
||||
return *(const wxIcon*)&m_messageBitmap;
|
||||
}
|
||||
|
||||
// for compatibility with wxMSW
|
||||
void SetIcon(const wxIcon& icon)
|
||||
{
|
||||
SetBitmap( icon );
|
||||
}
|
||||
|
||||
// Implementation
|
||||
virtual void ChangeBackgroundColour();
|
||||
virtual void ChangeForegroundColour();
|
||||
|
@@ -30,18 +30,6 @@ public:
|
||||
|
||||
virtual wxBitmap GetBitmap() const wxOVERRIDE { return m_bitmap; }
|
||||
|
||||
virtual void SetIcon(const wxIcon& icon) wxOVERRIDE
|
||||
{
|
||||
wxBitmap bmp;
|
||||
bmp.CopyFromIcon(icon);
|
||||
SetBitmap(bmp);
|
||||
}
|
||||
|
||||
#if defined(__WXGTK20__) || defined(__WXMAC__)
|
||||
// icons and bitmaps are really the same thing in wxGTK and wxMac
|
||||
wxIcon GetIcon() const wxOVERRIDE { return (const wxIcon &)m_bitmap; }
|
||||
#endif
|
||||
|
||||
virtual void SetScaleMode(ScaleMode scaleMode) wxOVERRIDE;
|
||||
|
||||
virtual ScaleMode GetScaleMode() const wxOVERRIDE { return m_scaleMode; }
|
||||
|
@@ -30,10 +30,8 @@ public:
|
||||
long style = 0,
|
||||
const wxString& name = wxASCII_STR(wxStaticBitmapNameStr));
|
||||
|
||||
virtual void SetIcon(const wxIcon& icon) wxOVERRIDE;
|
||||
virtual void SetBitmap(const wxBitmap& bitmap) wxOVERRIDE;
|
||||
virtual wxBitmap GetBitmap() const wxOVERRIDE;
|
||||
virtual wxIcon GetIcon() const wxOVERRIDE;
|
||||
|
||||
virtual QWidget *GetHandle() const wxOVERRIDE;
|
||||
protected:
|
||||
|
@@ -37,15 +37,12 @@ public:
|
||||
virtual ~wxStaticBitmapBase();
|
||||
|
||||
// our interface
|
||||
virtual void SetIcon(const wxIcon& icon) = 0;
|
||||
virtual void SetBitmap(const wxBitmap& bitmap) = 0;
|
||||
virtual wxBitmap GetBitmap() const = 0;
|
||||
virtual wxIcon GetIcon() const /* = 0 -- should be pure virtual */
|
||||
{
|
||||
// stub it out here for now as not all ports implement it (but they
|
||||
// should)
|
||||
return wxIcon();
|
||||
}
|
||||
|
||||
virtual void SetIcon(const wxIcon& icon);
|
||||
virtual wxIcon GetIcon() const;
|
||||
|
||||
virtual void SetScaleMode(ScaleMode WXUNUSED(scaleMode)) { }
|
||||
virtual ScaleMode GetScaleMode() const { return Scale_None; }
|
||||
|
||||
|
@@ -53,11 +53,8 @@ public:
|
||||
const wxString& name = wxASCII_STR(wxStaticBitmapNameStr));
|
||||
|
||||
virtual void SetBitmap(const wxBitmap& bitmap) wxOVERRIDE;
|
||||
virtual void SetIcon(const wxIcon& icon) wxOVERRIDE;
|
||||
virtual wxBitmap GetBitmap() const wxOVERRIDE { return m_bitmap; }
|
||||
|
||||
wxIcon GetIcon() const wxOVERRIDE;
|
||||
|
||||
virtual bool HasTransparentBackground() wxOVERRIDE { return true; }
|
||||
|
||||
protected:
|
||||
|
Reference in New Issue
Block a user