Process mouse events looking for a context click.
Inheritance: ComponentFactory.Krypton.Toolkit.GlobalId, IMouseController
Esempio n. 1
0
        private void CreateMediumSmallLabelView()
        {
            // Create the layout docker for the contents of the label
            _viewMediumSmall = new ViewLayoutDocker();

            if (_ribbon.InDesignMode)
            {
                // At design time we need to know when the user right clicks the label
                ContextClickController controller = new ContextClickController();
                controller.ContextClick         += new MouseEventHandler(OnContextClick);
                _viewMediumSmall.MouseController = controller;
            }

            // Create the image and drop down content
            _viewMediumSmallLabelImage = new ViewDrawRibbonGroupLabelImage(_ribbon, _ribbonLabel, false);
            _viewMediumSmallText1      = new ViewDrawRibbonGroupLabelText(_ribbon, _ribbonLabel, true);
            _viewMediumSmallText2      = new ViewDrawRibbonGroupLabelText(_ribbon, _ribbonLabel, false);
            _viewMediumSmallImage      = new ViewLayoutRibbonCenterPadding(_smallImagePadding);
            _viewMediumSmallImage.Add(_viewMediumSmallLabelImage);

            // Layout the content in the center of a row
            _viewMediumSmallCenter = new ViewLayoutRibbonRowCenter();
            _viewMediumSmallCenter.Add(_viewMediumSmallImage);
            _viewMediumSmallCenter.Add(_viewMediumSmallText1);
            _viewMediumSmallCenter.Add(_viewMediumSmallText2);

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

            // Create controller for intercepting events to determine tool tip handling
            _viewMediumSmall.MouseController = new ToolTipController(_ribbon.TabsArea.ButtonSpecManager.ToolTipManager,
                                                                     _viewMediumSmall, _viewMediumSmall.MouseController);
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupSeparator class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonSeparator">Reference to group separator definition.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroupSeparator(KryptonRibbon ribbon,
                                            KryptonRibbonGroupSeparator ribbonSeparator,
                                            NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonSeparator != null);
            Debug.Assert(needPaint != null);

            _ribbon          = ribbon;
            _ribbonSeparator = ribbonSeparator;
            _needPaint       = needPaint;

            // Associate this view with the source component (required for design time selection)
            Component = _ribbonSeparator;

            if (_ribbon.InDesignMode)
            {
                // At design time we need to know when the user right clicks the label
                ContextClickController controller = new ContextClickController();
                controller.ContextClick += OnContextClick;
                MouseController          = controller;
            }

            // Define back reference to view for the separator definition
            _ribbonSeparator.SeparatorView = this;

            // Hook into changes in the ribbon separator definition
            _ribbonSeparator.PropertyChanged += OnSeparatorPropertyChanged;

            // Default the preferred size
            _lastShape     = PaletteRibbonShape.Office2007;
            _preferredSize = _preferredSize2007;
        }
Esempio n. 3
0
        private void CreateLargeLabelView()
        {
            // Create the layout docker for the contents of the label
            _viewLarge = new ViewLayoutDocker();

            if (_ribbon.InDesignMode)
            {
                // At design time we need to know when the user right clicks the label
                ContextClickController controller = new ContextClickController();
                controller.ContextClick   += new MouseEventHandler(OnContextClick);
                _viewLarge.MouseController = controller;
            }

            // Add the large button at the top
            _viewLargeLabelImage = new ViewDrawRibbonGroupLabelImage(_ribbon, _ribbonLabel, true);
            _viewLargeImage      = new ViewLayoutRibbonCenterPadding(_largeImagePadding);
            _viewLargeImage.Add(_viewLargeLabelImage);
            _viewLarge.Add(_viewLargeImage, ViewDockStyle.Top);

            // Add the first line of text
            _viewLargeText1 = new ViewDrawRibbonGroupLabelText(_ribbon, _ribbonLabel, true);
            _viewLarge.Add(_viewLargeText1, ViewDockStyle.Bottom);

            // Add the second line of text
            _viewLargeText2 = new ViewDrawRibbonGroupLabelText(_ribbon, _ribbonLabel, false);
            _viewLarge.Add(_viewLargeText2, ViewDockStyle.Bottom);

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

            // Create controller for intercepting events to determine tool tip handling
            _viewLarge.MouseController = new ToolTipController(_ribbon.TabsArea.ButtonSpecManager.ToolTipManager,
                                                               _viewLarge, _viewLarge.MouseController);
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupSeparator class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonSeparator">Reference to group separator definition.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroupSeparator(KryptonRibbon ribbon,
                                            KryptonRibbonGroupSeparator ribbonSeparator,
                                            NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonSeparator != null);
            Debug.Assert(needPaint != null);

            _ribbon = ribbon;
            _ribbonSeparator = ribbonSeparator;
            _needPaint = needPaint;

            // Associate this view with the source component (required for design time selection)
            Component = _ribbonSeparator;

            if (_ribbon.InDesignMode)
            {
                // At design time we need to know when the user right clicks the label
                ContextClickController controller = new ContextClickController();
                controller.ContextClick += new MouseEventHandler(OnContextClick);
                MouseController = controller;
            }

            // Define back reference to view for the separator definition
            _ribbonSeparator.SeparatorView = this;

            // Hook into changes in the ribbon separator definition
            _ribbonSeparator.PropertyChanged += new PropertyChangedEventHandler(OnSeparatorPropertyChanged);

            // Default the preferred size
            _lastShape = PaletteRibbonShape.Office2007;
            _preferredSize = _preferredSize2007;
        }
Esempio n. 5
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupGallery class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonGallery">Reference to source gallery.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroupGallery(KryptonRibbon ribbon,
                                          KryptonRibbonGroupGallery ribbonGallery,
                                          NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonGallery != null);
            Debug.Assert(needPaint != null);

            // Remember incoming references
            _ribbon      = ribbon;
            GroupGallery = ribbonGallery;
            _needPaint   = needPaint;
            _currentSize = GroupGallery.ItemSizeCurrent;

            // Create the button view used in small setting
            CreateLargeButtonView();

            // Hook into the gallery events
            GroupGallery.MouseEnterControl += OnMouseEnterControl;
            GroupGallery.MouseLeaveControl += OnMouseLeaveControl;

            // Associate this view with the source component (required for design time selection)
            Component = GroupGallery;

            if (_ribbon.InDesignMode)
            {
                // At design time we need to know when the user right clicks the gallery
                ContextClickController controller = new ContextClickController();
                controller.ContextClick += OnContextClick;
                MouseController          = controller;
            }

            // Create controller needed for handling focus and key tip actions
            _controller      = new GalleryController(_ribbon, GroupGallery, this);
            SourceController = _controller;
            KeyController    = _controller;

            // We need to rest visibility of the gallery for each layout cycle
            _ribbon.ViewRibbonManager.LayoutBefore += OnLayoutAction;
            _ribbon.ViewRibbonManager.LayoutAfter  += OnLayoutAction;

            // Define back reference to view for the gallery definition
            GroupGallery.GalleryView = this;

            // Give paint delegate to gallery so its palette changes are redrawn
            GroupGallery.ViewPaintDelegate = needPaint;

            // Hook into changes in the ribbon custom definition
            GroupGallery.PropertyChanged += OnGalleryPropertyChanged;
        }
Esempio n. 6
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupTextBox class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonTextBox">Reference to source textbox.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroupTextBox(KryptonRibbon ribbon,
                                          KryptonRibbonGroupTextBox ribbonTextBox,
                                          NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonTextBox != null);
            Debug.Assert(needPaint != null);

            // Remember incoming references
            _ribbon        = ribbon;
            _ribbonTextBox = ribbonTextBox;
            _needPaint     = needPaint;
            _currentSize   = _ribbonTextBox.ItemSizeCurrent;

            // Hook into the textbox events
            _ribbonTextBox.MouseEnterControl += new EventHandler(OnMouseEnterControl);
            _ribbonTextBox.MouseLeaveControl += new EventHandler(OnMouseLeaveControl);

            // Associate this view with the source component (required for design time selection)
            Component = _ribbonTextBox;

            if (_ribbon.InDesignMode)
            {
                // At design time we need to know when the user right clicks the textbox
                ContextClickController controller = new ContextClickController();
                controller.ContextClick += new MouseEventHandler(OnContextClick);
                MouseController          = controller;
            }

            // Create controller needed for handling focus and key tip actions
            _controller      = new TextBoxController(_ribbon, _ribbonTextBox, this);
            SourceController = _controller;
            KeyController    = _controller;

            // We need to rest visibility of the textbox for each layout cycle
            _ribbon.ViewRibbonManager.LayoutBefore += new EventHandler(OnLayoutAction);
            _ribbon.ViewRibbonManager.LayoutAfter  += new EventHandler(OnLayoutAction);

            // Define back reference to view for the text box definition
            _ribbonTextBox.TextBoxView = this;

            // Give paint delegate to textbox so its palette changes are redrawn
            _ribbonTextBox.ViewPaintDelegate = needPaint;

            // Hook into changes in the ribbon custom definition
            _ribbonTextBox.PropertyChanged += new PropertyChangedEventHandler(OnTextBoxPropertyChanged);
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupMaskedTextBox class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonMaskedTextBox">Reference to source masked textbox.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroupMaskedTextBox(KryptonRibbon ribbon,
                                                KryptonRibbonGroupMaskedTextBox ribbonMaskedTextBox,
                                                NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonMaskedTextBox != null);
            Debug.Assert(needPaint != null);

            // Remember incoming references
            _ribbon = ribbon;
            _ribbonMaskedTextBox = ribbonMaskedTextBox;
            _needPaint = needPaint;
            _currentSize = _ribbonMaskedTextBox.ItemSizeCurrent;

            // Hook into the masked textbox events
            _ribbonMaskedTextBox.MouseEnterControl += new EventHandler(OnMouseEnterControl);
            _ribbonMaskedTextBox.MouseLeaveControl += new EventHandler(OnMouseLeaveControl);

            // Associate this view with the source component (required for design time selection)
            Component = _ribbonMaskedTextBox;

            if (_ribbon.InDesignMode)
            {
                // At design time we need to know when the user right clicks the masked textbox
                ContextClickController controller = new ContextClickController();
                controller.ContextClick += new MouseEventHandler(OnContextClick);
                MouseController = controller;
            }

            // Create controller needed for handling focus and key tip actions
            _controller = new MaskedTextBoxController(_ribbon, _ribbonMaskedTextBox, this);
            SourceController = _controller;
            KeyController = _controller;

            // We need to rest visibility of the masked textbox for each layout cycle
            _ribbon.ViewRibbonManager.LayoutBefore += new EventHandler(OnLayoutAction);
            _ribbon.ViewRibbonManager.LayoutAfter += new EventHandler(OnLayoutAction);

            // Define back reference to view for the masked text box definition
            _ribbonMaskedTextBox.MaskedTextBoxView = this;

            // Give paint delegate to masked textbox so its palette changes are redrawn
            _ribbonMaskedTextBox.ViewPaintDelegate = needPaint;

            // Hook into changes in the ribbon custom definition
            _ribbonMaskedTextBox.PropertyChanged += new PropertyChangedEventHandler(OnMaskedTextBoxPropertyChanged);
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupCustom class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonCustom">Reference to source custom definition.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroupCustomControl(KryptonRibbon ribbon,
                                                KryptonRibbonGroupCustomControl ribbonCustom,
                                                NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonCustom != null);
            Debug.Assert(needPaint != null);

            // Remember incoming references
            _ribbon            = ribbon;
            GroupCustomControl = ribbonCustom;
            _needPaint         = needPaint;
            _currentSize       = GroupCustomControl.ItemSizeCurrent;

            // Hook into the custom control events
            GroupCustomControl.MouseEnterControl += OnMouseEnterControl;
            GroupCustomControl.MouseLeaveControl += OnMouseLeaveControl;

            // Associate this view with the source component (required for design time selection)
            Component = GroupCustomControl;

            if (_ribbon.InDesignMode)
            {
                // At design time we need to know when the user right clicks the label
                ContextClickController controller = new ContextClickController();
                controller.ContextClick += OnContextClick;
                MouseController          = controller;
            }

            // Create controller needed for handling focus and key tip actions
            _controller      = new CustomControlController(_ribbon, GroupCustomControl, this);
            SourceController = _controller;
            KeyController    = _controller;

            // We need to rest visibility of the custom control for each layout cycle
            _ribbon.ViewRibbonManager.LayoutBefore += OnLayoutAction;
            _ribbon.ViewRibbonManager.LayoutAfter  += OnLayoutAction;

            // Provide back reference to the custom control definition
            GroupCustomControl.CustomControlView = this;

            // Give paint delegate to label so its palette changes are redrawn
            GroupCustomControl.ViewPaintDelegate = needPaint;

            // Hook into changes in the ribbon custom definition
            GroupCustomControl.PropertyChanged += OnCustomPropertyChanged;
        }
Esempio n. 9
0
        private void CreateNormalView()
        {
            // Create a layout for the main area
            _layoutNormalMain = new ViewLayoutRibbonTitle();

            if (_ribbon.InDesignMode)
            {
                // At design time we need to know when the user right clicks the group
                ContextClickController controller = new ContextClickController();
                controller.ContextClick          += new MouseEventHandler(OnContextClick);
                _layoutNormalMain.MouseController = controller;
            }

            // Create layout elements
            _layoutNormalTitle    = new ViewLayoutDocker();
            _layoutNormalContent  = new ViewLayoutRibbonGroupContent(_ribbon, _ribbonGroup, _needPaint);
            _layoutNormalSepTop   = new ViewLayoutRibbonSeparator(NORMAL_BORDER_TOPLEFT2007, true);
            _layoutNormalSepLeft  = new ViewLayoutRibbonSeparator(NORMAL_BORDER_TOPLEFT2007, true);
            _layoutNormalSepRight = new ViewLayoutRibbonSeparator(NORMAL_BORDER_RIGHT2007, true);

            // Add layout elements to correct areas of the normal group
            _layoutNormalMain.Add(_layoutNormalTitle, ViewDockStyle.Bottom);
            _layoutNormalMain.Add(_layoutNormalSepTop, ViewDockStyle.Top);
            _layoutNormalMain.Add(_layoutNormalSepLeft, ViewDockStyle.Left);
            _layoutNormalMain.Add(_layoutNormalSepRight, ViewDockStyle.Right);
            _layoutNormalMain.Add(_layoutNormalContent, ViewDockStyle.Fill);

            // Create and add the title string that fills remainder title area
            _viewNormalTitle = new ViewDrawRibbonGroupTitle(_ribbon, _ribbonGroup);
            _layoutNormalTitle.Add(_viewNormalTitle, ViewDockStyle.Fill);

            // Add the dialog box launcher button to the right side of title area
            _viewNormalDialog = new ViewLayoutRibbonGroupButton(_ribbon, _ribbonGroup, _needPaint);
            _layoutNormalContent.DialogView = _viewNormalDialog;
            _layoutNormalTitle.Add(_viewNormalDialog, ViewDockStyle.Right);

            // Use this class to return the context color for any null values
            _paletteContextBack = new PaletteRibbonContextBack(_ribbon);

            // All values are equal to a default of Office 2007 shape
            _lastRibbonShape = PaletteRibbonShape.Office2007;
            _totalBorders    = TOTAL_LEFT_RIGHT_BORDERS_2007;
        }
        private void CreateMediumSmallLabelView()
        {
            // Create the layout docker for the contents of the label
            _viewMediumSmall = new ViewLayoutDocker();

            if (_ribbon.InDesignMode)
            {
                // At design time we need to know when the user right clicks the label
                ContextClickController controller = new ContextClickController();
                controller.ContextClick += new MouseEventHandler(OnContextClick);
                _viewMediumSmall.MouseController = controller;
            }

            // Create the image and drop down content
            _viewMediumSmallLabelImage = new ViewDrawRibbonGroupLabelImage(_ribbon, _ribbonLabel, false);
            _viewMediumSmallText1 = new ViewDrawRibbonGroupLabelText(_ribbon, _ribbonLabel, true);
            _viewMediumSmallText2 = new ViewDrawRibbonGroupLabelText(_ribbon, _ribbonLabel, false);
            _viewMediumSmallImage = new ViewLayoutRibbonCenterPadding(_smallImagePadding);
            _viewMediumSmallImage.Add(_viewMediumSmallLabelImage);

            // Layout the content in the center of a row
            _viewMediumSmallCenter = new ViewLayoutRibbonRowCenter();
            _viewMediumSmallCenter.Add(_viewMediumSmallImage);
            _viewMediumSmallCenter.Add(_viewMediumSmallText1);
            _viewMediumSmallCenter.Add(_viewMediumSmallText2);

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

            // Create controller for intercepting events to determine tool tip handling
            _viewMediumSmall.MouseController = new ToolTipController(_ribbon.TabsArea.ButtonSpecManager.ToolTipManager,
                                                                     _viewMediumSmall, _viewMediumSmall.MouseController);
        }
        private void CreateLargeLabelView()
        {
            // Create the layout docker for the contents of the label
            _viewLarge = new ViewLayoutDocker();

            if (_ribbon.InDesignMode)
            {
                // At design time we need to know when the user right clicks the label
                ContextClickController controller = new ContextClickController();
                controller.ContextClick += new MouseEventHandler(OnContextClick);
                _viewLarge.MouseController = controller;
            }

            // Add the large button at the top
            _viewLargeLabelImage = new ViewDrawRibbonGroupLabelImage(_ribbon, _ribbonLabel, true);
            _viewLargeImage = new ViewLayoutRibbonCenterPadding(_largeImagePadding);
            _viewLargeImage.Add(_viewLargeLabelImage);
            _viewLarge.Add(_viewLargeImage, ViewDockStyle.Top);

            // Add the first line of text
            _viewLargeText1 = new ViewDrawRibbonGroupLabelText(_ribbon, _ribbonLabel, true);
            _viewLarge.Add(_viewLargeText1, ViewDockStyle.Bottom);

            // Add the second line of text
            _viewLargeText2 = new ViewDrawRibbonGroupLabelText(_ribbon, _ribbonLabel, false);
            _viewLarge.Add(_viewLargeText2, ViewDockStyle.Bottom);

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

            // Create controller for intercepting events to determine tool tip handling
            _viewLarge.MouseController = new ToolTipController(_ribbon.TabsArea.ButtonSpecManager.ToolTipManager,
                                                               _viewLarge, _viewLarge.MouseController);
        }
Esempio n. 12
0
        private void CreateNormalView()
        {
            // Create a layout for the main area
            _layoutNormalMain = new ViewLayoutRibbonTitle();

            if (_ribbon.InDesignMode)
            {
                // At design time we need to know when the user right clicks the group
                ContextClickController controller = new ContextClickController();
                controller.ContextClick += new MouseEventHandler(OnContextClick);
                _layoutNormalMain.MouseController = controller;
            }

            // Create layout elements
            _layoutNormalTitle = new ViewLayoutDocker();
            _layoutNormalContent = new ViewLayoutRibbonGroupContent(_ribbon, _ribbonGroup, _needPaint);
            _layoutNormalSepTop = new ViewLayoutRibbonSeparator(NORMAL_BORDER_TOPLEFT2007, true);
            _layoutNormalSepLeft = new ViewLayoutRibbonSeparator(NORMAL_BORDER_TOPLEFT2007, true);
            _layoutNormalSepRight = new ViewLayoutRibbonSeparator(NORMAL_BORDER_RIGHT2007, true);

            // Add layout elements to correct areas of the normal group
            _layoutNormalMain.Add(_layoutNormalTitle, ViewDockStyle.Bottom);
            _layoutNormalMain.Add(_layoutNormalSepTop, ViewDockStyle.Top);
            _layoutNormalMain.Add(_layoutNormalSepLeft, ViewDockStyle.Left);
            _layoutNormalMain.Add(_layoutNormalSepRight, ViewDockStyle.Right);
            _layoutNormalMain.Add(_layoutNormalContent, ViewDockStyle.Fill);

            // Create and add the title string that fills remainder title area
            _viewNormalTitle = new ViewDrawRibbonGroupTitle(_ribbon, _ribbonGroup);
            _layoutNormalTitle.Add(_viewNormalTitle, ViewDockStyle.Fill);

            // Add the dialog box launcher button to the right side of title area
            _viewNormalDialog = new ViewLayoutRibbonGroupButton(_ribbon, _ribbonGroup, _needPaint);
            _layoutNormalContent.DialogView = _viewNormalDialog;
            _layoutNormalTitle.Add(_viewNormalDialog, ViewDockStyle.Right);

            // Use this class to return the context color for any null values
            _paletteContextBack = new PaletteRibbonContextBack(_ribbon);

            // All values are equal to a default of Office 2007 shape
            _lastRibbonShape = PaletteRibbonShape.Office2007;
            _totalBorders = TOTAL_LEFT_RIGHT_BORDERS_2007;
        }