Esempio n. 1
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)
        {
            // Let base class do standard stuff
            base.Initialize(component);

            Debug.Assert(component != null);

            // Cast to correct type
            _ribbonDomainUpDown = component as KryptonRibbonGroupDomainUpDown;
            if (_ribbonDomainUpDown != null)
            {
                _ribbonDomainUpDown.DomainUpDownDesigner = this;

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

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

                // Tell the embedded domain up-down control it is in design mode
                _ribbonDomainUpDown.DomainUpDown.InRibbonDesignMode = true;

                // Hook into events
                _ribbonDomainUpDown.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>
        /// Initialize a new instance of the DomainUpDownController class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon instance.</param>
        /// <param name="domainUpDown">Source definition.</param>
        /// <param name="target">Target view element.</param>
        public DomainUpDownController(KryptonRibbon ribbon,
                                      KryptonRibbonGroupDomainUpDown domainUpDown,
                                      ViewDrawRibbonGroupDomainUpDown target)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(domainUpDown != null);
            Debug.Assert(target != null);

            _ribbon       = ribbon;
            _domainUpDown = domainUpDown;
            _target       = target;
        }
Esempio n. 3
0
 /// <summary>
 /// Propagates the theme selector.
 /// </summary>
 /// <param name="target">The target.</param>
 public static void PropagateThemeSelector(KryptonRibbonGroupDomainUpDown target)
 {
     try
     {
         foreach (var theme in ThemeManager.SupportedThemeArray)
         {
             target.Items.Add(theme);
         }
     }
     catch
     {
         throw;
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupDomainUpDown class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonDomainUpDown">Reference to source domain up-down.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroupDomainUpDown(KryptonRibbon ribbon,
                                               KryptonRibbonGroupDomainUpDown ribbonDomainUpDown,
                                               NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonDomainUpDown != null);
            Debug.Assert(needPaint != null);

            // Remember incoming references
            _ribbon           = ribbon;
            GroupDomainUpDown = ribbonDomainUpDown;
            _needPaint        = needPaint;
            _currentSize      = GroupDomainUpDown.ItemSizeCurrent;

            // Hook into the domain up-down events
            GroupDomainUpDown.MouseEnterControl += OnMouseEnterControl;
            GroupDomainUpDown.MouseLeaveControl += OnMouseLeaveControl;

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

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

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

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

            // Define back reference to view for the domain up-down definition
            GroupDomainUpDown.DomainUpDownView = this;

            // Give paint delegate to domain up-down so its palette changes are redrawn
            GroupDomainUpDown.ViewPaintDelegate = needPaint;

            // Hook into changes in the ribbon custom definition
            GroupDomainUpDown.PropertyChanged += OnDomainUpDownPropertyChanged;
            NULL_CONTROL_WIDTH = (int)(50 * FactorDpiX);
        }