- // draw all the items that are lines
-
- wxPaintDC dc(this);
-
- for(size_t i = 0; i < _items.GetCount(); i++)
- {
- wxFoldWindowItem &item = _items.Item(i);
- wxPen pen(item.GetLineColour(), 1, wxSOLID);
- if(item.GetType() == wxFoldWindowItem::SEPARATOR)
- {
- dc.SetPen(pen);
- dc.DrawLine(item.GetLeftSpacing(), item.GetLineY() + item.GetYSpacing(),
- item.GetLineWidth() + item.GetLeftSpacing(), item.GetLineY() + item.GetYSpacing());
- }
- }
+ // draw all the items that are lines
+ wxPaintDC dc(this);
+ bool vertical = IsVertical();
+
+ for(size_t i = 0; i < m_items.GetCount(); i++)
+ {
+ wxFoldWindowItem &item = m_items.Item(i);
+ wxPen pen(item.GetLineColour(), 1, wxSOLID);
+ if(item.GetType() == wxFoldWindowItem::SEPARATOR)
+ {
+ dc.SetPen(pen);
+ int a = item.GetLeftSpacing();
+ int b = item.GetLineY() + item.GetSpacing();
+ int c = item.GetLineLength();
+ int d = a + c;
+ if (vertical)
+ dc.DrawLine(a, b, d, b);
+ else
+ dc.DrawLine(b, a, b, d);
+ }
+ }
+}
+
+bool wxFoldPanelItem::IsVertical() const
+{
+ // grandparent of wxFoldPanelItem is wxFoldPanelBar
+ // default is vertical
+ wxPanel *panel = wxDynamicCast(GetParent(), wxPanel);
+ wxCHECK_MSG( panel, true, _T("wrong parent") );
+ wxFoldPanelBar *bar = wxDynamicCast(panel->GetParent(), wxFoldPanelBar);
+ wxCHECK_MSG( bar, true, _T("wrong parent") );
+ return bar->IsVertical();