change property type dialog to use dropdown (has bug with popover autohide, but added...
[roobuilder] / src / JsRender / NodeProp.vala
index 1cf7d32..edb5e17 100644 (file)
@@ -86,6 +86,43 @@ public enum JsRender.NodePropType
                }
        }
        
+       public static NodePropType[] alltypes()
+       {
+               return {
+                       PROP,
+                       USER,
+                       RAW,                    
+                       METHOD,
+                       SIGNAL,
+
+                       SPECIAL,
+                       LISTENER
+               //      CTOR,
+                       
+               };
+       }
+       public static NodePropType nameToType(string str)
+       {
+               foreach(var np in alltypes()) {
+                       if (np.to_name() == str) {
+                               return np;
+                       }
+               }
+               return NONE;
+       
+       }
+       public static string[] get_pulldown_list()
+       {
+               // eventually it needs to be smarter.... - but i did not have internet so could not use listmodels for the dropdown
+                
+               string[] ret = {};
+               foreach(var np in alltypes()) {
+                       ret += np.to_name();
+               }
+               return ret;
+       
+       }
+       
        
 }
 
@@ -94,6 +131,10 @@ public enum JsRender.NodePropType
 public class JsRender.NodeProp : Object {
 
 
+
+
+
+
        private string _name = "";
        public string name { 
                get {
@@ -104,7 +145,8 @@ public class JsRender.NodeProp : Object {
                                return;
                        }
                        this._name = value;
-
+                
+                       this.updated_count++;
                        if (this.parent != null) {
                                // causes props/ listeners array to get updated.
                                this.parent.updated_count++;
@@ -141,8 +183,7 @@ public class JsRender.NodeProp : Object {
                        if (this.parent != null) {
                                this.parent.updated_count++;
                        }
-                       this.to_display_name_prop = "";
-                       this.to_tooltip_name_prop = "";
+                        
                        this.updated_count++;
                }
         } // return or type
@@ -161,10 +202,7 @@ public class JsRender.NodeProp : Object {
                        if (this.parent != null) {
                                this.parent.updated_count++;
                        }
-                       this.val_short = "";
-                       this.val_tooltip = "";                  
                        this.updated_count++;
-                       
                }
        }
 
@@ -177,9 +215,12 @@ public class JsRender.NodeProp : Object {
                set  {
  
                        // set things that are used to display values.
-                       this.to_display_name_prop = "";
-                       this.to_tooltip_name_prop = "";
-                       this. _updated_count = value;
+                       this.to_display_name_prop = value.to_string();
+                       this.to_tooltip_name_prop = value.to_string();
+                                       
+                       this.val_short =  value.to_string();
+                       this.val_tooltip =  value.to_string();  
+                       this._updated_count = value;
                }
  
        } // changes to this trigger updates on the tree..
@@ -217,6 +258,10 @@ public class JsRender.NodeProp : Object {
                this.childstore = new GLib.ListStore( typeof(NodeProp));
                 
        }
+       public string ptype_as_string {
+               get { return this.ptype.to_string(); }
+               private set {}
+       }
        
        
        public bool equals(NodeProp p) 
@@ -640,6 +685,7 @@ public class JsRender.NodeProp : Object {
                this.childstore.append(child);
 
        }
+        
        
        /**
        could use enums.. but basically.