- const int sizeStd = stdSizes[n];
- if ( width != sizeStd || height != sizeStd )
- {
- wxASSERT_MSG( width <= sizeStd && height <= sizeStd,
- _T("bitmap shouldn't be cropped") );
-
- wxImage square_image = bitmap.ConvertToImage();
- newBmp = square_image.Size
- (
- wxSize(sizeStd, sizeStd),
- wxPoint((sizeStd - width)/2, (sizeStd-height)/2)
- );
- }
+ // unfortunately we can't avoid the ugly resizing problem mentioned
+ // above if a bitmap of supported size was used initially but was
+ // replaced with another one later as the control was already created
+ // as an icon control (although maybe we ought to recreate it?)
+ ControlButtonContentInfo info;
+ InitButtonContentInfo(info, bitmap);
+
+ if ( info.contentType == kControlContentIconRef )
+ SetData(kControlIconPart, kControlIconContentTag, info);
+ else if ( info.contentType != kControlNoContent )
+ SetData(kControlButtonPart, kControlBevelButtonContentTag, info);
+
+ wxMacReleaseBitmapButton(&info);