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

            // Remember incoming references
            _ribbon            = ribbon;
            GroupMaskedTextBox = ribbonMaskedTextBox;
            _needPaint         = needPaint;
            _currentSize       = GroupMaskedTextBox.ItemSizeCurrent;

            // Hook into the masked textbox events
            GroupMaskedTextBox.MouseEnterControl += OnMouseEnterControl;
            GroupMaskedTextBox.MouseLeaveControl += OnMouseLeaveControl;

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

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

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

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

            // Define back reference to view for the masked text box definition
            GroupMaskedTextBox.MaskedTextBoxView = this;

            // Give paint delegate to masked textbox so its palette changes are redrawn
            GroupMaskedTextBox.ViewPaintDelegate = needPaint;

            // Hook into changes in the ribbon custom definition
            GroupMaskedTextBox.PropertyChanged += OnMaskedTextBoxPropertyChanged;
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupMaskedTextBox class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonMaskedTextBox">Reference to source masked textbox.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroupMaskedTextBox(KryptonRibbon ribbon,
                                                KryptonRibbonGroupMaskedTextBox ribbonMaskedTextBox,
                                                NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonMaskedTextBox != null);
            Debug.Assert(needPaint != null);

            // Remember incoming references
            _ribbon = ribbon;
            _ribbonMaskedTextBox = ribbonMaskedTextBox;
            _needPaint = needPaint;
            _currentSize = _ribbonMaskedTextBox.ItemSizeCurrent;

            // Hook into the masked textbox events
            _ribbonMaskedTextBox.MouseEnterControl += new EventHandler(OnMouseEnterControl);
            _ribbonMaskedTextBox.MouseLeaveControl += new EventHandler(OnMouseLeaveControl);

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

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

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

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

            // Define back reference to view for the masked text box definition
            _ribbonMaskedTextBox.MaskedTextBoxView = this;

            // Give paint delegate to masked textbox so its palette changes are redrawn
            _ribbonMaskedTextBox.ViewPaintDelegate = needPaint;

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