public override void layout() { if (animating) { if (childContainer != null) { childContainer.Location = Location; childContainer.WorkingSize = currentSize; childContainer.layout(); } if (oldChildContainer != null) { oldChildContainer.Location = Location; oldChildContainer.WorkingSize = currentSize; oldChildContainer.layout(); } } else { if (childContainer != null) { childContainer.Location = Location; childContainer.WorkingSize = WorkingSize; childContainer.layout(); } } }
public override void layout() { if (child != null) { child.Location = Location; child.WorkingSize = WorkingSize; child.layout(); } }
public override void layout() { IntSize2 leftDesired = left != null ? left.DesiredSize : new IntSize2(); IntSize2 rightDesired = right != null ? right.DesiredSize : new IntSize2(); IntSize2 topDesired = top != null ? top.DesiredSize : new IntSize2(); IntSize2 bottomDesired = bottom != null ? bottom.DesiredSize : new IntSize2(); //Determine center region size. IntSize2 centerSize = new IntSize2(WorkingSize.Width - leftDesired.Width - rightDesired.Width, WorkingSize.Height - topDesired.Height - bottomDesired.Height); //Top if (top != null) { top.Location = this.Location; top.WorkingSize = new IntSize2(WorkingSize.Width, topDesired.Height); top.layout(); } //Bottom if (bottom != null) { bottom.Location = new IntVector2(this.Location.x, this.Location.y + topDesired.Height + centerSize.Height); bottom.WorkingSize = new IntSize2(WorkingSize.Width, bottomDesired.Height); bottom.layout(); } //Left if (left != null) { left.Location = new IntVector2(this.Location.x, this.Location.y + topDesired.Height); left.WorkingSize = new IntSize2(leftDesired.Width, centerSize.Height); left.layout(); } //Center if (center != null) { center.Location = new IntVector2(this.Location.x + leftDesired.Width, this.Location.y + topDesired.Height); center.WorkingSize = centerSize; center.layout(); } //Right if (right != null) { right.Location = new IntVector2(this.Location.x + leftDesired.Width + centerSize.Width, this.Location.y + topDesired.Height); right.WorkingSize = new IntSize2(rightDesired.Width, centerSize.Height); right.layout(); } }
public override void changePanel(LayoutContainer childContainer, float animDuration) { //If we were animating when a new request comes in clear the old animation first. if (animating) { if (this.childContainer != null) { this.childContainer.setAlpha(1.0f); this.childContainer.WorkingSize = newSize; this.childContainer.layout(); finishAnimation(); } else { //If we were transitioning to null, but now there is another container use the child that was being transitioned this.childContainer = oldChildContainer; unsubscribeFromUpdates(); } } currentTime = 0.0f; animationLength = animDuration; oldChildContainer = this.childContainer; if (oldChildContainer != null) { oldSize = oldChildContainer.DesiredSize; oldChildContainer.animatedResizeStarted(new IntSize2(oldSize.Width, WorkingSize.Height)); } else { oldSize = new IntSize2(0, 0); } this.childContainer = childContainer; if (childContainer != null) { childContainer._setParent(this); newSize = childContainer.DesiredSize; childContainer.animatedResizeStarted(new IntSize2(newSize.Width, WorkingSize.Height)); //Force the child container to fit in the current alloted space childContainer.Location = Location; childContainer.WorkingSize = new IntSize2(oldSize.Width, WorkingSize.Height); childContainer.layout(); } else { newSize = new IntSize2(0, 0); } sizeDelta = newSize - oldSize; if (oldSize.Width == 0) { currentEasing = EasingFunction.EaseOutQuadratic; } else if (newSize.Width == 0) { currentEasing = EasingFunction.EaseInQuadratic; } else { currentEasing = EasingFunction.EaseInOutQuadratic; } //Make sure we start with no alpha if blending if (childContainer != null && oldChildContainer != null) { childContainer.setAlpha(0.0f); } subscribeToUpdates(); }