コード例 #1
0
        private void CreateLargeButtonView()
        {
            // Create the background and border view
            _viewLarge = new ViewDrawRibbonGroupButtonBackBorder(_ribbon, GroupGallery,
                                                                 _ribbon.StateCommon.RibbonGroupButton.PaletteBack,
                                                                 _ribbon.StateCommon.RibbonGroupButton.PaletteBorder,
                                                                 false, _needPaint)
            {
                ButtonType = GroupButtonType.DropDown
            };
            _viewLarge.DropDown += OnLargeButtonDropDown;

            if (_ribbon.InDesignMode)
            {
                _viewLarge.ContextClick += OnContextClick;
            }

            // Create the layout docker for the contents of the button
            ViewLayoutDocker contentLayout = new ViewLayoutDocker();

            // Add the large button at the top
            _viewLargeImage = new ViewDrawRibbonGroupGalleryImage(_ribbon, GroupGallery);
            ViewLayoutRibbonCenterPadding largeImagePadding = new ViewLayoutRibbonCenterPadding(_largeImagePadding)
            {
                _viewLargeImage
            };

            contentLayout.Add(largeImagePadding, ViewDockStyle.Top);

            // Add the first line of text
            _viewLargeText1 = new ViewDrawRibbonGroupGalleryText(_ribbon, GroupGallery, true);
            contentLayout.Add(_viewLargeText1, ViewDockStyle.Bottom);

            // Add the second line of text
            _viewLargeCenter    = new ViewLayoutRibbonRowCenter();
            _viewLargeText2     = new ViewDrawRibbonGroupGalleryText(_ribbon, GroupGallery, false);
            _viewLargeDropArrow = new ViewDrawRibbonDropArrow(_ribbon);
            _viewLargeText2Sep1 = new ViewLayoutRibbonSeparator(4, false);
            _viewLargeText2Sep2 = new ViewLayoutRibbonSeparator(4, false);
            _viewLargeCenter.Add(_viewLargeText2);
            _viewLargeCenter.Add(_viewLargeText2Sep1);
            _viewLargeCenter.Add(_viewLargeDropArrow);
            _viewLargeCenter.Add(_viewLargeText2Sep2);
            contentLayout.Add(_viewLargeCenter, ViewDockStyle.Bottom);

            // Add a 1 pixel separator at bottom of button before the text
            contentLayout.Add(new ViewLayoutRibbonSeparator(1, false), ViewDockStyle.Bottom);

            // Add the content into the background and border
            _viewLarge.Add(contentLayout);

            // Create controller for intercepting events to determine tool tip handling
            _viewLarge.MouseController = new ToolTipController(_ribbon.TabsArea.ButtonSpecManager.ToolTipManager,
                                                               _viewLarge, _viewLarge.MouseController);

            // Add as a child view but as hidden, will become visible only in small mode
            _viewLarge.Visible = false;
            Add(_viewLarge);
        }
コード例 #2
0
        private void CreateMediumSmallButtonView()
        {
            // Create the background and border view
            _viewMediumSmall = new ViewDrawRibbonGroupButtonBackBorder(_ribbon, GroupButton,
                                                                       _ribbon.StateCommon.RibbonGroupButton.PaletteBack,
                                                                       _ribbon.StateCommon.RibbonGroupButton.PaletteBorder,
                                                                       false, _needPaint)
            {
                SplitVertical = false
            };
            _viewMediumSmall.Click    += OnMediumSmallButtonClick;
            _viewMediumSmall.DropDown += OnMediumSmallButtonDropDown;

            if (_ribbon.InDesignMode)
            {
                _viewMediumSmall.ContextClick += OnContextClick;
            }

            // Create the layout docker for the contents of the button
            ViewLayoutDocker contentLayout = new ViewLayoutDocker();

            // Create the image and drop down content
            _viewMediumSmallImage     = new ViewDrawRibbonGroupButtonImage(_ribbon, GroupButton, false);
            _viewMediumSmallText1     = new ViewDrawRibbonGroupButtonText(_ribbon, GroupButton, true);
            _viewMediumSmallText2     = new ViewDrawRibbonGroupButtonText(_ribbon, GroupButton, false);
            _viewMediumSmallDropArrow = new ViewDrawRibbonDropArrow(_ribbon);
            _viewMediumSmallText2Sep2 = new ViewLayoutRibbonSeparator(3, false);
            _viewMediumSmallText2Sep3 = new ViewLayoutRibbonSeparator(3, false);
            ViewLayoutRibbonCenterPadding imagePadding = new ViewLayoutRibbonCenterPadding(_smallImagePadding)
            {
                _viewMediumSmallImage
            };

            // Layout the content in the center of a row
            _viewMediumSmallCenter = new ViewLayoutRibbonRowCenter
            {
                imagePadding,
                _viewMediumSmallText1,
                _viewMediumSmallText2,
                _viewMediumSmallText2Sep2,
                _viewMediumSmallDropArrow,
                _viewMediumSmallText2Sep3
            };

            // Use content as only fill item
            contentLayout.Add(_viewMediumSmallCenter, ViewDockStyle.Fill);

            // Add the content into the background and border
            _viewMediumSmall.Add(contentLayout);

            // Create controller for intercepting events to determine tool tip handling
            _viewMediumSmall.MouseController = new ToolTipController(_ribbon.TabsArea.ButtonSpecManager.ToolTipManager,
                                                                     _viewMediumSmall, _viewMediumSmall.MouseController);
        }
コード例 #3
0
        /// <summary>
        /// Initialize a new instance of the GroupButtonController class.
        /// </summary>
        /// <param name="ribbon">Source control instance.</param>
        /// <param name="target">Target for state changes.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public GroupButtonController(KryptonRibbon ribbon,
                                     ViewDrawRibbonGroupButtonBackBorder target,
                                     NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(target != null);
            Debug.Assert(needPaint != null);

            _ribbon   = ribbon;
            _target   = target;
            NeedPaint = needPaint;

            // Default other fields
            ButtonType = GroupButtonType.Push;
        }