From da1f0e87e2c24ad9ee7647261dd986ad3e8d60eb Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Fri, 28 Dec 2007 22:12:32 +0000 Subject: [PATCH] Restore MSW's colour picker git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50938 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/clrpickerg.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/generic/clrpickerg.cpp b/src/generic/clrpickerg.cpp index 4c1a588490..80de3e15a6 100644 --- a/src/generic/clrpickerg.cpp +++ b/src/generic/clrpickerg.cpp @@ -51,7 +51,7 @@ bool wxGenericColourButton::Create( wxWindow *parent, wxWindowID id, // create this button if (!wxBitmapButton::Create( parent, id, m_bitmap, pos, - size, style, validator, name )) + size, style | wxBU_AUTODRAW, validator, name )) { wxFAIL_MSG( wxT("wxGenericColourButton creation failed") ); return false; @@ -105,19 +105,27 @@ void wxGenericColourButton::UpdateColour() dc.SetPen( *wxTRANSPARENT_PEN ); dc.SetBrush( wxBrush(m_colour) ); dc.DrawRectangle( 0,0,m_bitmap.GetWidth(),m_bitmap.GetHeight() ); + +// if ( HasFlag(wxCLRP_SHOW_LABEL) ) + { + wxColour col( ~m_colour.Red(), ~m_colour.Green(), ~m_colour.Blue() ); + dc.SetTextForeground( col ); + dc.SetFont( GetFont() ); + dc.DrawText( m_colour.GetAsString(wxC2S_HTML_SYNTAX), 0, 0 ); + } + dc.SelectObject( wxNullBitmap ); SetBitmapLabel( m_bitmap ); - -#if 0 - if ( HasFlag(wxCLRP_SHOW_LABEL) ) - SetLabel(m_colour.GetAsString(wxC2S_HTML_SYNTAX)); -#endif } wxSize wxGenericColourButton::DoGetBestSize() const { wxSize sz(wxBitmapButton::DoGetBestSize()); +#ifdef __WXMAC__ sz.y += 6; +#else + sz.y += 2; +#endif sz.x += 30; if ( HasFlag(wxCLRP_SHOW_LABEL) ) return sz; -- 2.45.2