Example #1
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupRadioButton class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonRadioButton">Reference to source radio button definition.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroupRadioButton(KryptonRibbon ribbon,
                                              KryptonRibbonGroupRadioButton ribbonRadioButton,
                                              NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonRadioButton != null);
            Debug.Assert(needPaint != null);

            // Remember incoming references
            _ribbon          = ribbon;
            GroupRadioButton = ribbonRadioButton;
            _needPaint       = needPaint;
            _currentSize     = GroupRadioButton.ItemSizeCurrent;

            // Create delegate used to process end of click action
            _finishDelegateLarge       = ActionFinishedLarge;
            _finishDelegateMediumSmall = ActionFinishedMediumSmall;

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

            // Create the different views for different sizes of the radio button
            CreateLargeRadioButtonView();
            CreateMediumSmallRadioButtonView();

            // Update all views to reflect current radio button state
            UpdateEnabledState();
            UpdateCheckedState();
            UpdateItemSizeState();

            // Hook into changes in the ribbon radio button definition
            GroupRadioButton.PropertyChanged += OnRadioButtonPropertyChanged;
        }
Example #2
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupRadioButtonText class.
        /// </summary>
        /// <param name="ribbon">Source ribbon control.</param>
        /// <param name="ribbonRadioButton">Group radio button to display title for.</param>
        /// <param name="firstText">Should show the first button text.</param>
        public ViewDrawRibbonGroupRadioButtonText(KryptonRibbon ribbon,
                                                  KryptonRibbonGroupRadioButton ribbonRadioButton,
                                                  bool firstText)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonRadioButton != null);

            _ribbon            = ribbon;
            _ribbonRadioButton = ribbonRadioButton;
            _firstText         = firstText;

            // Use a class to convert from ribbon group to content interface
            _contentProvider = new RibbonGroupNormalDisabledTextToContent(ribbon.StateCommon.RibbonGeneral,
                                                                          ribbon.StateNormal.RibbonGroupRadioButtonText,
                                                                          ribbon.StateDisabled.RibbonGroupRadioButtonText);
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupRadioButtonImage class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonRadioButton">Reference to ribbon group radio button definition.</param>
        /// <param name="large">Show the large image.</param>
        public ViewDrawRibbonGroupRadioButtonImage(KryptonRibbon ribbon,
                                                   KryptonRibbonGroupRadioButton ribbonRadioButton,
                                                   bool large)
        {
            Debug.Assert(ribbonRadioButton != null);

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

            // Remember incoming parameters
            _ribbonRadioButton = ribbonRadioButton;
            _large             = large;

            // Use redirector to get the radio button images and redirect to parent palette
            PaletteRedirectRadioButton redirectImages = new PaletteRedirectRadioButton(ribbon.GetRedirector(), ribbon.StateCommon.RibbonImages.RadioButton);

            // Create drawing element
            _drawRadioButton = new ViewDrawRadioButton(redirectImages);

            // Add as only child
            Add(_drawRadioButton);
        }
Example #4
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(nameof(component));
            }

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

            // Cast to correct type
            _ribbonRadioButton = (KryptonRibbonGroupRadioButton)component;
            _ribbonRadioButton.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;
        }