- // reuse the current size (as wxWindow does) instead of using some
- // arbitrary default size (as wxControl, our immediate base class, does)
- return wxWindow::DoGetBestSize();
+ if ( ImageIsOk() )
+ {
+ wxSize best(m_image->GetWidth(), m_image->GetHeight());
+ CacheBestSize(best);
+ return best;
+ }
+
+ // this is completely arbitrary
+ return wxSize(16, 16);
+}
+
+#ifndef __WXWINCE__
+
+void wxStaticBitmap::DoPaintManually(wxPaintEvent& WXUNUSED(event))
+{
+ wxPaintDC dc(this);
+
+ const wxSize size(GetSize());
+ const wxBitmap bmp(GetBitmap());
+
+ // Clear the background: notice that we're supposed to be transparent, so
+ // use the parent background colour if we don't have our own instead of
+ // falling back to the default
+ const wxWindow *win = UseBgCol() ? this : GetParent();
+ dc.SetBrush(win->GetBackgroundColour());
+ dc.SetPen(*wxTRANSPARENT_PEN);
+ dc.DrawRectangle(0, 0, size.GetWidth(), size.GetHeight());
+
+ // Draw the image in the middle
+ dc.DrawBitmap(bmp,
+ (size.GetWidth() - bmp.GetWidth()) / 2,
+ (size.GetHeight() - bmp.GetHeight()) / 2,
+ true /* use mask */);