Пример #1
0
            /// <summary>
            /// Resizes the right panel
            /// </summary>
            /// <param name="newWidth">The new width of the right panel in pixels</param>
            public void Resize(int newWidth)
            {
                if (Container.SplitterOrientation() != "Vertical")
                {
                    throw GUI.ApeException("Right panel does not exist");
                }

                // Resize the panel
                int actualNewWidth         = newWidth;
                int rightPanelMinimumWidth = Container.GetPanelMinimumDimension(SplitterPanel.Panel2);
                int leftPanelMinimumWidth  = Container.GetPanelMinimumDimension(SplitterPanel.Panel1);
                int splitterWidth          = Container.GetSplitterRectangle().Width;

                if (actualNewWidth > Container.Width - leftPanelMinimumWidth - splitterWidth)
                {
                    actualNewWidth = Container.Width - leftPanelMinimumWidth - splitterWidth;
                }
                if (actualNewWidth < rightPanelMinimumWidth)
                {
                    actualNewWidth = rightPanelMinimumWidth;
                }

                int currentWidth = Container.GetPanelDimension(SplitterPanel.Panel2, SplitterDimension.Width);
                int adjustment   = actualNewWidth - currentWidth;

                if (actualNewWidth != newWidth)
                {
                    GUI.Log("Warning new width adjusted to " + actualNewWidth + " due to size restrictions of the " + Container.Description, LogItemType.Warning);
                }

                if (actualNewWidth == currentWidth)
                {
                    GUI.Log("Make sure the width of the right panel in the " + Container.Description + " is " + actualNewWidth.ToString(), LogItemType.Action);
                    return;
                }

                GUI.Log("Resize the right panel of the " + Container.Identity.Description + " to have a width of " + actualNewWidth.ToString() + " pixels ", LogItemType.Action);
                Container.Resize(adjustment, Axis.X);
            }
Пример #2
0
            /// <summary>
            /// Resizes the bottom panel
            /// </summary>
            /// <param name="newHeight">The new height of the bottom panel in pixels</param>
            public void Resize(int newHeight)
            {
                if (Container.SplitterOrientation() != "Horizontal")
                {
                    throw GUI.ApeException("Bottom panel does not exist");
                }

                // Resize the panel
                int actualNewHeight          = newHeight;
                int bottomPanelMinimumHeight = Container.GetPanelMinimumDimension(SplitterPanel.Panel2);
                int topPanelMinimumHeight    = Container.GetPanelMinimumDimension(SplitterPanel.Panel1);
                int splitterHeight           = Container.GetSplitterRectangle().Height;

                if (actualNewHeight > Container.Height - topPanelMinimumHeight - splitterHeight)
                {
                    actualNewHeight = Container.Height - topPanelMinimumHeight - splitterHeight;
                }
                if (actualNewHeight < bottomPanelMinimumHeight)
                {
                    actualNewHeight = bottomPanelMinimumHeight;
                }

                int currentHeight = Container.GetPanelDimension(SplitterPanel.Panel2, SplitterDimension.Height);
                int adjustment    = actualNewHeight - currentHeight;

                if (actualNewHeight != newHeight)
                {
                    GUI.Log("Warning new height adjusted to " + actualNewHeight + " due to size restrictions of the " + Container.Description, LogItemType.Warning);
                }

                if (actualNewHeight == currentHeight)
                {
                    GUI.Log("Make sure the height of the bottom panel in the " + Container.Description + " is " + actualNewHeight.ToString(), LogItemType.Action);
                    return;
                }

                GUI.Log("Resize the bottom panel of the " + Container.Identity.Description + " to have a height of " + actualNewHeight.ToString() + " pixels ", LogItemType.Action);
                Container.Resize(adjustment, Axis.Y);
            }