Process mouse events for a ribbon group richtextbox.
Inheritance: ComponentFactory.Krypton.Toolkit.GlobalId, ISourceController, IKeyController, IRibbonKeyTipTarget
Example #1
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupRichTextBox class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonRichTextBox">Reference to source richtextbox.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroupRichTextBox(KryptonRibbon ribbon,
                                              KryptonRibbonGroupRichTextBox ribbonRichTextBox,
                                              NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonRichTextBox != null);
            Debug.Assert(needPaint != null);

            // Remember incoming references
            _ribbon            = ribbon;
            _ribbonRichTextBox = ribbonRichTextBox;
            _needPaint         = needPaint;
            _currentSize       = _ribbonRichTextBox.ItemSizeCurrent;

            // Hook into the richtextbox events
            _ribbonRichTextBox.MouseEnterControl += new EventHandler(OnMouseEnterControl);
            _ribbonRichTextBox.MouseLeaveControl += new EventHandler(OnMouseLeaveControl);

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

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

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

            // We need to rest visibility of the richtextbox for each layout cycle
            _ribbon.ViewRibbonManager.LayoutBefore += new EventHandler(OnLayoutAction);
            _ribbon.ViewRibbonManager.LayoutAfter  += new EventHandler(OnLayoutAction);

            // Define back reference to view for the rich text box definition
            _ribbonRichTextBox.RichTextBoxView = this;

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

            // Hook into changes in the ribbon custom definition
            _ribbonRichTextBox.PropertyChanged += new PropertyChangedEventHandler(OnRichTextBoxPropertyChanged);
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupRichTextBox class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonRichTextBox">Reference to source richtextbox.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroupRichTextBox(KryptonRibbon ribbon,
                                              KryptonRibbonGroupRichTextBox ribbonRichTextBox,
                                              NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonRichTextBox != null);
            Debug.Assert(needPaint != null);

            // Remember incoming references
            _ribbon = ribbon;
            _ribbonRichTextBox = ribbonRichTextBox;
            _needPaint = needPaint;
            _currentSize = _ribbonRichTextBox.ItemSizeCurrent;

            // Hook into the richtextbox events
            _ribbonRichTextBox.MouseEnterControl += new EventHandler(OnMouseEnterControl);
            _ribbonRichTextBox.MouseLeaveControl += new EventHandler(OnMouseLeaveControl);

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

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

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

            // We need to rest visibility of the richtextbox for each layout cycle
            _ribbon.ViewRibbonManager.LayoutBefore += new EventHandler(OnLayoutAction);
            _ribbon.ViewRibbonManager.LayoutAfter += new EventHandler(OnLayoutAction);

            // Define back reference to view for the rich text box definition
            _ribbonRichTextBox.RichTextBoxView = this;

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

            // Hook into changes in the ribbon custom definition
            _ribbonRichTextBox.PropertyChanged += new PropertyChangedEventHandler(OnRichTextBoxPropertyChanged);
        }