コード例 #1
0
        public override string GetLabel(object forObject, out FontStyle fontStyle)
        {
            fontStyle = FontStyle.Bold;
            UrhoBackend.Node nd      = ((UrhoBackend.Node)forObject);
            string           netType = "";

            if (nd.GetID() >= 0x1000000)
            {
                netType = "Local ";
            }
            string name = "Node";

            if (!String.IsNullOrWhiteSpace(nd.GetName()))
            {
                name = nd.GetName();
            }
            return(String.Format("{0} ({1}{2})", name, netType, nd.GetID()));
        }
コード例 #2
0
ファイル: SceneTreeView.cs プロジェクト: JSandusky/UrShell
 public void GetInfo(object item, ItemInfo info)
 {
     if (item is UrhoBackend.Node)
     {
         if (item is UrhoBackend.Scene)
         {
             UrhoBackend.Scene scene = ((UrhoBackend.Scene)item);
             info.IsExpandedInView = true;
             info.IsLeaf           = false;
             if (String.IsNullOrWhiteSpace(scene.GetName()))
             {
                 info.Label = "Scene : " + scene.GetID();
             }
             else
             {
                 info.Label = scene.GetName() + " : " + scene.GetID();
             }
             info.FontStyle      = System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Underline;
             info.AllowLabelEdit = true;
         }
         else
         {
             UrhoBackend.Node node = ((UrhoBackend.Node)item);
             info.IsLeaf = node.GetChildren().Count > 0;
             if (String.IsNullOrWhiteSpace(node.GetName()))
             {
                 info.Label = "Node" + (node.IsNetworked() ? " : NET " : " : ") + node.GetID();
             }
             else
             {
                 info.Label = node.GetName() + (node.IsNetworked() ? " : NET " : " : ") + node.GetID();
             }
             info.FontStyle      = System.Drawing.FontStyle.Bold;
             info.AllowLabelEdit = true;
         }
     }
     else if (item is UrhoBackend.Component)
     {
         UrhoBackend.Component comp = ((UrhoBackend.Component)item);
         info.IsLeaf         = true;
         info.Label          = comp.GetTypeName() + " : " + comp.GetID();
         info.AllowLabelEdit = false;
     }
 }