Removed Vadim's surplus code in clipboard.
wxTreeCtrl now creates its two font in the constructor. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4457 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -523,6 +523,13 @@ void wxTreeCtrl::Init()
|
||||
m_dragCount = 0;
|
||||
|
||||
m_renameTimer = new wxTreeRenameTimer( this );
|
||||
|
||||
m_normalFont = wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT );
|
||||
m_boldFont = wxFont( m_normalFont.GetPointSize(),
|
||||
m_normalFont.GetFamily(),
|
||||
m_normalFont.GetStyle(),
|
||||
wxBOLD,
|
||||
m_normalFont.GetUnderlined());
|
||||
}
|
||||
|
||||
bool wxTreeCtrl::Create(wxWindow *parent, wxWindowID id,
|
||||
@@ -1406,28 +1413,8 @@ int wxTreeCtrl::GetLineHeight(wxGenericTreeItem *item) const
|
||||
|
||||
void wxTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
|
||||
{
|
||||
// render bold items in bold
|
||||
wxFont fontOld;
|
||||
wxFont fontNew;
|
||||
|
||||
if (item->IsBold())
|
||||
{
|
||||
fontOld = dc.GetFont();
|
||||
if (fontOld.Ok())
|
||||
{
|
||||
// VZ: is there any better way to make a bold variant of old font?
|
||||
fontNew = wxFont( fontOld.GetPointSize(),
|
||||
fontOld.GetFamily(),
|
||||
fontOld.GetStyle(),
|
||||
wxBOLD,
|
||||
fontOld.GetUnderlined());
|
||||
dc.SetFont(fontNew);
|
||||
}
|
||||
else
|
||||
{
|
||||
wxFAIL_MSG(wxT("wxDC::GetFont() failed!"));
|
||||
}
|
||||
}
|
||||
dc.SetFont(m_boldFont);
|
||||
|
||||
long text_w = 0;
|
||||
long text_h = 0;
|
||||
@@ -1460,11 +1447,8 @@ void wxTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
|
||||
dc.DrawText( item->GetText(), image_w + item->GetX(), item->GetY()
|
||||
+ ((total_h > text_h) ? (total_h - text_h)/2 : 0));
|
||||
|
||||
// restore normal font for bold items
|
||||
if (fontOld.Ok())
|
||||
{
|
||||
dc.SetFont( fontOld);
|
||||
}
|
||||
// restore normal font
|
||||
dc.SetFont( m_normalFont );
|
||||
}
|
||||
|
||||
// Now y stands for the top of the item, whereas it used to stand for middle !
|
||||
@@ -1612,9 +1596,10 @@ void wxTreeCtrl::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
wxPaintDC dc(this);
|
||||
PrepareDC( dc );
|
||||
|
||||
dc.SetFont( wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT ) );
|
||||
|
||||
dc.SetFont( m_normalFont );
|
||||
dc.SetPen( m_dottedPen );
|
||||
|
||||
// this is now done dynamically
|
||||
//if(GetImageList() == NULL)
|
||||
// m_lineHeight = (int)(dc.GetCharHeight() + 4);
|
||||
|
||||
@@ -2011,33 +1996,14 @@ void wxTreeCtrl::CalculateSize( wxGenericTreeItem *item, wxDC &dc )
|
||||
long text_w = 0;
|
||||
long text_h = 0;
|
||||
|
||||
wxFont fontOld;
|
||||
wxFont fontNew;
|
||||
if (item->IsBold())
|
||||
{
|
||||
fontOld = dc.GetFont();
|
||||
if (fontOld.Ok())
|
||||
{
|
||||
// VZ: is there any better way to make a bold variant of old font?
|
||||
fontNew = wxFont( fontOld.GetPointSize(),
|
||||
fontOld.GetFamily(),
|
||||
fontOld.GetStyle(),
|
||||
wxBOLD,
|
||||
fontOld.GetUnderlined());
|
||||
dc.SetFont(fontNew);
|
||||
}
|
||||
else
|
||||
{
|
||||
wxFAIL_MSG(wxT("wxDC::GetFont() failed!"));
|
||||
}
|
||||
}
|
||||
dc.SetFont(m_boldFont);
|
||||
|
||||
dc.GetTextExtent( item->GetText(), &text_w, &text_h );
|
||||
text_h+=2;
|
||||
|
||||
// restore normal font for bold items
|
||||
if (fontOld.Ok())
|
||||
dc.SetFont( fontOld);
|
||||
// restore normal font
|
||||
dc.SetFont( m_normalFont );
|
||||
|
||||
int image_h = 0;
|
||||
int image_w = 0;
|
||||
@@ -2092,7 +2058,7 @@ void wxTreeCtrl::CalculatePositions()
|
||||
wxClientDC dc(this);
|
||||
PrepareDC( dc );
|
||||
|
||||
dc.SetFont( wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT ) );
|
||||
dc.SetFont( m_normalFont );
|
||||
|
||||
dc.SetPen( m_dottedPen );
|
||||
//if(GetImageList() == NULL)
|
||||
|
Reference in New Issue
Block a user