- wxRect value(0,0,0,0);
-
- // determine wether the number of panels left
- // times the size of their captions is enough
- // to be placed in the left over space
-
- int expanded = 0, collapsed = 0, offset;
- GetPanelsHeight(collapsed, expanded);
-
- // if no room stick them behind the normal ones, else
- // at the bottom
-
- if((GetSize().GetHeight() - expanded - collapsed) < 0)
- offset = expanded;
- else
- {
- // value is the region which is left unpainted
- // I will send it back as 'slack' so it does not need to
- // be recalulated.
-
- value.SetX(0);
- value.SetY(expanded);
- value.SetHeight(GetSize().GetHeight() - expanded);
- value.SetWidth(GetSize().GetWidth());
-
- offset = GetSize().GetHeight() - collapsed;
- }
-
-
- // go reposition
-
- for(size_t i = 0; i < _panels.GetCount(); i++)
- {
- if(!_panels.Item(i)->IsExpanded())
- offset += _panels.Item(i)->Reposition(offset);
- }
-
- return value;
+ wxRect value(0,0,0,0);
+ bool vertical = IsVertical();
+
+ // determine wether the number of panels left
+ // times the size of their captions is enough
+ // to be placed in the left over space
+
+ int expanded = 0, collapsed = 0, offset;
+ GetPanelsLength(collapsed, expanded);
+
+ // if no room stick them behind the normal ones, else
+ // at the bottom
+
+ if(((vertical ? GetSize().GetHeight() : GetSize().GetWidth()) - expanded - collapsed) < 0)
+ offset = expanded;
+ else
+ {
+ // value is the region which is left unpainted
+ // I will send it back as 'slack' so it does not need to
+ // be recalulated.
+
+ value.SetHeight(GetSize().GetHeight());
+ value.SetWidth(GetSize().GetWidth());
+
+ if(vertical)
+ {
+ value.SetY(expanded);
+ value.SetHeight(value.GetHeight() - expanded);
+ }
+ else
+ {
+ value.SetX(expanded);
+ value.SetWidth(value.GetWidth() - expanded);
+ }
+
+ offset = (vertical ? GetSize().GetHeight() : GetSize().GetWidth()) - collapsed;
+ }
+
+ // go reposition
+
+ for(size_t i = 0; i < m_panels.GetCount(); i++)
+ {
+ if(!m_panels.Item(i)->IsExpanded())
+ offset += m_panels.Item(i)->Reposition(offset);
+ }
+
+ return value;