Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
            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);
            }
Пример #4
0
		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;
		}
Пример #5
0
		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;
		}
Пример #6
0
			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;
			}