wxTreeTextCtrl::wxTreeTextCtrl( wxWindow *parent, const wxWindowID id,
bool *accept, wxString *res, wxTreeCtrl *owner,
const wxString &value, const wxPoint &pos, const wxSize &size,
+#if wxUSE_VALIDATORS
+# if defined(__VISAGECPP__)
+ int style, const wxValidator* validator, const wxString &name ) :
+# else
int style, const wxValidator& validator, const wxString &name ) :
+# endif
+#endif
wxTextCtrl( parent, id, value, pos, size, style, validator, name )
{
m_res = res;
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,
const wxPoint& pos, const wxSize& size,
long style,
+#if wxUSE_VALIDATORS
+# if defined(__VISAGECPP__)
+ const wxValidator *validator,
+# else
const wxValidator &validator,
+# endif
+#endif
const wxString& name )
{
Init();
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;
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 !
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);
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;
wxClientDC dc(this);
PrepareDC( dc );
- dc.SetFont( wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT ) );
+ dc.SetFont( m_normalFont );
dc.SetPen( m_dottedPen );
//if(GetImageList() == NULL)