Beispiel #1
0
        private FlowLayoutWidget GetThemeControl()
        {
            FlowLayoutWidget buttonRow = new FlowLayoutWidget(Agg.UI.FlowDirection.TopToBottom);

            buttonRow.HAnchor = HAnchor.ParentLeftRight;
            buttonRow.Margin  = new BorderDouble(0, 6);

            string     settingLabelBeggining = LocalizedString.Get("Theme");
            string     settingLabelEnd       = LocalizedString.Get("Display Options");
            string     settingLabelFull      = String.Format("{0}/{1}", settingLabelBeggining, settingLabelEnd);
            TextWidget settingLabel          = new TextWidget(settingLabelFull);   //"Theme/Display Options"

            settingLabel.AutoExpandBoundsToText = true;
            settingLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            settingLabel.HAnchor   = Agg.UI.HAnchor.ParentLeft;


            FlowLayoutWidget colorSelectorContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);

            colorSelectorContainer.HAnchor = HAnchor.ParentLeftRight;
            colorSelectorContainer.Margin  = new BorderDouble(top: 4);

            GuiWidget currentColorThemeBorder = new GuiWidget();

            currentColorThemeBorder.VAnchor         = VAnchor.ParentBottomTop;
            currentColorThemeBorder.Padding         = new BorderDouble(5);
            currentColorThemeBorder.Width           = 80;
            currentColorThemeBorder.BackgroundColor = RGBA_Bytes.White;

            GuiWidget currentColorTheme = new GuiWidget();

            currentColorTheme.HAnchor         = HAnchor.ParentLeftRight;
            currentColorTheme.VAnchor         = VAnchor.ParentBottomTop;
            currentColorTheme.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor;

            currentColorThemeBorder.AddChild(currentColorTheme);

            ThemeColorSelectorWidget themeSelector = new ThemeColorSelectorWidget(colorToChangeTo: currentColorTheme);

            themeSelector.Margin = new BorderDouble(right: 5);



            colorSelectorContainer.AddChild(themeSelector);
            colorSelectorContainer.AddChild(currentColorThemeBorder);


            buttonRow.AddChild(settingLabel);
            buttonRow.AddChild(colorSelectorContainer);

            return(buttonRow);
        }
Beispiel #2
0
        public ThemePreviewButton(IThemeColors theme, bool isActive)
        {
            this.Padding         = 8;
            this.BackgroundColor = theme.PrimaryBackgroundColor;
            this.Cursor          = Cursors.Hand;

            secondaryBackground = new GuiWidget()
            {
                HAnchor         = HAnchor.Absolute | HAnchor.Left,
                VAnchor         = VAnchor.Stretch,
                Margin          = new BorderDouble(0),
                Width           = 20,
                BackgroundColor = theme.SecondaryBackgroundColor,
            };
            this.AddChild(secondaryBackground);

            accentColor = new GuiWidget()
            {
                HAnchor         = HAnchor.Stretch,
                VAnchor         = VAnchor.Absolute | VAnchor.Top,
                Height          = 6,
                Margin          = new BorderDouble(left: 25),
                BackgroundColor = theme.PrimaryAccentColor,
            };
            this.AddChild(accentColor);

            icon1 = new GuiWidget()
            {
                HAnchor         = HAnchor.Absolute | HAnchor.Left,
                VAnchor         = VAnchor.Absolute | VAnchor.Top,
                Height          = 8,
                Width           = 8,
                Margin          = new BorderDouble(left: 6, top: 6),
                BackgroundColor = theme.PrimaryAccentColor,
            };
            this.AddChild(icon1);

            icon2 = new GuiWidget()
            {
                HAnchor         = HAnchor.Absolute | HAnchor.Left,
                VAnchor         = VAnchor.Absolute | VAnchor.Top,
                Height          = 8,
                Width           = 8,
                Margin          = new BorderDouble(left: 6, top: 20),
                BackgroundColor = theme.PrimaryAccentColor,
            };
            this.AddChild(icon2);

            icon3 = new GuiWidget()
            {
                HAnchor         = HAnchor.Absolute | HAnchor.Left,
                VAnchor         = VAnchor.Absolute | VAnchor.Top,
                Height          = 8,
                Width           = 8,
                Margin          = new BorderDouble(left: 6, top: 34),
                BackgroundColor = theme.PrimaryAccentColor,
            };
            this.AddChild(icon3);

            tertiaryBackground = new GuiWidget()
            {
                HAnchor         = HAnchor.Stretch,
                VAnchor         = VAnchor.Absolute | VAnchor.Top,
                Height          = 37,
                Margin          = new BorderDouble(left: 25, top: 12),
                BackgroundColor = theme.TertiaryBackgroundColor,
            };
            this.AddChild(tertiaryBackground);

            if (isActive)
            {
                this.AddChild(new ImageWidget(AggContext.StaticData.LoadIcon("426.png", 16, 16, invertImage: true))
                {
                    HAnchor = HAnchor.Absolute,
                    VAnchor = VAnchor.Absolute,
                    OriginRelativeParent = new Vector2(45, 20)
                });
            }

            var overlay = new GuiWidget();

            overlay.AnchorAll();
            overlay.Cursor = Cursors.Hand;
            overlay.Click += (s, e) =>
            {
                ThemeColorSelectorWidget.SetTheme(this.themeName);
            };

            this.AddChild(overlay);
        }
Beispiel #3
0
 public override void OnClick(MouseEventArgs mouseEvent)
 {
     ThemeColorSelectorWidget.SetTheme(this.themeName);
     base.OnClick(mouseEvent);
 }
		private FlowLayoutWidget GetThemeControl()
		{
			FlowLayoutWidget buttonRow = new FlowLayoutWidget(Agg.UI.FlowDirection.TopToBottom);
			buttonRow.HAnchor = HAnchor.ParentLeftRight;
			buttonRow.Margin = new BorderDouble(0, 6);

			string settingLabelBeggining = "Theme".Localize();
			string settingLabelEnd = "Display Options".Localize();
			string settingLabelFull = String.Format("{0}/{1}", settingLabelBeggining, settingLabelEnd);
			TextWidget settingLabel = new TextWidget(settingLabelFull);//"Theme/Display Options"
			settingLabel.AutoExpandBoundsToText = true;
			settingLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			settingLabel.HAnchor = Agg.UI.HAnchor.ParentLeft;

			FlowLayoutWidget colorSelectorContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);
			colorSelectorContainer.HAnchor = HAnchor.ParentLeftRight;
			colorSelectorContainer.Margin = new BorderDouble(top: 4);

			GuiWidget currentColorThemeBorder = new GuiWidget();

			currentColorThemeBorder.VAnchor = VAnchor.ParentBottomTop;
			currentColorThemeBorder.Padding = new BorderDouble(5);
			currentColorThemeBorder.Width = 80;
			currentColorThemeBorder.BackgroundColor = RGBA_Bytes.White;

			GuiWidget currentColorTheme = new GuiWidget();
			currentColorTheme.HAnchor = HAnchor.ParentLeftRight;
			currentColorTheme.VAnchor = VAnchor.ParentBottomTop;
			currentColorTheme.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor;

			currentColorThemeBorder.AddChild(currentColorTheme);

			ThemeColorSelectorWidget themeSelector = new ThemeColorSelectorWidget(colorToChangeTo: currentColorTheme);
			themeSelector.Margin = new BorderDouble(right: 5);

			colorSelectorContainer.AddChild(themeSelector);
			colorSelectorContainer.AddChild(currentColorThemeBorder);

			buttonRow.AddChild(settingLabel);
			buttonRow.AddChild(colorSelectorContainer);

			return buttonRow;
		}