Inheritance: KryptonRibbonGroupItem
コード例 #1
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupLabel class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonLabel">Reference to source label definition.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroupLabel(KryptonRibbon ribbon,
                                        KryptonRibbonGroupLabel ribbonLabel,
                                        NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonLabel != null);
            Debug.Assert(needPaint != null);

            // Remember incoming references
            _ribbon    = ribbon;
            GroupLabel = ribbonLabel;
            _needPaint = needPaint;

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

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

            // Create the different views for different sizes of the label
            CreateLargeLabelView();
            CreateMediumSmallLabelView();

            // Update all views to reflect current label state
            UpdateEnabledState();
            UpdateImageSmallState();
            UpdateItemSizeState();

            // Hook into changes in the ribbon button definition
            GroupLabel.PropertyChanged += OnLabelPropertyChanged;
        }
コード例 #2
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupLabel class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonLabel">Reference to source label definition.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroupLabel(KryptonRibbon ribbon,
                                        KryptonRibbonGroupLabel ribbonLabel,
                                        NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonLabel != null);
            Debug.Assert(needPaint != null);

            // Remember incoming references
            _ribbon = ribbon;
            _ribbonLabel = ribbonLabel;
            _needPaint = needPaint;

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

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

            // Create the different views for different sizes of the label
            CreateLargeLabelView();
            CreateMediumSmallLabelView();

            // Update all views to reflect current label state
            UpdateEnabledState();
            UpdateImageSmallState();
            UpdateItemSizeState();

            // Hook into changes in the ribbon button definition
            _ribbonLabel.PropertyChanged += new PropertyChangedEventHandler(OnLabelPropertyChanged);
        }
コード例 #3
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupLabelImage class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonLabel">Reference to ribbon group label definition.</param>
        /// <param name="large">Show the large image.</param>
        public ViewDrawRibbonGroupLabelImage(KryptonRibbon ribbon,
                                             KryptonRibbonGroupLabel ribbonLabel,
                                             bool large)
            : base(ribbon)
        {
            Debug.Assert(ribbonLabel != null);

            _ribbonLabel = ribbonLabel;
            _large       = large;
        }
コード例 #4
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupLabelImage class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonLabel">Reference to ribbon group label definition.</param>
        /// <param name="large">Show the large image.</param>
        public ViewDrawRibbonGroupLabelImage(KryptonRibbon ribbon,
                                             KryptonRibbonGroupLabel ribbonLabel,
                                             bool large)
            : base(ribbon)
        {
            Debug.Assert(ribbonLabel != null);

            _ribbonLabel = ribbonLabel;
            _large = large;
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupLabelImage class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonLabel">Reference to ribbon group label definition.</param>
        /// <param name="large">Show the large image.</param>
        public ViewDrawRibbonGroupLabelImage(KryptonRibbon ribbon,
                                             KryptonRibbonGroupLabel ribbonLabel,
                                             bool large)
            : base(ribbon)
        {
            Debug.Assert(ribbonLabel != null);

            //Seb dpi aware
            _smallSize = new Size((int)(16 * FactorDpiX), (int)(16 * FactorDpiY));
            _largeSize = new Size((int)(32 * FactorDpiX), (int)(32 * FactorDpiY));

            _ribbonLabel = ribbonLabel;
            _large       = large;
        }
コード例 #6
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupLabelImage class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonLabel">Reference to ribbon group label definition.</param>
        /// <param name="large">Show the large image.</param>
        public ViewDrawRibbonGroupLabelImage(KryptonRibbon ribbon,
                                             KryptonRibbonGroupLabel ribbonLabel,
                                             bool large)
            : base(ribbon)
        {
            Debug.Assert(ribbonLabel != null);

            //Seb dpi aware
            _smallSize = new Size((int)(16 * FactorDpiX), (int)(16 * FactorDpiY));
            _largeSize = new Size((int)(32 * FactorDpiX), (int)(32 * FactorDpiY));

            _ribbonLabel = ribbonLabel;
            _large = large;
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupLabelText class.
        /// </summary>
        /// <param name="ribbon">Source ribbon control.</param>
        /// <param name="ribbonLabel">Group label to display title for.</param>
        /// <param name="firstText">Should show the first button text.</param>
        public ViewDrawRibbonGroupLabelText(KryptonRibbon ribbon,
                                            KryptonRibbonGroupLabel ribbonLabel,
                                            bool firstText)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonLabel != null);

            _ribbon      = ribbon;
            _ribbonLabel = ribbonLabel;
            _firstText   = firstText;

            // Use a class to convert from ribbon group to content interface
            _contentProvider = new RibbonGroupLabelTextToContent(ribbon.StateCommon.RibbonGeneral,
                                                                 ribbon.StateNormal.RibbonGroupLabelText,
                                                                 ribbon.StateDisabled.RibbonGroupLabelText,
                                                                 ribbonLabel.StateNormal,
                                                                 ribbonLabel.StateDisabled);
        }
コード例 #8
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupLabelText class.
        /// </summary>
        /// <param name="ribbon">Source ribbon control.</param>
        /// <param name="ribbonLabel">Group label to display title for.</param>
        /// <param name="firstText">Should show the first button text.</param>
        public ViewDrawRibbonGroupLabelText(KryptonRibbon ribbon,
                                            KryptonRibbonGroupLabel ribbonLabel,
                                            bool firstText)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonLabel != null);

            _ribbon = ribbon;
            _ribbonLabel = ribbonLabel;
            _firstText = firstText;

            // Use a class to convert from ribbon group to content interface
            _contentProvider = new RibbonGroupLabelTextToContent(ribbon.StateCommon.RibbonGeneral,
                                                                 ribbon.StateNormal.RibbonGroupLabelText,
                                                                 ribbon.StateDisabled.RibbonGroupLabelText,
                                                                 ribbonLabel.StateNormal,
                                                                 ribbonLabel.StateDisabled);
        }
コード例 #9
0
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_ribbonLabel != null)
                {
                    // Remove back reference to the paint delegate
                    _ribbonLabel.ViewPaintDelegate = null;

                    // Must unhook to prevent memory leaks
                    _ribbonLabel.PropertyChanged -= new PropertyChangedEventHandler(OnLabelPropertyChanged);

                    // Remove association with definition
                    _ribbonLabel.LabelView = null;
                    _ribbonLabel           = null;
                }
            }

            base.Dispose(disposing);
        }
        /// <summary>
        /// Initializes the designer with the specified component.
        /// </summary>
        /// <param name="component">The IComponent to associate the designer with.</param>
        public override void Initialize(IComponent component)
        {
            Debug.Assert(component != null);

            // Validate the parameter reference
            if (component == null)
            {
                throw new ArgumentNullException(nameof(component));
            }

            // Let base class do standard stuff
            base.Initialize(component);

            // Cast to correct type
            _ribbonLabel = (KryptonRibbonGroupLabel)component;
            _ribbonLabel.DesignTimeContextMenu += OnContextMenu;

            // Get access to the services
            _designerHost  = (IDesignerHost)GetService(typeof(IDesignerHost));
            _changeService = (IComponentChangeService)GetService(typeof(IComponentChangeService));

            // We need to know when we are being removed/changed
            _changeService.ComponentChanged += OnComponentChanged;
        }
コード例 #11
0
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_ribbonLabel != null)
                {
                    // Remove back reference to the paint delegate
                    _ribbonLabel.ViewPaintDelegate = null;

                    // Must unhook to prevent memory leaks
                    _ribbonLabel.PropertyChanged -= new PropertyChangedEventHandler(OnLabelPropertyChanged);

                    // Remove association with definition
                    _ribbonLabel.LabelView = null;
                    _ribbonLabel = null;
                }
            }

            base.Dispose(disposing);
        }
コード例 #12
0
        /// <summary>
        /// Initializes the designer with the specified component.
        /// </summary>
        /// <param name="component">The IComponent to associate the designer with.</param>
        public override void Initialize(IComponent component)
        {
            Debug.Assert(component != null);

            // Validate the parameter reference
            if (component == null) throw new ArgumentNullException("component");

            // Let base class do standard stuff
            base.Initialize(component);

            // Cast to correct type
            _ribbonLabel = (KryptonRibbonGroupLabel)component;
            _ribbonLabel.DesignTimeContextMenu += new MouseEventHandler(OnContextMenu);

            // Get access to the services
            _designerHost = (IDesignerHost)GetService(typeof(IDesignerHost));
            _changeService = (IComponentChangeService)GetService(typeof(IComponentChangeService));

            // We need to know when we are being removed/changed
            _changeService.ComponentChanged += new ComponentChangedEventHandler(OnComponentChanged);
        }