public void AddRange(GlyphCollection value)
 {
     for (int i = 0; i < value.Count; i++)
     {
         this.Add(value[i]);
     }
 }
 public void AddRange(GlyphCollection value)
 {
     for (int i = 0; i < value.Count; i++)
     {
         this.Add(value[i]);
     }
 }
 private bool CheckAssociatedControl(Component c, Glyph childGlyph, GlyphCollection glyphs)
 {
     bool flag = false;
     ToolStripDropDownItem dropDownItem = c as ToolStripDropDownItem;
     if (dropDownItem != null)
     {
         flag = this.CheckDropDownBounds(dropDownItem, childGlyph, glyphs);
     }
     if (flag)
     {
         return flag;
     }
     Control associatedControl = this.GetAssociatedControl(c);
     if (((associatedControl == null) || (associatedControl == this.toolStripContainer)) || System.Design.UnsafeNativeMethods.IsChild(new HandleRef(this.toolStripContainer, this.toolStripContainer.Handle), new HandleRef(associatedControl, associatedControl.Handle)))
     {
         return flag;
     }
     Rectangle bounds = childGlyph.Bounds;
     Rectangle rect = base.BehaviorService.ControlRectInAdornerWindow(associatedControl);
     if ((c == this.designerHost.RootComponent) || !bounds.IntersectsWith(rect))
     {
         glyphs.Insert(0, childGlyph);
     }
     return true;
 }
Example #4
0
 public void AddRange(GlyphCollection value)
 {
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     InnerList.AddRange(value);
 }
 private bool CheckDropDownBounds(ToolStripDropDownItem dropDownItem, Glyph childGlyph, GlyphCollection glyphs)
 {
     if (dropDownItem == null)
     {
         return false;
     }
     Rectangle bounds = childGlyph.Bounds;
     Rectangle rect = base.BehaviorService.ControlRectInAdornerWindow(dropDownItem.DropDown);
     if (!bounds.IntersectsWith(rect))
     {
         glyphs.Insert(0, childGlyph);
     }
     return true;
 }
 internal GlyphCollection GetGlyphs(ToolStrip parent, GlyphCollection glyphs, System.Windows.Forms.Design.Behavior.Behavior standardBehavior)
 {
     if (this.b == null)
     {
         this.b = (BehaviorService) parent.Site.GetService(typeof(BehaviorService));
     }
     Point pos = this.b.ControlToAdornerWindow(base.Parent);
     Rectangle bounds = this.Bounds;
     bounds.Offset(pos);
     bounds.Inflate(-2, -2);
     glyphs.Add(new MiniLockedBorderGlyph(bounds, SelectionBorderGlyphType.Top, standardBehavior, true));
     glyphs.Add(new MiniLockedBorderGlyph(bounds, SelectionBorderGlyphType.Bottom, standardBehavior, true));
     glyphs.Add(new MiniLockedBorderGlyph(bounds, SelectionBorderGlyphType.Left, standardBehavior, true));
     glyphs.Add(new MiniLockedBorderGlyph(bounds, SelectionBorderGlyphType.Right, standardBehavior, true));
     return glyphs;
 }
 private void AddSelectionGlyphs(SelectionManager selMgr, ISelectionService selectionService)
 {
     ICollection selectedComponents = selectionService.GetSelectedComponents();
     GlyphCollection glyphs = new GlyphCollection();
     foreach (object obj2 in selectedComponents)
     {
         ToolStripItem component = obj2 as ToolStripItem;
         if (component != null)
         {
             ToolStripItemDesigner designer = (ToolStripItemDesigner) this.host.GetDesigner(component);
             if (designer != null)
             {
                 designer.GetGlyphs(ref glyphs, new ResizeBehavior(component.Site));
             }
         }
     }
     if (glyphs.Count > 0)
     {
         selMgr.SelectionGlyphAdorner.Glyphs.AddRange(glyphs);
     }
 }
        private void AddControlGlyphs(Control c, GlyphSelectionType selType)
        {
            ControlDesigner designer = (ControlDesigner)this.componentToDesigner[c];

            if (designer != null)
            {
                ControlBodyGlyph controlGlyphInternal = designer.GetControlGlyphInternal(selType);
                if (controlGlyphInternal != null)
                {
                    this.bodyAdorner.Glyphs.Add(controlGlyphInternal);
                    if ((selType == GlyphSelectionType.SelectedPrimary) || (selType == GlyphSelectionType.Selected))
                    {
                        if (this.curSelectionBounds[this.curCompIndex] == Rectangle.Empty)
                        {
                            this.curSelectionBounds[this.curCompIndex] = controlGlyphInternal.Bounds;
                        }
                        else
                        {
                            this.curSelectionBounds[this.curCompIndex] = Rectangle.Union(this.curSelectionBounds[this.curCompIndex], controlGlyphInternal.Bounds);
                        }
                    }
                }
                GlyphCollection glyphs = designer.GetGlyphs(selType);
                if (glyphs != null)
                {
                    this.selectionAdorner.Glyphs.AddRange(glyphs);
                    if ((selType == GlyphSelectionType.SelectedPrimary) || (selType == GlyphSelectionType.Selected))
                    {
                        foreach (Glyph glyph2 in glyphs)
                        {
                            this.curSelectionBounds[this.curCompIndex] = Rectangle.Union(this.curSelectionBounds[this.curCompIndex], glyph2.Bounds);
                        }
                    }
                }
            }
            if ((selType == GlyphSelectionType.SelectedPrimary) || (selType == GlyphSelectionType.Selected))
            {
                this.curCompIndex++;
            }
        }
 public override GlyphCollection GetGlyphs(GlyphSelectionType selType)
 {
     GlyphCollection glyphs = new GlyphCollection();
     foreach (object obj2 in this.SelectionService.GetSelectedComponents())
     {
         if (obj2 is System.Windows.Forms.ToolStrip)
         {
             GlyphCollection glyphs2 = base.GetGlyphs(selType);
             glyphs.AddRange(glyphs2);
         }
         else
         {
             ToolStripItem component = obj2 as ToolStripItem;
             if ((component != null) && component.Visible)
             {
                 ToolStripItemDesigner designer = (ToolStripItemDesigner) this.host.GetDesigner(component);
                 if (designer != null)
                 {
                     designer.GetGlyphs(ref glyphs, this.StandardBehavior);
                 }
             }
         }
     }
     if ((((this.SelectionRules & SelectionRules.Moveable) != SelectionRules.None) && (this.InheritanceAttribute != System.ComponentModel.InheritanceAttribute.InheritedReadOnly)) && (selType != GlyphSelectionType.NotSelected))
     {
         Point location = base.BehaviorService.ControlToAdornerWindow((Control) base.Component);
         Rectangle containerBounds = new Rectangle(location, ((Control) base.Component).Size);
         int glyphOffset = (int) (DesignerUtils.CONTAINERGRABHANDLESIZE * 0.5);
         if (containerBounds.Width < (2 * DesignerUtils.CONTAINERGRABHANDLESIZE))
         {
             glyphOffset = -1 * glyphOffset;
         }
         ContainerSelectorBehavior behavior = new ContainerSelectorBehavior(this.ToolStrip, base.Component.Site, true);
         ContainerSelectorGlyph glyph = new ContainerSelectorGlyph(containerBounds, DesignerUtils.CONTAINERGRABHANDLESIZE, glyphOffset, behavior);
         glyphs.Insert(0, glyph);
     }
     return glyphs;
 }
 public void GetGlyphs(ref GlyphCollection glyphs, System.Windows.Forms.Design.Behavior.Behavior standardBehavior)
 {
     if (this.ImmediateParent != null)
     {
         Rectangle glyphBounds = this.GetGlyphBounds();
         ToolStripDesignerUtils.GetAdjustedBounds(this.ToolStripItem, ref glyphBounds);
         BehaviorService service = (BehaviorService) this.GetService(typeof(BehaviorService));
         if (service.ControlRectInAdornerWindow((Control) this.ImmediateParent).Contains(glyphBounds.Left, glyphBounds.Top))
         {
             if (this.ToolStripItem.IsOnDropDown)
             {
                 ToolStrip currentParent = this.ToolStripItem.GetCurrentParent();
                 if (currentParent == null)
                 {
                     currentParent = this.ToolStripItem.Owner;
                 }
                 if ((currentParent != null) && currentParent.Visible)
                 {
                     glyphs.Add(new MiniLockedBorderGlyph(glyphBounds, SelectionBorderGlyphType.Top, standardBehavior, true));
                     glyphs.Add(new MiniLockedBorderGlyph(glyphBounds, SelectionBorderGlyphType.Bottom, standardBehavior, true));
                     glyphs.Add(new MiniLockedBorderGlyph(glyphBounds, SelectionBorderGlyphType.Left, standardBehavior, true));
                     glyphs.Add(new MiniLockedBorderGlyph(glyphBounds, SelectionBorderGlyphType.Right, standardBehavior, true));
                 }
             }
             else
             {
                 glyphs.Add(new MiniLockedBorderGlyph(glyphBounds, SelectionBorderGlyphType.Top, standardBehavior, true));
                 glyphs.Add(new MiniLockedBorderGlyph(glyphBounds, SelectionBorderGlyphType.Bottom, standardBehavior, true));
                 glyphs.Add(new MiniLockedBorderGlyph(glyphBounds, SelectionBorderGlyphType.Left, standardBehavior, true));
                 glyphs.Add(new MiniLockedBorderGlyph(glyphBounds, SelectionBorderGlyphType.Right, standardBehavior, true));
             }
         }
     }
 }
Example #11
0
		public void AddRange (GlyphCollection value)
		{
			if (value == null)
				throw new ArgumentNullException ("value");
			InnerList.AddRange (value);
		}
 public GlyphCollection(GlyphCollection value)
 {
     this.AddRange(value);
 }
 public GlyphCollection GetGlyphsForComponent(IComponent comp)
 {
     GlyphCollection glyphs = new GlyphCollection();
     if (((this.behaviorSvc != null) && (comp != null)) && (this.behaviorSvc.DesignerActionUI != null))
     {
         Glyph designerActionGlyph = this.behaviorSvc.DesignerActionUI.GetDesignerActionGlyph(comp);
         if (designerActionGlyph != null)
         {
             glyphs.Add(designerActionGlyph);
         }
     }
     return glyphs;
 }
Example #14
0
        private readonly GlyphCollection _glyphs; //collection of Glyphs that this particular Adorner manages

        /// <summary>
        ///     Standard constructor.  Creates a new GlyphCollection and by default is enabled.
        /// </summary>
        public Adorner()
        {
            _glyphs         = new GlyphCollection();
            EnabledInternal = true;
        }
 public virtual GlyphCollection GetGlyphs(GlyphSelectionType selectionType)
 {
     GlyphCollection glyphs = new GlyphCollection();
     if (selectionType != GlyphSelectionType.NotSelected)
     {
         Rectangle controlBounds = this.BehaviorService.ControlRectInAdornerWindow(this.Control);
         bool primarySelection = selectionType == GlyphSelectionType.SelectedPrimary;
         System.Windows.Forms.Design.SelectionRules selectionRules = this.SelectionRules;
         if (this.Locked || (this.InheritanceAttribute == System.ComponentModel.InheritanceAttribute.InheritedReadOnly))
         {
             glyphs.Add(new LockedHandleGlyph(controlBounds, primarySelection));
             glyphs.Add(new LockedBorderGlyph(controlBounds, SelectionBorderGlyphType.Top));
             glyphs.Add(new LockedBorderGlyph(controlBounds, SelectionBorderGlyphType.Bottom));
             glyphs.Add(new LockedBorderGlyph(controlBounds, SelectionBorderGlyphType.Left));
             glyphs.Add(new LockedBorderGlyph(controlBounds, SelectionBorderGlyphType.Right));
             return glyphs;
         }
         if ((selectionRules & System.Windows.Forms.Design.SelectionRules.AllSizeable) == System.Windows.Forms.Design.SelectionRules.None)
         {
             glyphs.Add(new NoResizeHandleGlyph(controlBounds, selectionRules, primarySelection, this.MoveBehavior));
             glyphs.Add(new NoResizeSelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Top, this.MoveBehavior));
             glyphs.Add(new NoResizeSelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Bottom, this.MoveBehavior));
             glyphs.Add(new NoResizeSelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Left, this.MoveBehavior));
             glyphs.Add(new NoResizeSelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Right, this.MoveBehavior));
             if (TypeDescriptor.GetAttributes(base.Component).Contains(DesignTimeVisibleAttribute.Yes) && (this.behaviorService.DesignerActionUI != null))
             {
                 Glyph designerActionGlyph = this.behaviorService.DesignerActionUI.GetDesignerActionGlyph(base.Component);
                 if (designerActionGlyph != null)
                 {
                     glyphs.Insert(0, designerActionGlyph);
                 }
             }
             return glyphs;
         }
         if ((selectionRules & System.Windows.Forms.Design.SelectionRules.TopSizeable) != System.Windows.Forms.Design.SelectionRules.None)
         {
             glyphs.Add(new GrabHandleGlyph(controlBounds, GrabHandleGlyphType.MiddleTop, this.StandardBehavior, primarySelection));
             if ((selectionRules & System.Windows.Forms.Design.SelectionRules.LeftSizeable) != System.Windows.Forms.Design.SelectionRules.None)
             {
                 glyphs.Add(new GrabHandleGlyph(controlBounds, GrabHandleGlyphType.UpperLeft, this.StandardBehavior, primarySelection));
             }
             if ((selectionRules & System.Windows.Forms.Design.SelectionRules.RightSizeable) != System.Windows.Forms.Design.SelectionRules.None)
             {
                 glyphs.Add(new GrabHandleGlyph(controlBounds, GrabHandleGlyphType.UpperRight, this.StandardBehavior, primarySelection));
             }
         }
         if ((selectionRules & System.Windows.Forms.Design.SelectionRules.BottomSizeable) != System.Windows.Forms.Design.SelectionRules.None)
         {
             glyphs.Add(new GrabHandleGlyph(controlBounds, GrabHandleGlyphType.MiddleBottom, this.StandardBehavior, primarySelection));
             if ((selectionRules & System.Windows.Forms.Design.SelectionRules.LeftSizeable) != System.Windows.Forms.Design.SelectionRules.None)
             {
                 glyphs.Add(new GrabHandleGlyph(controlBounds, GrabHandleGlyphType.LowerLeft, this.StandardBehavior, primarySelection));
             }
             if ((selectionRules & System.Windows.Forms.Design.SelectionRules.RightSizeable) != System.Windows.Forms.Design.SelectionRules.None)
             {
                 glyphs.Add(new GrabHandleGlyph(controlBounds, GrabHandleGlyphType.LowerRight, this.StandardBehavior, primarySelection));
             }
         }
         if ((selectionRules & System.Windows.Forms.Design.SelectionRules.LeftSizeable) != System.Windows.Forms.Design.SelectionRules.None)
         {
             glyphs.Add(new GrabHandleGlyph(controlBounds, GrabHandleGlyphType.MiddleLeft, this.StandardBehavior, primarySelection));
         }
         if ((selectionRules & System.Windows.Forms.Design.SelectionRules.RightSizeable) != System.Windows.Forms.Design.SelectionRules.None)
         {
             glyphs.Add(new GrabHandleGlyph(controlBounds, GrabHandleGlyphType.MiddleRight, this.StandardBehavior, primarySelection));
         }
         glyphs.Add(new SelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Top, this.StandardBehavior));
         glyphs.Add(new SelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Bottom, this.StandardBehavior));
         glyphs.Add(new SelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Left, this.StandardBehavior));
         glyphs.Add(new SelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Right, this.StandardBehavior));
         if (TypeDescriptor.GetAttributes(base.Component).Contains(DesignTimeVisibleAttribute.Yes) && (this.behaviorService.DesignerActionUI != null))
         {
             Glyph glyph2 = this.behaviorService.DesignerActionUI.GetDesignerActionGlyph(base.Component);
             if (glyph2 != null)
             {
                 glyphs.Insert(0, glyph2);
             }
         }
     }
     return glyphs;
 }
 public GlyphCollection(GlyphCollection value)
 {
     this.AddRange(value);
 }
Example #17
0
 public GlyphCollection(GlyphCollection value)
 {
     throw null;
 }
 public override GlyphCollection GetGlyphs(GlyphSelectionType selectionType)
 {
     GlyphCollection glyphs = new GlyphCollection();
     if (selectionType != GlyphSelectionType.NotSelected)
     {
         Point location = base.BehaviorService.ControlToAdornerWindow((Control) base.Component);
         Rectangle controlBounds = new Rectangle(location, ((Control) base.Component).Size);
         bool primarySelection = selectionType == GlyphSelectionType.SelectedPrimary;
         bool flag2 = false;
         PropertyDescriptor descriptor = TypeDescriptor.GetProperties(base.Component)["Locked"];
         if (descriptor != null)
         {
             flag2 = (bool) descriptor.GetValue(base.Component);
         }
         bool flag3 = false;
         descriptor = TypeDescriptor.GetProperties(base.Component)["AutoSize"];
         if (descriptor != null)
         {
             flag3 = (bool) descriptor.GetValue(base.Component);
         }
         AutoSizeMode growOnly = AutoSizeMode.GrowOnly;
         descriptor = TypeDescriptor.GetProperties(base.Component)["AutoSizeMode"];
         if (descriptor != null)
         {
             growOnly = (AutoSizeMode) descriptor.GetValue(base.Component);
         }
         System.Windows.Forms.Design.SelectionRules selectionRules = this.SelectionRules;
         if (flag2)
         {
             glyphs.Add(new LockedHandleGlyph(controlBounds, primarySelection));
             glyphs.Add(new LockedBorderGlyph(controlBounds, SelectionBorderGlyphType.Top));
             glyphs.Add(new LockedBorderGlyph(controlBounds, SelectionBorderGlyphType.Bottom));
             glyphs.Add(new LockedBorderGlyph(controlBounds, SelectionBorderGlyphType.Left));
             glyphs.Add(new LockedBorderGlyph(controlBounds, SelectionBorderGlyphType.Right));
             return glyphs;
         }
         if ((flag3 && (growOnly == AutoSizeMode.GrowAndShrink)) && !(this.Control is Form))
         {
             glyphs.Add(new NoResizeHandleGlyph(controlBounds, selectionRules, primarySelection, null));
             glyphs.Add(new NoResizeSelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Top, null));
             glyphs.Add(new NoResizeSelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Bottom, null));
             glyphs.Add(new NoResizeSelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Left, null));
             glyphs.Add(new NoResizeSelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Right, null));
             return glyphs;
         }
         glyphs.Add(new GrabHandleGlyph(controlBounds, GrabHandleGlyphType.MiddleRight, this.StandardBehavior, primarySelection));
         glyphs.Add(new GrabHandleGlyph(controlBounds, GrabHandleGlyphType.LowerRight, this.StandardBehavior, primarySelection));
         glyphs.Add(new GrabHandleGlyph(controlBounds, GrabHandleGlyphType.MiddleBottom, this.StandardBehavior, primarySelection));
         glyphs.Add(new SelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Top, null));
         glyphs.Add(new SelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Bottom, this.StandardBehavior));
         glyphs.Add(new SelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Left, null));
         glyphs.Add(new SelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Right, this.StandardBehavior));
     }
     return glyphs;
 }
Example #19
0
 public void AddRange(GlyphCollection value)
 {
     throw null;
 }