コード例 #1
0
ファイル: GuiConnection.cs プロジェクト: presscad/BaseLayer
        // registers connection in StaticView structures:
        public void ConnectionCreated(StaticView parent_view, string role1, string role2, string name, string stereo)
        {
            //  1. register connection ipoints in objects
            first.item.add_connection_point(first);
            second.item.add_connection_point(second);
            //  2. create ID for connection
            id = parent_view.RegisterItemID(type.ToString(), this);
            //  3. create default roles
            first.role  = create_label(role1 != null ? role1 : "Left", -1, 0f, first.hyphen_dir, 0, role1 == null);
            second.role = create_label(role2 != null ? role2 : "Right", -second.number_in_conn - 1, 0f, second.hyphen_dir, 0, role2 == null);
            conn_name   = create_label(name != null ? name : "Name", Int32.MaxValue, 0f, Geometry.Direction.Null, 0, name == null);
            conn_stereo = new GuiBoundStereotype(stereo != null ? stereo : "Usage", this, 0, -15, Int32.MaxValue, 0f, stereo == null);
            //  4. register children, make them drawable and serializable
            add_child(first, "LeftPoint");
            add_child(second, "RightPoint");
            add_child(first.role, "Role 1");
            add_child(second.role, "Role 2");
            add_child(conn_name, "Name");
            add_child(conn_stereo, "Stereotype");

            for (int i = 1; i < ipoints.Count - 1; i++)
            {
                add_child(ipoints[i] as GuiBound, null);
            }

            //  5. Redraw
            created = true;
            invalidate_children();
            Invalidate();
        }
コード例 #2
0
ファイル: GuiConnection.cs プロジェクト: presscad/BaseLayer
        public override void PostLoad()
        {
            base.PostLoad();
            first  = find_child("LeftPoint") as GuiConnectionPoint;
            second = find_child("RightPoint") as GuiConnectionPoint;
            first.UpdatePosition(true);
            second.UpdatePosition(true);
            first.role  = find_child("Role 1") as GuiBoundString;
            second.role = find_child("Role 2") as GuiBoundString;
            conn_name   = find_child("Name") as GuiBoundString;
            conn_stereo = find_child("Stereotype") as GuiBoundStereotype;
            ipoints.Add(first);
            for (int i = 1; i < loadtime_iterm_count - 1; i++)
            {
                ipoints.Add(find_child("Point #" + i));
            }
            ipoints.Add(second);
            created = true;

            notify_children();
        }