Fix font of custom attributes in wxTreeCtrl on DPI change
This commit is contained in:
@@ -261,6 +261,7 @@ protected:
|
||||
// return true if the key was processed, false otherwise
|
||||
bool MSWHandleSelectionKey(unsigned vkey);
|
||||
|
||||
virtual void MSWUpdateFontOnDPIChange(const wxSize& newDPI) wxOVERRIDE;
|
||||
|
||||
// data used only while editing the item label:
|
||||
wxTextCtrl *m_textCtrl; // text control in which it is edited
|
||||
|
@@ -1253,7 +1253,9 @@ void wxTreeCtrl::SetItemFont(const wxTreeItemId& item, const wxFont& font)
|
||||
attr = it->second;
|
||||
}
|
||||
|
||||
attr->SetFont(font);
|
||||
wxFont f = font;
|
||||
f.WXAdjustToPPI(GetDPI());
|
||||
attr->SetFont(f);
|
||||
|
||||
// Reset the item's text to ensure that the bounding rect will be adjusted
|
||||
// for the new font.
|
||||
@@ -2270,6 +2272,17 @@ bool wxTreeCtrl::MSWCommand(WXUINT cmd, WXWORD id_)
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxTreeCtrl::MSWUpdateFontOnDPIChange(const wxSize& newDPI)
|
||||
{
|
||||
wxTreeCtrlBase::MSWUpdateFontOnDPIChange(newDPI);
|
||||
|
||||
for ( wxMapTreeAttr::const_iterator it = m_attrs.begin(); it != m_attrs.end(); ++it )
|
||||
{
|
||||
if ( it->second->HasFont() )
|
||||
SetItemFont(it->first, it->second->GetFont());
|
||||
}
|
||||
}
|
||||
|
||||
bool wxTreeCtrl::MSWIsOnItem(unsigned flags) const
|
||||
{
|
||||
unsigned mask = TVHT_ONITEM;
|
||||
|
Reference in New Issue
Block a user