-// New HEL version with rounder tabs
-#if 1
- if (!m_view) return;
-
- int tabInc = 0;
- if (m_isSelected)
- {
- tabInc = m_view->GetTabSelectionHeight() - m_view->GetTabHeight();
- }
- int tabLeft = GetX() + m_view->GetViewRect().x;
- int tabTop = GetY() + m_view->GetViewRect().y - tabInc;
- int tabRight = tabLeft + m_view->GetTabWidth();
- int left = m_view->GetViewRect().x;
- int top = tabTop + m_view->GetTabHeight() + tabInc;
- int right = left + m_view->GetViewRect().width;
- int bottom = top + m_view->GetViewRect().height;
-
- if (m_isSelected)
- {
- // TAB is selected - draw TAB and the View's full outline
-
- dc.SetPen(*(m_view->GetHighlightPen()));
- wxPoint pnts[10];
- int n = 0;
- pnts[n].x = left; pnts[n++].y = bottom;
- pnts[n].x = left; pnts[n++].y = top;
- pnts[n].x = tabLeft; pnts[n++].y = top;
- pnts[n].x = tabLeft; pnts[n++].y = tabTop + 2;
- pnts[n].x = tabLeft + 2; pnts[n++].y = tabTop;
- pnts[n].x = tabRight - 1; pnts[n++].y = tabTop;
- dc.DrawLines(n, pnts);
- if (!lastInRow)
- {
- dc.DrawLine(
- (tabRight + 2),
- top,
- right,
- top
- );
- }
-
- dc.SetPen(*(m_view->GetShadowPen()));
- dc.DrawLine(
- tabRight,
- tabTop + 2,
- tabRight,
- top
- );
- dc.DrawLine(
- right,
- top,
- right,
- bottom
- );
- dc.DrawLine(
- right,
- bottom,
- left,
- bottom
- );
-
- dc.SetPen(*wxBLACK_PEN);
- dc.DrawPoint(
- tabRight,
- tabTop + 1
- );
- dc.DrawPoint(
- tabRight + 1,
- tabTop + 2
- );
- if (lastInRow)
- {
- dc.DrawLine(
- tabRight + 1,
- bottom,
- tabRight + 1,
- tabTop + 1
- );
- }
- else
- {
- dc.DrawLine(
- tabRight + 1,
- tabTop + 2,
- tabRight + 1,
- top
- );
- dc.DrawLine(
- right + 1,
- top,
- right + 1,
- bottom + 1
- );
- }
- dc.DrawLine(
- right + 1,
- bottom + 1,
- left + 1,
- bottom + 1
- );
- }
- else
- {
- // TAB is not selected - just draw TAB outline and RH edge
- // if the TAB is the last in the row
-
- int maxPositions = ((wxTabLayer*)m_view->GetLayers().Nth(0)->Data())->Number();
- wxTabControl* tabBelow = 0;
- wxTabControl* tabBelowRight = 0;
- if (GetColPosition() > 0)
- {
- tabBelow = m_view->FindTabControlForPosition(
- GetColPosition() - 1,
- GetRowPosition()
- );
- }
- if (!lastInRow && GetColPosition() > 0)
- {
- tabBelowRight = m_view->FindTabControlForPosition(
- GetColPosition() - 1,
- GetRowPosition() + 1
- );
- }
-
- float raisedTop = top - m_view->GetTabSelectionHeight() +
- m_view->GetTabHeight();
-
- dc.SetPen(*(m_view->GetHighlightPen()));
- wxPoint pnts[10];
- int n = 0;
-
- pnts[n].x = tabLeft;
-
- if (tabBelow && tabBelow->IsSelected())
- {
- pnts[n++].y = (long)raisedTop;
- }
- else
- {
- pnts[n++].y = top;
- }
- pnts[n].x = tabLeft; pnts[n++].y = tabTop + 2;
- pnts[n].x = tabLeft + 2; pnts[n++].y = tabTop;
- pnts[n].x = tabRight - 1; pnts[n++].y = tabTop;
- dc.DrawLines(n, pnts);
-
- dc.SetPen(*(m_view->GetShadowPen()));
- if (GetRowPosition() >= maxPositions - 1)
- {
- dc.DrawLine(
- tabRight,
- (tabTop + 2),
- tabRight,
- bottom
- );
- dc.DrawLine(
- tabRight,
- bottom,
- (tabRight - m_view->GetHorizontalTabOffset()),
- bottom
- );
- }
- else
- {
- if (tabBelowRight && tabBelowRight->IsSelected())
- {
- dc.DrawLine(
- tabRight,
- (long)raisedTop,
- tabRight,
- tabTop + 1
- );
- }
- else
- {
- dc.DrawLine(
- tabRight,
- top - 1,
- tabRight,
- tabTop + 1
- );
- }
- }
-
- dc.SetPen(*wxBLACK_PEN);
- dc.DrawPoint(
- tabRight,
- tabTop + 1
- );
- dc.DrawPoint(
- tabRight + 1,
- tabTop + 2
- );
- if (GetRowPosition() >= maxPositions - 1)
- {
- // draw right hand edge to bottom of view
- dc.DrawLine(
- tabRight + 1,
- bottom + 1,
- tabRight + 1,
- tabTop + 2
- );
- dc.DrawLine(
- tabRight + 1,
- bottom + 1,
- (tabRight - m_view->GetHorizontalTabOffset()),
- bottom + 1
- );
- }
- else
- {
- // draw right hand edge of TAB
- if (tabBelowRight && tabBelowRight->IsSelected())
- {
- dc.DrawLine(
- tabRight + 1,
- (long)(raisedTop - 1),
- tabRight + 1,
- tabTop + 2
- );
- }
- else
- {
- dc.DrawLine(
- tabRight + 1,
- top - 1,
- tabRight + 1,
- tabTop + 2
- );
- }
- }
- }
-
- // Draw centered text
- dc.SetPen(*wxBLACK_PEN);
- if (m_isSelected)
- {
- dc.SetFont(*(m_view->GetSelectedTabFont()));
- }
- else
- {
- dc.SetFont(*(GetFont()));
- }
-
- wxColour col(m_view->GetTextColour());
- dc.SetTextForeground(col);
- dc.SetBackgroundMode(wxTRANSPARENT);
- long textWidth, textHeight;
- dc.GetTextExtent(GetLabel(), &textWidth, &textHeight);
-
- float textX = (tabLeft + tabRight - textWidth) / 2;
- float textY = (tabInc + tabTop + m_view->GetVerticalTabTextSpacing());
-
- dc.DrawText(GetLabel(), (long)textX, (long)textY);