コード例 #1
0
        /// <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;
        }
コード例 #2
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);
        }
コード例 #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);
        }
コード例 #4
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;
            _ribbonGallery = ribbonGallery;
            _needPaint     = needPaint;
            _currentSize   = _ribbonGallery.ItemSizeCurrent;

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

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

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

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

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

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

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

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

            // Hook into changes in the ribbon custom definition
            _ribbonGallery.PropertyChanged += new PropertyChangedEventHandler(OnGalleryPropertyChanged);
        }
コード例 #5
0
        /// <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;
            _ribbonCustomControl = ribbonCustom;
            _needPaint           = needPaint;
            _currentSize         = _ribbonCustomControl.ItemSizeCurrent;

            // Hook into the custom control events
            _ribbonCustomControl.MouseEnterControl += new EventHandler(OnMouseEnterControl);
            _ribbonCustomControl.MouseLeaveControl += new EventHandler(OnMouseLeaveControl);

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

            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;
            }

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

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

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

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

            // Hook into changes in the ribbon custom definition
            _ribbonCustomControl.PropertyChanged += new PropertyChangedEventHandler(OnCustomPropertyChanged);
        }
コード例 #6
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;
        }