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
This commit is contained in:
Vadim Zeitlin 2014-09-23 17:45:10 +00:00
parent db2ecf57cc
commit 01c1dde264
5 changed files with 13 additions and 19 deletions

View File

@ -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() )
{

View File

@ -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);
}

View File

@ -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 );
}
}

View File

@ -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<int>(style) == wxDEFAULT ? wxFONTSTYLE_NORMAL : style;
m_weight = static_cast<int>(weight) == wxDEFAULT ? wxFONTWEIGHT_NORMAL : weight;
m_underlined = underlined;
m_strikethrough = strikethrough;

View File

@ -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();