예제 #1
0
        private void AddThemeControls(FlowLayoutWidget controlsTopToBottomLayout)
        {
            DisableableWidget container = new DisableableWidget();

            GroupBox themeControlsGroupBox = new GroupBox(LocalizedString.Get("Theme Settings"));

            themeControlsGroupBox.TextColor   = ActiveTheme.Instance.PrimaryTextColor;
            themeControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
            themeControlsGroupBox.HAnchor     = Agg.UI.HAnchor.ParentLeftRight;
            themeControlsGroupBox.VAnchor     = Agg.UI.VAnchor.FitToChildren;
            themeControlsGroupBox.Height      = 78;

            FlowLayoutWidget colorSelectorContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);

            colorSelectorContainer.HAnchor = HAnchor.ParentLeftRight;


            ThemeColorSelectorWidget themeSelector = new ThemeColorSelectorWidget();

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

            GuiWidget currentColorThemeBorder = new GuiWidget();

            currentColorThemeBorder.HAnchor         = Agg.UI.HAnchor.ParentLeftRight;
            currentColorThemeBorder.VAnchor         = VAnchor.ParentBottomTop;
            currentColorThemeBorder.Margin          = new BorderDouble(top: 2, bottom: 2);
            currentColorThemeBorder.Padding         = new BorderDouble(4);
            currentColorThemeBorder.BackgroundColor = RGBA_Bytes.White;

            GuiWidget currentColorTheme = new GuiWidget();

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


            themeControlsGroupBox.AddChild(colorSelectorContainer);
            colorSelectorContainer.AddChild(themeSelector);
            colorSelectorContainer.AddChild(currentColorThemeBorder);
            currentColorThemeBorder.AddChild(currentColorTheme);
            container.AddChild(themeControlsGroupBox);
            controlsTopToBottomLayout.AddChild(container);
        }
예제 #2
0
		public ThemeSelectorWindow()
			:base(400, 200)
		{
			Title = LocalizedString.Get("Theme Selector").Localize();

			FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
			topToBottom.AnchorAll();
			topToBottom.Padding = new BorderDouble(3, 0, 3, 5);

			//Create Header
			FlowLayoutWidget headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight);
			headerRow.HAnchor = HAnchor.ParentLeftRight;
			headerRow.Margin = new BorderDouble(0, 3, 0, 0);
			headerRow.Padding = new BorderDouble(0, 3, 0, 3);

			//Create 'Theme Change' label and add it to Header
			string themeChangeHeader = LocalizedString.Get("Select Theme".Localize());
			TextWidget elementHeader = new TextWidget(string.Format("{0}:", themeChangeHeader), pointSize: 14);
			elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			elementHeader.HAnchor = HAnchor.ParentLeftRight;
			elementHeader.VAnchor = Agg.UI.VAnchor.ParentBottom;

			//Add label to header 
			headerRow.AddChild(elementHeader);
			//Add Header
			topToBottom.AddChild(headerRow);


			//Theme Selector widget container and add themeselector
			FlowLayoutWidget themeChangeWidgetContainer = new FlowLayoutWidget();
			themeChangeWidgetContainer.Padding = new BorderDouble(3);
			themeChangeWidgetContainer.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;

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


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


			//Create CurrentColorTheme GUI Widgets
			GuiWidget currentColorThemeBorder = new GuiWidget();
			currentColorThemeBorder.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
			currentColorThemeBorder.VAnchor = VAnchor.ParentBottomTop;
			currentColorThemeBorder.Margin = new BorderDouble (top: 2, bottom: 2);
			currentColorThemeBorder.Padding = new BorderDouble(4);
			currentColorThemeBorder.BackgroundColor = RGBA_Bytes.White;




			FlowLayoutWidget presetsFormContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);

			{
				presetsFormContainer.HAnchor = HAnchor.ParentLeftRight;
				presetsFormContainer.VAnchor = VAnchor.ParentBottomTop;
				presetsFormContainer.Padding = new BorderDouble(3);
				presetsFormContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
			}

			FlowLayoutWidget currentColorLabelContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);
			currentColorLabelContainer.HAnchor = HAnchor.ParentLeftRight;
			currentColorLabelContainer.Margin = new BorderDouble(0, 3, 0, 0);
			currentColorLabelContainer.Padding = new BorderDouble(0, 3, 0, 3);

			string currentColorThemeLabelText = LocalizedString.Get("Currently Selected Theme".Localize());
			TextWidget currentColorThemeHeader = new TextWidget(string.Format("{0}:", currentColorThemeLabelText), pointSize: 14);
			currentColorThemeHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			currentColorThemeHeader.HAnchor = HAnchor.ParentLeftRight;
			currentColorThemeHeader.VAnchor = Agg.UI.VAnchor.ParentBottom;
			currentColorLabelContainer.AddChild(currentColorThemeHeader);


			//
			FlowLayoutWidget currentColorContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
			currentColorContainer.HAnchor = HAnchor.ParentLeftRight;
			currentColorContainer.VAnchor = VAnchor.ParentBottomTop;
			currentColorContainer.Padding = new BorderDouble(3);
			currentColorContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;

			currentColorContainer.AddChild(currentColorThemeBorder);
			currentColorThemeBorder.AddChild(currentColorTheme);

		
			presetsFormContainer.AddChild(themeChangeWidgetContainer);
			topToBottom.AddChild(presetsFormContainer);
			topToBottom.AddChild(currentColorLabelContainer);

			topToBottom.AddChild(currentColorContainer);
			BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

			FlowLayoutWidget buttonRow = new FlowLayoutWidget();
			buttonRow.HAnchor = HAnchor.ParentLeftRight;
			buttonRow.Padding = new BorderDouble(0, 3);

			closeButton = textImageButtonFactory.Generate("Close");
			closeButton.Click += (sender, e) =>
			{
				UiThread.RunOnIdle((state) =>
				{
						Close();
				});
			};

			saveButton = textImageButtonFactory.Generate("Save");
			saveButton.Click += (sender, e) =>
			{
					UserSettings.Instance.set("ActiveThemeIndex",((GuiWidget)sender).Name);
					ActiveTheme.Instance.LoadThemeSettings(int.Parse(((GuiWidget)sender).Name));//GUIWIDGET
			};


			buttonRow.AddChild(saveButton);
			buttonRow.AddChild(new HorizontalSpacer());
			buttonRow.AddChild(closeButton);
			topToBottom.AddChild(buttonRow);
			AddChild(topToBottom);


			ShowAsSystemWindow();
		}
예제 #3
0
        public ThemeSelectorWindow()
            : base(400, 200)
        {
            Title = LocalizedString.Get("Theme Selector").Localize();

            FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);

            topToBottom.AnchorAll();
            topToBottom.Padding = new BorderDouble(3, 0, 3, 5);

            //Create Header
            FlowLayoutWidget headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight);

            headerRow.HAnchor = HAnchor.ParentLeftRight;
            headerRow.Margin  = new BorderDouble(0, 3, 0, 0);
            headerRow.Padding = new BorderDouble(0, 3, 0, 3);

            //Create 'Theme Change' label and add it to Header
            string     themeChangeHeader = LocalizedString.Get("Select Theme".Localize());
            TextWidget elementHeader     = new TextWidget(string.Format("{0}:", themeChangeHeader), pointSize: 14);

            elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            elementHeader.HAnchor   = HAnchor.ParentLeftRight;
            elementHeader.VAnchor   = Agg.UI.VAnchor.ParentBottom;

            //Add label to header
            headerRow.AddChild(elementHeader);
            //Add Header
            topToBottom.AddChild(headerRow);


            //Theme Selector widget container and add themeselector
            FlowLayoutWidget themeChangeWidgetContainer = new FlowLayoutWidget();

            themeChangeWidgetContainer.Padding  = new BorderDouble(3);
            themeChangeWidgetContainer.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;

            GuiWidget currentColorTheme = new GuiWidget();

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


            ThemeColorSelectorWidget themeSelector = new ThemeColorSelectorWidget(colorToChangeTo: currentColorTheme);

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


            //Create CurrentColorTheme GUI Widgets
            GuiWidget currentColorThemeBorder = new GuiWidget();

            currentColorThemeBorder.HAnchor         = Agg.UI.HAnchor.ParentLeftRight;
            currentColorThemeBorder.VAnchor         = VAnchor.ParentBottomTop;
            currentColorThemeBorder.Margin          = new BorderDouble(top: 2, bottom: 2);
            currentColorThemeBorder.Padding         = new BorderDouble(4);
            currentColorThemeBorder.BackgroundColor = RGBA_Bytes.White;



            FlowLayoutWidget presetsFormContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);

            {
                presetsFormContainer.HAnchor         = HAnchor.ParentLeftRight;
                presetsFormContainer.VAnchor         = VAnchor.ParentBottomTop;
                presetsFormContainer.Padding         = new BorderDouble(3);
                presetsFormContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
            }

            FlowLayoutWidget currentColorLabelContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);

            currentColorLabelContainer.HAnchor = HAnchor.ParentLeftRight;
            currentColorLabelContainer.Margin  = new BorderDouble(0, 3, 0, 0);
            currentColorLabelContainer.Padding = new BorderDouble(0, 3, 0, 3);

            string     currentColorThemeLabelText = LocalizedString.Get("Currently Selected Theme".Localize());
            TextWidget currentColorThemeHeader    = new TextWidget(string.Format("{0}:", currentColorThemeLabelText), pointSize: 14);

            currentColorThemeHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            currentColorThemeHeader.HAnchor   = HAnchor.ParentLeftRight;
            currentColorThemeHeader.VAnchor   = Agg.UI.VAnchor.ParentBottom;
            currentColorLabelContainer.AddChild(currentColorThemeHeader);


            //
            FlowLayoutWidget currentColorContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);

            currentColorContainer.HAnchor         = HAnchor.ParentLeftRight;
            currentColorContainer.VAnchor         = VAnchor.ParentBottomTop;
            currentColorContainer.Padding         = new BorderDouble(3);
            currentColorContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;

            currentColorContainer.AddChild(currentColorThemeBorder);
            currentColorThemeBorder.AddChild(currentColorTheme);


            presetsFormContainer.AddChild(themeChangeWidgetContainer);
            topToBottom.AddChild(presetsFormContainer);
            topToBottom.AddChild(currentColorLabelContainer);

            topToBottom.AddChild(currentColorContainer);
            BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

            FlowLayoutWidget buttonRow = new FlowLayoutWidget();

            buttonRow.HAnchor = HAnchor.ParentLeftRight;
            buttonRow.Padding = new BorderDouble(0, 3);

            closeButton        = textImageButtonFactory.Generate("Close");
            closeButton.Click += (sender, e) =>
            {
                UiThread.RunOnIdle((state) =>
                {
                    Close();
                });
            };

            saveButton        = textImageButtonFactory.Generate("Save");
            saveButton.Click += (sender, e) =>
            {
                UserSettings.Instance.set("ActiveThemeIndex", ((GuiWidget)sender).Name);
                ActiveTheme.Instance.LoadThemeSettings(int.Parse(((GuiWidget)sender).Name));                        //GUIWIDGET
            };


            buttonRow.AddChild(saveButton);
            buttonRow.AddChild(new HorizontalSpacer());
            buttonRow.AddChild(closeButton);
            topToBottom.AddChild(buttonRow);
            AddChild(topToBottom);


            ShowAsSystemWindow();
        }
		private void AddThemeControls(FlowLayoutWidget controlsTopToBottomLayout)
		{
			DisableableWidget container = new DisableableWidget();

			AltGroupBox themeControlsGroupBox = new AltGroupBox(LocalizedString.Get("Theme Settings"));
			themeControlsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			themeControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
			themeControlsGroupBox.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
			themeControlsGroupBox.VAnchor = Agg.UI.VAnchor.FitToChildren;
			themeControlsGroupBox.Height = 78;

			FlowLayoutWidget colorSelectorContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);
			colorSelectorContainer.HAnchor = HAnchor.ParentLeftRight;

			GuiWidget currentColorThemeBorder = new GuiWidget();
			currentColorThemeBorder.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
			currentColorThemeBorder.VAnchor = VAnchor.ParentBottomTop;
			currentColorThemeBorder.Margin = new BorderDouble(top: 2, bottom: 2);
			currentColorThemeBorder.Padding = new BorderDouble(4);
			currentColorThemeBorder.BackgroundColor = RGBA_Bytes.White;

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

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

			themeControlsGroupBox.AddChild(colorSelectorContainer);
			colorSelectorContainer.AddChild(themeSelector);
			colorSelectorContainer.AddChild(currentColorThemeBorder);
			currentColorThemeBorder.AddChild(currentColorTheme);
			container.AddChild(themeControlsGroupBox);
			controlsTopToBottomLayout.AddChild(container);
		}