Process mouse events for a ribbon group textbox.
Наследование: ComponentFactory.Krypton.Toolkit.GlobalId, ISourceController, IKeyController, IRibbonKeyTipTarget
Пример #1
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);
        }