Fix setting size of wxGenericStaticBitmap
We must call SetInitialSize() in Create() in order to take the size argument passed to ctor/Create() into account -- it was completely ignored previously. But calling SetBitmap() must not change the initial size, as it can also be done later, so just change the current size there instead (which is consistent with wxMSW version and original behaviour, so keep it like this, even though it's not totally clear if all ports do it). Remove the now unused wxGenericStaticBitmap::GetBitmapSize().
This commit is contained in:
@@ -34,7 +34,13 @@ bool wxGenericStaticBitmap::Create(wxWindow *parent, wxWindowID id,
|
||||
wxDefaultValidator, name))
|
||||
return false;
|
||||
m_scaleMode = Scale_None;
|
||||
SetBitmap(bitmap);
|
||||
|
||||
// Don't call SetBitmap() here, as it changes the size and refreshes the
|
||||
// window unnecessarily, when we don't need either of these side effects
|
||||
// here.
|
||||
m_bitmap = bitmap;
|
||||
SetInitialSize(size);
|
||||
|
||||
Bind(wxEVT_PAINT, &wxGenericStaticBitmap::OnPaint, this);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user