public Property(CssProperty prop, string name) { RawProperty = CssProperties.Get(name); if (RawProperty == null) { throw new Exception("CSS Specification failure: Property '" + name + "' is required."); } CssCompositeProperty compProp = prop as CssCompositeProperty; if (compProp != null) { SetInfo = compProp.GetPropertySetInfo(RawProperty); } }
void OnGUI() { PowerUIEditor.HelpBox("Here's the CSS properties that PowerUI is currently recognising."); if (Properties == null) { Load(); } // Dropdown list: int selected = EditorGUILayout.Popup(SelectedPropertyIndex, Properties); if (selected != SelectedPropertyIndex || SelectedProperty == null) { SelectedPropertyIndex = selected; LoadSelected(); } // Detailed information about the selected property: if (SelectedProperty != null) { // Show the name: EditorGUILayout.LabelField(SelectedProperty.Name, EditorStyles.boldLabel); string hostName; // Get as a composite property: CssCompositeProperty composite = SelectedProperty as CssCompositeProperty; if (composite != null) { // It's a composite property (e.g. font, animation etc). // They set multiple properties at once. EditorGUILayout.LabelField("Composite property"); hostName = SelectedProperty.Name; } else if (SelectedProperty.IsAlias) { // Get as an alias: CssPropertyAlias alias = SelectedProperty as CssPropertyAlias; // e.g. color-r is an alias of color. if (alias.Target == null) { // Hmm! hostName = SelectedProperty.Name; // It's not an alias property EditorGUILayout.LabelField("Not an alias"); } else { // Get the target of the alias: string aliasedTo = alias.Target.Name; // It's an alias property EditorGUILayout.LabelField("Alias of " + aliasedTo); hostName = aliasedTo; } } else { hostName = SelectedProperty.Name; // It's not an alias property EditorGUILayout.LabelField("Not an alias/ composite"); } if (!string.IsNullOrEmpty(PropertyFile)) { PowerUIEditor.HelpBox("To find the source file, search for its name in camel case, like this:"); EditorGUILayout.SelectableLabel(PropertyFile); } if (SelectedProperty.NonStandard) { PowerUIEditor.WarnBox("This property is non-standard or not on a standards track."); } else if (SelectedProperty.NamespaceName == "svg") { if (GUILayout.Button("View Mozilla Docs (SVG)")) { Application.OpenURL("https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/" + hostName); } } else { if (GUILayout.Button("View Mozilla Docs")) { Application.OpenURL("https://developer.mozilla.org/en-US/docs/Web/CSS/" + hostName); } } } }