Process mouse events for a ribbon group button.
Inheritance: ComponentFactory.Krypton.Toolkit.GlobalId, IMouseController, ISourceController, IKeyController, IRibbonKeyTipTarget
        /// <summary>
        /// Gets the array of group level key tips.
        /// </summary>
        /// <param name="keyTipList">List to add new entries into.</param>
        /// <param name="lineHint">Provide hint to item about its location.</param>
        public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint)
        {
            // Only provide a key tip if we are visible
            if (Visible)
            {
                // Get the screen location of the button
                Rectangle viewRect = _ribbon.KeyTipToScreen(this[0]);

                Point screenPt = Point.Empty;
                GroupButtonController controller = null;

                // Determine the screen position of the key tip dependant on item location/size
                switch (_currentSize)
                {
                case GroupItemSize.Large:
                    screenPt   = new Point(viewRect.Left + (viewRect.Width / 2), viewRect.Bottom);
                    controller = _viewLarge.Controller;
                    break;

                case GroupItemSize.Medium:
                case GroupItemSize.Small:
                    screenPt   = _ribbon.CalculatedValues.KeyTipRectToPoint(viewRect, lineHint);
                    controller = _viewMediumSmall.Controller;
                    break;
                }

                keyTipList.Add(new KeyTipInfo(GroupColorButton.Enabled, GroupColorButton.KeyTip,
                                              screenPt, this[0].ClientRectangle, controller));
            }
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupButtonBackBorder class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="groupItem">Reference to owning group item.</param>
        /// <param name="paletteBack">Palette to use for the background.</param>
        /// <param name="paletteBorder">Palette to use for the border.</param>
        /// <param name="constantBorder">Should the border be a constant normal state.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroupButtonBackBorder(KryptonRibbon ribbon,
                                                   KryptonRibbonGroupItem groupItem,
                                                   IPaletteBack paletteBack,
                                                   IPaletteBorder paletteBorder,
                                                   bool constantBorder,
                                                   NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(groupItem != null);
            Debug.Assert(paletteBack != null);
            Debug.Assert(paletteBorder != null);

            // Remember incoming references
            _ribbon          = ribbon;
            GroupItem        = groupItem;
            _paletteBack     = paletteBack;
            _paletteBackDraw = new PaletteBackInheritForced(paletteBack)
            {
                ForceDraw = InheritBool.True
            };
            _paletteBackLight = new PaletteBackLightenColors(paletteBack);
            _paletteBorderAll = new PaletteBorderInheritForced(paletteBorder);
            _paletteBorderAll.ForceBorderEdges(PaletteDrawBorders.All);
            _paletteBorder = paletteBorder;
            ConstantBorder = constantBorder;

            // Default other fields
            Checked = false;
            DrawNonTrackingAreas = true;

            // Create delegate used to process end of click action
            FinishDelegate = ActionFinished;

            // Attach a controller to this element for the pressing of the button
            Controller               = new GroupButtonController(_ribbon, this, needPaint);
            Controller.Click        += OnClick;
            Controller.ContextClick += OnContextClick;
            Controller.DropDown     += OnDropDown;
            MouseController          = Controller;
            SourceController         = Controller;
            KeyController            = Controller;
        }
コード例 #3
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupButtonBackBorder class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="groupItem">Reference to owning group item.</param>
        /// <param name="paletteBack">Palette to use for the background.</param>
        /// <param name="paletteBorder">Palette to use for the border.</param>
        /// <param name="constantBorder">Should the border be a constant normal state.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroupButtonBackBorder(KryptonRibbon ribbon,
                                                   KryptonRibbonGroupItem groupItem,
                                                   IPaletteBack paletteBack,
                                                   IPaletteBorder paletteBorder,
                                                   bool constantBorder,
                                                   NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(groupItem != null);
            Debug.Assert(paletteBack != null);
            Debug.Assert(paletteBorder != null);

            // Remember incoming references
            _ribbon = ribbon;
            _groupItem = groupItem;
            _paletteBack = paletteBack;
            _paletteBackDraw = new PaletteBackInheritForced(paletteBack);
            _paletteBackDraw.ForceDraw = InheritBool.True;
            _paletteBackLight = new PaletteBackLightenColors(paletteBack);
            _paletteBorderAll = new PaletteBorderInheritForced(paletteBorder);
            _paletteBorderAll.ForceBorderEdges(PaletteDrawBorders.All);
            _paletteBorder = paletteBorder;
            _constantBorder = constantBorder;

            // Default other fields
            _checked = false;
            _drawNonTrackingAreas = true;

            // Create delegate used to process end of click action
            _finishDelegate = new EventHandler(ActionFinished);

            // Attach a controller to this element for the pressing of the button
            _controller = new GroupButtonController(_ribbon, this, needPaint);
            _controller.Click += new EventHandler(OnClick);
            _controller.ContextClick += new MouseEventHandler(OnContextClick);
            _controller.DropDown += new EventHandler(OnDropDown);
            MouseController = _controller;
            SourceController = _controller;
            KeyController = _controller;
        }