/// <summary> /// Initialize a new instance of the ViewDrawRibbonGroupButtonBackBorder class. /// </summary> /// <param name="ribbon">Reference to owning ribbon control.</param> /// <param name="groupItem">Reference to owning group item.</param> /// <param name="paletteBack">Palette to use for the background.</param> /// <param name="paletteBorder">Palette to use for the border.</param> /// <param name="constantBorder">Should the border be a constant normal state.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public ViewDrawRibbonGroupButtonBackBorder(KryptonRibbon ribbon, KryptonRibbonGroupItem groupItem, IPaletteBack paletteBack, IPaletteBorder paletteBorder, bool constantBorder, NeedPaintHandler needPaint) { Debug.Assert(ribbon != null); Debug.Assert(groupItem != null); Debug.Assert(paletteBack != null); Debug.Assert(paletteBorder != null); // Remember incoming references _ribbon = ribbon; _groupItem = groupItem; _paletteBack = paletteBack; _paletteBackDraw = new PaletteBackInheritForced(paletteBack); _paletteBackDraw.ForceDraw = InheritBool.True; _paletteBackLight = new PaletteBackLightenColors(paletteBack); _paletteBorderAll = new PaletteBorderInheritForced(paletteBorder); _paletteBorderAll.ForceBorderEdges(PaletteDrawBorders.All); _paletteBorder = paletteBorder; _constantBorder = constantBorder; // Default other fields _checked = false; _drawNonTrackingAreas = true; // Create delegate used to process end of click action _finishDelegate = new EventHandler(ActionFinished); // Attach a controller to this element for the pressing of the button _controller = new GroupButtonController(_ribbon, this, needPaint); _controller.Click += new EventHandler(OnClick); _controller.ContextClick += new MouseEventHandler(OnContextClick); _controller.DropDown += new EventHandler(OnDropDown); MouseController = _controller; SourceController = _controller; KeyController = _controller; }
private void OnClearItems(object sender, EventArgs e) { if ((_ribbonCluster != null) && (_ribbonCluster.Ribbon != null)) { // Use a transaction to support undo/redo actions DesignerTransaction transaction = _designerHost.CreateTransaction("KryptonRibbonGroupCluster ClearItems"); try { // Get access to the Items property MemberDescriptor propertyItems = TypeDescriptor.GetProperties(_ribbonCluster)["Items"]; RaiseComponentChanging(propertyItems); // Need access to host in order to delete a component IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); // We need to remove all the buttons from the cluster group for (int i = _ribbonCluster.Items.Count - 1; i >= 0; i--) { KryptonRibbonGroupItem item = _ribbonCluster.Items[i]; _ribbonCluster.Items.Remove(item); host.DestroyComponent(item); } RaiseComponentChanged(propertyItems, null, null); } finally { // If we managed to create the transaction, then do it if (transaction != null) { transaction.Commit(); } } } }
/// <summary> /// Initialize a new instance of the GroupItemToolTipToContent class. /// </summary> /// <param name="groupItem">Source ribbon group item.</param> public GroupItemToolTipToContent(KryptonRibbonGroupItem groupItem) { Debug.Assert(groupItem != null); _groupItem = groupItem; }