- SetCanAddEventHandler(TRUE);
-
- wxSize newSize = size;
-
- if (m_buttonBitmap.Ok())
- {
- int border = (style & wxNO_BORDER) ? 4 : 10;
- if (newSize.x == -1)
- newSize.x = m_buttonBitmap.GetWidth()+border;
- if (newSize.y == -1)
- newSize.y = m_buttonBitmap.GetHeight()+border;
- }
-
- AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, newSize.x, newSize.y);
+ wxSize best = m_bmpNormal.Ok() ? GetBestSize() : wxSize(30, 30);
+ if( size.x != -1 ) best.x = size.x;
+ if( size.y != -1 ) best.y = size.y;
+
+ AttachWidget (parent, m_mainWidget, (WXWidget) NULL,
+ pos.x, pos.y, best.x, best.y);