示例#1
0
        protected virtual IEnumerable <IStyleRule> CreateStyleForButton(StyleBuilder b)
        {
            var widgetStyles = b.StyleSystem.StylesFor <WidgetStyleDefinition>();
            var textStyles   = b.StyleSystem.StylesFor <TextStyleDefinition>();

            return(new List <IStyleRule>
            {
                b.CreateRule(
                    b.SelectForType <Button>(),
                    b.CreateStyle()
                    .WithValue(widgetStyles.Padding, new Insets(20, 20))
                    .WithValue(textStyles.Alignment, Alignment.Center)
                    .WithValue(textStyles.TextColor, new Color(224, 224, 224))
                    .WithBox(widgetStyles.FrameTexture, "UI/Button/ButtonFrame", new Insets(20))),
                b.CreateRule(
                    b.SelectForType <Button>().WithDirectChild(b.SelectForType <IconLabel>()).WithDirectChild(b.SelectForType <Label>()),
                    b.CreateStyle().WithValue(textStyles.Alignment, Alignment.Center)),
                b.CreateRule(
                    b.SelectForType <Button>().WithDirectChild(b.SelectForType <IconLabel>()),
                    b.CreateStyle().WithValue(widgetStyles.Padding, new Insets(0))),
                b.CreateRule(
                    b.SelectForType <Button>().WithCondition(StyleBuilderExtensions.HasPseudoClass(WidgetPseudoClasses.HoveredPseudoClass)),
                    b.CreateStyle().WithBox(widgetStyles.HoverOverlayTexture, "UI/Button/ButtonHover", new Insets(20))),
                b.CreateRule(
                    b.SelectForType <Button>().WithCondition(StyleBuilderExtensions.HasPseudoClass(WidgetPseudoClasses.FocusedPseudoClass)),
                    b.CreateStyle().WithBox(widgetStyles.FocusedOverlayTexture, "UI/Button/ButtonFocus", new Insets(20))),
                b.CreateRule(
                    b.SelectForType <Button>().WithCondition(StyleBuilderExtensions.HasPseudoClass(ButtonPseudoClasses.DownPseudoClass)),
                    b.CreateStyle()
                    .WithBox(widgetStyles.FrameTexture, "UI/Button/ButtonFrameDown", new Insets(20))
                    .WithBox(widgetStyles.FrameOverlayTexture, "UI/Button/ButtonPress", new Insets(20)))
            });
        }
示例#2
0
        protected virtual IEnumerable <IStyleRule> CreateStyleForTextField(StyleBuilder b)
        {
            var widgetStyles = b.StyleSystem.StylesFor <WidgetStyleDefinition>();
            var textStyles   = b.StyleSystem.StylesFor <TextStyleDefinition>();

            return(new List <IStyleRule>
            {
                b.CreateRule(
                    b.SelectForType <TextField>(),
                    b.CreateStyle()
                    .WithBox(widgetStyles.FrameTexture, "UI/TextField/TextFieldFrame", new Insets(20))
                    .WithValue(widgetStyles.Padding, new Insets(15))
                    .WithFont(textStyles.Font, "Fonts/MediumFont")
                    .WithValue(textStyles.TextColor, Color.White)),
                b.CreateRule(
                    b.SelectForType <TextField>().WithDirectChild(b.SelectForType("Caret")),
                    b.CreateStyle()
                    .WithValue(widgetStyles.Visibility, Visibility.Collapsed)
                    .WithValue(widgetStyles.Color, Color.White)
                    .WithValue(textStyles.SelectionColor, Color.Gray)
                    .WithValue(textStyles.CaretWidth, 1)),
                b.CreateRule(
                    b.SelectForType <TextField>()
                    .WithCondition(StyleBuilderExtensions.HasPseudoClass(WidgetPseudoClasses.FocusedPseudoClass))
                    .WithDirectChild(b.SelectForType("Caret")),
                    b.CreateStyle().WithValue(widgetStyles.Visibility, Visibility.Visible))
            });
        }
示例#3
0
        protected virtual IEnumerable <IStyleRule> CreateStyleForListView(StyleBuilder b)
        {
            var widgetStyles = b.StyleSystem.StylesFor <WidgetStyleDefinition>();

            return(new List <IStyleRule>
            {
                b.CreateRule(
                    b.SelectForType("ListView").WithDirectChild(b.SelectForType("ScrollPanel")),
                    b.CreateStyle()
                    .WithBox(widgetStyles.FrameTexture, "UI/ListView/ListFrame", new Insets(10))
                    .WithValue(widgetStyles.Padding, new Insets(10))),
                b.CreateRule(
                    b.SelectForType <ListDataItemRenderer>(),
                    b.CreateStyle()
                    .WithBox(widgetStyles.FrameTexture, "UI/ListView/ListRowFrame", new Insets(10))
                    .WithValue(widgetStyles.Padding, new Insets(10))),
                b.CreateRule(
                    b.SelectForType <ListDataItemRenderer>()
                    .WithCondition(StyleBuilderExtensions.HasAttribute(nameof(IListDataItemRenderer.Selected), true)),
                    b.CreateStyle()
                    .WithBox(widgetStyles.FrameTexture, "UI/ListView/ListRowFrameSelected", new Insets(10))
                    .WithValue(widgetStyles.Padding, new Insets(10))),
                b.CreateRule(
                    b.SelectForType <ListDataItemRenderer>().WithCondition(StyleBuilderExtensions.HasPseudoClass(WidgetPseudoClasses.FocusedPseudoClass)),
                    b.CreateStyle().WithBox(widgetStyles.FocusedOverlayTexture, "UI/ListView/ListRowFrameFocused", new Insets(10))),
                b.CreateRule(
                    b.SelectForType <ListDataItemRenderer>().WithCondition(StyleBuilderExtensions.HasPseudoClass(WidgetPseudoClasses.HoveredPseudoClass)),
                    b.CreateStyle().WithBox(widgetStyles.HoverOverlayTexture, "UI/ListView/ListRowFrameHover", new Insets(10)))
            });
        }
示例#4
0
        protected virtual IEnumerable <IStyleRule> CreateStyleForNotebook(StyleBuilder b)
        {
            var widgetStyles   = b.StyleSystem.StylesFor <WidgetStyleDefinition>();
            var notebookStyles = b.StyleSystem.StylesFor <NotebookStyleDefinition>();

            return(new List <IStyleRule>
            {
                b.CreateRule(b.SelectForType <Notebook>(), b.CreateStyle().WithValue(notebookStyles.NotebookTabOverlapY, 15)),
                b.CreateRule(
                    b.SelectForType <Notebook>().WithDirectChild(b.SelectForType <ScrollPanel>()),
                    b.CreateStyle().WithBox(widgetStyles.FrameTexture, "UI/Notebook/NotebookFrame", new Insets(15)).WithValue(notebookStyles.NotebookTabOverlapY, 5)),
                b.CreateRule(
                    b.SelectForType <NotebookTabList>(),
                    b.CreateStyle().WithValue(widgetStyles.Padding, new Insets(0, 20, 0, 20)).WithValue(notebookStyles.NotebookTabOverlapX, 15)),
                b.CreateRule(
                    b.SelectForType <NotebookTab>(),
                    b.CreateStyle()
                    .WithValue(widgetStyles.Padding, new Insets(0, 20, 0, 20))
                    .WithBox(widgetStyles.FrameTexture, "UI/Notebook/Tab", new Insets(15))
                    .WithBox(widgetStyles.HoverOverlayTexture, "UI/Notebook/TabHover", new Insets(15))),
                b.CreateRule(
                    b.SelectForType <NotebookTab>().WithCondition(StyleBuilderExtensions.HasAttribute(nameof(NotebookTab.IsActive), "true")),
                    b.CreateStyle().WithBox(widgetStyles.FrameTexture, "UI/Notebook/ActiveTab", new Insets(15))),
                b.CreateRule(
                    b.SelectForType <NotebookTab>().WithCondition(StyleBuilderExtensions.HasPseudoClass(WidgetPseudoClasses.FocusedPseudoClass)),
                    b.CreateStyle().WithBox(widgetStyles.FocusedOverlayTexture, "UI/Notebook/TabFocus", new Insets(15))),
                b.CreateRule(
                    b.SelectForType <NotebookTab>()
                    .WithCondition(
                        StyleBuilderExtensions.HasAttribute(nameof(NotebookTab.IsActive), "true")
                        .And(StyleBuilderExtensions.HasPseudoClass(WidgetPseudoClasses.FocusedPseudoClass))),
                    b.CreateStyle().WithBox(widgetStyles.FocusedOverlayTexture, "UI/Notebook/ActiveTabFocused", new Insets(15))),
                b.CreateRule(
                    b.SelectForType <Button>().WithCondition(StyleBuilderExtensions.HasClass(NotebookTab.CloseButtonStyleClass)),
                    b.CreateStyle()
                    .WithValue(widgetStyles.Padding, new Insets(0, 20, 0, 20))
                    .WithBox(widgetStyles.FrameTexture, "UI/Notebook/TabClose", new Insets(15))),
                b.CreateRule(
                    b.SelectForType <Button>()
                    .WithCondition(
                        StyleBuilderExtensions.HasClass(NotebookTab.CloseButtonStyleClass)
                        .And(StyleBuilderExtensions.HasPseudoClass(WidgetPseudoClasses.HoveredPseudoClass))),
                    b.CreateStyle()
                    .WithValue(widgetStyles.Padding, new Insets(0, 20, 0, 20))
                    .WithBox(widgetStyles.HoverOverlayTexture, "UI/Notebook/TabCloseHover", new Insets(15))),
                b.CreateRule(
                    b.SelectForType <Button>()
                    .WithCondition(
                        StyleBuilderExtensions.HasClass(NotebookTab.CloseButtonStyleClass)
                        .And(StyleBuilderExtensions.HasPseudoClass(ButtonPseudoClasses.DownPseudoClass))),
                    b.CreateStyle()
                    .WithValue(widgetStyles.Padding, new Insets(0, 20, 0, 20))
                    .WithBox(widgetStyles.HoverOverlayTexture, "UI/Notebook/TabCloseDown", new Insets(15)))
            });
        }
示例#5
0
        protected virtual IEnumerable <IStyleRule> CreateStyleForRadioButtons(StyleBuilder b)
        {
            var widgetStyles = b.StyleSystem.StylesFor <WidgetStyleDefinition>();
            var textStyles   = b.StyleSystem.StylesFor <TextStyleDefinition>();

            return(new List <IStyleRule>
            {
                b.CreateRule(b.SelectForType("RadioButtonSet"), b.CreateStyle().WithValue(widgetStyles.Padding, new Insets())),
                b.CreateRule(
                    b.SelectForType <Button>().WithCondition(StyleBuilderExtensions.HasClass(RadioButtonSetContent.StyleClass)),
                    b.CreateStyle()
                    .WithBox(widgetStyles.FrameTexture, "UI/RadioButtonSet/ButtonFrameMiddle", new Insets(20))
                    .WithBox(widgetStyles.HoverOverlayTexture, null)
                    .WithValue(textStyles.TextColor, Color.White)),
                b.CreateRule(
                    b.SelectForType <Button>()
                    .WithCondition(
                        StyleBuilderExtensions.HasPseudoClass(WidgetPseudoClasses.FirstChildPseudoClass)
                        .And(StyleBuilderExtensions.HasClass(RadioButtonSetContent.StyleClass))),
                    b.CreateStyle()
                    .WithBox(widgetStyles.FrameTexture, "UI/RadioButtonSet/ButtonFrameLeft", new Insets(20))
                    .WithBox(widgetStyles.HoverOverlayTexture, null)),
                b.CreateRule(
                    b.SelectForType <Button>()
                    .WithCondition(
                        StyleBuilderExtensions.HasPseudoClass(WidgetPseudoClasses.LastChildPseudoClass)
                        .And(StyleBuilderExtensions.HasClass(RadioButtonSetContent.StyleClass))),
                    b.CreateStyle()
                    .WithBox(widgetStyles.FrameTexture, "UI/RadioButtonSet/ButtonFrameRight", new Insets(20))
                    .WithBox(widgetStyles.HoverOverlayTexture, null)),
                b.CreateRule(
                    b.SelectForType <Button>()
                    .WithCondition(
                        StyleBuilderExtensions.HasClass(RadioButtonSetContent.StyleClass)
                        .And(StyleBuilderExtensions.HasPseudoClass(ButtonPseudoClasses.DownPseudoClass))),
                    b.CreateStyle()
                    .WithBox(widgetStyles.FrameTexture, "UI/RadioButtonSet/ButtonFrameMiddleDown", new Insets(20))
                    .WithValue(textStyles.TextColor, Color.Black)),
                b.CreateRule(
                    b.SelectForType <Button>()
                    .WithCondition(
                        StyleBuilderExtensions.HasPseudoClass(WidgetPseudoClasses.FirstChildPseudoClass)
                        .And(StyleBuilderExtensions.HasClass(RadioButtonSetContent.StyleClass))
                        .And(StyleBuilderExtensions.HasPseudoClass(ButtonPseudoClasses.DownPseudoClass))),
                    b.CreateStyle().WithBox(widgetStyles.FrameTexture, "UI/RadioButtonSet/ButtonFrameLeftDown", new Insets(20))),
                b.CreateRule(
                    b.SelectForType <Button>()
                    .WithCondition(
                        StyleBuilderExtensions.HasPseudoClass(WidgetPseudoClasses.LastChildPseudoClass)
                        .And(StyleBuilderExtensions.HasClass(RadioButtonSetContent.StyleClass))
                        .And(StyleBuilderExtensions.HasPseudoClass(ButtonPseudoClasses.DownPseudoClass))),
                    b.CreateStyle().WithBox(widgetStyles.FrameTexture, "UI/RadioButtonSet/ButtonFrameRightDown", new Insets(20)))
            });
        }
示例#6
0
        protected virtual IEnumerable <IStyleRule> CreateStyleForCheckBox(StyleBuilder b)
        {
            var widgetStyles    = b.StyleSystem.StylesFor <WidgetStyleDefinition>();
            var buttonStyles    = b.StyleSystem.StylesFor <ButtonStyleDefinition>();
            var iconLabelStyles = b.StyleSystem.StylesFor <IconLabelStyleDefinition>();

            return(new List <IStyleRule>
            {
                b.CreateRule(b.SelectForType <CheckBox>(), b.CreateStyle().WithValue(widgetStyles.Padding, new Insets(10, 15))),
                b.CreateRule(
                    b.SelectForType <CheckBox>()
                    .WithDescendent(b.SelectForType <Label>().WithCondition(StyleBuilderExtensions.HasClass(CheckBox.CheckBoxLabelStyleClass))),
                    b.CreateStyle().WithValue(iconLabelStyles.IconTextGap, 10)),
                b.CreateRule(
                    b.SelectForType <CheckBox>().WithDescendent(b.SelectForType <Button>()),
                    b.CreateStyle()
                    .WithValue(widgetStyles.Padding, new Insets(20))
                    .WithBox(widgetStyles.FrameTexture, "UI/CheckBox/CheckBoxFrame", new Insets(20))),
                b.CreateRule(
                    b.SelectForType <CheckBox>()
                    .WithDescendent(b.SelectForType <Button>().WithCondition(StyleBuilderExtensions.HasPseudoClass(WidgetPseudoClasses.FocusedPseudoClass))),
                    b.CreateStyle().WithBox(widgetStyles.FocusedOverlayTexture, "UI/CheckBox/CheckBoxFrameFocus", new Insets(20))),
                b.CreateRule(
                    b.SelectForType <CheckBox>()
                    .WithDescendent(b.SelectForType <Button>().WithCondition(StyleBuilderExtensions.HasPseudoClass(WidgetPseudoClasses.HoveredPseudoClass))),
                    b.CreateStyle().WithBox(widgetStyles.HoverOverlayTexture, "UI/CheckBox/CheckBoxFrameHover", new Insets(20))),
                b.CreateRule(
                    b.SelectForType <CheckBox>()
                    .WithDescendent(
                        b.SelectForType <Button>().WithCondition(StyleBuilderExtensions.HasAttribute(nameof(Button.Selected), SelectionState.Selected))),
                    b.CreateStyle().WithBox(widgetStyles.WidgetStateOverlay, "UI/CheckBox/Checked", new Insets(20))),
                b.CreateRule(
                    b.SelectForType <CheckBox>()
                    .WithDescendent(
                        b.SelectForType <Button>().WithCondition(StyleBuilderExtensions.HasAttribute(nameof(Button.Selected), SelectionState.Unselected))),
                    b.CreateStyle().WithBox(widgetStyles.WidgetStateOverlay, "UI/CheckBox/Unchecked", new Insets(20))),
                b.CreateRule(
                    b.SelectForType <CheckBox>()
                    .WithDescendent(
                        b.SelectForType <Button>().WithCondition(StyleBuilderExtensions.HasAttribute(nameof(Button.Selected), SelectionState.Indeterminate))),
                    b.CreateStyle().WithBox(widgetStyles.WidgetStateOverlay, "UI/CheckBox/Indeterminate", new Insets(20)))
            });
        }