/// <summary> /// Sets the style /// </summary> /// <param name="styleName">Style name</param> /// <param name="newValue">Style value</param> public void SetStyle(string styleName, object newValue) { /** * Setting the style creates a style declaration specific to this object * */ StyleProtoChain.SetStyle(this, styleName, newValue); }
/// <summary> /// Runs each time after any of styles changes<br/> /// The name and the new value for the style are passed as arguments /// </summary> /// <param name="styleProp">Style property</param> public virtual void StyleChanged(string styleProp) { //if (styleProp == "paddingLeft") // Debug.Log("Component -> StyleChanged: " + styleProp); StyleProtoChain.StyleChanged(this, styleProp); if (DispatchStyleChanges) { if (null != styleProp && (styleProp != "styleName")) { if (HasEventListener(styleProp + "Changed")) { DispatchEvent(new Event(styleProp + "Changed")); } } else { if (HasEventListener("allStylesChanged")) { DispatchEvent(new Event("allStylesChanged")); } } } switch (styleProp) { case "disabledOverlayStyle": case "overlayStyle": case "showOverlay": case "color": case "backgroundColor": /*Debug.Log( ComponentUtil.PathToString(this, "->") + " ---> " + (Color)GetStyle("backgroundColor")); * InvalidateDisplayList(); * break;*/ case "contentColor": InvalidateDisplayList(); break; } }
public bool MatchesCSSType(string cssType) { return(StyleProtoChain.MatchesCSSType(GetType(), cssType)); }
/** * Finds the type selectors for this Component instance. * The algorithm walks up the superclass chain. * For example, suppose that class MyButton extends Button. * A MyButton instance will first look for a MyButton type selector * then, it will look for a Button type selector. * then, it will look for a Component type selector. * (The superclass chain is considered to stop at Component, not Object.) * * Returns: An Array of type selectors for this Component instance. */ ///<summary> ///</summary> ///<returns></returns> public List <StyleDeclaration> GetClassStyleDeclarations() { return(StyleProtoChain.GetClassStyleDeclarations(this)); }
internal void InitProtoChain() { StyleProtoChain.InitProtoChain(this); }