X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ea1ad04b434f92c1269e6dde222a77698d6f873c..7a82dabcc7be89b73f1b15ac890ae776dd6f2bd2:/src/univ/button.cpp?ds=sidebyside diff --git a/src/univ/button.cpp b/src/univ/button.cpp index eaf7fea91b..b06789a25d 100644 --- a/src/univ/button.cpp +++ b/src/univ/button.cpp @@ -39,6 +39,7 @@ #include "wx/univ/renderer.h" #include "wx/univ/inphand.h" #include "wx/univ/theme.h" +#include "wx/univ/colschem.h" // ---------------------------------------------------------------------------- // constants @@ -136,12 +137,14 @@ wxSize wxButton::DoGetBestClientSize() const // for compatibility with other ports, the buttons default size is never // less than the standard one +#ifndef __WXX11__ if ( !(GetWindowStyle() & wxBU_EXACTFIT) ) { wxSize szDef = GetDefaultSize(); if ( width < szDef.x ) width = szDef.x; } +#endif return wxSize(width, height); } @@ -160,6 +163,30 @@ void wxButton::DoDraw(wxControlRenderer *renderer) renderer->DrawLabel(m_bitmap, m_marginBmpX, m_marginBmpY); } +bool wxButton::DoDrawBackground(wxDC& dc) +{ + wxRect rect; + wxSize size = GetSize(); + rect.width = size.x; + rect.height = size.y; + + if ( GetBackgroundBitmap().Ok() ) + { + // get the bitmap and the flags + int alignment; + wxStretch stretch; + wxBitmap bmp = GetBackgroundBitmap(&alignment, &stretch); + wxControlRenderer::DrawBitmap(dc, bmp, rect, alignment, stretch); + } + else + { + m_renderer->DrawButtonSurface(dc, wxTHEME_BG_COLOUR(this), + rect, GetStateFlags()); + } + + return TRUE; +} + // ---------------------------------------------------------------------------- // input processing // ---------------------------------------------------------------------------- @@ -236,9 +263,9 @@ void wxButton::SetImageLabel(const wxBitmap& bitmap) void wxButton::SetImageMargins(wxCoord x, wxCoord y) { - m_marginBmpX = x; - m_marginBmpY = y; - + m_marginBmpX = x + 2; + m_marginBmpY = y + 2; + SetBestSize(wxDefaultSize); }