void GetDecorationsSize(MinMaxValue * w, MinMaxValue * h)
{
Window::GetDecorationsSize(w, h);
- if(bits.scrollable && bits.endButtons)
+ if(bits.scrollable && bits.endButtons && left.visible)
{
if(direction == vertical) *h += left.size.h + right.size.h + 8; else *w += left.size.w + right.size.w + 8;
}
void SetWindowArea(int * x, int * y, MinMaxValue * w, MinMaxValue * h, MinMaxValue * cw, MinMaxValue * ch)
{
Window::SetWindowArea(x, y, w, h, cw, ch);
- if(bits.scrollable && bits.endButtons)
+ if(bits.scrollable && bits.endButtons && left.visible)
{
if(direction == vertical) *y += left.size.h + 4; else *x += left.size.w + 4;
}
void DoResize(int width, int height)
{
+ if(left.visible)
+ {
+ // Take into consideration the space we would gain back by getting rid of the scrolling buttons
+ if(direction == horizontal)
+ width += 2 * (left.size.w + 4);
+ else
+ height += 2 * (left.size.h + 4);
+ }
// TOIMPROVE: this needs to maintain an order and allow for dynamically adding
// children. inserting in the order should also be possible.
// TOIMPROVE: in Window.ec... it should be possible to change the order of children
public void DestroyChildren()
{
- // This is not required and will jam if the Stacker is destroyed
+ // This safe loop with 'left' will jam if the Stacker is destroyed
if(!destroyed && created)
{
bool left = true;
}
}
}
+ else
+ {
+ // If the stacker is already destroyed, just clear everything
+ Iterator<Window> it { controls };
+ while(it.pointer = null, it.Next())
+ {
+ Window w = it.data;
+ it.Remove();
+ w.Destroy(0);
+ delete w;
+ }
+ }
}
public void MakeControlVisible(Window control)