private LastChildSelector(ISelectorContext context, string selectorText, Specificity specificity)
 {
     this.context = context;
     regex = new Regex("^(:last-child)|(:last-of-type)");
     this.selectorText = selectorText;
     this.specificity = specificity;
 }
 private FirstChildSelector(ISelectorContext context, string selectorText, Specificity specificity)
 {
     this.context = context;
     regex = new Regex("^:first-child");
     this.selectorText = selectorText;
     this.specificity = specificity;
 }
 private NthChildSelector(ISelectorContext context, string selectorText, int position, Specificity specificity)
 {
     this.context = context;
     regex = new Regex("^:nth-child\\(\\d+\\)");
     this.selectorText = selectorText;
     this.position = position;
     this.specificity = specificity;
 }
 private IdentitySelector(ISelectorContext context, string currentSelector, string selectorText, Specificity specificity)
 {
     this.context = context;
     regex = new Regex("^#[-_]*([a-zA-Z]+[0-9_-]*)+");
     this.currentSelector = currentSelector;
     this.selectorText = selectorText;
     this.specificity = specificity;
 }
 private AttributeSelector(ISelectorContext context, AttributeElements element, Specificity specificity)
 {
     this.context = context;
     this.element = element;
     this.specificity = specificity;
     isValid = new Regex("^\\[([a-zA-Z]+[0-9]*)+([~|^$*]?=+[\"']?([a-zA-Z]+[0-9]*)+[\"']?)*\\]");
     spliter = new Regex(@"\w+|[~|^$*]|=");
 }
Пример #6
0
 private NotSelector(ISelectorContext context, string selectorText, string currentSelector, Specificity specificity)
 {
     this.context = context;
     regex = new Regex("^:not\\([a-zA-Z]+[0-9]*\\)");
     elementName = new Regex("\\([a-zA-Z]+[0-9]*\\)");
     this.selectorText = selectorText;
     this.currentSelector = currentSelector;
     this.specificity = specificity;
 }
        internal GlobalSelector(ISelectorContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            this.context = context;
        }
        internal ApplyNextElement(ISelectorContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            this.context = context;
            regex = new Regex(@"^\s*\+\s*");
        }
        internal IdentitySelector(ISelectorContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            context.AddAttachedSelector(this);
            this.context = context;
            regex = new Regex("^#[-_]*([a-zA-Z]+[0-9_-]*)+");
        }
        internal LastChildSelector(ISelectorContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            context.AddAttachedSelector(this);
            this.context = context;
            regex = new Regex("^(:last-child)|(:last-of-type)");
        }
        internal ApplyImmediateChildren(ISelectorContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            this.context = context;

            regex = new Regex(@"^\s*>\s*");
        }
        internal FirstChildSelector(ISelectorContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            context.AddAttachedSelector(this);
            this.context = context;

            regex = new Regex("^:first-child");
        }
        internal NthChildSelector(ISelectorContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            context.AddAttachedSelector(this);
            this.context = context;

            regex = new Regex("^:nth-child\\(\\d+\\)");
        }
Пример #14
0
        internal NotSelector(ISelectorContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            context.AddAttachedSelector(this);
            this.context = context;

            regex = new Regex("^:not\\([a-zA-Z]+[0-9]*\\)");
            elementName = new Regex("\\([a-zA-Z]+[0-9]*\\)");
        }
		internal ApplyAllChildren(ISelectorContext context)
		{
			if (context == null)
			{
				throw new ArgumentNullException("context");
			}

			this.context = context;

			//Atleast one space should occur preceeded by an occurance of an element selector
			isValid = new Regex(@"^\s+[^\s]+");
			//Parse all the space
			parse = new Regex(@"\s+");
		}
        private ElementSelector(ISelectorContext context, string currentSelector, string selectorText, Specificity specificity)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            this.context = context;
            regex = new Regex(@"^([a-zA-Z]+[0-9]*)+");
            this.currentSelector = currentSelector;
            this.selectorText = selectorText;
            this.specificity = specificity;

            FillSpecialTags();
        }
        internal AttributeSelector(ISelectorContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            //Attribute Selector can be next a selector or an independent selector.
            context.AddAttachedSelector(this);

            this.context = context;

            isValid = new Regex("^\\[([a-zA-Z]+[0-9]*)+([~|^$*]?=+[\"']?([a-zA-Z]+[0-9]*)+[\"']?)*\\]");
            spliter = new Regex(@"\w+|[~|^$*]|=");
        }
Пример #18
0
        protected override bool Init(object controller, object binding, DefinitionFiles.DefinitionFile definition)
        {
            if (!base.Init(controller, binding, definition))
            {
                return(false);
            }

            DefinitionFileWithStyle file = new DefinitionFileWithStyle(definition, typeof(UiScrollingSelector));

            _context = DefinitionResolver.GetValueFromMethodOrField(Controller, Binding, file["Context"]) as ISelectorContext;

            _elementHeight = DefinitionResolver.Get <Length>(Controller, Binding, file["ElementHeight"], Length.Zero);
            _spacing       = DefinitionResolver.Get <Length>(Controller, Binding, file["Spacing"], Length.Zero);

            _autoValidate = DefinitionResolver.Get <bool>(Controller, Binding, file["AutoValidate"], false);

            _selectedPositionOffset = DefinitionResolver.Get <Length>(Controller, Binding, file["SelectedPositionOffset"], Length.Zero);

            List <DefinitionFile> drawableFiles = file["Drawables"] as List <DefinitionFile>;

            if (drawableFiles != null)
            {
                foreach (var def in drawableFiles)
                {
                    ButtonDrawable drawable = def.CreateInstance(Controller, Binding) as ButtonDrawable;

                    if (drawable != null)
                    {
                        _drawables.Add(drawable);
                    }
                }
            }

            EnabledGestures = GestureType.Tap | GestureType.Up | GestureType.Down | GestureType.VerticalDrag;

            return(true);
        }
Пример #19
0
 internal StyleSheet(ISelectorContext context)
 {
     this.context = context;
     styles = new List<CSSElement>();
     mediaQueries = new List<MediaQuery>();
 }
 internal ElementSelector(ISelectorContext context)
     : this(context, string.Empty, string.Empty, new Specificity())
 {
 }
 private GlobalSelector(ISelectorContext context, string selectorText, Specificity specificity)
 {
     this.context = context;
     this.selectorText = selectorText;
     this.specificity = specificity;
 }