use SS_CENTERIMAGE to prevent wxStaticBitmap from stretching its bitmap; also a face lift for control creation code

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18388 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2002-12-21 14:35:18 +00:00
parent 168954a1d1
commit 46a5e01e86
3 changed files with 59 additions and 63 deletions

View File

@@ -36,6 +36,8 @@ public:
long style = 0,
const wxString& name = wxStaticBitmapNameStr)
{
Init();
Create(parent, id, label, pos, size, style, name);
}
@@ -55,11 +57,23 @@ public:
// assert failure is provoked by an attempt to get an icon from bitmap or
// vice versa
wxIcon GetIcon() const
{ wxASSERT( m_isIcon ); return *(wxIcon *)m_image; }
wxBitmap GetBitmap() const
{ wxASSERT( !m_isIcon ); return *(wxBitmap *)m_image; }
{
wxASSERT_MSG( m_isIcon, _T("no icon in this wxStaticBitmap") );
// IMPLEMENTATION
return *(wxIcon *)m_image;
}
wxBitmap GetBitmap() const
{
wxASSERT_MSG( !m_isIcon, _T("no bitmap in this wxStaticBitmap") );
return *(wxBitmap *)m_image;
}
// implementation only from now on
// -------------------------------
// implement base class virtuals
#ifdef __WIN16__
virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
#endif // __WIN16__
@@ -67,7 +81,9 @@ public:
protected:
virtual wxSize DoGetBestSize() const;
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
// ctor/dtor helpers
void Init() { m_isIcon = TRUE; m_image = NULL; }
void Free();