View element that can draw a panel (background but no border)
Inheritance: ViewComposite
Ejemplo n.º 1
1
            public InternalListBox(KryptonListBox kryptonListBox)
            {
                SetStyle(ControlStyles.ResizeRedraw, true);

                _kryptonListBox = kryptonListBox;
                _mouseIndex = -1;

                // Create manager and view for drawing the background
                _drawPanel = new ViewDrawPanel();
                _viewManager = new ViewManager(this, _drawPanel);

                // Set required properties to act as an owner draw list box
                base.Size = Size.Empty;
                base.BorderStyle = BorderStyle.None;
                base.IntegralHeight = false;
                base.MultiColumn = false;
                base.DrawMode = DrawMode.OwnerDrawVariable;

                // We need to create and cache a device context compatible with the display
                _screenDC = PI.CreateCompatibleDC(IntPtr.Zero);
            }
Ejemplo n.º 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 background
            _drawPanel = new ViewDrawPanel(Navigator.StateNormal.Back);

            // Put the exisint root into the canvas
            _drawPanel.Add(_oldRoot);

            // Update the child panel to have panel appearance
            Navigator.ChildPanel.PanelBackStyle = Navigator.Panel.PanelBackStyle;

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

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

            // Need to monitor changes in the enabled state
            Navigator.EnabledChanged += new EventHandler(OnEnabledChanged);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initialize a new instance of the KryptonBorderEdge class.
        /// </summary>
        public KryptonBorderEdge()
        {
            // The label cannot take the focus
            SetStyle(ControlStyles.Selectable, false);

            // Set default label style
            _orientation = Orientation.Horizontal;

            // Create the palette storage
            _borderRedirect = new PaletteBorderInheritRedirect(Redirector, PaletteBorderStyle.ControlClient);
            _stateCommon = new PaletteBorderEdgeRedirect(_borderRedirect, NeedPaintDelegate);
            _stateDisabled = new PaletteBorderEdge(_stateCommon, NeedPaintDelegate);
            _stateNormal = new PaletteBorderEdge(_stateCommon, NeedPaintDelegate);
            _stateCurrent = _stateNormal;
            _state = PaletteState.Normal;

            // Our view contains just a simple canvas that covers entire client area
            _drawPanel = new ViewDrawPanel(_stateNormal);

            // Create the view manager instance
            ViewManager = new ViewManager(this, _drawPanel);

            // We want to be auto sized by default, but not the property default!
            AutoSize = true;
            AutoSizeMode = AutoSizeMode.GrowAndShrink;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initialize a new instance of the KryptonBorderEdge class.
        /// </summary>
        public KryptonBorderEdge()
        {
            // The label cannot take the focus
            SetStyle(ControlStyles.Selectable, false);

            // Set default label style
            _orientation = Orientation.Horizontal;

            // Create the palette storage
            _borderRedirect = new PaletteBorderInheritRedirect(Redirector, PaletteBorderStyle.ControlClient);
            _stateCommon    = new PaletteBorderEdgeRedirect(_borderRedirect, NeedPaintDelegate);
            _stateDisabled  = new PaletteBorderEdge(_stateCommon, NeedPaintDelegate);
            _stateNormal    = new PaletteBorderEdge(_stateCommon, NeedPaintDelegate);
            _stateCurrent   = _stateNormal;
            _state          = PaletteState.Normal;

            // Our view contains just a simple canvas that covers entire client area
            _drawPanel = new ViewDrawPanel(_stateNormal);

            // Create the view manager instance
            ViewManager = new ViewManager(this, _drawPanel);

            // We want to be auto sized by default, but not the property default!
            AutoSize     = true;
            AutoSizeMode = AutoSizeMode.GrowAndShrink;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Raises the EnabledChanged event.
        /// </summary>
        /// <param name="e">An EventArgs that contains the event data.</param>
        protected override void OnEnabledChanged(EventArgs e)
        {
            // Let base class fire standard event
            base.OnEnabledChanged(e);

            // Update with the correct forced palette entry
            ViewDrawPanel.SetPalettes(Enabled ? _forcedNormal : _forcedDisabled);
        }
Ejemplo n.º 6
0
        private void Construct()
        {
            // Our view contains just a simple canvas that covers entire client area
            _drawPanel = new ViewDrawPanel(_stateNormal.Back);

            // Create the view manager instance
            ViewManager = new ViewManager(this, _drawPanel);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Initialize a new instance of the KryptonGroupPanel class.
        /// </summary>
        /// <param name="alignControl">Container control for alignment.</param>
        /// <param name="stateCommon">Common appearance state to inherit from.</param>
        /// <param name="stateDisabled">Disabled appearance state.</param>
        /// <param name="stateNormal">Normal appearance state.</param>
        /// <param name="layoutHandler">Callback delegate for layout processing.</param>
        public KryptonGroupPanel(Control alignControl,
                                 PaletteDoubleRedirect stateCommon,
                                 PaletteDouble stateDisabled,
                                 PaletteDouble stateNormal,
                                 NeedPaintHandler layoutHandler)
            : base(stateCommon, stateDisabled, stateNormal)
        {
            // Remember the delegate used to notify layouts
            _layoutHandler = layoutHandler;

            // Create the forced overrides to enforce the graphics option we want
            _forcedDisabled = new PaletteBackInheritForced(stateDisabled.Back);
            _forcedNormal   = new PaletteBackInheritForced(stateNormal.Back);

            // We never allow the anti alias option as it prevent transparent background working
            _forcedDisabled.ForceGraphicsHint = PaletteGraphicsHint.None;
            _forcedNormal.ForceGraphicsHint   = PaletteGraphicsHint.None;

            // Set the correct initial palettes
            ViewDrawPanel.SetPalettes(Enabled ? _forcedNormal : _forcedDisabled);

            // Make sure the alignment of the group panel is as that of the parent
            ViewManager.AlignControl = alignControl;
        }
        /// <summary>
        /// Create the view hierarchy for this view mode.
        /// </summary>
        protected override void CreateCheckItemView()
        {
            // 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.BarPaddingInside,
                                                        PaletteMetricInt.CheckButtonGap,
                                                        Navigator.Header.HeaderPositionBar,
                                                        Navigator.Bar.ItemAlignment,
                                                        Navigator.Bar.BarAnimation);
            _layoutBarViewport.Add(_layoutBar);

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

            // Place the bar inside a header style area
            _viewHeadingBar = new ViewDrawDocker(Navigator.StateNormal.HeaderGroup.HeaderBar.Back,
                                                 Navigator.StateNormal.HeaderGroup.HeaderBar.Border,
                                                 Navigator.StateNormal.HeaderGroup.HeaderBar,
                                                 PaletteMetricBool.None,
                                                 PaletteMetricPadding.HeaderGroupPaddingSecondary,
                                                 VisualOrientation.Top);

            _viewHeadingBar.Add(_layoutBarDocker, ViewDockStyle.Fill);

            // Create the docker used to layout contents of main panel and fill with group
            _layoutPanelDocker = new ViewLayoutDocker();
            _layoutPanelDocker.Add(new ViewLayoutPageHide(Navigator), ViewDockStyle.Fill);
            _layoutPanelDocker.Add(_viewHeadingBar, ViewDockStyle.Top);

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

            // Must call the base class to perform common actions
            base.CreateCheckItemView();
        }
Ejemplo n.º 9
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();
        }
Ejemplo n.º 10
0
            public InternalTreeView(KryptonTreeView kryptonTreeView)
            {
                SetStyle(ControlStyles.ResizeRedraw, true);

                _kryptonTreeView = kryptonTreeView;

                // Create manager and view for drawing the background
                _drawPanel = new ViewDrawPanel();
                _viewManager = new ViewManager(this, _drawPanel);

                // Set required properties to act as an owner draw list box
                base.Size = Size.Empty;
                base.BorderStyle = BorderStyle.None;

                // We need to create and cache a device context compatible with the display
                _screenDC = PI.CreateCompatibleDC(IntPtr.Zero);
            }
        /// <summary>
        /// Create the view hierarchy for this view mode.
        /// </summary>
        protected override void CreateCheckItemView()
        {
            // 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.BarPaddingOnly,
                                                        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 docker used to layout contents of main panel and fill with group
            _layoutPanelDocker = new ViewLayoutDocker();
            _layoutPanelDocker.Add(_layoutBarDocker, ViewDockStyle.Fill);
            _layoutPanelDocker.Add(new ViewLayoutPageHide(Navigator), ViewDockStyle.Top);

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

            // Must call the base class to perform common actions
            base.CreateCheckItemView();
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Initialize a new instance of the KryptonPage class.
        /// </summary>
        /// <param name="text">Initial text.</param>
        /// <param name="imageSmall">Initial small image.</param>
        /// <param name="uniqueName">Initial unique name.</param>
        public KryptonPage(string text, Image imageSmall, string uniqueName)
        {
            // Default properties
            Text = text;
            MinimumSize = new Size(50, 50);
            _textTitle = "Page Title";
            _textDescription = "Page Description";
            _toolTipTitle = "Page ToolTip";
            _toolTipBody = string.Empty;
            _toolTipImage = null;
            _toolTipStyle = LabelStyle.ToolTip;
            _toolTipImageTransparentColor = Color.Empty;
            _imageSmall = imageSmall;
            _setVisible = true;
            _autoHiddenSlideSize = new Size(200, 200);
            _uniqueName = (string.IsNullOrEmpty(uniqueName) ? CommonHelper.UniqueString : uniqueName);
            _flags.Flags = (int)(KryptonPageFlags.All);
            _flags.ClearFlags((int)KryptonPageFlags.PageInOverflowBarForOutlookMode);

            // Create delegates
            _needDisabledPaint = new NeedPaintHandler(OnNeedDisabledPaint);
            _needNormalPaint = new NeedPaintHandler(OnNeedNormalPaint);

            // Create redirector for inheriting from owning navigator
            _redirectNavigator = new PaletteRedirectDoubleMetric(Redirector);
            _redirectNavigatorPage = new PaletteRedirectDouble(Redirector);
            _redirectNavigatorHeaderGroup = new PaletteRedirectDoubleMetric(Redirector);
            _redirectNavigatorHeaderPrimary = new PaletteRedirectTripleMetric(Redirector);
            _redirectNavigatorHeaderSecondary = new PaletteRedirectTripleMetric(Redirector);
            _redirectNavigatorHeaderBar = new PaletteRedirectTripleMetric(Redirector);
            _redirectNavigatorHeaderOverflow = new PaletteRedirectTripleMetric(Redirector);
            _redirectNavigatorCheckButton = new PaletteRedirectTriple(Redirector);
            _redirectNavigatorOverflowButton = new PaletteRedirectTriple(Redirector);
            _redirectNavigatorMiniButton = new PaletteRedirectTriple(Redirector);
            _redirectNavigatorBar = new PaletteRedirectMetric(Redirector);
            _redirectNavigatorSeparator = new PaletteRedirectDoubleMetric(Redirector);
            _redirectNavigatorTab = new PaletteRedirectTriple(Redirector);
            _redirectNavigatorRibbonTab = new PaletteRedirectRibbonTabContent(Redirector);

            // Create the palette storage
            _stateCommon = new PaletteNavigatorRedirect(null,
                                                        _redirectNavigator,
                                                        _redirectNavigatorPage,
                                                        _redirectNavigatorHeaderGroup,
                                                        _redirectNavigatorHeaderPrimary,
                                                        _redirectNavigatorHeaderSecondary,
                                                        _redirectNavigatorHeaderBar,
                                                        _redirectNavigatorHeaderOverflow,
                                                        _redirectNavigatorCheckButton,
                                                        _redirectNavigatorOverflowButton,
                                                        _redirectNavigatorMiniButton,
                                                        _redirectNavigatorBar,
                                                        new PaletteRedirectBorder(Redirector),
                                                        _redirectNavigatorSeparator,
                                                        _redirectNavigatorTab,
                                                        _redirectNavigatorRibbonTab,
                                                        new PaletteRedirectRibbonGeneral(Redirector),
                                                        NeedPaintDelegate);

            _stateDisabled = new PaletteNavigator(_stateCommon, _needDisabledPaint);
            _stateNormal = new PaletteNavigator(_stateCommon, _needNormalPaint);
            _stateTracking = new PaletteNavigatorOtherEx(_stateCommon, _needNormalPaint);
            _statePressed = new PaletteNavigatorOtherEx(_stateCommon, _needNormalPaint);
            _stateSelected = new PaletteNavigatorOther(_stateCommon, _needNormalPaint);

            _stateFocus = new PaletteNavigatorOtherRedirect(_redirectNavigatorCheckButton,
                                                            _redirectNavigatorOverflowButton,
                                                            _redirectNavigatorMiniButton,
                                                            _redirectNavigatorTab,
                                                            _redirectNavigatorRibbonTab, _needNormalPaint);

            // Our view contains just a simple canvas that covers entire client area
            _drawPanel = new ViewDrawPanel(_stateNormal.Page);

            // Create page specific button spec storage
            _buttonSpecs = new PageButtonSpecCollection(this);

            // Create the view manager instance
            ViewManager = new ViewManager(this, _drawPanel);
        }
        /// <summary>
        /// Initialize a new instance of the KryptonSplitContainer class.
        /// </summary>
        public KryptonSplitContainer()
        {
            // Create the palette storage
            _stateCommon = new PaletteSplitContainerRedirect(Redirector, PaletteBackStyle.PanelClient,
                                                             PaletteBorderStyle.ControlClient, PaletteBackStyle.SeparatorLowProfile,
                                                             PaletteBorderStyle.SeparatorLowProfile, NeedPaintDelegate);

            _stateDisabled = new PaletteSplitContainer(_stateCommon, _stateCommon.Separator, _stateCommon.Separator, NeedPaintDelegate);
            _stateNormal = new PaletteSplitContainer(_stateCommon, _stateCommon.Separator, _stateCommon.Separator, NeedPaintDelegate);
            _stateTracking = new PaletteSeparatorPadding(_stateCommon.Separator, _stateCommon.Separator, NeedPaintDelegate);
            _statePressed = new PaletteSeparatorPadding(_stateCommon.Separator, _stateCommon.Separator, NeedPaintDelegate);

            // Our view contains just a simple canvas that covers entire client area and a separator view
            _drawSeparator = new ViewDrawSeparator(_stateDisabled.Separator, _stateNormal.Separator, _stateTracking, _statePressed,
                                                   _stateDisabled.Separator, _stateNormal.Separator, _stateTracking, _statePressed,
                                                    PaletteMetricPadding.SeparatorPaddingLowProfile, Orientation.Vertical);

            _drawPanel = new ViewDrawPanel(_stateNormal.Back);
            _drawPanel.Add(_drawSeparator);

            // Create a separator controller to handle separator style behaviour
            _separatorController = new SeparatorController(this, _drawSeparator, true, true, NeedPaintDelegate);

            // Assign the controller to the view element to treat as a separator
            _drawSeparator.MouseController = _separatorController;
            _drawSeparator.KeyController = _separatorController;
            _drawSeparator.SourceController = _separatorController;

            // Create the view manager instance
            ViewManager = new ViewManager(this, _drawPanel);

            // Set other internal starting values
            _splitterDistance = 50;
            _splitterPercent = 1f / 3f;
            _splitterIncrement = 1;
            _panel1MinSize = 25;
            _panel2MinSize = 25;
            _splitterWidth = 5;
            _fixedDistance = 50;
            _fixedPanel = FixedPanel.None;
            _orientation = Orientation.Vertical;

            // Create the two fixed child panels
            _panel1 = new KryptonSplitterPanel(this);
            _panel2 = new KryptonSplitterPanel(this);

            // Add both panels to the controls collection
            ((KryptonReadOnlyControls)Controls).AddInternal(_panel1);
            ((KryptonReadOnlyControls)Controls).AddInternal(_panel2);
        }
Ejemplo n.º 14
0
        private Rectangle CalculatePopupRect(ViewLayoutRibbonTabsArea tabsArea,
                                             ViewDrawPanel drawMinimizedPanel)
        {
            Size popupSize;

            // Get the preferred size of the groups area, we only really want the height
            using (ViewLayoutContext context = new ViewLayoutContext(_ribbon, Renderer))
                popupSize = drawMinimizedPanel.GetPreferredSize(context);

            // The width should default to being the same width as the ribbon control
            popupSize.Width = _ribbon.Width;

            // Get the screen rectangles for the ribbon and the tabs area of the ribbon
            Rectangle parentRibbonRect = _ribbon.RectangleToScreen(_ribbon.ClientRectangle);
            Rectangle parentTabsRect = _ribbon.RectangleToScreen(tabsArea.ClientRectangle);

            // Default popup is placed below the ribbon
            Rectangle popupRect = new Rectangle(parentRibbonRect.X, parentTabsRect.Bottom - 1, popupSize.Width, popupSize.Height);

            // Get the view element for the currently selected tab
            ViewDrawRibbonTab viewTab = tabsArea.LayoutTabs.GetViewForRibbonTab(_ribbon.SelectedTab);

            // Convert the view tab client area to screen coordinates
            Rectangle viewTabRect = _ribbon.RectangleToScreen(viewTab.ClientRectangle);

            // Get the screen that the tab is mostly within
            Screen screen = Screen.FromRectangle(viewTabRect);
            Rectangle workingArea = screen.WorkingArea;
            workingArea.Width -= BOTTOMRIGHT_GAP;
            workingArea.Height -= BOTTOMRIGHT_GAP;

            // Is the right side of the popup extending over the right edge of the screen...
            if (popupRect.Right > workingArea.Right)
            {
                // Reduce width to bring it back onto the screen
                popupRect.Width -= (popupRect.Right - workingArea.Right);

                // Enforce a minimum useful width for the popup
                if (popupRect.Width < MINIMUM_WIDTH)
                {
                    popupRect.X -= (MINIMUM_WIDTH - popupRect.Width);
                    popupRect.Width = MINIMUM_WIDTH;
                }
            }
            else
            {
                // Is the left side of the popup extending over left edge of screen...
                if (popupRect.Left < workingArea.Left)
                {
                    // Reduce left side of popup to start at screen left edge
                    int reduce = (workingArea.Left - popupRect.Left);
                    popupRect.Width -= reduce;
                    popupRect.X += reduce;

                    // Enforce a minimum useful width for the popup
                    if (popupRect.Width < MINIMUM_WIDTH)
                        popupRect.Width = MINIMUM_WIDTH;
                }
            }

            // If there is not enough room to place the popup below the tabs area
            if (popupRect.Bottom > workingArea.Bottom)
            {
                // Is there enough room above the parent for the entire popup height?
                if ((parentTabsRect.Top - popupRect.Height) >= workingArea.Top)
                {
                    // Place the popup above the parent
                    popupRect.Y = parentTabsRect.Top - popupSize.Height;
                }
                else
                {
                    // Cannot show entire popup above or below, find which has most space
                    int spareAbove = parentTabsRect.Top - workingArea.Top;
                    int spareBelow = workingArea.Bottom - parentTabsRect.Bottom;

                    // Place it in the area with the most space
                    if (spareAbove > spareBelow)
                        popupRect.Y = workingArea.Top;
                    else
                        popupRect.Y = parentTabsRect.Bottom;
                }
            }

            return popupRect;
        }
Ejemplo n.º 15
0
 /// <summary>
 /// Update the displayed position to reflect a change in selected tab.
 /// </summary>
 /// <param name="tabsArea">Tabs area of the </param>
 /// <param name="drawMinimizedPanel"></param>
 public void UpdatePosition(ViewLayoutRibbonTabsArea tabsArea, 
                            ViewDrawPanel drawMinimizedPanel)
 {
     // Move to the newly calculated position
     Rectangle popupRect = CalculatePopupRect(tabsArea, drawMinimizedPanel);
     SetBounds(popupRect.X, popupRect.Y, popupRect.Width, popupRect.Height);
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Show the minimized popup relative to the tabs area of the ribbon.
 /// </summary>
 /// <param name="tabsArea">Tabs area of the </param>
 /// <param name="drawMinimizedPanel"></param>
 public void Show(ViewLayoutRibbonTabsArea tabsArea, 
                  ViewDrawPanel drawMinimizedPanel)
 {
     // Show at the calculated position
     Show(CalculatePopupRect(tabsArea, drawMinimizedPanel));
 }
        /// <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);

            _drawGroup.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);
            _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);

            // Place the headers and page holding area into the group
            _topGroup = new ViewLayoutDocker();
            _topGroup.Add(_viewHeadingSecondary, ViewDockStyle.Bottom);
            _topGroup.Add(_viewHeadingPrimary, ViewDockStyle.Top);
            _topGroup.Add(_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);
            _drawPanel.Add(_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();
        }
Ejemplo n.º 18
0
        private void Construct()
        {
            // Our view contains just a simple canvas that covers entire client area
            _drawPanel = new ViewDrawPanel(_stateNormal.Back);

            // Create the view manager instance
            ViewManager = new ViewManager(this, _drawPanel);
        }