X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/561955046eefec83345402eedea28cb31a10f9c6..3225a4b8b8656f25dac6cb20684a3c2c273cf796:/src/univ/stdrend.cpp?ds=sidebyside diff --git a/src/univ/stdrend.cpp b/src/univ/stdrend.cpp index 6d7040a705..64e7903504 100644 --- a/src/univ/stdrend.cpp +++ b/src/univ/stdrend.cpp @@ -151,7 +151,7 @@ wxStdRenderer::ArrowDirection wxStdRenderer::GetArrowDirection(wxDirection dir) return Arrow_Down; default: - wxFAIL_MSG(_T("unknown arrow direction")); + wxFAIL_MSG(wxT("unknown arrow direction")); } return Arrow_Max; @@ -169,7 +169,7 @@ void wxStdRenderer::DrawBackground(wxDC& dc, { wxColour colBg; - if (col.Ok()) + if (col.IsOk()) { colBg = col; } @@ -199,7 +199,7 @@ void wxStdRenderer::DrawButtonSurface(wxDC& dc, // ---------------------------------------------------------------------------- void -wxStdRenderer::DrawFocusRect(wxDC& dc, const wxRect& rect, int WXUNUSED(flags)) +wxStdRenderer::DrawFocusRect(wxWindow* WXUNUSED(win), wxDC& dc, const wxRect& rect, int WXUNUSED(flags)) { // draw the pixels manually because the "dots" in wxPen with wxDOT style // may be short traits and not really dots @@ -257,6 +257,8 @@ void wxStdRenderer::DrawButtonLabel(wxDC& dc, int indexAccel, wxRect *rectBounds) { + wxDCTextColourChanger clrChanger(dc); + wxRect rectLabel = rect; if ( !label.empty() && (flags & wxCONTROL_DISABLED) ) { @@ -267,13 +269,13 @@ void wxStdRenderer::DrawButtonLabel(wxDC& dc, } // draw shadow of the text - dc.SetTextForeground(m_penHighlight.GetColour()); + clrChanger.Set(m_penHighlight.GetColour()); wxRect rectShadow = rect; rectShadow.Offset(1, 1); dc.DrawLabel(label, rectShadow, alignment, indexAccel); // make the main label text grey - dc.SetTextForeground(m_penDarkGrey.GetColour()); + clrChanger.Set(m_penDarkGrey.GetColour()); if ( flags & wxCONTROL_FOCUSED ) { @@ -288,7 +290,7 @@ void wxStdRenderer::DrawButtonLabel(wxDC& dc, { rectLabel.Inflate(-1); - DrawFocusRect(dc, rectLabel); + DrawFocusRect(NULL, dc, rectLabel); } } @@ -411,13 +413,17 @@ void wxStdRenderer::DrawBorder(wxDC& dc, switch ( border ) { case wxBORDER_SUNKEN: + case wxBORDER_THEME: DrawSunkenBorder(dc, &rect); break; + // wxBORDER_DOUBLE and wxBORDER_THEME are currently the same value. +#if 0 case wxBORDER_DOUBLE: DrawAntiSunkenBorder(dc, &rect); DrawExtraBorder(dc, &rect); break; +#endif case wxBORDER_STATIC: DrawStaticBorder(dc, &rect); @@ -432,7 +438,7 @@ void wxStdRenderer::DrawBorder(wxDC& dc, break; default: - wxFAIL_MSG(_T("unknown border type")); + wxFAIL_MSG(wxT("unknown border type")); // fall through case wxBORDER_DEFAULT: @@ -456,15 +462,16 @@ wxRect wxStdRenderer::GetBorderDimensions(wxBorder border) const case wxBORDER_RAISED: case wxBORDER_SUNKEN: + case wxBORDER_THEME: width = 2; break; - +#if 0 case wxBORDER_DOUBLE: width = 3; break; - +#endif default: - wxFAIL_MSG(_T("unknown border type")); + wxFAIL_MSG(wxT("unknown border type")); // fall through case wxBORDER_DEFAULT: @@ -630,7 +637,7 @@ void wxStdRenderer::DrawItem(wxDC& dc, if ( flags & wxCONTROL_FOCUSED ) { - DrawFocusRect(dc, rect, flags); + DrawFocusRect(NULL, dc, rect, flags); } } @@ -671,9 +678,10 @@ void wxStdRenderer::DrawCheckButton(wxDC& dc, wxAlignment align, int indexAccel) { - wxBitmap bmp(bitmap.Ok() ? bitmap : GetCheckBitmap(flags)); - - DrawCheckOrRadioButton(dc, label, bmp, rect, flags, align, indexAccel); + if (bitmap.IsOk()) + DrawCheckOrRadioButton(dc, label, bitmap, rect, flags, align, indexAccel); + else + DrawCheckOrRadioButton(dc, label, GetCheckBitmap(flags), rect, flags, align, indexAccel); } void wxStdRenderer::DrawRadioButton(wxDC& dc, @@ -684,9 +692,11 @@ void wxStdRenderer::DrawRadioButton(wxDC& dc, wxAlignment align, int indexAccel) { - wxBitmap bmp(bitmap.Ok() ? bitmap : GetRadioBitmap(flags)); + if (bitmap.IsOk()) + DrawCheckOrRadioButton(dc, label, bitmap, rect, flags, align, indexAccel); + else + DrawCheckOrRadioButton(dc, label, GetRadioBitmap(flags), rect, flags, align, indexAccel); - DrawCheckOrRadioButton(dc, label, bmp, rect, flags, align, indexAccel); } void wxStdRenderer::DrawCheckOrRadioButton(wxDC& dc, @@ -852,7 +862,7 @@ wxSize wxStdRenderer::GetStatusBarBorders() const wxRect flat = GetBorderDimensions(wxBORDER_STATIC); wxASSERT_MSG( raised.x == raised.width && raised.y == raised.height && flat.x == flat.width && flat.y == flat.height, - _T("this code expects uniform borders, you must override GetStatusBarBorders") ); + wxT("this code expects uniform borders, you must override GetStatusBarBorders") ); // take the larger of flat/raised values: wxSize border(wxMax(raised.x, flat.x), wxMax(raised.y, flat.y)); @@ -882,6 +892,8 @@ void wxStdRenderer::DrawStatusField(wxDC& dc, DrawBorder(dc, wxBORDER_RAISED, rect, flags, &rectIn); else if ( style != wxSB_FLAT ) DrawBorder(dc, wxBORDER_STATIC, rect, flags, &rectIn); + else + rectIn = rect; rectIn.Deflate(GetStatusBarFieldMargins()); @@ -1136,7 +1148,7 @@ void wxStdRenderer::DrawFrameIcon(wxDC& dc, const wxIcon& icon, int flags) { - if ( icon.Ok() ) + if ( icon.IsOk() ) { wxRect r = GetFrameClientArea(rect, flags & ~wxTOPLEVEL_TITLEBAR); dc.DrawIcon(icon, r.x, r.y); @@ -1162,7 +1174,7 @@ void wxStdRenderer::DrawFrameButton(wxDC& dc, } wxBitmap bmp = GetFrameButtonBitmap(idx); - if ( !bmp.Ok() ) + if ( !bmp.IsOk() ) return; wxRect rectBtn(x, y, FRAME_BUTTON_WIDTH, FRAME_BUTTON_HEIGHT);