From 01c1dde264490a74ca8db1951280d5d26392030b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 23 Sep 2014 17:45:10 +0000 Subject: [PATCH] Avoid deprecated wxPen/wxBrush/wxFont API in wxX11 code. Also simplify the code by relying on implicit constructors of wxPen and wxBrush from wxColour. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77873 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/univ/ctrlrend.cpp | 4 ++-- src/univ/stdrend.cpp | 3 +-- src/univ/themes/metal.cpp | 10 +++++----- src/x11/font.cpp | 4 ++-- src/x11/settings.cpp | 11 +++-------- 5 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/univ/ctrlrend.cpp b/src/univ/ctrlrend.cpp index a58019ad05..c8e828edfd 100644 --- a/src/univ/ctrlrend.cpp +++ b/src/univ/ctrlrend.cpp @@ -438,7 +438,7 @@ void wxControlRenderer::DrawCheckItems(const wxCheckListBox *lbox, void wxControlRenderer::DrawProgressBar(const wxGauge *gauge) { // draw background - m_dc.SetBrush(wxBrush(m_window->GetBackgroundColour(), wxSOLID)); + m_dc.SetBrush(m_window->GetBackgroundColour()); m_dc.SetPen(*wxTRANSPARENT_PEN); m_dc.DrawRectangle(m_rect); @@ -458,7 +458,7 @@ void wxControlRenderer::DrawProgressBar(const wxGauge *gauge) wxColour col = m_window->UseFgCol() ? m_window->GetForegroundColour() : wxTHEME_COLOUR(GAUGE); - m_dc.SetBrush(wxBrush(col, wxSOLID)); + m_dc.SetBrush(col); if ( gauge->IsSmooth() ) { diff --git a/src/univ/stdrend.cpp b/src/univ/stdrend.cpp index 7f5451855d..d434aac752 100644 --- a/src/univ/stdrend.cpp +++ b/src/univ/stdrend.cpp @@ -71,8 +71,7 @@ wxStdRenderer::wxStdRenderer(const wxColourScheme *scheme) void wxStdRenderer::DrawSolidRect(wxDC& dc, const wxColour& col, const wxRect& rect) { - wxBrush brush(col, wxSOLID); - dc.SetBrush(brush); + dc.SetBrush(col); dc.SetPen(*wxTRANSPARENT_PEN); dc.DrawRectangle(rect); } diff --git a/src/univ/themes/metal.cpp b/src/univ/themes/metal.cpp index 2f938aa18d..bf4ba36648 100644 --- a/src/univ/themes/metal.cpp +++ b/src/univ/themes/metal.cpp @@ -180,10 +180,10 @@ wxMetalRenderer::wxMetalRenderer(wxRenderer *renderer, wxColourScheme *scheme) : wxDelegateRenderer(renderer) { // init colours and pens - m_penBlack = wxPen(wxSCHEME_COLOUR(scheme, SHADOW_DARK), 0, wxSOLID); - m_penDarkGrey = wxPen(wxSCHEME_COLOUR(scheme, SHADOW_OUT), 0, wxSOLID); - m_penLightGrey = wxPen(wxSCHEME_COLOUR(scheme, SHADOW_IN), 0, wxSOLID); - m_penHighlight = wxPen(wxSCHEME_COLOUR(scheme, SHADOW_HIGHLIGHT), 0, wxSOLID); + m_penBlack = wxPen(wxSCHEME_COLOUR(scheme, SHADOW_DARK)); + m_penDarkGrey = wxPen(wxSCHEME_COLOUR(scheme, SHADOW_OUT)); + m_penLightGrey = wxPen(wxSCHEME_COLOUR(scheme, SHADOW_IN)); + m_penHighlight = wxPen(wxSCHEME_COLOUR(scheme, SHADOW_HIGHLIGHT)); // init the arrow bitmaps static const size_t ARROW_WIDTH = 7; @@ -539,7 +539,7 @@ void wxMetalRenderer::DrawMetal(wxDC &dc, const wxRect &rect ) for (int y = rect.y; y < rect.height+rect.y; y++) { unsigned char intens = (unsigned char)(230 + 80 * (rect.y-y) / rect.height); - dc.SetBrush( wxBrush( wxColour(intens,intens,intens), wxSOLID ) ); + dc.SetBrush(wxColour(intens, intens, intens)); dc.DrawRectangle( rect.x, y, rect.width, 1 ); } } diff --git a/src/x11/font.cpp b/src/x11/font.cpp index 0c0deed637..38865014af 100644 --- a/src/x11/font.cpp +++ b/src/x11/font.cpp @@ -182,8 +182,8 @@ void wxFontRefData::Init(int pointSize, m_faceName = faceName; // we accept both wxDEFAULT and wxNORMAL here - should we? - m_style = style == wxDEFAULT ? wxFONTSTYLE_NORMAL : style; - m_weight = weight == wxDEFAULT ? wxFONTWEIGHT_NORMAL : weight; + m_style = static_cast(style) == wxDEFAULT ? wxFONTSTYLE_NORMAL : style; + m_weight = static_cast(weight) == wxDEFAULT ? wxFONTWEIGHT_NORMAL : weight; m_underlined = underlined; m_strikethrough = strikethrough; diff --git a/src/x11/settings.cpp b/src/x11/settings.cpp index 22353ee721..c65654705f 100644 --- a/src/x11/settings.cpp +++ b/src/x11/settings.cpp @@ -43,18 +43,13 @@ wxFont wxSystemSettingsNative::GetFont(wxSystemFont index) switch (index) { case wxSYS_SYSTEM_FIXED_FONT: - { - return wxFont(12, wxMODERN, wxNORMAL, wxNORMAL, FALSE); - break; - } + return wxFontInfo(12).Family(wxFONTFAMILY_MODERN); + case wxSYS_DEVICE_DEFAULT_FONT: case wxSYS_SYSTEM_FONT: case wxSYS_DEFAULT_GUI_FONT: default: - { - return wxFont(12, wxSWISS, wxNORMAL, wxNORMAL, FALSE); - break; - } + return wxFontInfo(12).Family(wxFONTFAMILY_SWISS); } return wxFont();