protected override ControlBodyGlyph GetControlGlyph(GlyphSelectionType selectionType) { ControlBodyGlyph glyph = null; SelectionManager service = (SelectionManager)this.GetService(typeof(SelectionManager)); if (service != null) { Rectangle bounds = base.BehaviorService.ControlRectInAdornerWindow(this.splitterPanel1); SplitterPanelDesigner designer = this.designerHost.GetDesigner(this.splitterPanel1) as SplitterPanelDesigner; this.OnSetCursor(); if (designer != null) { glyph = new ControlBodyGlyph(bounds, Cursor.Current, this.splitterPanel1, designer); service.BodyGlyphAdorner.Glyphs.Add(glyph); } bounds = base.BehaviorService.ControlRectInAdornerWindow(this.splitterPanel2); designer = this.designerHost.GetDesigner(this.splitterPanel2) as SplitterPanelDesigner; if (designer != null) { glyph = new ControlBodyGlyph(bounds, Cursor.Current, this.splitterPanel2, designer); service.BodyGlyphAdorner.Glyphs.Add(glyph); } } return(base.GetControlGlyph(selectionType)); }
protected override void Dispose(bool disposing) { if (disposing) { if (this.selSvc != null) { this.selSvc.SelectionChanged -= new EventHandler(this.OnSelectionChanged); this.selSvc.SelectionChanging -= new EventHandler(this.OnSelectionChanging); } this.DisposeMenu(); if (this.designMenu != null) { this.designMenu.Dispose(); this.designMenu = null; } if (this.dummyToolStripGlyph != null) { this.dummyToolStripGlyph = null; } if (this.undoEngine != null) { this.undoEngine.Undone -= new EventHandler(this.OnUndone); } } base.Dispose(disposing); }
private void HideMenu() { if (this.menuItem != null) { if ((this.parentMenu != null) && (this.parentFormDesigner != null)) { this.parentFormDesigner.Menu = this.parentMenu; } this.selected = false; if (this.host.RootComponent is Control) { this.menuItem.DropDown.AutoClose = true; this.menuItem.HideDropDown(); this.menuItem.Visible = false; this.designMenu.Visible = false; ToolStripAdornerWindowService service = (ToolStripAdornerWindowService)this.GetService(typeof(ToolStripAdornerWindowService)); if (service != null) { service.Invalidate(); } if (((BehaviorService)this.GetService(typeof(BehaviorService))) != null) { if (this.dummyToolStripGlyph != null) { SelectionManager manager = (SelectionManager)this.GetService(typeof(SelectionManager)); if (manager != null) { if (manager.BodyGlyphAdorner.Glyphs.Contains(this.dummyToolStripGlyph)) { manager.BodyGlyphAdorner.Glyphs.Remove(this.dummyToolStripGlyph); } manager.Refresh(); } } this.dummyToolStripGlyph = null; } if (this.menuItem != null) { ToolStripMenuItemDesigner designer = this.host.GetDesigner(this.menuItem) as ToolStripMenuItemDesigner; if (designer != null) { designer.UnHookEvents(); designer.RemoveTypeHereNode(this.menuItem); } } } } }
protected override ControlBodyGlyph GetControlGlyph(GlyphSelectionType selectionType) { SelectionManager service = (SelectionManager)this.GetService(typeof(SelectionManager)); if (service != null) { for (int i = 0; i <= 4; i++) { Control c = this.panels[i]; Rectangle bounds = base.BehaviorService.ControlRectInAdornerWindow(c); ControlDesigner designer = this.InternalControlDesigner(i); this.OnSetCursor(); if (designer != null) { ControlBodyGlyph glyph = new ControlBodyGlyph(bounds, Cursor.Current, c, designer); service.BodyGlyphAdorner.Glyphs.Add(glyph); bool flag = true; ICollection selectedComponents = this.selectionSvc.GetSelectedComponents(); if (!this.selectionSvc.GetComponentSelected(this.toolStripContainer)) { foreach (object obj2 in selectedComponents) { if (this.ContainerParent(obj2 as Control) == this.toolStripContainer) { flag = true; } else { flag = false; } } } if (flag) { ToolStripPanelDesigner designer2 = designer as ToolStripPanelDesigner; if (designer2 != null) { this.AddPanelSelectionGlyph(designer2, service); } } } } } return(base.GetControlGlyph(selectionType)); }
void CreateTabGlyphs() { CCTabControl tabControl = Control as CCTabControl; int count = Control.Controls.Count; for (int i = 0; i < count; i++) { Point offset = BehaviorService.ControlToAdornerWindow(Control); Rectangle rect = tabControl.GetTabRect(i); if (rect != Rectangle.Empty) { rect.Offset(offset); Glyph g = new ControlBodyGlyph(rect, Cursors.Hand, Control, new TabBehavior(this)); _tabGlyphs.Add(g); tabControlAdorner.Glyphs.Add(g); } else { _tabGlyphs.Add(null); } } }
public void ShowMenu() { if (this.menuItem != null) { Control parent = this.designMenu.Parent; Form component = parent as Form; if (component != null) { this.parentFormDesigner = this.host.GetDesigner(component) as FormDocumentDesigner; if ((this.parentFormDesigner != null) && (this.parentFormDesigner.Menu != null)) { this.parentMenu = this.parentFormDesigner.Menu; this.parentFormDesigner.Menu = null; } } this.selected = true; this.designMenu.Visible = true; this.designMenu.BringToFront(); this.menuItem.Visible = true; if ((this.currentParent != null) && (this.currentParent != this.menuItem)) { ToolStripMenuItemDesigner designer = this.host.GetDesigner(this.currentParent) as ToolStripMenuItemDesigner; if (designer != null) { designer.RemoveTypeHereNode(this.currentParent); } } this.menuItem.DropDown = this.dropDown; this.menuItem.DropDown.OwnerItem = this.menuItem; if (this.dropDown.Items.Count > 0) { ToolStripItem[] array = new ToolStripItem[this.dropDown.Items.Count]; this.dropDown.Items.CopyTo(array, 0); foreach (ToolStripItem item in array) { if (item is DesignerToolStripControlHost) { this.dropDown.Items.Remove(item); } } } ToolStripMenuItemDesigner designer2 = (ToolStripMenuItemDesigner)this.host.GetDesigner(this.menuItem); BehaviorService service = (BehaviorService)this.GetService(typeof(BehaviorService)); if (service != null) { if ((designer2 != null) && (parent != null)) { Rectangle parentBounds = service.ControlRectInAdornerWindow(parent); if (ToolStripDesigner.IsGlyphTotallyVisible(service.ControlRectInAdornerWindow(this.designMenu), parentBounds)) { designer2.InitializeDropDown(); } } if (this.dummyToolStripGlyph == null) { Point pos = service.ControlToAdornerWindow(this.designMenu); Rectangle bounds = this.designMenu.Bounds; bounds.Offset(pos); this.dummyToolStripGlyph = new ControlBodyGlyph(bounds, Cursor.Current, this.menuItem, new ContextMenuStripBehavior(this.menuItem)); SelectionManager manager = (SelectionManager)this.GetService(typeof(SelectionManager)); if (manager != null) { manager.BodyGlyphAdorner.Glyphs.Insert(0, this.dummyToolStripGlyph); } } ToolStripKeyboardHandlingService service2 = (ToolStripKeyboardHandlingService)this.GetService(typeof(ToolStripKeyboardHandlingService)); if (service2 != null) { int num = this.dropDown.Items.Count - 1; if (num >= 0) { service2.SelectedDesignerControl = this.dropDown.Items[num]; } } } } }