예제 #1
0
 /// <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);
 }
예제 #2
0
        /// <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;
            }
        }
예제 #3
0
 public bool MatchesCSSType(string cssType)
 {
     return(StyleProtoChain.MatchesCSSType(GetType(), cssType));
 }
예제 #4
0
 /**
  *  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));
 }
예제 #5
0
 internal void InitProtoChain()
 {
     StyleProtoChain.InitProtoChain(this);
 }