X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f90d461a37856fab62b89fe7c3f7e7d5f2dab4c2..be88a6ade981b99d55fa1da20cd1a12be4a075f2:/src/univ/button.cpp diff --git a/src/univ/button.cpp b/src/univ/button.cpp index 23a4d96eea..4bde5f3b96 100644 --- a/src/univ/button.cpp +++ b/src/univ/button.cpp @@ -34,11 +34,13 @@ #include "wx/dcscreen.h" #include "wx/button.h" #include "wx/validate.h" + #include "wx/settings.h" #endif #include "wx/univ/renderer.h" #include "wx/univ/inphand.h" #include "wx/univ/theme.h" +#include "wx/univ/colschem.h" // ---------------------------------------------------------------------------- // constants @@ -135,15 +137,16 @@ 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) ) + // less than the standard one, but not when display not PDAs. + if (wxSystemSettings::GetScreenType() > wxSYS_SCREEN_PDA) { - wxSize szDef = GetDefaultSize(); - if ( width < szDef.x ) - width = szDef.x; + if ( !(GetWindowStyle() & wxBU_EXACTFIT) ) + { + wxSize szDef = GetDefaultSize(); + if ( width < szDef.x ) + width = szDef.x; + } } -#endif return wxSize(width, height); } @@ -162,6 +165,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 // ----------------------------------------------------------------------------