public bool RequestResize() { var p = (PathSelectorView)Subviews [0]; var overflowInfo = new OverflowInfoEventArgs(); if (OverflowInfoRequested != null) { OverflowInfoRequested(this, overflowInfo); } var size = new CGSize(p.ResizeIfNeeded(overflowInfo), Frame.Height); if (size != Frame.Size) { if (ResizeRequested != null) { ResizeRequested(this, new SizeRequestedEventArgs(size)); } SetFrameSize(size); p.SetFrameSize(size); SetNeedsDisplay(); p.SetNeedsDisplay(); return(true); } return(false); }
OverflowInfoEventArgs FillOverflowInfo(OverflowInfoEventArgs e) { var visibleItems = widget.VisibleItems; var allItems = widget.Items; e.WindowWidth = gtkWindow.Allocation.Width; foreach (var iter in allItems) { e.AllItemsWidth += iter.MinSize.Width; if (!visibleItems.Contains(iter)) { e.ItemsInOverflowWidth += iter.MinSize.Width; } } // Add spacings. nfloat spacing = (allItems.Length - 1) * 16; e.AllItemsWidth += spacing; return(e); }
internal nfloat ResizeIfNeeded(OverflowInfoEventArgs args) { var remaining = args.WindowWidth - args.AllItemsWidth; if (remaining < 0 || args.ItemsInOverflowWidth > 0) { var cell = PathComponentCells [RuntimeIdx]; var size = new NSAttributedString(cell.Title, new NSStringAttributes { Font = cell.Font }).Size.Width; remaining += size; args.ItemsInOverflowWidth -= size; if ((state & CellState.RuntimeShown) != 0) { state &= ~CellState.RuntimeShown; UpdatePathText(RuntimeIdx, string.Empty); } if ((remaining < 0 || args.ItemsInOverflowWidth > 0) && (state & CellState.ConfigurationShown) != 0) { state &= ~CellState.ConfigurationShown; UpdatePathText(ConfigurationIdx, string.Empty); } } else { remaining = remaining - args.ItemsInOverflowWidth; if ((state & CellState.ConfigurationShown) == 0) { remaining = UpdatePathCellForSize(ConfigurationIdx, remaining, CellState.ConfigurationShown); } if ((state & CellState.RuntimeShown) == 0) { UpdatePathCellForSize(RuntimeIdx, remaining, CellState.RuntimeShown); } } return(10 + PathComponentCells [ConfigurationIdx].CellSize.Width + PathComponentCells [RuntimeIdx].CellSize.Width + Frame.Left); }
public bool RequestResize () { var p = (PathSelectorView)Subviews [0]; var overflowInfo = new OverflowInfoEventArgs (); if (OverflowInfoRequested != null) OverflowInfoRequested (this, overflowInfo); var size = new CGSize (p.ResizeIfNeeded (overflowInfo), Frame.Height); if (size != Frame.Size) { if (ResizeRequested != null) ResizeRequested (this, new SizeRequestedEventArgs (size)); SetFrameSize (size); p.SetFrameSize (size); SetNeedsDisplay (); p.SetNeedsDisplay (); return true; } return false; }
OverflowInfoEventArgs FillOverflowInfo (OverflowInfoEventArgs e) { var visibleItems = widget.VisibleItems; var allItems = widget.Items; e.WindowWidth = gtkWindow.Allocation.Width; foreach (var iter in allItems) { e.AllItemsWidth += iter.MinSize.Width; if (!visibleItems.Contains (iter)) e.ItemsInOverflowWidth += iter.MinSize.Width; } // Add spacings. nfloat spacing = (allItems.Length - 1) * 16; e.AllItemsWidth += spacing; return e; }
internal nfloat ResizeIfNeeded (OverflowInfoEventArgs args) { var remaining = args.WindowWidth - args.AllItemsWidth; if (remaining < 0 || args.ItemsInOverflowWidth > 0) { var cell = PathComponentCells [RuntimeIdx]; var size = new NSAttributedString (cell.Title, new NSStringAttributes { Font = cell.Font }).Size.Width; remaining += size; args.ItemsInOverflowWidth -= size; if ((state & CellState.RuntimeShown) != 0) { state &= ~CellState.RuntimeShown; UpdatePathText (RuntimeIdx, string.Empty); } if ((remaining < 0 || args.ItemsInOverflowWidth > 0) && (state & CellState.ConfigurationShown) != 0) { state &= ~CellState.ConfigurationShown; UpdatePathText (ConfigurationIdx, string.Empty); } } else { remaining = remaining - args.ItemsInOverflowWidth; if ((state & CellState.ConfigurationShown) == 0) remaining = UpdatePathCellForSize (ConfigurationIdx, remaining, CellState.ConfigurationShown); if ((state & CellState.RuntimeShown) == 0) UpdatePathCellForSize (RuntimeIdx, remaining, CellState.RuntimeShown); } return 10 + PathComponentCells [ConfigurationIdx].CellSize.Width + PathComponentCells [RuntimeIdx].CellSize.Width + Frame.Left; }