public void AddRange(ConnectorCollection collection)
 {
     this.InnerList.AddRange(collection);
 }
        /// <summary>
        /// Default constructor for the class
        /// </summary>
        /// <remarks>
        ///	Parametrem by se mohlo predavat jmeno vystupniho konektoru.
        /// Problem bude s resenim vystupniho konenktoru, pro ktery vlastne 
        /// neni socket ale pozaduje SVG (bud kreslit natvrdo, nebo udelat
        /// v IBoxModule pro to nejaky zvlastni socket
        /// </remarks>
        /// <param name="site">Interface of a graph site (control)
        /// </param>
        /// <param name="box">Box that is connected with this node</param>
        /// <param name="resM">Resource manager of the application</param>
        /// <param name="svgman">Provider of svg images</param>
        /// <param name="view">View where this box is located</param>
        public BoxNode(IGraphSite site, ModulesManager.IBoxModule box, 
            SVGManager svgman, ProjectManager.View view, ResourceManager resM)
            : base(site)
        {
            FerdaConstants constants = new FerdaConstants();

            //filling the node
            this.box = box;
            this.svgManager = svgman;
            this.ResManager = resM;

            //determining the size
            Rectangle = new RectangleF(0, 0, constants.KrabickaWidth, constants.KrabickaHeight);

            //adding the output connector
            //it is not a FerdaConnector, because the box has no socket defined
            outputConnector = new Connector(this, ResManager.GetString("PropertiesOutputConnector"), true);
            Connectors.Add(outputConnector);
            outputConnector.ConnectorLocation = ConnectorLocations.East;

            //adding the input connectors
            inputConnectors = new ConnectorCollection();
            for (int i = 0; i < box.Sockets.Length; i++)
            {
                bool packed = view.IsAnyBoxPackedIn(box, box.Sockets[i].name);

                inputConnectors.Add(
                    new FerdaConnector(this, svgManager, box.Sockets[i], packed));
                Connectors.Add(inputConnectors[i]);
                inputConnectors[i].ConnectorLocation = ConnectorLocations.West;
            }

            //getting the bitmap
            bitmap = svgManager.GetBoxBitmap(box);

            //setting the view
            this.view = view;

            //adding the moving handler
            OnMouseDown += new MouseEventHandler(BoxNode_OnMouseDown);
            OnMouseUp += new MouseEventHandler(BoxNode_OnMouseUp);

            Resizable = false;
            this.Text = box.UserName;

            //using a smaller font - we have big labels
            mFont = new Font(mFontFamily, 7, FontStyle.Regular, GraphicsUnit.Point);
        }
예제 #3
0
 /// <summary>
 /// Adds a range to the collection
 /// </summary>
 /// <param name="collection"></param>
 public void AddRange(ConnectorCollection collection)
 {
     this.InnerList.AddRange(collection);
 }