X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dfe1eee3bb9ecde8c4490ea69c07b5030d69530c..81b41c03c6bcbffa9293a0e280729ffaaf9ef2c7:/src/motif/bmpbuttn.cpp diff --git a/src/motif/bmpbuttn.cpp b/src/motif/bmpbuttn.cpp index 358149b072..54d735b856 100644 --- a/src/motif/bmpbuttn.cpp +++ b/src/motif/bmpbuttn.cpp @@ -13,10 +13,22 @@ #pragma implementation "bmpbuttn.h" #endif +#ifdef __VMS +#define XtScreen XTSCREEN +#endif + +#include "wx/defs.h" + #include "wx/bmpbuttn.h" +#ifdef __VMS__ +#pragma message disable nosimpint +#endif #include #include +#ifdef __VMS__ +#pragma message enable nosimpint +#endif #include "wx/motif/private.h" @@ -25,9 +37,7 @@ void wxButtonCallback (Widget w, XtPointer clientData, XtPointer ptr); Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap ); -#if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton) -#endif wxBitmapButton::wxBitmapButton() { @@ -103,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; } @@ -252,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; +} +