case LayoutingType.Width:
if (Orientation == Orientation.Horizontal) {
if (go.Width == Measure.Stretched) {
- if (stretchedGO == null && Width != Measure.Fit)
+ if (stretchedGO == null && Width != Measure.Fit) {
stretchedGO = go;
- else if (stretchedGO != go) {
+ contentSize.Width -= go.LastSlots.Width;
+ } else if (stretchedGO != go) {
go.Slot.Width = 0;
go.Width = Measure.Fit;
return;
}
+ } else if (stretchedGO == go) {
+ stretchedGO = null;
+ contentSize.Width += go.Slot.Width;
} else
contentSize.Width += go.Slot.Width - go.LastSlots.Width;
+
adjustStretchedGo (LayoutingType.Width);
if (Width == Measure.Fit)
case LayoutingType.Height:
if (Orientation == Orientation.Vertical) {
if (go.Height == Measure.Stretched) {
- if (stretchedGO == null && Height != Measure.Fit)
+ if (stretchedGO == null && Height != Measure.Fit) {
stretchedGO = go;
- else if (stretchedGO != go){
+ contentSize.Height -= go.LastSlots.Height;
+ } else if (stretchedGO != go) {
go.Slot.Height = 0;
go.Height = Measure.Fit;
return;
}
+ } else if (stretchedGO == go) {
+ stretchedGO = null;
+ contentSize.Height += go.Slot.Height;
} else
contentSize.Height += go.Slot.Height - go.LastSlots.Height;
/// widget inside the stack, which is never added to the contentSize, instead, its size
/// is deducted from (parent.ClientRectangle - contentSize)
/// </summary>
- internal Size contentSize;
+ public Size contentSize;
#endregion
#region ILayoutable
if (value < minimumSize.Width || (value > maximumSize.Width && maximumSize.Width > 0))
return;
}
- Measure old = width;
width = value;
NotifyValueChanged ("Width", width);
- if (width == Measure.Stretched || old == Measure.Stretched) {
- //NotifyValueChanged ("WidthPolicy", width.Policy);
- //contentSize in Stacks are only update on childLayoutChange, and the single stretched
- //child of the stack is not counted in contentSize, so when changing size policy of a child
- //we should adapt contentSize
- //TODO:check case when child become stretched, and another stretched item already exists.
- GenericStack gs = Parent as GenericStack;
- if (gs != null){ //TODO:check if I should test Group instead
- if (gs.Orientation == Orientation.Horizontal) {
- if (width == Measure.Stretched)
- gs.contentSize.Width -= this.LastSlots.Width;
- else
- gs.contentSize.Width += this.LastSlots.Width;
- }
- }
- }
-
- this.RegisterForLayouting (LayoutingType.Width);
+ RegisterForLayouting (LayoutingType.Width);
}
}
/// <summary>
if (value < minimumSize.Height || (value > maximumSize.Height && maximumSize.Height > 0))
return;
}
- Measure old = height;
height = value;
NotifyValueChanged ("Height", height);
- if (height == Measure.Stretched || old == Measure.Stretched) {
- //NotifyValueChanged ("HeightPolicy", HeightPolicy);
- GenericStack gs = Parent as GenericStack;
- if (gs != null){ //TODO:check if I should test Group instead
- if (gs.Orientation == Orientation.Vertical) {
- if (height == Measure.Stretched)
- gs.contentSize.Height -= this.LastSlots.Height;
- else
- gs.contentSize.Height += this.LastSlots.Height;
- }
- }
- }
-
- this.RegisterForLayouting (LayoutingType.Height);
+ RegisterForLayouting (LayoutingType.Height);
}
}
/// <summary>