- if (item->HasPlus() && HasButtons()) // should the item show a button?
- {
- if (!HasFlag(wxTR_NO_LINES))
- {
- if (x > (signed)m_indent || HasFlag(wxTR_LINES_AT_ROOT))
- dc.DrawLine(x - m_indent, y_mid, x - 5, y_mid);
- dc.DrawLine(x + 5, y_mid, x + m_spacing, y_mid);
- }
-
- if (m_imageListButtons != NULL)
- {
- // draw the image button here
- int image_h = 0, image_w = 0, image = wxCLOSED_BUTTON;
- if (item->IsExpanded()) image = wxOPEN_BUTTON;
- if (item->IsSelected())
- image += wxOPEN_BUTTON_SELECTED - wxOPEN_BUTTON;
- m_imageListButtons->GetSize(image, image_w, image_h);
- int xx = x - (image_w>>1);
- int yy = y_mid - (image_h>>1);
- dc.SetClippingRegion(xx, yy, image_w, image_h);
- m_imageListButtons->Draw(image, dc, xx, yy,
- wxIMAGELIST_DRAW_TRANSPARENT);
- dc.DestroyClippingRegion();
- }
- else if (HasFlag(wxTR_TWIST_BUTTONS))
- {
- // draw the twisty button here
- dc.SetPen(*wxBLACK_PEN);
- dc.SetBrush(*m_hilightBrush);
-
- wxPoint button[3];
-
- if (item->IsExpanded())
- {
- button[0].x = x-5;
- button[0].y = y_mid-2;
- button[1].x = x+5;
- button[1].y = y_mid-2;
- button[2].x = x;
- button[2].y = y_mid+3;
- }
- else
- {
- button[0].y = y_mid-5;
- button[0].x = x-2;
- button[1].y = y_mid+5;
- button[1].x = x-2;
- button[2].y = y_mid;
- button[2].x = x+3;
- }
- dc.DrawPolygon(3, button);
-
- dc.SetPen(m_dottedPen);
- }
- else // if (HasFlag(wxTR_HAS_BUTTONS))
- {
- // draw the plus sign here
- dc.SetPen(*wxGREY_PEN);
- dc.SetBrush(*wxWHITE_BRUSH);
- dc.DrawRectangle(x-5, y_mid-4, 11, 9);
- dc.SetPen(*wxBLACK_PEN);
- dc.DrawLine(x-2, y_mid, x+3, y_mid);
- if (!item->IsExpanded())
- dc.DrawLine(x, y_mid-2, x, y_mid+3);
- dc.SetPen(m_dottedPen);
- }
- }
- else if (!HasFlag(wxTR_NO_LINES)) // no button; maybe a line?
- {
- // draw the horizontal line here
- int x_start = x;
- if (x > (signed)m_indent || HasFlag(wxTR_LINES_AT_ROOT))
- x_start -= m_indent;
- dc.DrawLine(x_start, y_mid, x + m_spacing, y_mid);
- }
-
- wxPen *pen =