public ControlBodyGlyph(Rectangle bounds, Cursor cursor, IComponent relatedComponent, ControlDesigner designer)
     : base(relatedComponent, new ControlDesigner.TransparentBehavior(designer))
 {
     this.bounds = bounds;
     this.hitTestCursor = cursor;
     this.component = relatedComponent;
 }
예제 #2
0
 public override bool CanParent(System.Windows.Forms.Design.ControlDesigner controlDesigner)
 {
     if (controlDesigner != null && controlDesigner.Control is System.Windows.Forms.Control)
     {
         return(true);
     }
     return(false);
 }
 public ToolboxItemSnapLineBehavior(IServiceProvider serviceProvider, BehaviorService behaviorService, ControlDesigner controlDesigner) : this(serviceProvider, behaviorService)
 {
     this.designer = controlDesigner;
     if ((controlDesigner != null) && !controlDesigner.ParticipatesWithSnapLines)
     {
         this.targetAllowsSnapLines = false;
     }
 }
 public ListControlBoundActionList(ControlDesigner owner) : base(owner.Component)
 {
     this._owner = owner;
     ListControl component = (ListControl) base.Component;
     if (component.DataSource != null)
     {
         this._boundMode = true;
     }
     this.uiService = base.GetService(typeof(DesignerActionUIService)) as DesignerActionUIService;
 }
 public ToolboxItemSnapLineBehavior(IServiceProvider serviceProvider, BehaviorService behaviorService)
 {
     this.serviceProvider = serviceProvider;
     this.behaviorService = behaviorService;
     this.designer = null;
     this.isPushed = false;
     this.lastRectangle = Rectangle.Empty;
     this.lastOffset = Point.Empty;
     this.statusCommandUI = new StatusCommandUI(serviceProvider);
     this.targetAllowsDragBox = true;
     this.targetAllowsSnapLines = true;
 }
예제 #6
0
        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));
        }
        protected Control GetControl(object component)
        {
            IComponent comp = component as IComponent;

            if (comp != null && comp.Site != null)
            {
                IDesignerHost host = comp.Site.GetService(typeof(IDesignerHost)) as IDesignerHost;
                if (host != null)
                {
                    ControlDesigner designer = host.GetDesigner(comp) as ControlDesigner;
                    if (designer != null)
                    {
                        return(designer.Control);
                    }
                }
            }
            return(null);
        }
 public virtual bool CanParent(ControlDesigner controlDesigner)
 {
     // TODO
     return(false);
 }
        /// <summary>
        /// Initializes the designer with the specified component.
        /// </summary>
        /// <param name="component">The <see cref="T:System.ComponentModel.IComponent"/> to associate the designer with. This component must always be an instance of, or derive from, <see cref="T:System.Windows.Forms.Control"/>. </param>
        public override void Initialize(IComponent component)
        {
            // Debug.WriteLine("ObjectListViewDesigner.Initialize");

            // Use reflection to bypass the "internal" marker on ListViewDesigner
            // If we can't get the unversioned designer, look specifically for .NET 4.0 version of it.
            Type tListViewDesigner = Type.GetType("System.Windows.Forms.Design.ListViewDesigner, System.Design") ??
                                     Type.GetType("System.Windows.Forms.Design.ListViewDesigner, System.Design, " +
                                                  "Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
            if (tListViewDesigner == null) throw new ArgumentException("Could not load ListViewDesigner");

            this.listViewDesigner = (ControlDesigner)Activator.CreateInstance(tListViewDesigner, BindingFlags.Instance | BindingFlags.Public, null, null, null);
            this.designerFilter = this.listViewDesigner;

            // Fetch the methods from the ListViewDesigner that we know we want to use
            this.listViewDesignGetHitTest = tListViewDesigner.GetMethod("GetHitTest", BindingFlags.Instance | BindingFlags.NonPublic);
            this.listViewDesignWndProc = tListViewDesigner.GetMethod("WndProc", BindingFlags.Instance | BindingFlags.NonPublic);

            Debug.Assert(this.listViewDesignGetHitTest != null, "Required method (GetHitTest) not found on ListViewDesigner");
            Debug.Assert(this.listViewDesignWndProc != null, "Required method (WndProc) not found on ListViewDesigner");

            // Tell the Designer to use properties of default designer as well as the properties of this class (do before base.Initialize)
            TypeDescriptor.CreateAssociation(component, this.listViewDesigner);

            IServiceContainer site = (IServiceContainer)component.Site;
            if (site != null && GetService(typeof(DesignerCommandSet)) == null) {
                site.AddService(typeof(DesignerCommandSet), new CDDesignerCommandSet(this));
            } else {
                Debug.Fail("site != null && GetService(typeof (DesignerCommandSet)) == null");
            }

            this.listViewDesigner.Initialize(component);
            base.Initialize(component);

            RemoveDuplicateDockingActionList();
        }
예제 #10
0
        /// <summary>
        ///  Serializes the given object into a CodeDom object.
        /// </summary>
        public override object Serialize(IDesignerSerializationManager manager, object value)
        {
            ArgumentNullException.ThrowIfNull(manager);
            ArgumentNullException.ThrowIfNull(value);

            // Find our base class's serializer.
            CodeDomSerializer serializer = (CodeDomSerializer)manager.GetSerializer(typeof(Component), typeof(CodeDomSerializer));

            if (serializer is null)
            {
                Debug.Fail("Unable to find a CodeDom serializer for 'Component'.  Has someone tampered with the serialization providers?");

                return(null);
            }

            // Now ask it to serializer
            object retVal = serializer.Serialize(manager, value);
            InheritanceAttribute inheritanceAttribute = (InheritanceAttribute)TypeDescriptor.GetAttributes(value)[typeof(InheritanceAttribute)];
            InheritanceLevel     inheritanceLevel     = InheritanceLevel.NotInherited;

            if (inheritanceAttribute != null)
            {
                inheritanceLevel = inheritanceAttribute.InheritanceLevel;
            }

            if (inheritanceLevel != InheritanceLevel.InheritedReadOnly)
            {
                // Next, see if we are in localization mode.  If we are, and if we can get
                // to a ResourceManager through the service provider, then emit the hierarchy information for
                // this object.  There is a small fragile assumption here:  The resource manager is demand
                // created, so if all of the properties of this control had default values it is possible
                // there will be no resource manager for us.  I'm letting that slip a bit, however, because
                // for Control classes, we always emit at least the location / size information for the
                // control.
                IDesignerHost host = (IDesignerHost)manager.GetService(typeof(IDesignerHost));

                if (host != null)
                {
                    PropertyDescriptor prop = TypeDescriptor.GetProperties(host.RootComponent)["Localizable"];

                    if (prop != null && prop.PropertyType == typeof(bool) && ((bool)prop.GetValue(host.RootComponent)))
                    {
                        SerializeControlHierarchy(manager, host, value);
                    }
                }

                CodeStatementCollection csCollection = retVal as CodeStatementCollection;

                if (csCollection != null)
                {
                    Control control = (Control)value;

                    // Serialize a suspend / resume pair.  We always serialize this
                    // for the root component
                    if ((host != null && control == host.RootComponent) || HasSitedNonReadonlyChildren(control))
                    {
                        SerializeSuspendLayout(manager, csCollection, value);
                        SerializeResumeLayout(manager, csCollection, value);
                        ControlDesigner controlDesigner = host.GetDesigner(control) as ControlDesigner;

                        if (HasAutoSizedChildren(control) || (controlDesigner != null && controlDesigner.SerializePerformLayout))
                        {
                            SerializePerformLayout(manager, csCollection, value);
                        }
                    }

                    // And now serialize the correct z-order relationships for the controls.  We only need to
                    // do this if there are controls in the collection that are inherited.
                    if (HasMixedInheritedChildren(control))
                    {
                        SerializeZOrder(manager, csCollection, control);
                    }
                }
            }

            return(retVal);
        }
 public DesignerWindowTarget(ControlDesigner designer)
 {
     Control control = designer.Control;
     this.designer = designer;
     this.oldTarget = control.WindowTarget;
     control.WindowTarget = this;
 }
 public DockingActionList(ControlDesigner owner)
     : base(owner.Component)
 {
     this._designer = owner;
     this._host = base.GetService(typeof(IDesignerHost)) as IDesignerHost;
 }
 public virtual bool CanParent(ControlDesigner controlDesigner)
 {
     return(CanParent(controlDesigner.Control));
 }
예제 #14
0
 public override bool CanParent(ControlDesigner controlDesigner)
 {
     return controlDesigner is WizardPageDesigner;
 }
 public void Dispose() => _designer = null;
		public override bool CanParent(ControlDesigner controlDesigner)
		{
			return base.CanParent(controlDesigner);
		}
 private bool AddControlSnaplinesWhenResizing(ControlDesigner designer, Control control, Control targetControl)
 {
     if (((this.resizing && (designer is ParentControlDesigner)) && (control.AutoSize && (targetControl != null))) && ((targetControl.Parent != null) && targetControl.Parent.Equals(control)))
     {
         return false;
     }
     return true;
 }
예제 #18
0
 public ControlDesignerAccessibleObject(ControlDesigner designer, Control control)
 {
     throw new NotImplementedException();
 }
예제 #19
0
 public ControlDesignerAccessibleObject(ControlDesigner designer, Control control)
 {
     throw null;
 }
예제 #20
0
 public ControlDesignerAccessibleObject(ControlDesigner designer, Control control)
 {
     // TODO
 }
예제 #21
0
 /// <summary>
 ///  Constructor that accepts the related ControlDesigner.
 /// </summary>
 internal TransparentBehavior(ControlDesigner designer) => _designer = designer;
 public virtual bool CanParent(ControlDesigner controlDesigner)
 {
     return this.CanParent(controlDesigner.Control);
 }
 internal TransparentBehavior(ControlDesigner designer)
 {
     this.designer = designer;
 }
		public ControlDesignerAccessibleObject(ControlDesigner designer, Control control)
				{
					// TODO
				}
 public void Dispose()
 {
     this.designer = null;
 }
 private void AddSnapLines(ControlDesigner controlDesigner, ArrayList horizontalList, ArrayList verticalList, bool isTarget, bool validTarget)
 {
     IList snapLines = controlDesigner.SnapLines;
     Rectangle clientRectangle = controlDesigner.Control.ClientRectangle;
     Rectangle bounds = controlDesigner.Control.Bounds;
     bounds.Location = clientRectangle.Location = this.behaviorService.ControlToAdornerWindow(controlDesigner.Control);
     int left = bounds.Left;
     int top = bounds.Top;
     Point offsetToClientArea = controlDesigner.GetOffsetToClientArea();
     clientRectangle.X += offsetToClientArea.X;
     clientRectangle.Y += offsetToClientArea.Y;
     foreach (SnapLine line in snapLines)
     {
         if (isTarget)
         {
             if ((line.Filter != null) && line.Filter.StartsWith("Padding"))
             {
                 continue;
             }
             if (validTarget && !this.targetSnapLineTypes.Contains(line.SnapLineType))
             {
                 this.targetSnapLineTypes.Add(line.SnapLineType);
             }
         }
         else
         {
             if (validTarget && !this.targetSnapLineTypes.Contains(line.SnapLineType))
             {
                 continue;
             }
             if ((line.Filter != null) && line.Filter.StartsWith("Padding"))
             {
                 this.snapLineToBounds.Add(line, clientRectangle);
             }
             else
             {
                 this.snapLineToBounds.Add(line, bounds);
             }
         }
         if (line.IsHorizontal)
         {
             line.AdjustOffset(top);
             horizontalList.Add(line);
         }
         else
         {
             line.AdjustOffset(left);
             verticalList.Add(line);
         }
     }
 }
예제 #27
0
		public virtual bool CanParent (ControlDesigner designer)
		{
			return CanParent (designer.Control);
		}
예제 #28
0
			public ControlDesignerAccessibleObject (ControlDesigner designer, Control control)
			{
				throw new NotImplementedException ();
			}
예제 #29
0
 public override bool CanParent(ControlDesigner controlDesigner)
 {
     if (controlDesigner is MultiPanelPageDesigner)
         return true;
     return false;
 }
 public ControlDesignerAccessibleObject(ControlDesigner designer, Control control)
 {
     _designer = designer;
     _control  = control;
 }
 public ToolboxItemSnapLineBehavior(IServiceProvider serviceProvider, BehaviorService behaviorService, ControlDesigner controlDesigner, bool allowDragBox)
     : this(serviceProvider, behaviorService, controlDesigner)
 {
     this.designer = controlDesigner;
     this.targetAllowsDragBox = allowDragBox;
 }
 public ControlDesignerAccessibleObject(ControlDesigner designer, Control control)
 {
     this.designer = designer;
     this.control = control;
 }
 public DockingActionList(ControlDesigner owner) : base(owner.Component)
 {
     _designer = owner;
     _host     = GetService(typeof(IDesignerHost)) as IDesignerHost;
 }
 public ChildSubClass(ControlDesigner designer, IntPtr hwnd)
 {
     this.designer = designer;
     if (designer != null)
     {
         designer.disposingHandler += new EventHandler(this.OnDesignerDisposing);
     }
     base.AssignHandle(hwnd);
 }
 internal DropDownBehavior(ControlDesigner designer, ToolStripMenuItemDesigner menuItemDesigner) : base(designer)
 {
     this.menuItemDesigner = menuItemDesigner;
 }
 public ChildWindowTarget(ControlDesigner designer, Control childControl, IWindowTarget oldWindowTarget)
 {
     this.designer = designer;
     this.childControl = childControl;
     this.oldWindowTarget = oldWindowTarget;
 }
 public ChildWindowTarget(ControlDesigner designer, Control childControl, IWindowTarget oldWindowTarget)
 {
     _designer       = designer;
     _childControl   = childControl;
     OldWindowTarget = oldWindowTarget;
 }
 public void Dispose()
 {
     if (this.designer != null)
     {
         this.designer.Control.WindowTarget = this.oldTarget;
         this.designer = null;
     }
 }
예제 #39
0
 public virtual bool CanParent(ControlDesigner controlDesigner)
 {
     throw null;
 }
예제 #40
0
		public override bool CanParent(ControlDesigner controlDesigner)
		{
			if (controlDesigner is WizardPageDesigner)
				return true;
			return false;
		}
	public virtual bool CanParent(ControlDesigner controlDesigner)
			{
				// TODO
				return false;
			}