refactored common parts of DrawItem() in the base class; implemented GetTextTotal/ClientArea() there as well
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41318 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -304,6 +304,12 @@ void wxStdRenderer::DrawAntiSunkenBorder(wxDC& dc, wxRect *rect)
|
||||
DrawShadedRect(dc, rect, m_penHighlight, m_penDarkGrey);
|
||||
}
|
||||
|
||||
void wxStdRenderer::DrawFrameBorder(wxDC& dc, wxRect *rect)
|
||||
{
|
||||
DrawShadedRect(dc, rect, m_penDarkGrey, m_penHighlight);
|
||||
DrawShadedRect(dc, rect, m_penHighlight, m_penDarkGrey);
|
||||
}
|
||||
|
||||
void wxStdRenderer::DrawBorder(wxDC& dc,
|
||||
wxBorder border,
|
||||
const wxRect& rectTotal,
|
||||
@@ -493,9 +499,7 @@ void wxStdRenderer::DrawFrame(wxDC& dc,
|
||||
}
|
||||
else // no label
|
||||
{
|
||||
// just draw the complete frame
|
||||
DrawShadedRect(dc, &rectFrame, m_penDarkGrey, m_penHighlight);
|
||||
DrawShadedRect(dc, &rectFrame, m_penHighlight, m_penDarkGrey);
|
||||
DrawFrameBorder(dc, &rectFrame);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -527,6 +531,31 @@ void wxStdRenderer::DrawItem(wxDC& dc,
|
||||
}
|
||||
}
|
||||
|
||||
void wxStdRenderer::DrawCheckItemBitmap(wxDC& dc,
|
||||
const wxBitmap& bitmap,
|
||||
const wxRect& rect,
|
||||
int flags)
|
||||
{
|
||||
DrawCheckButton(dc, wxEmptyString, bitmap, rect, flags);
|
||||
}
|
||||
|
||||
void wxStdRenderer::DrawCheckItem(wxDC& dc,
|
||||
const wxString& label,
|
||||
const wxBitmap& bitmap,
|
||||
const wxRect& rect,
|
||||
int flags)
|
||||
{
|
||||
wxRect rectBitmap = rect;
|
||||
rectBitmap.width = GetCheckBitmapSize().x;
|
||||
DrawCheckItemBitmap(dc, bitmap, rectBitmap, flags);
|
||||
|
||||
wxRect rectLabel = rect;
|
||||
wxCoord shift = rectBitmap.width + 2*GetCheckItemMargin();
|
||||
rectLabel.x += shift;
|
||||
rectLabel.width -= shift;
|
||||
DrawItem(dc, label, rectLabel, flags);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// check and radio bitmaps
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -681,6 +710,32 @@ void wxStdRenderer::DrawLineWrapMark(wxDC& WXUNUSED(dc),
|
||||
// nothing by default
|
||||
}
|
||||
|
||||
int wxStdRenderer::GetTextBorderWidth(const wxTextCtrl * WXUNUSED(text)) const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
wxRect
|
||||
wxStdRenderer::GetTextTotalArea(const wxTextCtrl *text, const wxRect& rect) const
|
||||
{
|
||||
wxRect rectTotal = rect;
|
||||
rectTotal.Inflate(GetTextBorderWidth(text));
|
||||
return rectTotal;
|
||||
}
|
||||
|
||||
wxRect wxStdRenderer::GetTextClientArea(const wxTextCtrl *text,
|
||||
const wxRect& rect,
|
||||
wxCoord *extraSpaceBeyond) const
|
||||
{
|
||||
wxRect rectText = rect;
|
||||
rectText.Deflate(GetTextBorderWidth(text));
|
||||
|
||||
if ( extraSpaceBeyond )
|
||||
*extraSpaceBeyond = 0;
|
||||
|
||||
return rectText;
|
||||
}
|
||||
|
||||
#endif // wxUSE_TEXTCTRL
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user