/// <summary>
 /// Initializes a new instance of the <see cref="T:TextLabel"/> class.
 /// </summary>
 public TextLabel()
     : base()
 {
     PaintStyle = ArtPallet.GetDefaultSolidPaintStyle();
      Resizable = false;
      connector = new Connector(new Point((int)(Rectangle.Left + Rectangle.Width / 2), Rectangle.Bottom), Model);
      connector.Name = "Central connector";
      connector.Parent = this;
      Connectors.Add(connector);
 }
Example #2
0
    // -----------------------------------------------------------------
    /// <summary>
    /// Initializes this instance.
    /// </summary>
    // -----------------------------------------------------------------
    protected override void Initialize() {
      base.Initialize();

      PaintStyle = ArtPalette.GetDefaultSolidPaintStyle();
      Resizable = false;
      connector = new Connector(new Point((int)(Rectangle.Left + Rectangle.Width / 2), Rectangle.Bottom), Model);
      connector.Name = "Central connector";
      connector.Parent = this;
      Connectors.Add(connector);
    }
Example #3
0
        /// <summary>
        /// Initializes this instance.
        /// </summary>
        private void Init(string text, Image icon)
        {
            // calculate the text length to adjust the size of rectangle
            SizeF size = TextRenderer.MeasureText(text, ArtPallet.DefaultFont);
            Rectangle r = new Rectangle(Rectangle.Location, Size.Round(Size.Add(size.ToSize(), new Size(icon.Width, icon.Height + 10))));
            this.Transform(r);

            cTop = new Connector(new Point(Rectangle.Left + Rectangle.Width / 2, Rectangle.Top), Model)
                       {
                           Name = "Top connector",
                           Parent = this
                       };
            Connectors.Add(cTop);

            cRight = new Connector(new Point(Rectangle.Right, Rectangle.Top + Rectangle.Height / 2), Model)
                         {
                             Name = "Right connector",
                             Parent = this
                         };
            Connectors.Add(cRight);

            cBottom = new Connector(new Point(Rectangle.Left + Rectangle.Width / 2, Rectangle.Bottom), Model)
                          {
                              Name = "Bottom connector",
                              Parent = this
                          };
            Connectors.Add(cBottom);

            cLeft = new Connector(new Point(Rectangle.Left, Rectangle.Top + Rectangle.Height / 2), Model)
                        {
                            Name = "Left connector",
                            Parent = this
                        };
            Connectors.Add(cLeft);

            ImageLabelMaterial ilab = new ImageLabelMaterial(text, icon) {Gliding = true, Resizable = false};
            // new Rectangle(Rectangle.X + 10, Rectangle.Y + 10, Rectangle.Width + 50, Rectangle.Height - 30)
            r.Inflate(-10, -5);
            ilab.Transform(r);
            Children.Add(ilab);

            Resizable = true;
        }
Example #4
0
        private void Initialize()
        {
            busConnector = new Connector(new Point((int)(Rectangle.Left + Rectangle.Width / 2),Rectangle.Bottom), Model);
            busConnector.Name = "Bus";
            Connectors.Add(busConnector);

            foreach(IConnector con in Connectors)
            {
                con.Parent = this;
            }

            AutoSize = false;
            Width = 20;
            Height = 20;
            Resizable = false;
            Text = sysRef.Index.ToString();

            PaintStyle = new GradientPaintStyle(Color.DarkGreen, Color.Yellow, -135);
        }
Example #5
0
        private void Initialize()
        {
            outConnector = new Connector(new Point(Rectangle.Right, (int)(Rectangle.Top + Rectangle.Height / 2)), Model);
            outConnector.Name = "Output";
            Connectors.Add(outConnector);

            inConnector = new Connector(new Point(Rectangle.Left, (int)(Rectangle.Top + Rectangle.Height / 2)), Model);
            inConnector.Name = "Input";
            Connectors.Add(inConnector);

            foreach(IConnector con in Connectors)
            {
                con.Parent = this;
            }

            AutoSize = false;
            Width = 20;
            Height = 20;
            Resizable = false;
            Text = sysRef.Index.ToString();

            PaintStyle = new GradientPaintStyle(Color.OrangeRed, Color.Yellow, -135);
        }
        /// <summary>
        /// Adds the connectors.
        /// </summary>
        public void AddConnectors()
        {
            //the initial size
            Transform(0, 0, 200, 50);
            #region Connectors
            cTop = new Connector(new Point((int) (Rectangle.Left + Rectangle.Width / 2), Rectangle.Top), Model);
            cTop.Name = "Top connector";
            cTop.Parent = this;
            Connectors.Add(cTop);

            cRight = new Connector(new Point(Rectangle.Right, (int) (Rectangle.Top + Rectangle.Height / 2)), Model);
            cRight.Name = "Right connector";
            cRight.Parent = this;
            Connectors.Add(cRight);

            cBottom = new Connector(new Point((int) (Rectangle.Left + Rectangle.Width / 2), Rectangle.Bottom), Model);
            cBottom.Name = "Bottom connector";
            cBottom.Parent = this;
            Connectors.Add(cBottom);

            cLeft = new Connector(new Point(Rectangle.Left, (int) (Rectangle.Top + Rectangle.Height / 2)), Model);
            cLeft.Name = "Left connector";
            cLeft.Parent = this;
            Connectors.Add(cLeft);
            #endregion
        }
Example #7
0
 private IConnector CreateConnector(string connectorName, Point location) {
   Connector connector = new Connector(location, this.Model);
   connector.ConnectorStyle = ConnectorStyle.Square;
   connector.Parent = this;
   connector.Name = connectorName;
   return connector;
 }
        /// <summary>
        /// Initializes this instance.
        /// </summary>
        private void Init()
        {
            cTop = new Connector(new Point((int) (Rectangle.Left + Rectangle.Width / 2), Rectangle.Top), Model);
             cTop.Name = "Top connector";
             cTop.Parent = this;
             Connectors.Add(cTop);

             cRight = new Connector(new Point(Rectangle.Right, (int) (Rectangle.Top + Rectangle.Height / 2)), Model);
             cRight.Name = "Right connector";
             cRight.Parent = this;
             Connectors.Add(cRight);

             cBottom = new Connector(new Point((int)(Rectangle.Left + Rectangle.Width / 2), Rectangle.Bottom), Model);
             cBottom.Name = "Bottom connector";
             cBottom.Parent = this;
             Connectors.Add(cBottom);

             cLeft = new Connector(new Point(Rectangle.Left, (int)(Rectangle.Top + Rectangle.Height / 2)), Model);
             cLeft.Name = "Left connector";
             cLeft.Parent = this;
             Connectors.Add(cLeft);

             #region Some examples of materials; feel free to add/remove what you wish
             /*
             ClickableIconMaterial cicon = new ClickableIconMaterial("Resources.Schema.ico");
             cicon.Resizable = false;
             cicon.Gliding = false;
             cicon.Transform(new Rectangle(Rectangle.X + 10, Rectangle.Y + 10, 16, 16));
             Children.Add(cicon);
              */
             /*
             SwitchIconMaterial xicon = new SwitchIconMaterial(SwitchIconType.PlusMinus);
             xicon.Gliding = false;
             xicon.Resizable = false;
             xicon.Transform(new Rectangle(Rectangle.X + 10, Rectangle.Y + 10, 16, 16));
             Children.Add(xicon);
             */
             /*
             IconLabelMaterial ilab = new IconLabelMaterial("Resources.PublicMethod.ico", "ISerializable.GetObjectData");
             ilab.Gliding = false;
             ilab.Resizable = false;
             ilab.Transform(new Rectangle(Rectangle.X + 10, Rectangle.Y + 10, Rectangle.Width - 20, Rectangle.Height - 30));
             Children.Add(ilab);
             */
             /*
             IconMaterial icon = new IconMaterial("Resources.Web.png");
             icon.Resizable = false;
             icon.Gliding = false;
             if(icon.Icon!=null)
                icon.Transform(new Rectangle(Rectangle.X + 10, Rectangle.Y + 10, icon.Icon.Width , icon.Icon.Height));
            Children.Add(icon);
             */
             /*
             LabelMaterial label = new LabelMaterial();
             label.Text = "Complex rectangle example";
             label.Transform( new Rectangle(Rectangle.X + 10, Rectangle.Y + 10, Rectangle.Width - 20, Rectangle.Height-30));
             this.Children.Add(label);
              */

             string[] stuff = new string[]{"Wagner", "van Beethoven", "Sibelius", "Lutovski", "Haydn", "Prokofiev", "Karduso"};
             FolderMaterial folder = new FolderMaterial("Expand me!", stuff);
             folder.Transform(new Rectangle(Rectangle.X + 10, Rectangle.Y + 10, Rectangle.Width - 20, Rectangle.Height - 30));
             folder.OnFolderChanged += new EventHandler<RectangleEventArgs>(folder_OnFolderChanged);
             this.Children.Add(folder);

             #endregion
             Resizable = true;

             Services[typeof(IAdditionCallback)] = this;
        }
        private void Addconnectors()
        {
            cBottom = new Connector(new Point((int)(Rectangle.Left + Rectangle.Width / 2), Rectangle.Bottom), Model);
             cBottom.Name = "Bottom connector";
             cBottom.Parent = this;
             Connectors.Add(cBottom);

             cLeft = new Connector(new Point(Rectangle.Left, (int)(Rectangle.Top + Rectangle.Height / 2)), Model);
             cLeft.Name = "Left connector";
             cLeft.Parent = this;
             Connectors.Add(cLeft);

             cRight = new Connector(new Point(Rectangle.Right, (int)(Rectangle.Top + Rectangle.Height / 2)), Model);
             cRight.Name = "Right connector";
             cRight.Parent = this;
             Connectors.Add(cRight);

             cTop = new Connector(new Point((int)(Rectangle.Left + Rectangle.Width / 2), Rectangle.Top), Model);
             cTop.Name = "Top connector";
             cTop.Parent = this;
             Connectors.Add(cTop);
        }
        // -----------------------------------------------------------------
        /// <summary>
        /// Initializes this instance.
        /// </summary>
        // -----------------------------------------------------------------
        protected override void Initialize()
        {
            base.Initialize();
            cTop        = new Connector(new Point((int)(Rectangle.Left + Rectangle.Width / 2), Rectangle.Top), Model);
            cTop.Name   = "Top connector";
            cTop.Parent = this;
            Connectors.Add(cTop);

            cRight        = new Connector(new Point(Rectangle.Right, (int)(Rectangle.Top + Rectangle.Height / 2)), Model);
            cRight.Name   = "Right connector";
            cRight.Parent = this;
            Connectors.Add(cRight);

            cBottom        = new Connector(new Point((int)(Rectangle.Left + Rectangle.Width / 2), Rectangle.Bottom), Model);
            cBottom.Name   = "Bottom connector";
            cBottom.Parent = this;
            Connectors.Add(cBottom);

            cLeft        = new Connector(new Point(Rectangle.Left, (int)(Rectangle.Top + Rectangle.Height / 2)), Model);
            cLeft.Name   = "Left connector";
            cLeft.Parent = this;
            Connectors.Add(cLeft);

            #region Some examples of materials; feel free to add/remove what you wish

            /*
             * ClickableIconMaterial cicon = new ClickableIconMaterial("Resources.Schema.ico");
             * cicon.Resizable = false;
             * cicon.Gliding = false;
             * cicon.Transform(new Rectangle(Rectangle.X + 10, Rectangle.Y + 10, 16, 16));
             * Children.Add(cicon);
             */
            /*
             * SwitchIconMaterial xicon = new SwitchIconMaterial(SwitchIconType.PlusMinus);
             * xicon.Gliding = false;
             * xicon.Resizable = false;
             * xicon.Transform(new Rectangle(Rectangle.X + 10, Rectangle.Y + 10, 16, 16));
             * Children.Add(xicon);
             */
            /*
             * IconLabelMaterial ilab = new IconLabelMaterial("Resources.PublicMethod.ico", "ISerializable.GetObjectData");
             * ilab.Gliding = false;
             * ilab.Resizable = false;
             * ilab.Transform(new Rectangle(Rectangle.X + 10, Rectangle.Y + 10, Rectangle.Width - 20, Rectangle.Height - 30));
             * Children.Add(ilab);
             */
            /*
             * IconMaterial icon = new IconMaterial("Resources.Web.png");
             * icon.Resizable = false;
             * icon.Gliding = false;
             * if(icon.Icon!=null)
             * icon.Transform(new Rectangle(Rectangle.X + 10, Rectangle.Y + 10, icon.Icon.Width , icon.Icon.Height));
             * Children.Add(icon);
             */
            /*
             * LabelMaterial label = new LabelMaterial();
             * label.Text = "Complex rectangle example";
             * label.Transform( new Rectangle(Rectangle.X + 10, Rectangle.Y + 10, Rectangle.Width - 20, Rectangle.Height-30));
             * this.Children.Add(label);
             */

            string[] stuff = new string[] {
                "Wagner",
                "van Beethoven",
                "Sibelius",
                "Lutovski",
                "Haydn",
                "Prokofiev",
                "Karduso"
            };

            FolderMaterial folder = new FolderMaterial("Expand me!", stuff);
            folder.Transform(
                new Rectangle(
                    Rectangle.X + 10,
                    Rectangle.Y + 10,
                    Rectangle.Width - 20,
                    Rectangle.Height - 30));

            folder.OnFolderChanged +=
                new EventHandler <RectangleEventArgs>(folder_OnFolderChanged);
            this.Children.Add(folder);

            #endregion
            Resizable = true;

            Services[typeof(IAdditionCallback)] = this;
        }
Example #11
0
 private void SyncConnectors(int count, List<Connector> list, string prefix)
 {
     if(count > list.Count)
         for(int i = list.Count; i < count; i++)
         {
             Connector c = new Connector(Model);
             c.Name = prefix + i.ToString();
             list.Add(c);
             Connectors.Add(c);
         }
     else if(count < list.Count)
         for(int i = list.Count - 1; i > count; i--)
         {
             Connector c = list[i];
             Connectors.Remove(c);
             list.RemoveAt(i);
         }
 }