Inheritance: KryptonRibbonGroupContainer
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupGalleryImage class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonGallery">Reference to ribbon group gallery definition.</param>
        public ViewDrawRibbonGroupGalleryImage(KryptonRibbon ribbon,
                                               KryptonRibbonGroupGallery ribbonGallery)
            : base(ribbon)
        {
            Debug.Assert(ribbonGallery != null);

            _ribbonGallery = ribbonGallery;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initialize a new instance of the GalleryController class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon instance.</param>
        /// <param name="gallery">Source definition.</param>
        /// <param name="target">Target view element.</param>
        public GalleryController(KryptonRibbon ribbon,
                                 KryptonRibbonGroupGallery gallery,
                                 ViewDrawRibbonGroupGallery target)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(gallery != null);
            Debug.Assert(target != null);

            _ribbon = ribbon;
            _gallery = gallery;
            _target = target;
        }
        /// <summary>
        /// Initialize a new instance of the GalleryController class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon instance.</param>
        /// <param name="gallery">Source definition.</param>
        /// <param name="target">Target view element.</param>
        public GalleryController(KryptonRibbon ribbon,
                                 KryptonRibbonGroupGallery gallery,
                                 ViewDrawRibbonGroupGallery target)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(gallery != null);
            Debug.Assert(target != null);

            _ribbon  = ribbon;
            _gallery = gallery;
            _target  = target;
        }
Exemplo n.º 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;
            GroupGallery = ribbonGallery;
            _needPaint   = needPaint;
            _currentSize = GroupGallery.ItemSizeCurrent;

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

            // Hook into the gallery events
            GroupGallery.MouseEnterControl += OnMouseEnterControl;
            GroupGallery.MouseLeaveControl += OnMouseLeaveControl;

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

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

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

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

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

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

            // Hook into changes in the ribbon custom definition
            GroupGallery.PropertyChanged += OnGalleryPropertyChanged;
        }
        /// <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);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupGalleryText class.
        /// </summary>
        /// <param name="ribbon">Source ribbon control.</param>
        /// <param name="ribbonGallery">Group gallery button to display title for.</param>
        /// <param name="firstText">Should show the first button text.</param>
        public ViewDrawRibbonGroupGalleryText(KryptonRibbon ribbon,
                                              KryptonRibbonGroupGallery ribbonGallery,
                                              bool firstText)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonGallery != null);

            _ribbon        = ribbon;
            _ribbonGallery = ribbonGallery;
            _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 ViewDrawRibbonGroupGalleryText class.
        /// </summary>
        /// <param name="ribbon">Source ribbon control.</param>
        /// <param name="ribbonGallery">Group gallery button to display title for.</param>
        /// <param name="firstText">Should show the first button text.</param>
        public ViewDrawRibbonGroupGalleryText(KryptonRibbon ribbon,
                                              KryptonRibbonGroupGallery ribbonGallery,
                                              bool firstText)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonGallery != null);

            _ribbon = ribbon;
            _ribbonGallery = ribbonGallery;
            _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);
        }
Exemplo n.º 8
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
            _ribbonGallery = (KryptonRibbonGroupGallery)component;
            _ribbonGallery.GalleryDesigner = this;

            // Update designer properties with actual starting values
            Visible = _ribbonGallery.Visible;
            Enabled = _ribbonGallery.Enabled;

            // Update visible/enabled to always be showing/enabled at design time
            _ribbonGallery.Visible = true;
            _ribbonGallery.Enabled = true;

            // Tell the embedded gallery it is in design mode
            _ribbonGallery.Gallery.InRibbonDesignMode = true;

            // Hook into events
            _ribbonGallery.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;
        }
        /// <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
            _ribbonGallery = (KryptonRibbonGroupGallery)component;
            _ribbonGallery.GalleryDesigner = this;

            // Update designer properties with actual starting values
            Visible = _ribbonGallery.Visible;
            Enabled = _ribbonGallery.Enabled;

            // Update visible/enabled to always be showing/enabled at design time
            _ribbonGallery.Visible = true;
            _ribbonGallery.Enabled = true;

            // Tell the embedded gallery it is in design mode
            _ribbonGallery.Gallery.InRibbonDesignMode = true;

            // Hook into events
            _ribbonGallery.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 (_ribbonGallery != null)
                {
                    // Must unhook to prevent memory leaks
                    if (_ribbonGallery.LastGallery != null)
                        _ribbonGallery.LastGallery.Ribbon = null;

                    _ribbonGallery.MouseEnterControl -= new EventHandler(OnMouseEnterControl);
                    _ribbonGallery.MouseLeaveControl -= new EventHandler(OnMouseLeaveControl);
                    _ribbonGallery.ViewPaintDelegate = null;
                    _ribbonGallery.PropertyChanged -= new PropertyChangedEventHandler(OnGalleryPropertyChanged);
                    _ribbon.ViewRibbonManager.LayoutAfter -= new EventHandler(OnLayoutAction);
                    _ribbon.ViewRibbonManager.LayoutBefore -= new EventHandler(OnLayoutAction);

                    // Remove association with definition
                    _ribbonGallery.GalleryView = null;
                    _ribbonGallery = null;
                }
            }

            base.Dispose(disposing);
        }