Inheritance: KryptonRibbonGroupItem
Ejemplo n.º 1
0
        /// <summary>
        /// Initialize a new instance of the DateTimePickerController class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon instance.</param>
        /// <param name="dateTimePicker">Source definition.</param>
        /// <param name="target">Target view element.</param>
        public DateTimePickerController(KryptonRibbon ribbon,
                                        KryptonRibbonGroupDateTimePicker dateTimePicker,
                                        ViewDrawRibbonGroupDateTimePicker target)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(dateTimePicker != null);
            Debug.Assert(target != null);

            _ribbon         = ribbon;
            _dateTimePicker = dateTimePicker;
            _target         = target;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initialize a new instance of the DateTimePickerController class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon instance.</param>
        /// <param name="dateTimePicker">Source definition.</param>
        /// <param name="target">Target view element.</param>
        public DateTimePickerController(KryptonRibbon ribbon,
                                        KryptonRibbonGroupDateTimePicker dateTimePicker,
                                        ViewDrawRibbonGroupDateTimePicker target)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(dateTimePicker != null);
            Debug.Assert(target != null);

            _ribbon = ribbon;
            _dateTimePicker = dateTimePicker;
            _target = target;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupDateTimePicker class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonDateTimePicker">Reference to source date time picker.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroupDateTimePicker(KryptonRibbon ribbon,
                                                 KryptonRibbonGroupDateTimePicker ribbonDateTimePicker,
                                                 NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonDateTimePicker != null);
            Debug.Assert(needPaint != null);

            // Remember incoming references
            _ribbon = ribbon;
            _ribbonDateTimePicker = ribbonDateTimePicker;
            _needPaint            = needPaint;
            _currentSize          = _ribbonDateTimePicker.ItemSizeCurrent;

            // Hook into the date time picker events
            _ribbonDateTimePicker.MouseEnterControl += new EventHandler(OnMouseEnterControl);
            _ribbonDateTimePicker.MouseLeaveControl += new EventHandler(OnMouseLeaveControl);

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

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

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

            // We need to rest visibility of the date time picker 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
            _ribbonDateTimePicker.DateTimePickerView = this;

            // Give paint delegate to date time picker so its palette changes are redrawn
            _ribbonDateTimePicker.ViewPaintDelegate = needPaint;

            // Hook into changes in the ribbon custom definition
            _ribbonDateTimePicker.PropertyChanged += new PropertyChangedEventHandler(OnDateTimePickerPropertyChanged);
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupDateTimePicker class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonDateTimePicker">Reference to source date time picker.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroupDateTimePicker(KryptonRibbon ribbon,
                                                 KryptonRibbonGroupDateTimePicker ribbonDateTimePicker,
                                                 NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonDateTimePicker != null);
            Debug.Assert(needPaint != null);

            // Remember incoming references
            _ribbon = ribbon;
            _ribbonDateTimePicker = ribbonDateTimePicker;
            _needPaint = needPaint;
            _currentSize = _ribbonDateTimePicker.ItemSizeCurrent;

            // Hook into the date time picker events
            _ribbonDateTimePicker.MouseEnterControl += new EventHandler(OnMouseEnterControl);
            _ribbonDateTimePicker.MouseLeaveControl += new EventHandler(OnMouseLeaveControl);

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

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

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

            // We need to rest visibility of the date time picker 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
            _ribbonDateTimePicker.DateTimePickerView = this;

            // Give paint delegate to date time picker so its palette changes are redrawn
            _ribbonDateTimePicker.ViewPaintDelegate = needPaint;

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

                    // Remove association with definition
                    _ribbonDateTimePicker.DateTimePickerView = null;
                    _ribbonDateTimePicker = null;
                }
            }

            base.Dispose(disposing);
        }
Ejemplo n.º 6
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
            _ribbonDateTimePicker = (KryptonRibbonGroupDateTimePicker)component;
            _ribbonDateTimePicker.DateTimePickerDesigner = this;

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

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

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

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

                    // Remove association with definition
                    _ribbonDateTimePicker.DateTimePickerView = null;
                    _ribbonDateTimePicker = 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("component");

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

            // Cast to correct type
            _ribbonDateTimePicker = (KryptonRibbonGroupDateTimePicker)component;
            _ribbonDateTimePicker.DateTimePickerDesigner = this;

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

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

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

            // Hook into events
            _ribbonDateTimePicker.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);
        }