Inheritance: KryptonRibbonGroupItem
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupColorButton class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonColorButton">Reference to source color button definition.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroupColorButton(KryptonRibbon ribbon,
                                              KryptonRibbonGroupColorButton ribbonColorButton,
                                              NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonColorButton != null);
            Debug.Assert(needPaint != null);

            // Remember incoming references
            _ribbon          = ribbon;
            GroupColorButton = ribbonColorButton;
            _needPaint       = needPaint;
            _currentSize     = GroupColorButton.ItemSizeCurrent;

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

            // Create the different views for different sizes of the button
            CreateLargeButtonView();
            CreateMediumSmallButtonView();

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

            // Hook into changes in the ribbon button definition
            GroupColorButton.PropertyChanged += OnButtonPropertyChanged;
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupColorButton class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonColorButton">Reference to source color button definition.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroupColorButton(KryptonRibbon ribbon,
                                              KryptonRibbonGroupColorButton ribbonColorButton,
                                              NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonColorButton != null);
            Debug.Assert(needPaint != null);

            // Remember incoming references
            _ribbon = ribbon;
            _ribbonColorButton = ribbonColorButton;
            _needPaint = needPaint;
            _currentSize = _ribbonColorButton.ItemSizeCurrent;

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

            // Create the different views for different sizes of the button
            CreateLargeButtonView();
            CreateMediumSmallButtonView();

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

            // Hook into changes in the ribbon button definition
            _ribbonColorButton.PropertyChanged += new PropertyChangedEventHandler(OnButtonPropertyChanged);
        }
 /// <summary>
 /// Initialize a new instance of the ViewDrawRibbonGroupColorButtonImage class.
 /// </summary>
 /// <param name="ribbon">Reference to owning ribbon control.</param>
 /// <param name="ribbonColorButton">Reference to ribbon group color button definition.</param>
 /// <param name="large">Show the large image.</param>
 public ViewDrawRibbonGroupColorButtonImage(KryptonRibbon ribbon,
                                            KryptonRibbonGroupColorButton ribbonColorButton,
                                            bool large)
     : base(ribbon)
 {
     Debug.Assert(ribbonColorButton != null);
     _ribbonColorButton = ribbonColorButton;
     _selectedColor     = ribbonColorButton.SelectedColor;
     _emptyBorderColor  = ribbonColorButton.EmptyBorderColor;
     _selectedRectSmall = ribbonColorButton.SelectedRectSmall;
     _selectedRectLarge = ribbonColorButton.SelectedRectLarge;
     _large             = large;
 }
 /// <summary>
 /// Initialize a new instance of the ViewDrawRibbonGroupColorButtonImage class.
 /// </summary>
 /// <param name="ribbon">Reference to owning ribbon control.</param>
 /// <param name="ribbonColorButton">Reference to ribbon group color button definition.</param>
 /// <param name="large">Show the large image.</param>
 public ViewDrawRibbonGroupColorButtonImage(KryptonRibbon ribbon,
     KryptonRibbonGroupColorButton ribbonColorButton,
     bool large)
     : base(ribbon)
 {
     Debug.Assert(ribbonColorButton != null);
     _ribbonColorButton = ribbonColorButton;
     _selectedColor = ribbonColorButton.SelectedColor;
     _emptyBorderColor = ribbonColorButton.EmptyBorderColor;
     _selectedRectSmall = ribbonColorButton.SelectedRectSmall;
     _selectedRectLarge = ribbonColorButton.SelectedRectLarge;
     _large = large;
 }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupColorButtonText class.
        /// </summary>
        /// <param name="ribbon">Source ribbon control.</param>
        /// <param name="ribbonColorButton">Group color button to display title for.</param>
        /// <param name="firstText">Should show the first button text.</param>
        public ViewDrawRibbonGroupColorButtonText(KryptonRibbon ribbon,
                                                  KryptonRibbonGroupColorButton ribbonColorButton,
                                                  bool firstText)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonColorButton != null);

            _ribbon            = ribbon;
            _ribbonColorButton = ribbonColorButton;
            _firstText         = firstText;

            // Use a class to convert from ribbon group to content interface
            _contentProvider = new RibbonGroupNormalDisabledTextToContent(ribbon.StateCommon.RibbonGeneral,
                                                                          ribbon.StateNormal.RibbonGroupButtonText,
                                                                          ribbon.StateDisabled.RibbonGroupButtonText);
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupColorButtonText class.
        /// </summary>
        /// <param name="ribbon">Source ribbon control.</param>
        /// <param name="ribbonColorButton">Group color button to display title for.</param>
        /// <param name="firstText">Should show the first button text.</param>
        public ViewDrawRibbonGroupColorButtonText(KryptonRibbon ribbon,
                                                  KryptonRibbonGroupColorButton ribbonColorButton,
                                                  bool firstText)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonColorButton != null);

            _ribbon = ribbon;
            _ribbonColorButton = ribbonColorButton;
            _firstText = firstText;

            // Use a class to convert from ribbon group to content interface
            _contentProvider = new RibbonGroupNormalDisabledTextToContent(ribbon.StateCommon.RibbonGeneral,
                                                                          ribbon.StateNormal.RibbonGroupButtonText,
                                                                          ribbon.StateDisabled.RibbonGroupButtonText);
        }
Ejemplo n.º 7
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 (_ribbonColorButton != null)
                {
                    // Must unhook to prevent memory leaks
                    _ribbonColorButton.PropertyChanged -= new PropertyChangedEventHandler(OnButtonPropertyChanged);

                    // Remove association with definition
                    _ribbonColorButton.ColorButtonView = null;
                    _ribbonColorButton = null;
                }
            }

            base.Dispose(disposing);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupColorButtonImage class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonColorButton">Reference to ribbon group color button definition.</param>
        /// <param name="large">Show the large image.</param>
        public ViewDrawRibbonGroupColorButtonImage(KryptonRibbon ribbon,
                                                   KryptonRibbonGroupColorButton ribbonColorButton,
                                                   bool large)
            : base(ribbon)
        {
            Debug.Assert(ribbonColorButton != null);

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

            _ribbonColorButton = ribbonColorButton;
            _selectedColor     = ribbonColorButton.SelectedColor;
            _emptyBorderColor  = ribbonColorButton.EmptyBorderColor;
            _selectedRectSmall = ribbonColorButton.SelectedRectSmall;
            _selectedRectLarge = ribbonColorButton.SelectedRectLarge;
            _large             = large;
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupColorButtonImage class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonColorButton">Reference to ribbon group color button definition.</param>
        /// <param name="large">Show the large image.</param>
        public ViewDrawRibbonGroupColorButtonImage(KryptonRibbon ribbon,
                                                   KryptonRibbonGroupColorButton ribbonColorButton,
                                                   bool large)
            : base(ribbon)
        {
            Debug.Assert(ribbonColorButton != null);

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

            _ribbonColorButton = ribbonColorButton;
            _selectedColor = ribbonColorButton.SelectedColor;
            _emptyBorderColor = ribbonColorButton.EmptyBorderColor;
            _selectedRectSmall = ribbonColorButton.SelectedRectSmall;
            _selectedRectLarge = ribbonColorButton.SelectedRectLarge;
            _large = large;
        }
        /// <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
            _ribbonColorButton = (KryptonRibbonGroupColorButton)component;
            _ribbonColorButton.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);
        }
        /// <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 (_ribbonColorButton != null)
                {
                    // Must unhook to prevent memory leaks
                    _ribbonColorButton.PropertyChanged -= new PropertyChangedEventHandler(OnButtonPropertyChanged);

                    // Remove association with definition
                    _ribbonColorButton.ColorButtonView = null;
                    _ribbonColorButton = 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("component");

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

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