private void toolStripDropDown_Closing(object sender, ToolStripDropDownClosingEventArgs e) { if (this.cancelClose || e.Cancel) { e.Cancel = true; } else { if (e.CloseReason == ToolStripDropDownCloseReason.ItemClicked) { e.Cancel = true; } if (e.CloseReason == ToolStripDropDownCloseReason.Keyboard) { e.Cancel = false; } if (!e.Cancel && (this.lastPanelComponent != null)) { Point lastCursorPoint = DesignerUtils.LastCursorPoint; DesignerActionGlyph glyph = this.componentToGlyph[this.lastPanelComponent] as DesignerActionGlyph; if (glyph != null) { Rectangle rectangle3 = new Rectangle(this.GetGlyphLocationScreenCoord(this.lastPanelComponent, glyph), new Size(glyph.Bounds.Width, glyph.Bounds.Height)); if (rectangle3.Contains(lastCursorPoint)) { DesignerActionBehavior behavior = glyph.Behavior as DesignerActionBehavior; behavior.IgnoreNextMouseUp = true; } glyph.InvalidateOwnerLocation(); } this.lastPanelComponent = null; this.behaviorService.PopBehavior(this.dapkb); } } }
internal bool ShowDesignerActionPanelForPrimarySelection() { if (this.selSvc != null) { object primarySelection = this.selSvc.PrimarySelection; if ((primarySelection == null) || !this.componentToGlyph.Contains(primarySelection)) { return(false); } DesignerActionGlyph g = (DesignerActionGlyph)this.componentToGlyph[primarySelection]; if ((g != null) && (g.Behavior is DesignerActionBehavior)) { DesignerActionBehavior behavior = g.Behavior as DesignerActionBehavior; if (behavior != null) { if (!this.IsDesignerActionPanelVisible) { behavior.ShowUI(g); return(true); } behavior.HideUI(); return(false); } } } return(false); }
internal DesignerActionGlyph GetDesignerActionGlyph(IComponent comp, DesignerActionListCollection dalColl) { InheritanceAttribute attribute = (InheritanceAttribute)TypeDescriptor.GetAttributes(comp)[typeof(InheritanceAttribute)]; if (attribute != InheritanceAttribute.InheritedReadOnly) { if (dalColl == null) { dalColl = this.designerActionService.GetComponentActions(comp); } if ((dalColl != null) && (dalColl.Count > 0)) { DesignerActionGlyph glyph = null; if (this.componentToGlyph[comp] == null) { DesignerActionBehavior behavior = new DesignerActionBehavior(this.serviceProvider, comp, dalColl, this); if (!(comp is Control) || (comp is ToolStripDropDown)) { ComponentTray service = this.serviceProvider.GetService(typeof(ComponentTray)) as ComponentTray; if (service != null) { ComponentTray.TrayControl trayControlFromComponent = service.GetTrayControlFromComponent(comp); if (trayControlFromComponent != null) { Rectangle bounds = trayControlFromComponent.Bounds; glyph = new DesignerActionGlyph(behavior, bounds, service); } } } if (glyph == null) { glyph = new DesignerActionGlyph(behavior, this.designerActionAdorner); } if (glyph != null) { this.componentToGlyph.Add(comp, glyph); } return(glyph); } glyph = this.componentToGlyph[comp] as DesignerActionGlyph; if (glyph != null) { DesignerActionBehavior behavior2 = glyph.Behavior as DesignerActionBehavior; if (behavior2 != null) { behavior2.ActionLists = dalColl; } glyph.Invalidate(); } return(glyph); } this.RemoveActionGlyph(comp); } return(null); }
private void RecreatePanel(Glyph glyphWithPanelToRegen) { if (this.IsDesignerActionPanelVisible && (glyphWithPanelToRegen != null)) { DesignerActionBehavior behavior = glyphWithPanelToRegen.Behavior as DesignerActionBehavior; if (behavior != null) { this.designerActionHost.CurrentPanel.UpdateTasks(behavior.ActionLists, new DesignerActionListCollection(), System.Design.SR.GetString("DesignerActionPanel_DefaultPanelTitle", new object[] { behavior.RelatedComponent.GetType().Name }), null); this.designerActionHost.UpdateContainerSize(); } } }
private void OnDesignerActionUIStateChange(object sender, DesignerActionUIStateChangeEventArgs e) { IComponent relatedObject = e.RelatedObject as IComponent; if (relatedObject != null) { DesignerActionGlyph designerActionGlyph = this.GetDesignerActionGlyph(relatedObject); if (designerActionGlyph != null) { if (e.ChangeType != DesignerActionUIStateChangeType.Show) { if (e.ChangeType != DesignerActionUIStateChangeType.Hide) { if (e.ChangeType == DesignerActionUIStateChangeType.Refresh) { designerActionGlyph.Invalidate(); this.RecreatePanel((IComponent)e.RelatedObject); } } else { DesignerActionBehavior behavior2 = designerActionGlyph.Behavior as DesignerActionBehavior; if (behavior2 != null) { behavior2.HideUI(); } } } else { DesignerActionBehavior behavior = designerActionGlyph.Behavior as DesignerActionBehavior; if (behavior != null) { behavior.ShowUI(designerActionGlyph); } } } } else if (e.ChangeType == DesignerActionUIStateChangeType.Hide) { this.HideDesignerActionPanel(); } }