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