コード例 #1
0
ファイル: Group.cs プロジェクト: onamoni/edriven-gui
        /*protected override void UpdateDisplayList(float width, float height)
         * {
         *  //Debug.Log("UpdateDisplayList: " + this);
         *  _backgroundStyle = (GUIStyle)GetStyle("backgroundStyle");
         *
         *  // temp fix style manager 20131109 - (Color)GetStyle("backgroundColor");
         *  // look also Component_styles class
         *  // GetStyle somehow doesn't deliver the hardcoded default
         *  _showBackground = (bool)GetStyle("showBackground");
         *  _bgColor = (Color)GetStyle("backgroundColor");
         *
         *  // NOTE: Turning padding propagation to layout ON overrides explicit layout settings with styled versions:
         *  //if (Layout is HorizontalLayout) {
         *  //    var hl = ((HorizontalLayout) Layout);
         *  //    hl.PaddingLeft = (float)Convert.ToDouble(GetStyle("paddingLeft"));
         *  //    hl.PaddingRight = (float)Convert.ToDouble(GetStyle("paddingRight"));
         *  //    hl.PaddingTop = (float)Convert.ToDouble(GetStyle("paddingTop"));
         *  //    hl.PaddingBottom = (float)Convert.ToDouble(GetStyle("paddingBottom"));
         *  //}
         *  //else if (Layout is VerticalLayout)
         *  //{
         *  //    var vl = ((VerticalLayout) Layout);
         *  //    vl.PaddingLeft = (float)Convert.ToDouble(GetStyle("paddingLeft"));
         *  //    vl.PaddingRight = (float)Convert.ToDouble(GetStyle("paddingRight"));
         *  //    vl.PaddingTop = (float)Convert.ToDouble(GetStyle("paddingTop"));
         *  //    vl.PaddingBottom = (float)Convert.ToDouble(GetStyle("paddingBottom"));
         *  //}
         *
         *  base.UpdateDisplayList(width, height);
         * }*/

        public override void NotifyStyleChangeInChildren(string styleProp, object value, bool recursive)
        {
            if (!recursive)
            {
                return;
            }

            int n = NumberOfContentChildren;

            for (int i = 0; i < n; i++)
            {
                ISimpleStyleClient child = GetContentChildAt(i) as ISimpleStyleClient;

                if (null != child)
                {
                    child.StyleChanged(styleProp);

                    // Always recursively call this function because of my
                    // descendants might have a styleName property that points
                    // to this object.  The recursive flag is respected in
                    // Container.notifyStyleChangeInChildren.
                    if (child is IStyleClient)
                    {
                        ((IStyleClient)child).NotifyStyleChangeInChildren(styleProp, value, true);
                    }
                }
            }
        }
コード例 #2
0
        /**
         *  Determines whether this condition matches the given component.
         *
         *  Param: object The component to which the condition may apply.
         *  Returns: true if component is a match, otherwise false.
         */
        ///<summary>
        ///</summary>
        ///<param name="client"></param>
        ///<returns></returns>
        internal bool MatchesStyleClient(ISimpleStyleClient client) // TEMP internal
        {
            bool match = false;

            if (_kind == CSSConditionKind.Class)
            {
                if (/*client.StyleName != null && */ client.StyleName is string)
                {
                    var sn = (string)client.StyleName;

                    /*if (client.GetType().FullName == "Assets.eDriven.Skins.ImageButtonSkin")
                     *  Debug.Log("MatchesStyleClient for: " + client);*/

                    // Look for a match in a potential list of styleNames
                    string[] styleNames = Regex.Split(sn, @"/\s+/");
                    for (int i = 0; i < styleNames.Length; i++)
                    {
                        if (styleNames[i] == _value)
                        {
                            match = true;
                            break;
                        }
                    }
                }
            }
            else if (_kind == CSSConditionKind.Id)
            {
                if (client.Id == _value)
                {
                    match = true;
                }
            }

            /*else if (_kind == CSSConditionKind.Pseudo)
             * {
             *  if (client.MatchesCSSState(_value))
             *      match = true;
             * }*/

            return(match);
        }
コード例 #3
0
ファイル: CSSCondition.cs プロジェクト: groov0v/edriven-gui
        /**
         *  Determines whether this condition matches the given component.
         * 
         *  Param: object The component to which the condition may apply.
         *  Returns: true if component is a match, otherwise false. 
         */
        ///<summary>
        ///</summary>
        ///<param name="client"></param>
        ///<returns></returns>
        internal bool MatchesStyleClient(ISimpleStyleClient client) // TEMP internal
        {
            bool match = false;

            if (_kind == CSSConditionKind.Class)
            {
                if (/*client.StyleName != null && */client.StyleName is string)
                {
                    var sn = (string) client.StyleName;

                    /*if (client.GetType().FullName == "Assets.eDriven.Skins.ImageButtonSkin")
                        Debug.Log("MatchesStyleClient for: " + client);*/

                    // Look for a match in a potential list of styleNames 
                    string[] styleNames = Regex.Split(sn, @"/\s+/");
                    for (int i = 0; i < styleNames.Length; i++)
                    {
                        if (styleNames[i] == _value)
                        {
                            match = true;
                            break;
                        }
                    }
                }
            }
            else if (_kind == CSSConditionKind.Id)
            {
                if (client.Id == _value)
                    match = true;
            }
            /*else if (_kind == CSSConditionKind.Pseudo)
            {
                if (client.MatchesCSSState(_value))
                    match = true;
            }*/

            return match;
        }