Inheritance: KryptonRibbonGroupItem
        /// <summary>
        /// Initialize a new instance of the TrackBarController class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon instance.</param>
        /// <param name="trackBar">Source definition.</param>
        /// <param name="target">Target view element.</param>
        public TrackBarController(KryptonRibbon ribbon,
                                  KryptonRibbonGroupTrackBar trackBar,
                                  ViewDrawRibbonGroupTrackBar target)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(trackBar != null);
            Debug.Assert(target != null);

            _ribbon = ribbon;
            _trackBar = trackBar;
            _target = target;
        }
Esempio n. 2
0
        /// <summary>
        /// Initialize a new instance of the TrackBarController class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon instance.</param>
        /// <param name="trackBar">Source definition.</param>
        /// <param name="target">Target view element.</param>
        public TrackBarController(KryptonRibbon ribbon,
                                  KryptonRibbonGroupTrackBar trackBar,
                                  ViewDrawRibbonGroupTrackBar target)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(trackBar != null);
            Debug.Assert(target != null);

            _ribbon   = ribbon;
            _trackBar = trackBar;
            _target   = target;
        }
Esempio n. 3
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupTrackBar class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonTrackBar">Reference to source track bar.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroupTrackBar(KryptonRibbon ribbon,
                                           KryptonRibbonGroupTrackBar ribbonTrackBar,
                                           NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonTrackBar != null);
            Debug.Assert(needPaint != null);

            // Remember incoming references
            _ribbon       = ribbon;
            GroupTrackBar = ribbonTrackBar;
            _needPaint    = needPaint;
            _currentSize  = GroupTrackBar.ItemSizeCurrent;

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

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

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

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

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

            // Define back reference to view for the text box definition
            GroupTrackBar.TrackBarView = this;

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

            // Hook into changes in the ribbon custom definition
            GroupTrackBar.PropertyChanged += OnTextBoxPropertyChanged;
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupTrackBar class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonTrackBar">Reference to source track bar.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroupTrackBar(KryptonRibbon ribbon,
                                           KryptonRibbonGroupTrackBar ribbonTrackBar,
                                           NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonTrackBar != null);
            Debug.Assert(needPaint != null);

            // Remember incoming references
            _ribbon = ribbon;
            _ribbonTrackBar = ribbonTrackBar;
            _needPaint = needPaint;
            _currentSize = _ribbonTrackBar.ItemSizeCurrent;

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

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

            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 TrackBarController(_ribbon, _ribbonTrackBar, this);
            SourceController = _controller;
            KeyController = _controller;

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

            // Define back reference to view for the text box definition
            _ribbonTrackBar.TrackBarView = this;

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

            // Hook into changes in the ribbon custom definition
            _ribbonTrackBar.PropertyChanged += new PropertyChangedEventHandler(OnTextBoxPropertyChanged);
        }
        /// <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 (_ribbonTrackBar != null)
                {
                    // Must unhook to prevent memory leaks
                    _ribbonTrackBar.MouseEnterControl      -= new EventHandler(OnMouseEnterControl);
                    _ribbonTrackBar.MouseLeaveControl      -= new EventHandler(OnMouseLeaveControl);
                    _ribbonTrackBar.ViewPaintDelegate       = null;
                    _ribbonTrackBar.PropertyChanged        -= new PropertyChangedEventHandler(OnTextBoxPropertyChanged);
                    _ribbon.ViewRibbonManager.LayoutAfter  -= new EventHandler(OnLayoutAction);
                    _ribbon.ViewRibbonManager.LayoutBefore -= new EventHandler(OnLayoutAction);

                    // Remove association with definition
                    _ribbonTrackBar.TrackBarView = null;
                    _ribbonTrackBar = 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(nameof(component));
            }

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

            // Cast to correct type
            _ribbonTrackBar = (KryptonRibbonGroupTrackBar)component;
            _ribbonTrackBar.TrackBarDesigner = this;

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

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

            // Tell the embedded text box it is in design mode
            _ribbonTrackBar.TrackBar.InRibbonDesignMode = true;

            // Hook into events
            _ribbonTrackBar.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
            _ribbonTrackBar = (KryptonRibbonGroupTrackBar)component;
            _ribbonTrackBar.TrackBarDesigner = this;

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

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

            // Tell the embedded text box it is in design mode
            _ribbonTrackBar.TrackBar.InRibbonDesignMode = true;

            // Hook into events
            _ribbonTrackBar.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 (_ribbonTrackBar != null)
                {
                    // Must unhook to prevent memory leaks
                    _ribbonTrackBar.MouseEnterControl -= new EventHandler(OnMouseEnterControl);
                    _ribbonTrackBar.MouseLeaveControl -= new EventHandler(OnMouseLeaveControl);
                    _ribbonTrackBar.ViewPaintDelegate = null;
                    _ribbonTrackBar.PropertyChanged -= new PropertyChangedEventHandler(OnTextBoxPropertyChanged);
                    _ribbon.ViewRibbonManager.LayoutAfter -= new EventHandler(OnLayoutAction);
                    _ribbon.ViewRibbonManager.LayoutBefore -= new EventHandler(OnLayoutAction);

                    // Remove association with definition
                    _ribbonTrackBar.TrackBarView = null;
                    _ribbonTrackBar = null;
                }
            }

            base.Dispose(disposing);
        }