/// <summary> /// Initialize a new instance of the ViewDrawRibbonQATButton class. /// </summary> /// <param name="ribbon">Reference to owning ribbon control.</param> /// <param name="qatButton">Reference to button definition.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public ViewDrawRibbonQATButton(KryptonRibbon ribbon, IQuickAccessToolbarButton qatButton, NeedPaintHandler needPaint) { Debug.Assert(ribbon != null); Debug.Assert(qatButton != null); // Remember incoming references _ribbon = ribbon; QATButton = qatButton; // If the source interface comes from a component then allow it to // be selected at design time by clicking on the view instance Component = qatButton as System.ComponentModel.Component; // Attach a controller to this element for the pressing of the button QATButtonController controller = new QATButtonController(ribbon, this, needPaint); controller.Click += OnClick; SourceController = controller; KeyController = controller; // Create controller for intercepting events to determine tool tip handling MouseController = new ToolTipController(_ribbon.TabsArea.ButtonSpecManager.ToolTipManager, this, controller); // Use a class to convert from ribbon tab to content interface _contentProvider = new QATButtonToContent(qatButton); // Create and add the draw content for display inside the button _drawContent = new ViewDrawContent(_contentProvider, this, VisualOrientation.Top); Add(_drawContent); // Need to notice when the ribbon enable state changes _ribbon.EnabledChanged += OnRibbonEnableChanged; // Set the initial enabled state UpdateEnabled(); }
/// <summary> /// Initialize a new instance of the ViewDrawRibbonQATButton class. /// </summary> /// <param name="ribbon">Reference to owning ribbon control.</param> /// <param name="qatButton">Reference to button definition.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public ViewDrawRibbonQATButton(KryptonRibbon ribbon, IQuickAccessToolbarButton qatButton, NeedPaintHandler needPaint) { Debug.Assert(ribbon != null); Debug.Assert(qatButton != null); // Remember incoming references _ribbon = ribbon; _qatButton = qatButton; // If the source interface comes from a component then allow it to // be selected at design time by clicking on the view instance Component = qatButton as System.ComponentModel.Component; // Attach a controller to this element for the pressing of the button QATButtonController controller = new QATButtonController(ribbon, this, needPaint); controller.Click += new MouseEventHandler(OnClick); SourceController = controller; KeyController = controller; // Create controller for intercepting events to determine tool tip handling MouseController = new ToolTipController(_ribbon.TabsArea.ButtonSpecManager.ToolTipManager, this, controller); // Use a class to convert from ribbon tab to content interface _contentProvider = new QATButtonToContent(qatButton); // Create and add the draw content for display inside the button _drawContent = new ViewDrawContent(_contentProvider, this, VisualOrientation.Top); Add(_drawContent); // Need to notice when the ribbon enable state changes _ribbon.EnabledChanged += new EventHandler(OnRibbonEnableChanged); // Set the initial enabled state UpdateEnabled(); }