+ int n;
+ for ( n = 0; n < (int)WXSIZEOF(stdSizes); n++ )
+ {
+ const int sizeStd = stdSizes[n];
+ if ( width > sizeStd || height > sizeStd )
+ {
+ // it will become -1 if the bitmap is larger than the biggest
+ // supported size, this is intentional
+ n--;
+
+ break;
+ }
+ }
+
+ if ( n != -1 )
+ {
+ const int sizeStd = stdSizes[n];
+ if ( width != sizeStd || height != sizeStd )
+ {
+ wxASSERT_MSG( width <= sizeStd && height <= sizeStd,
+ _T("bitmap shouldn't be cropped") );
+
+ newBmp.Create(sizeStd, sizeStd);
+ wxMemoryDC dcMem;
+ dcMem.SelectObject(newBmp);
+ dcMem.Clear();
+
+ dcMem.DrawBitmap(bitmap,
+ (sizeStd - width)/2, (sizeStd-height)/2,
+ true);
+ }
+ }
+ //else: let the system rescale the bitmap
+
+ return newBmp;
+}
+
+//---------------------------------------------------------------------------
+
+bool wxBitmapButton::Create( wxWindow *parent,
+ wxWindowID id, const wxBitmap& bitmap,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxValidator& validator,
+ const wxString& name )
+{
+ m_macIsUserPane = false;
+