internal Point UpdateDAPLocation(IComponent component, DesignerActionGlyph glyph) { DockStyle style; if (component == null) { component = this.lastPanelComponent; } if (this.designerActionHost == null) { return(Point.Empty); } if ((component == null) || (glyph == null)) { return(this.designerActionHost.Location); } if ((this.behaviorService != null) && !this.behaviorService.AdornerWindowControl.DisplayRectangle.IntersectsWith(glyph.Bounds)) { this.HideDesignerActionPanel(); return(this.designerActionHost.Location); } Point glyphLocationScreenCoord = this.GetGlyphLocationScreenCoord(component, glyph); Rectangle rectangleAnchor = new Rectangle(glyphLocationScreenCoord, glyph.Bounds.Size); Point point2 = DesignerActionPanel.ComputePreferredDesktopLocation(rectangleAnchor, this.designerActionHost.Size, out style); glyph.DockEdge = style; this.designerActionHost.Location = point2; return(point2); }
internal void ShowDesignerActionPanel(IComponent relatedComponent, DesignerActionPanel panel, DesignerActionGlyph glyph) { if (this.designerActionHost == null) { this.designerActionHost = new DesignerActionToolStripDropDown(this, this.mainParentWindow); this.designerActionHost.AutoSize = false; this.designerActionHost.Padding = Padding.Empty; this.designerActionHost.Renderer = new NoBorderRenderer(); this.designerActionHost.Text = "DesignerActionTopLevelForm"; this.designerActionHost.Closing += new ToolStripDropDownClosingEventHandler(this.toolStripDropDown_Closing); } this.designerActionHost.AccessibleName = System.Design.SR.GetString("DesignerActionPanel_DefaultPanelTitle", new object[] { relatedComponent.GetType().Name }); panel.AccessibleName = System.Design.SR.GetString("DesignerActionPanel_DefaultPanelTitle", new object[] { relatedComponent.GetType().Name }); this.designerActionHost.SetDesignerActionPanel(panel, glyph); Point screenLocation = this.UpdateDAPLocation(relatedComponent, glyph); if ((this.behaviorService != null) && this.behaviorService.AdornerWindowControl.DisplayRectangle.IntersectsWith(glyph.Bounds)) { if ((this.mainParentWindow != null) && (this.mainParentWindow.Handle != IntPtr.Zero)) { System.Design.UnsafeNativeMethods.SetWindowLong(new HandleRef(this.designerActionHost, this.designerActionHost.Handle), -8, new HandleRef(this.mainParentWindow, this.mainParentWindow.Handle)); } this.cancelClose = true; this.designerActionHost.Show(screenLocation); this.designerActionHost.Focus(); this.designerActionHost.BeginInvoke(new EventHandler(this.OnShowComplete)); glyph.InvalidateOwnerLocation(); this.lastPanelComponent = relatedComponent; this.dapkb = new DesignerActionKeyboardBehavior(this.designerActionHost.CurrentPanel, this.serviceProvider, this.behaviorService); this.behaviorService.PushBehavior(this.dapkb); } }
public void SetDesignerActionPanel(DesignerActionPanel panel, Glyph relatedGlyph) { if ((this._panel == null) || (panel != ((DesignerActionPanel)this._panel.Control))) { this.relatedGlyph = relatedGlyph; panel.SizeChanged += new EventHandler(this.PanelResized); if (this._panel != null) { this.Items.Remove(this._panel); this._panel.Dispose(); this._panel = null; } this._panel = new ToolStripControlHost(panel); this._panel.Margin = Padding.Empty; this._panel.Size = panel.Size; base.SuspendLayout(); base.Size = panel.Size; this.Items.Add(this._panel); base.ResumeLayout(); if (base.Visible) { this.CheckFocusIsRight(); } } }
public DesignerActionKeyboardBehavior(DesignerActionPanel panel, IServiceProvider serviceProvider, BehaviorService behaviorService) : base(true, behaviorService) { this.panel = panel; if (serviceProvider != null) { this.menuService = serviceProvider.GetService(typeof(IMenuCommandService)) as IMenuCommandService; this.daUISvc = serviceProvider.GetService(typeof(DesignerActionUIService)) as DesignerActionUIService; } }
internal void ShowUI(Glyph g) { DesignerActionGlyph glyph = g as DesignerActionGlyph; if (glyph != null) { DesignerActionPanel panel = this.CreateDesignerActionPanel(this.RelatedComponent); this.ParentUI.ShowDesignerActionPanel(this.RelatedComponent, panel, glyph); } }
internal DesignerActionPanel CreateDesignerActionPanel(IComponent relatedComponent) { DesignerActionListCollection actionLists = new DesignerActionListCollection(); actionLists.AddRange(this.ActionLists); DesignerActionPanel panel = new DesignerActionPanel(this.serviceProvider); panel.UpdateTasks(actionLists, new DesignerActionListCollection(), System.Design.SR.GetString("DesignerActionPanel_DefaultPanelTitle", new object[] { relatedComponent.GetType().Name }), null); return(panel); }
public DesignerActionKeyboardBehavior(DesignerActionPanel panel, IServiceProvider serviceProvider, BehaviorService behaviorService) : base(true, behaviorService) { _panel = panel; if (serviceProvider != null) { _menuService = serviceProvider.GetService(typeof(IMenuCommandService)) as IMenuCommandService; Debug.Assert(_menuService != null, "we should have found a menu service here..."); _daUISvc = serviceProvider.GetService(typeof(DesignerActionUIService)) as DesignerActionUIService; } }