public override bool UpdateLayout(LayoutingType layoutType) { RegisteredLayoutings &= (~layoutType); if (layoutType == LayoutingType.ArrangeChildren) { ComputeChildrenPositions(); //if no layouting remains in queue for item, registre for redraw if (RegisteredLayoutings == LayoutingType.None && IsDirty) { IFace.EnqueueForRepaint(this); } return(true); } return(base.UpdateLayout(layoutType)); }
public override bool UpdateLayout(LayoutingType layoutType) { RegisteredLayoutings &= (~layoutType); if (layoutType == LayoutingType.ArrangeChildren) { //allow 1 child to have size to 0 if stack has fixed or streched size policy, //this child will occupy remaining space //if stack size policy is Fit, no child may have stretch enabled //in the direction of stacking. ComputeChildrenPositions(); //if no layouting remains in queue for item, registre for redraw if (RegisteredLayoutings == LayoutingType.None && IsDirty) { IFace.EnqueueForRepaint(this); } return(true); } return(base.UpdateLayout(layoutType)); }
public override bool UpdateLayout(LayoutingType layoutType) { RegisteredLayoutings &= (~layoutType); if (layoutType == LayoutingType.ArrangeChildren && Children.Count > 0) { Rectangle cb = ClientRectangle; int tabSpace = tabWidth + leftSlope; int tc = Children.Count(c => c.Visible == true); if (tc > 0) { tabSpace = Math.Min(tabSpace, (cb.Width - rightSlope) / tc); } if (tabSpace < tabWidth + leftSlope) { adjustedTab = tabSpace - leftSlope; } else { adjustedTab = -1; } //Console.WriteLine ("tabspace: {0} tw:{1}", tabSpace, tabWidth); childrenRWLock.EnterReadLock(); TabItem[] tabItms = Children.Cast <TabItem>().OrderBy(t => t.ViewIndex).ToArray(); childrenRWLock.ExitReadLock(); int curOffset = leftSlope; for (int i = 0; i < tabItms.Length; i++) { if (!tabItms [i].Visible) { continue; } tabItms [i].NotifyValueChanged("TabHeight", tabHeight); tabItms [i].NotifyValueChanged("TabWidth", TabWidth); if (!tabItms [i].IsDragged) { tabItms [i].TabOffset = curOffset; //Console.WriteLine ("offset: {0}=>{1}", tabItms [i].Name, tabItms [i].TabOffset); } if (Orientation == Orientation.Horizontal) { curOffset += tabSpace; } else { curOffset += tabSpace; } } //if no layouting remains in queue for item, registre for redraw if (RegisteredLayoutings == LayoutingType.None && IsDirty) { IFace.EnqueueForRepaint(this); } return(true); } return(base.UpdateLayout(layoutType)); }