/// <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 ContextClickController(); 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; }
/// <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; _ribbonDomainUpDown = ribbonDomainUpDown; _needPaint = needPaint; _currentSize = _ribbonDomainUpDown.ItemSizeCurrent; // Hook into the domain up-down events _ribbonDomainUpDown.MouseEnterControl += new EventHandler(OnMouseEnterControl); _ribbonDomainUpDown.MouseLeaveControl += new EventHandler(OnMouseLeaveControl); // Associate this view with the source component (required for design time selection) Component = _ribbonDomainUpDown; if (_ribbon.InDesignMode) { // At design time we need to know when the user right clicks the domain up-down ContextClickController controller = new ContextClickController(); controller.ContextClick += new MouseEventHandler(OnContextClick); MouseController = controller; } // Create controller needed for handling focus and key tip actions _controller = new DomainUpDownController(_ribbon, _ribbonDomainUpDown, this); SourceController = _controller; KeyController = _controller; // We need to rest visibility of the domain up-down for each layout cycle _ribbon.ViewRibbonManager.LayoutBefore += new EventHandler(OnLayoutAction); _ribbon.ViewRibbonManager.LayoutAfter += new EventHandler(OnLayoutAction); // Define back reference to view for the domain up-down definition _ribbonDomainUpDown.DomainUpDownView = this; // Give paint delegate to domain up-down so its palette changes are redrawn _ribbonDomainUpDown.ViewPaintDelegate = needPaint; // Hook into changes in the ribbon custom definition _ribbonDomainUpDown.PropertyChanged += new PropertyChangedEventHandler(OnDomainUpDownPropertyChanged); }