Objects with this script can have ships docked inside of them.
Inheritance: MonoBehaviour
コード例 #1
0
ファイル: DockTests.cs プロジェクト: jhorv/CsConsoleFormat
        public void RenderSpiral ()
        {
            var dock = new Dock()
                .AddChildren(
                    new Fill { Char = 'a', Width = 4, Margin = new Thickness(1, 1, 0, 1) }
                        .Set(Dock.ToProperty, DockTo.Left),
                    new Fill { Char = 'b', Height = 3, Margin = new Thickness(1, 1, 1, 0) }
                        .Set(Dock.ToProperty, DockTo.Top),
                    new Fill { Char = 'c', Width = 2, Margin = new Thickness(0, 1, 1, 1) }
                        .Set(Dock.ToProperty, DockTo.Right),
                    new Fill { Char = 'd', Height = 1, Margin = new Thickness(1, 0, 1, 1) }
                        .Set(Dock.ToProperty, DockTo.Bottom),
                    new Fill { Char = 'e', Margin = 1, Width = 2, Height = 2 }
                );

            GetRenderedText(dock, 12).Should().BeLines(
                "            ",
                " aaaa bbbbb ",
                " aaaa bbbbb ",
                " aaaa bbbbb ",
                " aaaa       ",
                " aaaa ee cc ",
                " aaaa ee cc ",
                " aaaa    cc ",
                " aaaa dd cc ",
                "            ");
        }
コード例 #2
0
 public BoardInjector()
 {
     dock = new Dock();
     DockPath = new LinkedList<MainTrack>();
     SavePath = new LinkedList<MainTrack>();
     SecondPath = new LinkedList<MainTrack>();
     ConSwitch = new ConvergingSwitch[5];
     for (int x = 0; x < ConSwitch.Length; x++)
     {
         ConSwitch[x] = new ConvergingSwitch();
     }
     DevSwitch = new DevergingSwitch[5];
     for (int x = 0; x < DevSwitch.Length; x++)
     {
         DevSwitch[x] = new DevergingSwitch();
     }
     Basis = new MainTrack[10];
     for (int x = 0; x < Basis.Length; x++)
     {
         Basis[x] = new MainTrack();
     }
     Warehouses = new Warehouse[3];
     for (int x = 0; x < Warehouses.Length; x++)
     {
         Warehouses[x] = new Warehouse();
     }
 }
コード例 #3
0
ファイル: BaseView.cs プロジェクト: ReneNNielsen/SkemaMVVM
        /// <summary>
        /// Maximum Flexibility of Window Definition version of Show In Window
        /// </summary>
        /// <param name="window">THe Window in which to show this View</param>
        /// <param name="windowTitle">A Title for the Window</param>
        /// <param name="windowWidth">The Width of the Window</param>
        /// <param name="windowHeight">The Height of the Window</param>
        /// <param name="dock">How should the View be Docked</param>
        /// <param name="onWindowClosed">Event handler for when the window is closed</param>
        public void ShowInWindow(bool modal, ViewWindow window, string windowTitle, double windowWidth, double windowHeight, Dock dock, OnWindowClose onWindowClose)
        {
            this.onWindowClosed = onWindowClose;

            viewWindow = window;
            viewWindow.Title = windowTitle;

            DockPanel.SetDock(this, dock);
            // The viewWindow must have a dockPanel called WindowDockPanel. If you want to change this to use some other container on the window, then
            // the below code should be the only place it needs to be changed.
            viewWindow.WindowDockPanel.Children.Add(this);

            if (windowWidth == 0 && windowHeight == 0)
            {
                viewWindow.SizeToContent = SizeToContent.WidthAndHeight;
            }
            else
            {
                viewWindow.SizeToContent = SizeToContent.Manual;
                viewWindow.Width = windowWidth;
                viewWindow.Height = windowHeight;
            }

            if (modal)
            {
                viewWindow.ShowDialog();
            }
            else
            {
                viewWindow.Show();
            }
        }
コード例 #4
0
ファイル: Grabber.cs プロジェクト: GabrielSibley/games
 //Undocks, sets crate, and triggers movement update
 public void Dispatch(Crate crate, Dock port)
 {
     HeldCrate = crate;
     Undock(port);
     reverse = port == Pipe.To;
     Move();
 }
コード例 #5
0
ファイル: PackRule.cs プロジェクト: GabrielSibley/games
 private void OnGrabberDocked(Dock port, Grabber grabber)
 {
     if(port == output && outputOverflow != null)
     {
         grabber.Dispatch(outputOverflow, port);
         outputOverflow = null;
     }
     else if(inputA.DockedGrabbers.Count > 0
        && inputB.DockedGrabbers.Count > 0
        && output.DockedGrabbers.Count > 0)
     {
         Crate inCrateA = inputA.DockedGrabbers[0].HeldCrate;
         Crate inCrateB = inputB.DockedGrabbers[0].HeldCrate;
         int featuresMoved = Mathf.Min (Crate.MaxFeatures - inCrateA.Features.Count, inCrateB.Features.Count);
         for(int i = 0; i < featuresMoved; i++)
         {
             inCrateA.Features.Add(inCrateB.Features[i]);
         }
         if(featuresMoved < inCrateB.Features.Count)
         {
             inCrateB.Features.RemoveRange (0, featuresMoved);
             outputOverflow = inCrateB;
         }
         inputA.DockedGrabbers[0].Dispatch(null, inputA);
         inputB.DockedGrabbers[0].Dispatch(null, inputB);
         output.DockedGrabbers[0].Dispatch(inCrateA, output);
     }
 }
コード例 #6
0
        protected override void OnMouseDown(MouseButtonEventArgs e)
        {
            if (!IsEnabled) return;

            if (!IsMouseCaptured)
            {
                StartDragPoint = e.GetPosition(Parent as IInputElement);

                Panel ParentPanel = Parent as Panel;
                int i = ParentPanel.Children.IndexOf(this);

                // The splitter cannot be the first child of the parent DockPanel
                // The splitter works on the 'older' sibling
                if (i > 0 && ParentPanel.Children.Count > 0)
                {
                    _element = ParentPanel.Children[i - 1] as FrameworkElement;
                    _element = ParentPanel.Children[i - 1] as FrameworkElement;

                    if (_element != null)
                    {
                        _width = _element.ActualWidth;
                        _height = _element.ActualHeight;
                        _dock = DockPanel.GetDock(this);
                        CaptureMouse();
                    }
                }
            }

            base.OnMouseDown(e);
        }
コード例 #7
0
ファイル: DockablePane.cs プロジェクト: truonghinh/TnX
        public DockablePane(ManagedContent content, Dock dock)
        {
            Dock = dock;
            _tabs.TabStripPlacement = Dock.Bottom;

            Add(content);
        }
コード例 #8
0
        /// <summary>
        /// Sets the value of the Dock attached property to a specified element.
        /// </summary>
        /// <param name="element">The element to which the attached property is written.</param>
        /// <param name="dock">The new Dock value.</param>
        public static void SetDock(UIElement element, Dock dock)
        {
            if (element == null)
                throw new ArgumentNullException("element");

            element.SetValue(DockProperty, dock);
        }
コード例 #9
0
ファイル: SupplyContract.cs プロジェクト: GabrielSibley/games
 void GrabberDocked(Dock dock, Grabber grabber)
 {
     if (grabber.HeldCrate == null)
     {
         Quantity--;
         grabber.Dispatch(new Crate(Crate), dock);
     }
 }
コード例 #10
0
ファイル: DockingGrid.cs プロジェクト: truonghinh/TnX
        public Pane Add(ManagedContent content, Dock dock)
        {
            DockablePane pane = new DockablePane(content, dock);

            Add(pane);

            return pane;
        }
コード例 #11
0
ファイル: SlideMenu.xaml.cs プロジェクト: ethanhs/IronShell
        public SlideMenu(Dock docking, double width = 0)
        {
            InitializeComponent();
            Width = width;
            Show();
            Focus();
            SetDock(docking);

            Closed += SlideMenuClosed;
        }
コード例 #12
0
ファイル: PackRule.cs プロジェクト: GabrielSibley/games
 public void BindPorts(IList<Dock> inPorts, IList<Dock> outPorts)
 {
     inputA = inPorts[0];
     inputB = inPorts[1];
     output = outPorts[0];
     inputA.OnGrabberDocked += OnGrabberDocked;
     inputB.OnGrabberDocked += OnGrabberDocked;
     output.OnGrabberDocked += OnGrabberDocked;
     inputA.Effect = DockEffect.First;
     inputB.Effect = DockEffect.Last;
 }
コード例 #13
0
ファイル: UnpackRule.cs プロジェクト: GabrielSibley/games
 public void BindPorts(IList<Dock> inPorts, IList<Dock> outPorts)
 {
     input = inPorts[0];
     outputSingle = outPorts[0];
     outputRemainder = outPorts[1];
     input.OnGrabberDocked += OnGrabberDocked;
     outputSingle.OnGrabberDocked += OnGrabberDocked;
     outputRemainder.OnGrabberDocked += OnGrabberDocked;
     outputSingle.Effect = DockEffect.Last;
     outputRemainder.Effect = DockEffect.First;
 }
コード例 #14
0
 public IPipeDisplayAnchor GetAnchorForDock(Dock dock)
 {
     //TODO: Make not O(N)
     foreach(var anchor in pipeAnchors)
     {
         if(anchor.Dock == dock)
         {
             return anchor;
         }
     }
     return null;
 }
コード例 #15
0
        public OverlayDockablePane(DockManager dockManager, DockableContent content, Dock initialDock)
            : base(dockManager, initialDock)
        {
            btnAutoHide.LayoutTransform = new RotateTransform(90);
            ReferencedPane = content.ContainerPane as DockablePane;
            ReferencedContent = content;
            Add(ReferencedContent);
            Show(ReferencedContent);
            ReferencedContent.SetContainerPane(ReferencedPane);

            _state = PaneState.AutoHide;
        }
コード例 #16
0
 protected override void OnMouseEnter(MouseEventArgs e)
 {
     base.OnMouseEnter(e);
     if (!IsEnabled) return;
     _dock = DockPanel.GetDock(this);
     if (_dock == Dock.Left || _dock == Dock.Right)
     {
         Cursor = Cursors.SizeWE;
     }
     else
     {
         Cursor = Cursors.SizeNS;
     }
 }
コード例 #17
0
ファイル: DockingGrid.cs プロジェクト: truonghinh/TnX
        public void ChangeDock(DockablePane pane, Dock dock)
        {
            //if (dock == pane.Dock)
            //    return;

            //rimuovo innanizitutto il pane dalla griglia
            IPane resultPane = Remove(_rootPane, pane);
            if (resultPane != null)
                _rootPane = resultPane;

            pane.Dock = dock;
            //(pane.Parent as Grid).Children.Remove(pane);
            Add(pane);
        }
コード例 #18
0
 void GrabberDocked(Dock dock, Grabber grabber)
 {
     if (grabber.HeldCrate != null && grabber.HeldCrate.Features.Count == Crate.Features.Count)
     {
         for (int i = 0; i < grabber.HeldCrate.Features.Count; i++)
         {
             if (grabber.HeldCrate.Features[i] != Crate.Features[i])
             {
                 return;
             }
         }
         Quantity--;
         grabber.Dispatch(null, dock);
     }
 }
コード例 #19
0
 private static string GetPaneName(Dock location)
 {
     switch (location)
     {
         case Dock.Left:
             return "LeftPane";
         case Dock.Right:
             return "RightPane";
         case Dock.Bottom:
             return "BottomPane";
         case Dock.Top:
             return "TopPane";
         default:
             throw new ArgumentOutOfRangeException("location");
     }
 }
コード例 #20
0
ファイル: Grabber.cs プロジェクト: GabrielSibley/games
 public void Dock(Dock dock)
 {
     DockedAt = dock;
     if(dock == Pipe.To)
     {
         NormalizedDistance = 1;
     }
     else if(dock == Pipe.From)
     {
         NormalizedDistance = 0;
     }
     else
     {
         Debug.LogError ("Grabber docked to port not on its pipe");
     }
     dock.DockGrabber(this);
 }
コード例 #21
0
ファイル: DockingGrid.xaml.cs プロジェクト: truonghinh/TnX
        public void Add(DockablePane pane, Pane relativePane, Dock relativeDock)
        {
            Console.WriteLine("Add(...)");
            AttachPaneEvents(pane);
            DockablePaneGroup group = GetPaneGroup(relativePane);
            //group.ParentGroup.ReplaceChildGroup(group, new DockablePaneGroup(group, new DockablePaneGroup(relativePane), relativeDock));

            switch (relativeDock)
            {
                case Dock.Right:
                case Dock.Bottom:
                    {
                        if (group == _rootGroup)
                        {
                            _rootGroup = new DockablePaneGroup(group, new DockablePaneGroup(pane), relativeDock);
                        }
                        else
                        {
                            DockablePaneGroup parentGroup = group.ParentGroup;
                            DockablePaneGroup newChildGroup = new DockablePaneGroup(group, new DockablePaneGroup(pane), relativeDock);
                            parentGroup.ReplaceChildGroup(group, newChildGroup);
                        }
                    }
                    break;
                case Dock.Left:
                case Dock.Top:
                    {
                        if (group == _rootGroup)
                        {
                            _rootGroup = new DockablePaneGroup(new DockablePaneGroup(pane), group, relativeDock);
                        }
                        else
                        {
                            DockablePaneGroup parentGroup = group.ParentGroup;
                            DockablePaneGroup newChildGroup = new DockablePaneGroup(new DockablePaneGroup(pane), group, relativeDock);
                            parentGroup.ReplaceChildGroup(group, newChildGroup);
                        }
                    }
                    break;
                    //return new DockablePaneGroup(new DockablePaneGroup(pane), this, pane.Dock);
            }

            //group.ChildGroup = new DockablePaneGroup(group.ChildGroup, pane, relativeDock);
            ArrangeLayout();
        }
コード例 #22
0
ファイル: BaseView.cs プロジェクト: karlog100/SchoolScheduler
        public void ShowInWindow(ViewWindow window, string windowTitle, double windowWidth, double windowHeight, Dock dock)
        {
            viewWindow = window;
            ViewWindow.Title = windowTitle;

            DockPanel.SetDock(this, dock);

            ViewWindow.WindowDockPanel.Children.Add(this);

            ViewWindow.MinHeight = 100;
            ViewWindow.MinWidth = 200;

            if (windowWidth == 0 && windowHeight == 0)
            {
                viewWindow.SizeToContent = SizeToContent.WidthAndHeight;
            }
            else
            {
                ViewWindow.SizeToContent = SizeToContent.Manual;
                ViewWindow.Width = windowWidth;
                ViewWindow.Height = windowHeight;
            }

            bool? dialogResult = ViewWindow.ShowDialog();
            switch (dialogResult)
            {
                case true:
                    // User accepted dialog box
                    break;
                case false:
                    // User canceled dialog box
                    WindowClosed();
                    break;
                default:
                    // Indeterminate
                    break;
            }
        }
コード例 #23
0
		private void ChangeSizeByDock(Dock? dock)
		{
			if (!this.settings.AutomaticallyResize) return;

			var browserSize = this.previousBrowserSize ?? new Size();

			var width = browserSize.Width;
			var height = browserSize.Height + this.toolbarArea.ActualHeight + this.captionBar.ActualHeight + this.statusBar.ActualHeight;

			if (dock == Dock.Top || dock == Dock.Bottom)
			{
				height += Math.Max(this.informationArea.ActualHeight, informationDefaultSize.Height);
			}
			else if (dock == Dock.Left || dock == Dock.Right)
			{
				width += Math.Max(this.informationArea.ActualWidth, informationDefaultSize.Width);
			}

			this.Width = width;
			this.Height = height;

			this.previousDock = dock;
		}
コード例 #24
0
 public void Process(Dock port, Grabber grabber)
 {
     Crate crate = grabber.HeldCrate;
     bool match = true;
     if(crate.Features.Count == filter.Features.Count)
     {
         for(int i = 0; i < crate.Features.Count; i++)
         {
             if(crate.Features[i] != filter.Features[i])
             {
                 match = false;
             }
         }
     }
     else
     {
         match = false;
     }
     if(match)
     {
         grabber.Dispatch(null, port);
     }
 }
コード例 #25
0
        public void AddChild(Control control, Dock dock)
        {
            switch (dock)
            {
                case Dock.Left:
                    left = control;
                    break;
                case Dock.Right:
                    right = control;
                    break;
                case Dock.Top:
                    top = control;
                    break;
                case Dock.Bottom:
                    bottom = control;
                    break;
                default:
                    center = control;
                    break;
            }

            base.AddChild(control);
        }
コード例 #26
0
ファイル: UnpackRule.cs プロジェクト: GabrielSibley/games
 private void OnGrabberDocked(Dock port, Grabber grabber)
 {
     if(input.DockedGrabbers.Count > 0
        && outputSingle.DockedGrabbers.Count > 0
        && (input.DockedGrabbers[0].HeldCrate.Features.Count == 1 || outputRemainder.DockedGrabbers.Count > 0))
     {
         Crate inCrate = input.DockedGrabbers[0].HeldCrate;
         if(inCrate.Features.Count == 1)
         {
             outputSingle.DockedGrabbers[0].Dispatch(inCrate, outputSingle);
             input.DockedGrabbers[0].Dispatch(null, input);
         }
         else
         {
             Crate single = new Crate();
             int last = inCrate.Features.Count - 1;
             single.Features = new List<CrateFeature>(){inCrate.Features[last]};
             inCrate.Features.RemoveAt (last);
             input.DockedGrabbers[0].Dispatch(null, input);
             outputSingle.DockedGrabbers[0].Dispatch(single, outputSingle);
             outputRemainder.DockedGrabbers[0].Dispatch(inCrate, outputRemainder);
         }
     }
 }
コード例 #27
0
 public override void Dock(Actor dockableActor, Dockable dockable, Actor dockActor, Dock dock)
 {
     isDocking = true;
     Setup(dockableActor, dockable, dockActor, dock);
     QueueChild(new Move(dockableActor, dockEntry, WDist.Zero));
     state = SequenceState.Move;
 }
コード例 #28
0
 public static void SetButtonDock(DependencyObject element, Dock value)
 {
     element.SetValue(ButtonDockProperty, value);
 }
コード例 #29
0
 public PanelSwitcher(IServiceProvider package, Dock dockDirection)
 {
     _package       = package;
     _dockDirection = dockDirection;
 }
コード例 #30
0
 internal NestedDockEntry(DockPane sourcePane, DockItem targetItem, int ancestorSplitLevel, Dock dock, SplitterDistance splitterDistance, bool swapChildren)
 {
     Debug.Assert(targetItem != null);
     _sourcePane         = sourcePane;
     _targetItem         = targetItem;
     _ancestorSplitLevel = ancestorSplitLevel;
     _dock             = dock;
     _splitterDistance = splitterDistance;
     _swapChildren     = swapChildren;
 }
コード例 #31
0
ファイル: QDockPanel.cs プロジェクト: TzarIvan/ratel
 public void add(UIElement element, Dock position)
 {
     SetDock(element, position);
     add(element);
 }
コード例 #32
0
 /// <summary>
 /// Reads the pinned panes.
 /// </summary>
 /// <param name="dock">Dock point</param>
 /// <returns>DockPanes in order within pinned pane with specified dock point</returns>
 protected abstract IEnumerable <DockPane> ReadPinnedPanes(Dock dock);
コード例 #33
0
ファイル: SkinBase.cs プロジェクト: EReeves/gwen-net-ex
 public virtual void DrawTabButton(Control.ControlBase control, bool active, Dock dir)
 {
 }
コード例 #34
0
 public static UIElement Add(DockPanel panel, Dock dock, UIElement element)
 {
     DockPanel.SetDock(element, dock);
     panel.Children.Add(element);
     return(element);
 }
コード例 #35
0
 public static void SetIconDock(UIElement obj, Dock value) => obj.SetValue(IconDockProperty, value);
コード例 #36
0
 internal SideGlowResizeArgs(Dock side, HitTest mode)
 {
     _side = side;
     _mode = mode;
 }
コード例 #37
0
 /// <summary>
 /// Sets the value of the DockPanel.Dock attached property
 /// to a specified element.
 /// </summary>
 /// <param name="element">The element to which the attached property is written.</param>
 /// <param name="dock">The needed Dock value.</param>
 public static void SetDock(DependencyObject element, Dock dock)
 {
     element.SetValue(DockProperty, dock);
 }
コード例 #38
0
        private void MakeUIStructure()
        {
            //we go through the children and determine the rows, columns and positions in the grid:
            if (Children != null && Children.Count > 0)
            {
                int  amountOfRows    = 1;         // = 1 for the remaining space
                int  amountOfColumns = 1;         // = 1 for the remaining space
                Dock lastChildDock   = Dock.Left; //We only need it to know the amount of rows and columns and to know which row and column are the "remaining space" (sized at star) in the case where LastChildFill is true.

                //first pass: we count the amount of rows and columns.
                foreach (UIElement child in Children)
                {
                    //get the Dock value of the child:
                    Dock dock = DockPanel.GetDock(child);

                    if (dock == Dock.Left || dock == Dock.Right)
                    {
                        ++amountOfColumns;
                    }
                    else
                    {
                        ++amountOfRows;
                    }
                }
                if (LastChildFill) //if the last child fills the remaining space, we "remove" the row/column we "added" for this child.
                {
                    lastChildDock = GetDock(Children[Children.Count - 1]);
                    if (lastChildDock == Dock.Right || lastChildDock == Dock.Left)
                    {
                        --amountOfColumns;
                    }
                    else
                    {
                        --amountOfRows;
                    }
                }

                //second pass: we determine the Grid.Row, Grid.Column, Grid.RowSpan and Grid.ColumnsSpan for each child.
                int amountOfRightPlaced  = 0;
                int amountOfLeftPlaced   = 0;
                int amountOfTopPlaced    = 0;
                int amountOfBottomPlaced = 0;

                foreach (UIElement child in Children)
                {
                    //get the Dock value of the child:
                    Dock dock = DockPanel.GetDock(child);

                    switch (dock)
                    {
                    case Dock.Left:
                        Grid.SetRow(child, amountOfTopPlaced);
                        Grid.SetColumn(child, amountOfLeftPlaced);
                        Grid.SetRowSpan(child, amountOfRows - amountOfTopPlaced - amountOfBottomPlaced);
                        Grid.SetColumnSpan(child, 1);
                        ++amountOfLeftPlaced;
                        break;

                    case Dock.Top:
                        Grid.SetRow(child, amountOfTopPlaced);
                        Grid.SetColumn(child, amountOfLeftPlaced);
                        Grid.SetRowSpan(child, 1);
                        Grid.SetColumnSpan(child, amountOfColumns - amountOfLeftPlaced - amountOfRightPlaced);
                        ++amountOfTopPlaced;
                        break;

                    case Dock.Right:
                        Grid.SetRow(child, amountOfTopPlaced);
                        Grid.SetColumn(child, amountOfColumns - amountOfRightPlaced - 1);
                        Grid.SetRowSpan(child, amountOfRows - amountOfTopPlaced - amountOfBottomPlaced);
                        Grid.SetColumnSpan(child, 1);
                        ++amountOfRightPlaced;
                        break;

                    case Dock.Bottom:
                        Grid.SetRow(child, amountOfRows - amountOfBottomPlaced - 1);
                        Grid.SetColumn(child, amountOfLeftPlaced);
                        Grid.SetRowSpan(child, 1);
                        Grid.SetColumnSpan(child, amountOfColumns - amountOfLeftPlaced - amountOfRightPlaced);
                        ++amountOfBottomPlaced;
                        break;

                    default:
                        break;
                    }
                }

                //we remove the grid because we will change its structure A LOT, and we want to avoid redrawing everything on each change:
                INTERNAL_VisualTreeManager.DetachVisualChildIfNotNull(_grid, this);

                ColumnDefinitionCollection columnsDefinitions = _grid.ColumnDefinitions;
                columnsDefinitions.Clear();
                for (int i = 0; i < amountOfColumns; ++i)
                {
                    columnsDefinitions.Add(new ColumnDefinition()
                    {
                        Width = GridLength.Auto
                    });
                }
                RowDefinitionCollection rowsDefinitions = _grid.RowDefinitions;
                rowsDefinitions.Clear();
                for (int i = 0; i < amountOfRows; ++i)
                {
                    rowsDefinitions.Add(new RowDefinition()
                    {
                        Height = GridLength.Auto
                    });
                }

                if (!LastChildFill)
                {
                    columnsDefinitions.ElementAt(amountOfLeftPlaced).Width = new GridLength(1, GridUnitType.Star);
                    rowsDefinitions.ElementAt(amountOfTopPlaced).Height    = new GridLength(1, GridUnitType.Star);
                }
                else
                {
                    //the position of the "remaining space" depends on the last child's dock:
                    if (lastChildDock == Dock.Left)
                    {
                        columnsDefinitions.ElementAt(amountOfLeftPlaced - 1).Width = new GridLength(1, GridUnitType.Star); //minus 1 because the column index of the last child placed left is also the column index of the "remaining space".
                    }
                    else
                    {
                        columnsDefinitions.ElementAt(amountOfLeftPlaced).Width = new GridLength(1, GridUnitType.Star);
                    }

                    if (lastChildDock == Dock.Top)
                    {
                        rowsDefinitions.ElementAt(amountOfTopPlaced - 1).Height = new GridLength(1, GridUnitType.Star); //minus 1 because the column index of the last child placed left is also the column index of the "remaining space".
                    }
                    else
                    {
                        rowsDefinitions.ElementAt(amountOfTopPlaced).Height = new GridLength(1, GridUnitType.Star); //minus 1 because the column index of the last child placed left is also the column index of the "remaining space".
                    }
                }
                //the changes on the grid's structure are over so we can put it back.
#if REWORKLOADED
                this.AddVisualChild(this._grid);
#else
                INTERNAL_VisualTreeManager.AttachVisualChildIfNotAlreadyAttached(_grid, this);
#endif
            }
        }
コード例 #39
0
ファイル: KryptonFloatspace.cs プロジェクト: yp25/Krypton
 /// <summary>
 /// Gets a string representation of the class.
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     return("KryptonFloatspace " + Dock.ToString());
 }
コード例 #40
0
ファイル: TabItem.cs プロジェクト: ondrej11/o106
 /// <summary>
 /// Inherited code: Requires comment.
 /// </summary>
 /// <param name="isSelected">Inherited code: Requires comment 1.</param>
 /// <param name="tabPlacement">Inherited code: Requires comment 2.</param>
 /// <returns>Inherited code: Requires comment 3.</returns>
 internal ContentControl GetContentControl(bool isSelected, Dock tabPlacement)
 {
     switch (tabPlacement)
     {
         case Dock.Top:
             return isSelected ? ElementHeaderTopSelected : ElementHeaderTopUnselected;
         case Dock.Bottom:
             return isSelected ? ElementHeaderBottomSelected : ElementHeaderBottomUnselected;
         case Dock.Left:
             return isSelected ? ElementHeaderLeftSelected : ElementHeaderLeftUnselected;
         case Dock.Right:
             return isSelected ? ElementHeaderRightSelected : ElementHeaderRightUnselected;
     }
     return null;
 }
コード例 #41
0
        /// <summary>
        /// Measure Override
        /// </summary>
        protected override Size MeasureOverride(Size availableSize)
        {
           
                _viewPort = availableSize;
                _tabStripPlacement = TabStripPlacement;

                switch (_tabStripPlacement)
                {
                    case Dock.Top:
                    case Dock.Bottom:
                        return MeasureHorizontal(availableSize);

                    case Dock.Left:
                    case Dock.Right:
                        return MeasureVertical(availableSize);
                }
            
           
                return new Size();
            
        }
コード例 #42
0
ファイル: DockPanel.cs プロジェクト: jlarbi/Avalonia
 /// <summary>
 /// Sets the value of the Dock attached property on the specified control.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="value">The value of the Dock property.</param>
 public static void SetDock(Control control, Dock value)
 {
     control.SetValue(DockProperty, value);
 }
コード例 #43
0
 private void Awake()
 {
     dockComponent = GetComponent <Dock>();
 }
コード例 #44
0
 private static Orientation GetDockOrientation(Dock dock)
 {
     return(dock == Dock.Left || dock == Dock.Right ? Orientation.Horizontal : Orientation.Vertical);
 }
コード例 #45
0
 public static void SetDock(DependencyObject obj, Dock value)
 {
     obj.SetValue(DockProperty, value);
 }
コード例 #46
0
ファイル: Extensions.cs プロジェクト: daviddw/Kinsky
        public static void SetPopupOffset(this Popup aPopup, FrameworkElement aRelativeElement)
        {
            Window containingWindow = aRelativeElement.FindVisualAncestor <Window>();

            System.Windows.Point windowPosition = containingWindow.PointToScreen(new System.Windows.Point(0, 0));
            Rect virtualScreenCoords            = new Rect(SystemParameters.VirtualScreenLeft, SystemParameters.VirtualScreenTop, SystemParameters.VirtualScreenWidth, SystemParameters.VirtualScreenHeight);

            double desiredPopupWidth  = aPopup.Width;
            double desiredPopupHeight = aPopup.Height;

            System.Windows.Point relativeElementTopLeftCorner = aRelativeElement.TranslatePoint(new System.Windows.Point(0, 0), containingWindow);

            Dock desiredHorizontalPlacement = (Dock)aPopup.GetValue(PopupExtensions.DesiredHorizontalPlacementProperty);
            Dock desiredVerticalPlacement   = (Dock)aPopup.GetValue(PopupExtensions.DesiredVerticalPlacementProperty);
            Dock actualHorizontalPlacement  = desiredHorizontalPlacement;
            Dock actualVerticalPlacement    = desiredVerticalPlacement;



            // determine best fit horizontally
            if (desiredHorizontalPlacement == Dock.Right)
            {
                System.Windows.Point popupBottomRight = new System.Windows.Point(relativeElementTopLeftCorner.X + desiredPopupWidth, relativeElementTopLeftCorner.Y + aRelativeElement.ActualHeight + desiredPopupHeight);
                if (popupBottomRight.X > containingWindow.Width || containingWindow.PointToScreen(popupBottomRight).X > virtualScreenCoords.Width - virtualScreenCoords.Left)
                {
                    actualHorizontalPlacement = Dock.Left;
                }
            }
            else
            {
                System.Windows.Point popupBottomLeft = new System.Windows.Point(relativeElementTopLeftCorner.X + aRelativeElement.ActualWidth - desiredPopupWidth, relativeElementTopLeftCorner.Y + aRelativeElement.ActualHeight + desiredPopupHeight);
                if (popupBottomLeft.X < 0 || containingWindow.PointToScreen(popupBottomLeft).X < virtualScreenCoords.Left)
                {
                    actualHorizontalPlacement = Dock.Right;
                }
            }

            // calculate horizontal offset based on actual horizontal placement
            double horizontalOffset = (actualHorizontalPlacement == Dock.Right ? relativeElementTopLeftCorner.X : relativeElementTopLeftCorner.X + aRelativeElement.ActualWidth - desiredPopupWidth);

            // determine best fit vertically
            System.Windows.Point bottomDockLeft = new System.Windows.Point(horizontalOffset, relativeElementTopLeftCorner.Y + aRelativeElement.ActualHeight + desiredPopupHeight);
            System.Windows.Point topDockLeft    = new System.Windows.Point(horizontalOffset, relativeElementTopLeftCorner.Y - desiredPopupHeight);
            if (desiredVerticalPlacement == Dock.Bottom)
            {
                if (containingWindow.PointToScreen(bottomDockLeft).Y > virtualScreenCoords.Height - virtualScreenCoords.Left && containingWindow.PointToScreen(topDockLeft).Y > virtualScreenCoords.Top)
                {
                    actualVerticalPlacement = Dock.Top;
                }
            }
            else
            {
                if (containingWindow.PointToScreen(bottomDockLeft).Y < virtualScreenCoords.Height - virtualScreenCoords.Left && containingWindow.PointToScreen(topDockLeft).Y < virtualScreenCoords.Top)
                {
                    actualVerticalPlacement = Dock.Bottom;
                }
            }

            double verticalOffset = (actualVerticalPlacement == Dock.Bottom ? relativeElementTopLeftCorner.Y + aRelativeElement.ActualHeight : relativeElementTopLeftCorner.Y - desiredPopupHeight);

            // setup popup based on actual best placements and resulting co-ordinates relative to containing window
            aPopup.SetValue(PopupExtensions.VerticalPlacementProperty, actualVerticalPlacement);
            aPopup.SetValue(PopupExtensions.HorizontalPlacementProperty, actualHorizontalPlacement);
            aPopup.PlacementTarget  = containingWindow;
            aPopup.Placement        = PlacementMode.Relative;
            aPopup.HorizontalOffset = horizontalOffset;
            aPopup.VerticalOffset   = verticalOffset;

            // adjust maxheight of popup to prevent it being shifted up by wpf
            if (actualVerticalPlacement == Dock.Bottom)
            {
                System.Windows.Point bottomLeftScreenCoords = containingWindow.PointToScreen(new System.Windows.Point(horizontalOffset, verticalOffset + desiredPopupHeight));
                if (bottomLeftScreenCoords.Y > virtualScreenCoords.Height)
                {
                    System.Windows.Point screenBottomScreenCoords = new System.Windows.Point(bottomLeftScreenCoords.X, virtualScreenCoords.Height);
                    System.Windows.Point screenBottomWindowCoords = containingWindow.PointFromScreen(screenBottomScreenCoords);
                    aPopup.MaxHeight = screenBottomWindowCoords.Y - verticalOffset;
                }
                else
                {
                    aPopup.ClearValue(FrameworkElement.MaxHeightProperty);
                }
            }
            else
            {
                System.Windows.Point topLeftScreenCoords = containingWindow.PointToScreen(new System.Windows.Point(horizontalOffset, verticalOffset));
                if (topLeftScreenCoords.Y < virtualScreenCoords.Top)
                {
                    System.Windows.Point screenTopScreenCoords = new System.Windows.Point(topLeftScreenCoords.X, virtualScreenCoords.Top);
                    System.Windows.Point screenTopWindowCoords = containingWindow.PointFromScreen(screenTopScreenCoords);
                    aPopup.MaxHeight = desiredPopupHeight - (screenTopWindowCoords.Y - verticalOffset);
                }
                else
                {
                    aPopup.ClearValue(FrameworkElement.MaxHeightProperty);
                }
            }
        }
コード例 #47
0
ファイル: GridExpandBehavior.cs プロジェクト: jljse/rmvvml
 public GridElementWrapper(FrameworkElement fe, bool isHorizontal, Dock dock)
 {
     Element      = fe;
     IsHorizontal = isHorizontal;
     Dock         = dock;
 }
コード例 #48
0
ファイル: Extensions.cs プロジェクト: daviddw/Kinsky
 public static void SetDesiredHorizontalPlacement(TabControl element, Dock value)
 {
     element.SetValue(DesiredHorizontalPlacementProperty, value);
 }
コード例 #49
0
        /// <summary>
        /// Called when mouse enters condenced dock panel
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="args">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        private void OnCondencedDockPanelMouseEnter(object source, RoutedEventArgs args)
        {
            FrameworkElement element = source as FrameworkElement;

            Validate.Assert <ArgumentException>(element != null);

            DockPane pane = element.DataContext as DockPane;

            Validate.Assert <ArgumentException>(pane != null);

            RemovePopupEvents();
            PopupArea.Children.Clear();
            Dock dock = DockPanel.GetDock(pane);

            PopupArea.Children.Add(pane);

            bool isLeftOrRightDock = (dock == Dock.Left) || (dock == Dock.Right);

            GridSplitter sizingThumb = new GridSplitter();

            if (isLeftOrRightDock)
            {
                sizingThumb.Width             = 4;
                sizingThumb.VerticalAlignment = VerticalAlignment.Stretch;
            }
            else
            {
                sizingThumb.Height = 4;
                sizingThumb.HorizontalAlignment = HorizontalAlignment.Stretch;
            }

            sizingThumb.Background = Brushes.Transparent;
            sizingThumb.Cursor     = isLeftOrRightDock ? Cursors.SizeWE : Cursors.SizeNS;
            DockPanel.SetDock(sizingThumb, dock);
            PopupArea.Children.Add(sizingThumb);

            sizingThumb.DragDelta += (c, d) =>
            {
                if (isLeftOrRightDock && (pane.Width.Equals(double.NaN)))
                {
                    pane.Width = pane.DesiredSize.Width;
                }
                else if ((!(isLeftOrRightDock)) && (pane.Height.Equals(double.NaN)))
                {
                    pane.Height = pane.DesiredSize.Height;
                }

                double result = 0;
                switch (dock)
                {
                case Dock.Bottom:
                    result = pane.Height - d.VerticalChange;
                    break;

                case Dock.Left:
                    result = pane.Width + d.HorizontalChange;
                    break;

                case Dock.Right:
                    result = pane.Width - d.HorizontalChange;
                    break;

                case Dock.Top:
                    result = pane.Height + d.VerticalChange;
                    break;
                }

                if (result <= 0)
                {
                    return;
                }

                if (isLeftOrRightDock)
                {
                    pane.Width = result;
                }
                else
                {
                    pane.Height = result;
                }
            };

            pane.MouseLeave        += OnPopupAreaMouseLeave;
            sizingThumb.MouseLeave += OnPopupAreaMouseLeave;
            pane.MouseEnter        += OnPopupAreaMouseEnter;
            sizingThumb.MouseEnter += OnPopupAreaMouseEnter;

            _mouseOverPopupPane = true;

            EnablePopupTimer();
        }
コード例 #50
0
ファイル: Extensions.cs プロジェクト: daviddw/Kinsky
 public static void SetVerticalPlacement(TabControl element, Dock value)
 {
     element.SetValue(VerticalPlacementProperty, value);
 }
コード例 #51
0
 public override void Undock(Actor dockableActor, Dockable dockable, Actor dockActor, Dock dock)
 {
     Setup(dockableActor, dockable, dockActor, dock);
     QueueChild(new Drag(dockableActor, dockTarget, dockableActor.World.Map.CenterOfCell(dockEntry), distance / speed));
     state = SequenceState.Drag;
 }
コード例 #52
0
 /// <summary>
 /// Gets a string representation of the instance.
 /// </summary>
 /// <returns>String.</returns>
 public override string ToString()
 {
     return("KryptonDockableWorkspace " + Dock.ToString());
 }
コード例 #53
0
 /// <summary>
 /// Prepare a ContentControl to be used in a layout test.
 /// </summary>
 /// <param name="control">Control to prepare.</param>
 /// /// <param name="dock">Side to dock the control.</param>
 /// <param name="minWidth">Minimum width of the control.</param>
 /// <param name="minHeight">Minimum height of the control.</param>
 /// <returns>The prepared Control.</returns>
 protected virtual ContentControl Prepare(ContentControl control, Dock dock, double minWidth, double minHeight)
 {
     DockPanel.SetDock(control, dock);
     return(Prepare(control, minWidth, minHeight));
 }
コード例 #54
0
 public static void SetDock(UIElement obj, Dock value)
 {
     obj.SetValue(DockProperty, value);
 }
コード例 #55
0
ファイル: DockPanel.cs プロジェクト: chekiI/MediaPortal-2
 /// <summary>
 /// Setter method for the attached property <c>Dock</c>.
 /// </summary>
 /// <param name="targetObject">The object whose property value will
 /// be set.</param>
 /// <param name="value">Value of the <c>Dock</c> property on the
 /// <paramref name="targetObject"/> to be set.</param>
 public static void SetDock(DependencyObject targetObject, Dock value)
 {
   targetObject.SetAttachedPropertyValue<Dock>(DOCK_ATTACHED_PROPERTY, value);
 }
コード例 #56
0
 void IDragSource.Drop(Dock dock, bool sendToBack)
 {
     DockManager.Drop(DockItem, dock, sendToBack);
 }
コード例 #57
0
ファイル: TabItem.cs プロジェクト: ondrej11/o106
 /// <summary>
 /// Inherited code: Requires comment.
 /// </summary>
 /// <param name="isSelected">Inherited code: Requires comment 1.</param>
 /// <param name="tabPlacement">Inherited code: Requires comment 2.</param>
 /// <returns>Inherited code: Requires comment 3.</returns>
 internal FrameworkElement GetTemplate(bool isSelected, Dock tabPlacement)
 {
     switch (tabPlacement)
     {
         case Dock.Top:
             return isSelected ? ElementTemplateTopSelected : ElementTemplateTopUnselected;
         case Dock.Bottom:
             return isSelected ? ElementTemplateBottomSelected : ElementTemplateBottomUnselected;
         case Dock.Left:
             return isSelected ? ElementTemplateLeftSelected : ElementTemplateLeftUnselected;
         case Dock.Right:
             return isSelected ? ElementTemplateRightSelected : ElementTemplateRightUnselected;
     }
     return null;
 }
コード例 #58
0
 /// <summary>
 /// Gets a string representation of the class.
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     return("KryptonDockspaceSeparator " + Dock.ToString() + " " + Orientation.ToString());
 }
コード例 #59
0
 public void SetDockToAssignTo(Dock dock)
 {
     dockToAssignTo = dock;
 }
コード例 #60
0
 /// <summary>
 /// Reads the header panes.
 /// </summary>
 /// <param name="dock">Dock point</param>
 /// <returns>DockPanes in order within header pane with specified dock point</returns>
 protected abstract IEnumerable <DockPane> ReadHeaderPanes(Dock dock);