コード例 #1
0
        private void SetHeaderPosition(ViewDrawCanvas canvas,
                                       ViewDrawContent content,
                                       VisualOrientation position)
        {
            switch (position)
            {
            case VisualOrientation.Top:
                _topGroup.SetDock(canvas, ViewDockStyle.Top);
                canvas.Orientation  = VisualOrientation.Top;
                content.Orientation = VisualOrientation.Top;
                break;

            case VisualOrientation.Bottom:
                _topGroup.SetDock(canvas, ViewDockStyle.Bottom);
                canvas.Orientation  = VisualOrientation.Top;
                content.Orientation = VisualOrientation.Top;
                break;

            case VisualOrientation.Left:
                _topGroup.SetDock(canvas, ViewDockStyle.Left);
                canvas.Orientation  = VisualOrientation.Left;
                content.Orientation = VisualOrientation.Left;
                break;

            case VisualOrientation.Right:
                _topGroup.SetDock(canvas, ViewDockStyle.Right);
                canvas.Orientation  = VisualOrientation.Right;
                content.Orientation = VisualOrientation.Right;
                break;
            }
        }
コード例 #2
0
        /// <summary>
        /// Construct the view appropriate for this builder.
        /// </summary>
        /// <param name="navigator">Reference to navigator instance.</param>
        /// <param name="manager">Reference to current manager.</param>
        /// <param name="redirector">Palette redirector.</param>
        public override void Construct(KryptonNavigator navigator,
                                       ViewManager manager,
                                       PaletteRedirect redirector)
        {
            // Let base class perform common operations
            base.Construct(navigator, manager, redirector);

            // Get the current root element
            _oldRoot = ViewManager.Root;

            // Create a canvas for the border and background using current enabled state
            _drawCanvas = new ViewDrawCanvas(Navigator.StateNormal.HeaderGroup.Back,
                                             Navigator.StateNormal.HeaderGroup.Border,
                                             VisualOrientation.Top)
            {
                // Put the exising root into the canvas
                _oldRoot
            };

            // Set the correct palettes based on enabled state and selected page
            UpdateStatePalettes();

            // Canvas becomes the new root
            ViewManager.Root = _drawCanvas;

            // Need to monitor changes in the enabled state
            Navigator.EnabledChanged += new EventHandler(OnEnabledChanged);
        }
コード例 #3
0
        /// <summary>
        /// Create the view hierarchy for this view mode.
        /// </summary>
        protected override void CreateCheckItemView()
        {
            // Create a canvas for containing the selected page and put old root inside it
            _drawGroup = new ViewDrawCanvas(Navigator.StateNormal.HeaderGroup.Back,
                                            Navigator.StateNormal.HeaderGroup.Border,
                                            VisualOrientation.Top);

            _drawGroup.Add(_oldRoot);

            // Create the view element that lays out the check/tab buttons
            ViewLayoutBarForTabs layoutBar = new ViewLayoutBarForTabs(Navigator.Bar.ItemSizing,
                                                                      Navigator.Bar.ItemAlignment,
                                                                      Navigator.Bar.BarMultiline,
                                                                      Navigator.Bar.ItemMinimumSize,
                                                                      Navigator.Bar.ItemMaximumSize,
                                                                      Navigator.Bar.BarMinimumHeight,
                                                                      Navigator.Bar.TabBorderStyle,
                                                                      true);

            _layoutBar = layoutBar;

            // Create the scroll spacer that restricts display
            _layoutBarViewport = new ViewLayoutViewport(Navigator.StateCommon.Bar,
                                                        PaletteMetricPadding.BarPaddingTabs,
                                                        PaletteMetricInt.CheckButtonGap,
                                                        Navigator.Bar.BarOrientation,
                                                        Navigator.Bar.ItemAlignment,
                                                        Navigator.Bar.BarAnimation);
            _layoutBarViewport.Add(_layoutBar);

            // Create the button bar area docker
            _layoutBarDocker = new ViewLayoutDocker();
            _layoutBarDocker.Add(_layoutBarViewport, ViewDockStyle.Fill);

            // Add a separators for insetting items
            _layoutBarSeparatorFirst = new ViewLayoutSeparator(0);
            _layoutBarSeparatorLast  = new ViewLayoutSeparator(0);
            _layoutBarDocker.Add(_layoutBarSeparatorFirst, ViewDockStyle.Left);
            _layoutBarDocker.Add(_layoutBarSeparatorLast, ViewDockStyle.Right);

            // Create the layout that insets the contents to allow for rounding of the group border
            _layoutOverlap = new ViewLayoutInsetOverlap(_drawGroup);
            _layoutOverlap.Add(_layoutBarDocker);

            // Create the docker used to layout contents of main panel and fill with group
            _layoutPanelDocker = new ViewLayoutDockerOverlap(_drawGroup, _layoutOverlap, layoutBar);
            _layoutPanelDocker.Add(_layoutOverlap, ViewDockStyle.Top);
            _layoutPanelDocker.Add(_drawGroup, ViewDockStyle.Fill);

            // Create the top level panel and put a layout docker inside it
            _drawPanel = new ViewDrawPanel(Navigator.StateNormal.Back);
            _drawPanel.Add(_layoutPanelDocker);
            _newRoot = _drawPanel;

            // Set the correct tab style
            UpdateTabStyle();

            // Must call the base class to perform common actions
            base.CreateCheckItemView();
        }
コード例 #4
0
        /// <summary>
        /// Create the view hierarchy for this view mode.
        /// </summary>
        protected override void CreateCheckItemView()
        {
            // Create a canvas for containing the selected page and put old root inside it
            _drawGroup = new ViewDrawCanvas(Navigator.StateNormal.HeaderGroup.Back, Navigator.StateNormal.HeaderGroup.Border, VisualOrientation.Top)
            {
                _oldRoot
            };

            // Create the view element that lays out the check buttons
            _layoutBar = new ViewLayoutBar(Navigator.StateCommon.Bar,
                                           PaletteMetricInt.CheckButtonGap,
                                           Navigator.Bar.ItemSizing,
                                           Navigator.Bar.ItemAlignment,
                                           Navigator.Bar.BarMultiline,
                                           Navigator.Bar.ItemMinimumSize,
                                           Navigator.Bar.ItemMaximumSize,
                                           Navigator.Bar.BarMinimumHeight,
                                           false);

            // Create the scroll spacer that restricts display
            _layoutBarViewport = new ViewLayoutViewport(Navigator.StateCommon.Bar,
                                                        PaletteMetricPadding.BarPaddingOutside,
                                                        PaletteMetricInt.CheckButtonGap,
                                                        Navigator.Bar.BarOrientation,
                                                        Navigator.Bar.ItemAlignment,
                                                        Navigator.Bar.BarAnimation)
            {
                _layoutBar
            };

            // Create the button bar area docker
            _layoutBarDocker = new ViewLayoutDocker
            {
                { _layoutBarViewport, ViewDockStyle.Fill }
            };

            // Add a separators for insetting items
            _layoutBarSeparatorFirst = new ViewLayoutSeparator(0);
            _layoutBarSeparatorLast  = new ViewLayoutSeparator(0);
            _layoutBarDocker.Add(_layoutBarSeparatorFirst, ViewDockStyle.Left);
            _layoutBarDocker.Add(_layoutBarSeparatorLast, ViewDockStyle.Right);

            // Create the docker used to layout contents of main panel and fill with group
            _layoutPanelDocker = new ViewLayoutDocker
            {
                { _drawGroup, ViewDockStyle.Fill },
                { _layoutBarDocker, ViewDockStyle.Top }
            };

            // Create the top level panel and put a layout docker inside it
            _drawPanel = new ViewDrawPanel(Navigator.StateNormal.Back)
            {
                _layoutPanelDocker
            };
            _newRoot = _drawPanel;

            // Must call the base class to perform common actions
            base.CreateCheckItemView();
        }
コード例 #5
0
        private ViewDrawCanvas CreateInsideCanvas()
        {
            ViewDrawCanvas mainBackground = new ViewDrawCanvas(_provider.ProviderStateCommon.ControlInner.Back, _provider.ProviderStateCommon.ControlInner.Border, VisualOrientation.Top);

            mainBackground.Add(_viewColumns);
            mainBackground.KeyController = new ContextMenuController((ViewContextMenuManager)ViewManager);
            return(mainBackground);
        }
コード例 #6
0
        /// <summary>
        /// Initialize a new instance of the VisualPopupPage class.
        /// </summary>
        /// <param name="navigator">Reference to owning navigator control.</param>
        /// <param name="page">Reference to page for display.</param>
        /// <param name="renderer">Drawing renderer.</param>
        public VisualPopupPage(KryptonNavigator navigator,
                               KryptonPage page,
                               IRenderer renderer)
            : base(renderer, true)
        {
            Debug.Assert(navigator != null);
            Debug.Assert(page != null);

            // Remember references needed later
            _navigator = navigator;
            _page = page;

            // Always create the layout that positions the actual page
            ViewLayoutPopupPage layoutPage = new ViewLayoutPopupPage(navigator, page);

            // Create the internal panel used for containing content
            ViewDrawCanvas drawGroup = new ViewDrawCanvas(navigator.StateNormal.HeaderGroup.Back,
                                                          navigator.StateNormal.HeaderGroup.Border,
                                                          VisualOrientation.Top)
            {

                // Add the layout inside the draw group
                layoutPage
            };

            // Do we need to add a border area around the page group
            if (_navigator.PopupPages.Border > 0)
            {
                // Grab the actual border values
                int border = _navigator.PopupPages.Border;

                // Put the page group inside a layout that has separators 
                // to pad out the sizing to the border size we need
                ViewLayoutDocker layoutDocker = new ViewLayoutDocker
                {
                    { drawGroup, ViewDockStyle.Fill },
                    { new ViewLayoutSeparator(border), ViewDockStyle.Top },
                    { new ViewLayoutSeparator(border), ViewDockStyle.Bottom },
                    { new ViewLayoutSeparator(border), ViewDockStyle.Left },
                    { new ViewLayoutSeparator(border), ViewDockStyle.Right }
                };

                // Create a new top level group that contains the layout
                drawGroup = new ViewDrawCanvas(navigator.StateNormal.Back,
                                               navigator.StateNormal.HeaderGroup.Border,
                                               VisualOrientation.Top)
                {
                    layoutDocker
                };
            }

            ViewManager = new ViewManager(this, drawGroup);

            // Borrow the child panel that contains all the pages from 
            // the navigator and add it inside as a child of ourself
            navigator.BorrowChildPanel();
            Controls.Add(navigator.ChildPanel);
        }
コード例 #7
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawButton class.
        /// </summary>
        /// <param name="paletteDisabled">Palette source for the disabled state.</param>
        /// <param name="paletteNormal">Palette source for the normal state.</param>
        /// <param name="paletteTracking">Palette source for the tracking state.</param>
        /// <param name="palettePressed">Palette source for the pressed state.</param>
        /// <param name="paletteCheckedNormal">Palette source for the normal checked state.</param>
        /// <param name="paletteCheckedTracking">Palette source for the tracking checked state.</param>
        /// <param name="paletteCheckedPressed">Palette source for the pressed checked state.</param>
        /// <param name="paletteMetric">Palette source for metric values.</param>
        /// <param name="imageValue"></param>
        /// <param name="commandLinkTextValues"></param>
        /// <param name="orientation">Visual orientation of the content.</param>
        /// <param name="useMnemonic">Use mnemonics.</param>
        public ViewDrawCommandLinkButton(IPaletteTriple paletteDisabled,
                                         IPaletteTriple paletteNormal,
                                         IPaletteTriple paletteTracking,
                                         IPaletteTriple palettePressed,
                                         IPaletteTriple paletteCheckedNormal,
                                         IPaletteTriple paletteCheckedTracking,
                                         IPaletteTriple paletteCheckedPressed,
                                         IPaletteMetric paletteMetric,
                                         ImageValue imageValue, CommandLinkTextValues commandLinkTextValues,
                                         VisualOrientation orientation,
                                         bool useMnemonic)
        {
            // Remember the source information
            _paletteDisabled        = paletteDisabled;
            _paletteNormal          = paletteNormal;
            _paletteTracking        = paletteTracking;
            _palettePressed         = palettePressed;
            _paletteCheckedNormal   = paletteCheckedNormal;
            _paletteCheckedTracking = paletteCheckedTracking;
            _paletteCheckedPressed  = paletteCheckedPressed;
            CurrentPalette          = _paletteNormal;

            // Default to not being checked
            Checked      = false;
            AllowUncheck = true;

            // Create the drop down view
            _drawImageContent = new ViewDrawContent(_paletteNormal.PaletteContent, imageValue, orientation);
            _drawImage        = new ViewLayoutCenter(paletteMetric, PaletteMetricPadding.BarPaddingOnly,
                                                     orientation, _drawImageContent);

            // Our view contains background and border with content inside
            _drawContent = new ViewDrawContent(_paletteNormal.PaletteContent, commandLinkTextValues, orientation)
            {
                // Pass the mnemonic default to the content view
                UseMnemonic = useMnemonic
            };

            // Use a docker layout to organize the contents of the canvas
            LayoutDocker = new ViewLayoutDocker
            {
                { _drawContent, ViewDockStyle.Left },
                { _drawImage, ViewDockStyle.Left }
            };
            LayoutDocker.Tag = this;


            _drawCanvas = new ViewDrawCanvas(_paletteNormal.PaletteBack, _paletteNormal.PaletteBorder, paletteMetric,
                                             PaletteMetricPadding.BarPaddingTabs, orientation)
            {
                // Place the content inside the canvas
                LayoutDocker
            };

            // Place the canvas inside ourself
            Add(_drawCanvas);
        }
コード例 #8
0
        /// <summary>
        /// Initialize a new instance of the ViewLayoutInsetOverlap class.
        /// </summary>
        public ViewLayoutInsetOverlap(ViewDrawCanvas drawCanvas)
        {
            Debug.Assert(drawCanvas != null);

            // Remember source of the rounding values
            _drawCanvas = drawCanvas;

            // Default other state
            Orientation = VisualOrientation.Top;
        }
コード例 #9
0
        /// <summary>
        /// Initialize a new instance of the ViewLayoutDockerOverlap class.
        /// </summary>
        /// <param name="drawCanvas">Canvas used to recover border width/rounding for overlapping.</param>
        /// <param name="layoutOverlap">Overlapping element.</param>
        /// <param name="layoutTabs">Tab item container element.</param>
        public ViewLayoutDockerOverlap(ViewDrawCanvas drawCanvas,
                                       ViewLayoutInsetOverlap layoutOverlap,
                                       ViewLayoutBarForTabs layoutTabs)
        {
            Debug.Assert(drawCanvas != null);
            Debug.Assert(layoutOverlap != null);
            Debug.Assert(layoutTabs != null);

            // Remember provided references
            _drawCanvas    = drawCanvas;
            _layoutOverlap = layoutOverlap;
            _layoutTabs    = layoutTabs;
        }
        /// <summary>
        /// Create the view hierarchy for this view mode.
        /// </summary>
        protected override void CreateCheckItemView()
        {
            // Create the two headers and header content
            _viewContentPrimary = new ViewDrawContent(Navigator.StateNormal.HeaderGroup.HeaderPrimary.Content,
                                                      Navigator.Header.HeaderValuesPrimary,
                                                      VisualOrientation.Top);

            _viewHeadingPrimary = new ViewDrawDocker(Navigator.StateNormal.HeaderGroup.HeaderPrimary.Back,
                                                     Navigator.StateNormal.HeaderGroup.HeaderPrimary.Border,
                                                     Navigator.StateNormal.HeaderGroup.HeaderPrimary,
                                                     PaletteMetricBool.None,
                                                     PaletteMetricPadding.HeaderGroupPaddingPrimary,
                                                     VisualOrientation.Top);

            _viewContentSecondary = new ViewDrawContent(Navigator.StateNormal.HeaderGroup.HeaderSecondary.Content,
                                                        Navigator.Header.HeaderValuesSecondary,
                                                        VisualOrientation.Top);

            _viewHeadingSecondary = new ViewDrawDocker(Navigator.StateNormal.HeaderGroup.HeaderSecondary.Back,
                                                       Navigator.StateNormal.HeaderGroup.HeaderSecondary.Border,
                                                       Navigator.StateNormal.HeaderGroup.HeaderSecondary,
                                                       PaletteMetricBool.None,
                                                       PaletteMetricPadding.HeaderGroupPaddingSecondary,
                                                       VisualOrientation.Top);

            // Place the the content as fillers in the headers
            _viewHeadingPrimary.Add(_viewContentPrimary, ViewDockStyle.Fill);
            _viewHeadingSecondary.Add(_viewContentSecondary, ViewDockStyle.Fill);

            // Create a canvas for containing the selected page and put old root inside it
            _drawGroup = new ViewDrawCanvas(Navigator.StateNormal.HeaderGroup.Back,
                                            Navigator.StateNormal.HeaderGroup.Border,
                                            VisualOrientation.Top)
            {
                ApplyIncludeBorderEdge = true
            };
            _drawGroup.Add(_oldRoot);

            // Create the view element that lays out the check/tab buttons
            ViewLayoutBarForTabs layoutBar = new ViewLayoutBarForTabs(Navigator.Bar.ItemSizing,
                                                                      Navigator.Bar.ItemAlignment,
                                                                      Navigator.Bar.BarMultiline,
                                                                      Navigator.Bar.ItemMinimumSize,
                                                                      Navigator.Bar.ItemMaximumSize,
                                                                      Navigator.Bar.BarMinimumHeight,
                                                                      Navigator.Bar.TabBorderStyle,
                                                                      true);

            _layoutBar = layoutBar;

            // Create the scroll spacer that restricts display
            _layoutBarViewport = new ViewLayoutViewport(Navigator.StateCommon.Bar,
                                                        PaletteMetricPadding.BarPaddingTabs,
                                                        PaletteMetricInt.CheckButtonGap,
                                                        Navigator.Bar.BarOrientation,
                                                        Navigator.Bar.ItemAlignment,
                                                        Navigator.Bar.BarAnimation)
            {
                _layoutBar
            };

            // Create the button bar area docker
            _layoutBarDocker = new ViewLayoutDocker
            {
                { _layoutBarViewport, ViewDockStyle.Fill }
            };

            // Add a separators for insetting items
            _layoutBarSeparatorFirst = new ViewLayoutSeparator(0);
            _layoutBarSeparatorLast  = new ViewLayoutSeparator(0);
            _layoutBarDocker.Add(_layoutBarSeparatorFirst, ViewDockStyle.Left);
            _layoutBarDocker.Add(_layoutBarSeparatorLast, ViewDockStyle.Right);

            // Create the layout that insets the contents to allow for rounding of the group border
            _layoutOverlap = new ViewLayoutInsetOverlap(_drawGroup)
            {
                _layoutBarDocker
            };

            // Create the docker used to layout contents of main panel and fill with group
            _layoutPanelDocker = new ViewLayoutDockerOverlap(_drawGroup, _layoutOverlap, layoutBar)
            {
                { _layoutOverlap, ViewDockStyle.Top },
                { _drawGroup, ViewDockStyle.Fill }
            };

            // Place the headers and page holding area into the group
            _topGroup = new ViewLayoutDocker
            {
                { _viewHeadingSecondary, ViewDockStyle.Bottom },
                { _viewHeadingPrimary, ViewDockStyle.Top },
                { _layoutPanelDocker, ViewDockStyle.Fill }
            };

            // Prevent adjacent headers from having two borders
            _topGroup.RemoveChildBorders = true;

            // Create the top level panel and put a layout docker inside it
            _drawPanel = new ViewDrawPanel(Navigator.StateNormal.Back)
            {
                _topGroup
            };
            _newRoot = _drawPanel;

            // Set initial visible state of headers
            _viewHeadingPrimary.Visible   = Navigator.Header.HeaderVisiblePrimary;
            _viewHeadingSecondary.Visible = Navigator.Header.HeaderVisibleSecondary;

            // Set the correct tab style
            UpdateTabStyle();

            // Must call the base class to perform common actions
            base.CreateCheckItemView();
        }
コード例 #11
0
        private void UpdateChildBorders(ViewBase child,
                                        ViewLayoutContext context,
                                        ref PaletteDrawBorders leftEdges,
                                        ref PaletteDrawBorders rightEdges,
                                        ref PaletteDrawBorders topEdges,
                                        ref PaletteDrawBorders bottomEdges,
                                        ref PaletteDrawBorders fillEdges)
        {
            // Do we need to calculate if the child should remove any borders?
            if (RemoveChildBorders)
            {
                // Check if the view is a canvas
                ViewDrawCanvas childCanvas = child as ViewDrawCanvas;

                // Docking edge determines calculation
                switch (CalculateDock(GetDock(child), context.Control))
                {
                case ViewDockStyle.Top:
                    if (childCanvas != null)
                    {
                        childCanvas.MaxBorderEdges = CommonHelper.ReverseOrientateDrawBorders(topEdges, childCanvas.Orientation);
                    }

                    // Remove top edges from subsequent children
                    leftEdges  &= PaletteDrawBorders.BottomLeftRight;
                    rightEdges &= PaletteDrawBorders.BottomLeftRight;
                    topEdges   &= PaletteDrawBorders.BottomLeftRight;
                    break;

                case ViewDockStyle.Bottom:
                    if (childCanvas != null)
                    {
                        childCanvas.MaxBorderEdges = CommonHelper.ReverseOrientateDrawBorders(bottomEdges, childCanvas.Orientation);
                    }

                    // Remove bottom edges from subsequent children
                    leftEdges   &= PaletteDrawBorders.TopLeftRight;
                    rightEdges  &= PaletteDrawBorders.TopLeftRight;
                    bottomEdges &= PaletteDrawBorders.TopLeftRight;
                    break;

                case ViewDockStyle.Left:
                    if (childCanvas != null)
                    {
                        childCanvas.MaxBorderEdges = CommonHelper.ReverseOrientateDrawBorders(leftEdges, childCanvas.Orientation);
                    }

                    // Remove left edges from subsequent children
                    topEdges    &= PaletteDrawBorders.TopBottomRight;
                    bottomEdges &= PaletteDrawBorders.TopBottomRight;
                    leftEdges   &= PaletteDrawBorders.TopBottomRight;
                    break;

                case ViewDockStyle.Right:
                    if (childCanvas != null)
                    {
                        childCanvas.MaxBorderEdges = CommonHelper.ReverseOrientateDrawBorders(rightEdges, childCanvas.Orientation);
                    }

                    // Remove right edges from subsequent children
                    topEdges    &= PaletteDrawBorders.TopBottomLeft;
                    bottomEdges &= PaletteDrawBorders.TopBottomLeft;
                    rightEdges  &= PaletteDrawBorders.TopBottomLeft;
                    break;
                }
            }
        }