public static Type ToCSharp(this IProperty.PropertyType propertyType) { switch (propertyType) { case IProperty.PropertyType.IProperty_CHARSTR: case IProperty.PropertyType.IProperty_UNICODESTR: return(typeof(string)); case IProperty.PropertyType.IProperty_DOUBLE: return(typeof(double)); case IProperty.PropertyType.IProperty_FLOAT: return(typeof(float)); case IProperty.PropertyType.IProperty_INTEGER: return(typeof(int)); case IProperty.PropertyType.IProperty_LONG: return(typeof(long)); case IProperty.PropertyType.IProperty_STRUCTURE: return(typeof(IPropertyMap)); case IProperty.PropertyType.IProperty_UINTEGER: return(typeof(uint)); case IProperty.PropertyType.IProperty_ULONG: return(typeof(ulong)); default: throw new Exception(); } }
public virtual IProperty.PropertyType getType() { IProperty.PropertyType ret = (IProperty.PropertyType)xpcf_propertiesPINVOKE.IProperty_getType(swigCPtr); if (xpcf_propertiesPINVOKE.SWIGPendingException.Pending) { throw xpcf_propertiesPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public static object OnGUI(this IProperty.PropertyType propertyType, object value) { switch (propertyType) { case IProperty.PropertyType.IProperty_CHARSTR: case IProperty.PropertyType.IProperty_UNICODESTR: return(GUILayout.TextField((string)value)); case IProperty.PropertyType.IProperty_DOUBLE: { var v = (double)value; using (GUIScope.ChangeCheck) { var text = GUILayout.TextField(value.ToString()); if (GUI.changed) { if (double.TryParse(text, out v)) { value = v; } } } } return(value); case IProperty.PropertyType.IProperty_FLOAT: { var v = (float)value; using (GUIScope.ChangeCheck) { var text = GUILayout.TextField(value.ToString()); if (GUI.changed) { if (float.TryParse(text, out v)) { value = v; } } } } return(value); case IProperty.PropertyType.IProperty_INTEGER: { var v = (int)value; using (GUIScope.ChangeCheck) { var text = GUILayout.TextField(value.ToString()); if (GUI.changed) { if (int.TryParse(text, out v)) { value = v; } } } } return(value); case IProperty.PropertyType.IProperty_LONG: { var v = (long)value; using (GUIScope.ChangeCheck) { var text = GUILayout.TextField(value.ToString()); if (GUI.changed) { if (long.TryParse(text, out v)) { value = v; } } } } return(value); case IProperty.PropertyType.IProperty_STRUCTURE: return(default(IPropertyMap)); case IProperty.PropertyType.IProperty_UINTEGER: { var v = (uint)value; using (GUIScope.ChangeCheck) { var text = GUILayout.TextField(value.ToString()); if (GUI.changed) { if (uint.TryParse(text, out v)) { value = v; } } } } return(value); case IProperty.PropertyType.IProperty_ULONG: { var v = (ulong)value; using (GUIScope.ChangeCheck) { var text = GUILayout.TextField(value.ToString()); if (GUI.changed) { if (ulong.TryParse(text, out v)) { value = v; } } } } return(value); default: GUILayout.TextField(value.ToString()); return(value); } }