void wxTreeListHeaderWindow::RefreshColLabel(int col)
{
- if ( col > GetColumnCount() )
+ if ( col >= GetColumnCount() )
return;
int x = 0;
#endif // !__WXMAC__
dc.SetTextForeground (colTextHilight);
}else if (item->IsSelected()) {
+#if defined(__WXGTK2__) || defined(__WXMAC__)
+ int flags = wxCONTROL_SELECTED;
+ if (m_hasFocus)
+ {
+ flags |= wxCONTROL_FOCUSED;
+#ifdef __WXMAC__
+ dc.SetTextForeground( *wxWHITE );
+#endif
+ }
+ wxRendererNative::GetDefault().DrawItemSelectionRect( m_owner, dc, wxRect( 0, item->GetY() + off_h, total_w, total_h - off_h ), flags);
+#else
if (!m_isDragging && m_hasFocus) {
dc.SetBrush (*m_hilightBrush);
-#ifndef __WXMAC__ // don't draw rect outline if we already have the background color
dc.SetPen (*wxBLACK_PEN);
-#endif // !__WXMAC__
}else{
dc.SetBrush (*m_hilightUnfocusedBrush);
-#ifndef __WXMAC__ // don't draw rect outline if we already have the background color
dc.SetPen (*wxTRANSPARENT_PEN);
-#endif // !__WXMAC__
}
dc.SetTextForeground (colTextHilight);
+#endif // defined(__WXGTK2__) || defined(__WXMAC__)
}else if (item == m_curItem) {
dc.SetPen (m_hasFocus? *wxBLACK_PEN: *wxTRANSPARENT_PEN);
}else{
dc.SetTextForeground (colText);
}
+#if !defined(__WXGTK2__) && !defined(__WXMAC__)
dc.DrawRectangle (0, item->GetY() + off_h, total_w, total_h - off_h);
+#endif
}else{
dc.SetTextForeground (colText);
}
#endif // !__WXMAC__
dc.SetTextForeground (colTextHilight);
}else if (item->IsSelected()) {
+#if defined(__WXGTK2__) || defined(__WXMAC__)
+ int flags = wxCONTROL_SELECTED;
+ if (m_hasFocus)
+ {
+ flags |= wxCONTROL_FOCUSED;
+#ifdef __WXMAC__
+ dc.SetTextForeground( *wxWHITE );
+#endif
+ }
+ wxRendererNative::GetDefault().DrawItemSelectionRect( m_owner, dc, wxRect( 0, item->GetY() + off_h, total_w, total_h - off_h ), flags);
+#else
if (!m_isDragging && m_hasFocus) {
dc.SetBrush (*m_hilightBrush);
-#ifndef __WXMAC__ // don't draw rect outline if we already have the background color
dc.SetPen (*wxBLACK_PEN);
-#endif // !__WXMAC__
}else{
dc.SetBrush (*m_hilightUnfocusedBrush);
-#ifndef __WXMAC__ // don't draw rect outline if we already have the background color
- dc.SetPen (*wxTRANSPARENT_PEN);
-#endif // !__WXMAC__
+ dc.SetPen (*wxTRANSPARENT_PEN);
}
dc.SetTextForeground (colTextHilight);
+#endif // defined(__WXGTK2__) || defined(__WXMAC__)
}else if (item == m_curItem) {
dc.SetPen (m_hasFocus? *wxBLACK_PEN: *wxTRANSPARENT_PEN);
}else{
dc.SetTextForeground (colText);
}
+#if !defined(__WXGTK2__) && !defined(__WXMAC__)
dc.DrawRectangle (text_x, item->GetY() + off_h, text_w, total_h - off_h);
+#endif
}else{
dc.SetTextForeground (colText);
}
default:
if (event.GetKeyCode() >= (int)' ') {
if (!m_findTimer->IsRunning()) m_findStr.Clear();
- m_findStr.Append (event.GetKeyCode());
+ m_findStr.Append ((char)event.GetKeyCode());
m_findTimer->Start (FIND_TIMER_TICKS, wxTIMER_ONE_SHOT);
wxTreeItemId prev = m_curItem? (wxTreeItemId*)m_curItem: (wxTreeItemId*)NULL;
while (true) {
void wxTreeListCtrl::SetColumnWidth(int column, int width)
{
+ if (width == wxLIST_AUTOSIZE_USEHEADER)
+ {
+ wxFont font = m_header_win->GetFont();
+ m_header_win->GetTextExtent(m_header_win->GetColumnText(column), &width, NULL, NULL, NULL, font.Ok()? &font: NULL);
+ //search wxTreeListHeaderWindow::OnPaint to understand this:
+ width += 2*EXTRA_WIDTH + MARGIN;
+ }
+ else if (width == wxLIST_AUTOSIZE)
+ {
+ width = m_main_win->GetBestColumnWidth(column);
+ }
+
m_header_win->SetColumnWidth (column, width);
m_header_win->Refresh();
}