X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ad81651f00edc6f489d9b6a0839d316a964fd521..5e3841bf8069fbcc2b1da3ef36af4f569c604265:/src/motif/bmpbuttn.cpp diff --git a/src/motif/bmpbuttn.cpp b/src/motif/bmpbuttn.cpp index 8abd0e2167..54d735b856 100644 --- a/src/motif/bmpbuttn.cpp +++ b/src/motif/bmpbuttn.cpp @@ -13,6 +13,12 @@ #pragma implementation "bmpbuttn.h" #endif +#ifdef __VMS +#define XtScreen XTSCREEN +#endif + +#include "wx/defs.h" + #include "wx/bmpbuttn.h" #ifdef __VMS__ @@ -107,7 +113,19 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit (XtPointer) this); SetCanAddEventHandler(TRUE); - AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y); + + 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); return TRUE; } @@ -256,3 +274,23 @@ void wxBitmapButton::ChangeBackgroundColour() // Must reset the bitmaps since the colours have changed. DoSetBitmap(); } + +wxSize wxBitmapButton::DoGetBestSize() const +{ + wxSize ret( 30,30 ); + + if (m_buttonBitmap.Ok()) + { + int border = (GetWindowStyle() & wxNO_BORDER) ? 4 : 10; + ret.x = m_buttonBitmap.GetWidth()+border; + ret.y = m_buttonBitmap.GetHeight()+border; + } + + if (!HasFlag(wxBU_EXACTFIT)) + { + if (ret.x < 80) ret.x = 80; + } + + return ret; +} +