Example #1
0
        private CheckBoxViewStates getCheckBoxButtonView(string label, ImageBuffer normalImage = null,
                                                         ImageBuffer pressedImage         = null,
                                                         ImageBuffer normalToPressedImage = null,
                                                         ImageBuffer pressedToNormalImage = null,
                                                         string pressedLabel = null)
        {
            string pressedText = pressedLabel;

            if (pressedLabel == null)
            {
                pressedText = label;
            }

            Options.FlowDirection = FlowDirection.LeftToRight;

            //Create the multi-state button view
            GuiWidget normal                = new TextImageWidget(label, normalFillColor, normalBorderColor, normalTextColor, borderWidth, Margin, normalImage, fontSize: this.fontSize, height: this.FixedHeight);
            GuiWidget normalHover           = new TextImageWidget(label, hoverFillColor, normalBorderColor, hoverTextColor, borderWidth, Margin, normalImage, fontSize: this.fontSize, height: this.FixedHeight);
            GuiWidget switchNormalToPressed = new TextImageWidget(label, pressedFillColor, normalBorderColor, pressedTextColor, borderWidth, Margin, normalToPressedImage, fontSize: this.fontSize, height: this.FixedHeight);
            GuiWidget pressed               = new TextImageWidget(pressedText, pressedFillColor, pressedBorderColor, pressedTextColor, borderWidth, Margin, pressedImage, fontSize: this.fontSize, height: this.FixedHeight);
            GuiWidget pressedHover          = new TextImageWidget(label, hoverFillColor, pressedBorderColor, hoverTextColor, borderWidth, Margin, pressedImage, fontSize: this.fontSize, height: this.FixedHeight);
            GuiWidget switchPressedToNormal = new TextImageWidget(label, normalFillColor, pressedBorderColor, normalTextColor, borderWidth, Margin, pressedToNormalImage, fontSize: this.fontSize, height: this.FixedHeight);
            GuiWidget disabled              = new TextImageWidget(label, disabledFillColor, disabledBorderColor, disabledTextColor, borderWidth, Margin, normalImage, fontSize: this.fontSize, height: this.FixedHeight);

            return(new CheckBoxViewStates(normal, normalHover, switchNormalToPressed, pressed, pressedHover, switchPressedToNormal, disabled));
        }
Example #2
0
        public RadioButton GenerateRadioButton(string label, string iconImageName = null)
        {
            ImageBuffer iconImage = null;

            if (iconImageName != null)
            {
                iconImage = StaticData.Instance.LoadIcon(iconImageName);
                if (!ActiveTheme.Instance.IsDarkTheme && AllowThemeToAdjustImage)
                {
                    InvertLightness.DoInvertLightness(iconImage);
                }
            }

            BorderDouble          internalMargin           = new BorderDouble(0);
            TextImageWidget       nomalState               = new TextImageWidget(label, normalFillColor, normalBorderColor, normalTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
            TextImageWidget       hoverState               = new TextImageWidget(label, hoverFillColor, hoverBorderColor, hoverTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
            TextImageWidget       checkingState            = new TextImageWidget(label, hoverFillColor, checkedBorderColor, hoverTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
            TextImageWidget       checkedState             = new TextImageWidget(label, pressedFillColor, checkedBorderColor, pressedTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
            TextImageWidget       disabledState            = new TextImageWidget(label, disabledFillColor, disabledBorderColor, disabledTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
            RadioButtonViewStates checkBoxButtonViewWidget = new RadioButtonViewStates(nomalState, hoverState, checkingState, checkedState, disabledState);
            RadioButton           radioButton              = new RadioButton(checkBoxButtonViewWidget);

            radioButton.Margin = Margin;
            return(radioButton);
        }
Example #3
0
        public RadioButton GenerateRadioButton(string label, ImageBuffer iconImage)
        {
            BorderDouble internalMargin = 0;

            var nomalState    = new TextImageWidget(label, normalFillColor, normalBorderColor, normalTextColor, borderWidth, internalMargin, iconImage, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth);
            var hoverState    = new TextImageWidget(label, hoverFillColor, hoverBorderColor, hoverTextColor, borderWidth, internalMargin, iconImage, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth);
            var checkingState = new TextImageWidget(label, hoverFillColor, checkedBorderColor, hoverTextColor, borderWidth, internalMargin, iconImage, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth);
            var checkedState  = new TextImageWidget(label, pressedFillColor, checkedBorderColor, pressedTextColor, borderWidth, internalMargin, iconImage, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth);
            var disabledState = new TextImageWidget(label, disabledFillColor, disabledBorderColor, disabledTextColor, borderWidth, internalMargin, iconImage, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth);

            var buttonView = new RadioButtonViewStates(nomalState, hoverState, checkingState, checkedState, disabledState);

            return(new RadioButton(buttonView)
            {
                Margin = Margin
            });
        }
        public RadioButton GenerateRadioButton(string label, string iconImageName = null)
        {
            ImageBuffer iconImage = null;

            if (iconImageName != null)
            {
                iconImage = new ImageBuffer();
                ImageBMPIO.LoadImageData(this.GetImageLocation(iconImageName), iconImage);
            }

            BorderDouble          internalMargin           = new BorderDouble(0);
            TextImageWidget       nomalState               = new TextImageWidget(label, normalFillColor, normalBorderColor, normalTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
            TextImageWidget       hoverState               = new TextImageWidget(label, hoverFillColor, hoverBorderColor, hoverTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
            TextImageWidget       checkingState            = new TextImageWidget(label, hoverFillColor, RGBA_Bytes.White, hoverTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
            TextImageWidget       checkedState             = new TextImageWidget(label, pressedFillColor, RGBA_Bytes.White, pressedTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
            TextImageWidget       disabledState            = new TextImageWidget(label, disabledFillColor, disabledBorderColor, disabledTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
            RadioButtonViewStates checkBoxButtonViewWidget = new RadioButtonViewStates(nomalState, hoverState, checkingState, checkedState, disabledState);
            RadioButton           radioButton              = new RadioButton(checkBoxButtonViewWidget);

            radioButton.Margin = Margin;
            return(radioButton);
        }
Example #5
0
        private CheckBoxViewStates getCheckBoxButtonView(string label, string normalImageName = null, string normalToPressedImageName = null, string pressedImageName = null, string pressedToNormalImageName = null, string pressedLabel = null)
        {
            ImageBuffer normalImage          = new ImageBuffer();
            ImageBuffer pressedImage         = new ImageBuffer();
            ImageBuffer normalToPressedImage = new ImageBuffer();
            ImageBuffer pressedToNormalImage = new ImageBuffer();
            string      pressedText          = pressedLabel;

            if (pressedLabel == null)
            {
                pressedText = label;
            }

            if (normalToPressedImageName == null)
            {
                normalToPressedImageName = pressedImageName;
            }

            if (pressedImageName == null)
            {
                pressedImageName = normalToPressedImageName;
            }

            if (pressedToNormalImageName == null)
            {
                pressedToNormalImageName = normalImageName;
            }

            if (normalImageName != null)
            {
                StaticData.Instance.LoadIcon(normalImageName, normalImage);

                if (!ActiveTheme.Instance.IsDarkTheme && AllowThemeToAdjustImage)
                {
                    InvertLightness.DoInvertLightness(normalImage);
                }
            }

            if (pressedImageName != null)
            {
                StaticData.Instance.LoadIcon(pressedImageName, pressedImage);
                if (!ActiveTheme.Instance.IsDarkTheme && AllowThemeToAdjustImage)
                {
                    InvertLightness.DoInvertLightness(pressedImage);
                }
            }

            if (normalToPressedImageName != null)
            {
                StaticData.Instance.LoadIcon(normalToPressedImageName, normalToPressedImage);
                if (!ActiveTheme.Instance.IsDarkTheme && AllowThemeToAdjustImage)
                {
                    InvertLightness.DoInvertLightness(normalToPressedImage);
                }
            }

            if (pressedToNormalImageName != null)
            {
                StaticData.Instance.LoadIcon(pressedToNormalImageName, pressedToNormalImage);
                if (!ActiveTheme.Instance.IsDarkTheme && AllowThemeToAdjustImage)
                {
                    InvertLightness.DoInvertLightness(pressedToNormalImage);
                }
            }

            if (invertImageLocation)
            {
                flowDirection = FlowDirection.RightToLeft;
            }
            else
            {
                flowDirection = FlowDirection.LeftToRight;
            }

            //Create the multi-state button view
            GuiWidget normal                = new TextImageWidget(label, normalFillColor, normalBorderColor, normalTextColor, borderWidth, Margin, normalImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight);
            GuiWidget normalHover           = new TextImageWidget(label, hoverFillColor, normalBorderColor, hoverTextColor, borderWidth, Margin, normalImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight);
            GuiWidget switchNormalToPressed = new TextImageWidget(label, pressedFillColor, normalBorderColor, pressedTextColor, borderWidth, Margin, normalToPressedImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight);
            GuiWidget pressed               = new TextImageWidget(pressedText, pressedFillColor, pressedBorderColor, pressedTextColor, borderWidth, Margin, pressedImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight);
            GuiWidget pressedHover          = new TextImageWidget(label, hoverFillColor, pressedBorderColor, hoverTextColor, borderWidth, Margin, pressedImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight);
            GuiWidget switchPressedToNormal = new TextImageWidget(label, normalFillColor, pressedBorderColor, normalTextColor, borderWidth, Margin, pressedToNormalImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight);
            GuiWidget disabled              = new TextImageWidget(label, disabledFillColor, disabledBorderColor, disabledTextColor, borderWidth, Margin, normalImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight);

            CheckBoxViewStates checkBoxButtonViewWidget = new CheckBoxViewStates(normal, normalHover, switchNormalToPressed, pressed, pressedHover, switchPressedToNormal, disabled);

            return(checkBoxButtonViewWidget);
        }
		public RadioButton GenerateRadioButton(string label, string iconImageName = null)
		{
			ImageBuffer iconImage = null;

			if (iconImageName != null)
			{
				iconImage = StaticData.Instance.LoadIcon(iconImageName);
				if (!ActiveTheme.Instance.IsDarkTheme && AllowThemeToAdjustImage)
				{
					InvertLightness.DoInvertLightness(iconImage);
				}
			}

			BorderDouble internalMargin = new BorderDouble(0);
			TextImageWidget nomalState = new TextImageWidget(label, normalFillColor, normalBorderColor, normalTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
			TextImageWidget hoverState = new TextImageWidget(label, hoverFillColor, hoverBorderColor, hoverTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
			TextImageWidget checkingState = new TextImageWidget(label, hoverFillColor, checkedBorderColor, hoverTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
			TextImageWidget checkedState = new TextImageWidget(label, pressedFillColor, checkedBorderColor, pressedTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
			TextImageWidget disabledState = new TextImageWidget(label, disabledFillColor, disabledBorderColor, disabledTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
			RadioButtonViewStates checkBoxButtonViewWidget = new RadioButtonViewStates(nomalState, hoverState, checkingState, checkedState, disabledState);
			RadioButton radioButton = new RadioButton(checkBoxButtonViewWidget);
			radioButton.Margin = Margin;
			return radioButton;
		}
		private CheckBoxViewStates getCheckBoxButtonView(string label, string normalImageName = null, string normalToPressedImageName = null, string pressedImageName = null, string pressedToNormalImageName = null, string pressedLabel = null)
		{
			ImageBuffer normalImage = new ImageBuffer();
			ImageBuffer pressedImage = new ImageBuffer();
			ImageBuffer normalToPressedImage = new ImageBuffer();
			ImageBuffer pressedToNormalImage = new ImageBuffer();
			string pressedText = pressedLabel;

			if (pressedLabel == null)
			{
				pressedText = label;
			}

			if (normalToPressedImageName == null)
			{
				normalToPressedImageName = pressedImageName;
			}

			if (pressedImageName == null)
			{
				pressedImageName = normalToPressedImageName;
			}

			if (pressedToNormalImageName == null)
			{
				pressedToNormalImageName = normalImageName;
			}

			if (normalImageName != null)
			{
				StaticData.Instance.LoadIcon(normalImageName, normalImage);

				if (!ActiveTheme.Instance.IsDarkTheme && AllowThemeToAdjustImage)
				{
					InvertLightness.DoInvertLightness(normalImage);
				}
			}

			if (pressedImageName != null)
			{
				StaticData.Instance.LoadIcon(pressedImageName, pressedImage);
				if (!ActiveTheme.Instance.IsDarkTheme && AllowThemeToAdjustImage)
				{
					InvertLightness.DoInvertLightness(pressedImage);
				}
			}

			if (normalToPressedImageName != null)
			{
				StaticData.Instance.LoadIcon(normalToPressedImageName, normalToPressedImage);
				if (!ActiveTheme.Instance.IsDarkTheme && AllowThemeToAdjustImage)
				{
					InvertLightness.DoInvertLightness(normalToPressedImage);
				}
			}

			if (pressedToNormalImageName != null)
			{
				StaticData.Instance.LoadIcon(pressedToNormalImageName, pressedToNormalImage);
				if (!ActiveTheme.Instance.IsDarkTheme && AllowThemeToAdjustImage)
				{
					InvertLightness.DoInvertLightness(pressedToNormalImage);
				}
			}

			if (invertImageLocation)
			{
				flowDirection = FlowDirection.RightToLeft;
			}
			else
			{
				flowDirection = FlowDirection.LeftToRight;
			}

			//Create the multi-state button view
			GuiWidget normal = new TextImageWidget(label, normalFillColor, normalBorderColor, normalTextColor, borderWidth, Margin, normalImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight);
			GuiWidget normalHover = new TextImageWidget(label, hoverFillColor, normalBorderColor, hoverTextColor, borderWidth, Margin, normalImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight);
			GuiWidget switchNormalToPressed = new TextImageWidget(label, pressedFillColor, normalBorderColor, pressedTextColor, borderWidth, Margin, normalToPressedImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight);
			GuiWidget pressed = new TextImageWidget(pressedText, pressedFillColor, pressedBorderColor, pressedTextColor, borderWidth, Margin, pressedImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight);
			GuiWidget pressedHover = new TextImageWidget(label, hoverFillColor, pressedBorderColor, hoverTextColor, borderWidth, Margin, pressedImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight);
			GuiWidget switchPressedToNormal = new TextImageWidget(label, normalFillColor, pressedBorderColor, normalTextColor, borderWidth, Margin, pressedToNormalImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight);
			GuiWidget disabled = new TextImageWidget(label, disabledFillColor, disabledBorderColor, disabledTextColor, borderWidth, Margin, normalImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight);

			CheckBoxViewStates checkBoxButtonViewWidget = new CheckBoxViewStates(normal, normalHover, switchNormalToPressed, pressed, pressedHover, switchPressedToNormal, disabled);
			return checkBoxButtonViewWidget;
		}
        public RadioButton GenerateRadioButton(string label, string iconImageName = null)
        {
            ImageBuffer iconImage = null;

            if (iconImageName != null)
            {
                iconImage = new ImageBuffer();
                ImageBMPIO.LoadImageData(this.GetImageLocation(iconImageName), iconImage);
            }

            BorderDouble internalMargin = new BorderDouble(0);
            TextImageWidget nomalState = new TextImageWidget(label, normalFillColor, normalBorderColor, normalTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
            TextImageWidget hoverState = new TextImageWidget(label, hoverFillColor, hoverBorderColor, hoverTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
            TextImageWidget checkingState = new TextImageWidget(label, hoverFillColor, RGBA_Bytes.White, hoverTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
            TextImageWidget checkedState = new TextImageWidget(label, pressedFillColor, RGBA_Bytes.White, pressedTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
            TextImageWidget disabledState = new TextImageWidget(label, disabledFillColor, disabledBorderColor, disabledTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
            RadioButtonViewStates checkBoxButtonViewWidget = new RadioButtonViewStates(nomalState, hoverState, checkingState, checkedState, disabledState);
            RadioButton radioButton = new RadioButton(checkBoxButtonViewWidget);
            radioButton.Margin = Margin;
            return radioButton;
        }
        private CheckBoxViewStates getCheckBoxButtonView(string label, string normalImageName = null, string normalToPressedImageName = null, string pressedImageName = null, string pressedToNormalImageName = null)
        {
            ImageBuffer normalImage          = new ImageBuffer();
            ImageBuffer pressedImage         = new ImageBuffer();
            ImageBuffer normalToPressedImage = new ImageBuffer();
            ImageBuffer pressedToNormalImage = new ImageBuffer();

            if (normalImageName != null)
            {
                ImageBMPIO.LoadImageData(this.GetImageLocation(normalImageName), normalImage);
            }

            if (pressedImageName != null)
            {
                ImageBMPIO.LoadImageData(this.GetImageLocation(pressedImageName), pressedImage);
            }

            if (normalToPressedImageName != null)
            {
                ImageBMPIO.LoadImageData(this.GetImageLocation(normalToPressedImageName), normalToPressedImage);
            }

            if (pressedToNormalImageName != null)
            {
                ImageBMPIO.LoadImageData(this.GetImageLocation(pressedToNormalImageName), pressedToNormalImage);
            }

            if (normalToPressedImageName == null)
            {
                normalToPressedImage = pressedImage;
            }

            if (pressedImageName == null)
            {
                pressedImage = normalToPressedImage;
            }

            if (pressedToNormalImageName == null)
            {
                pressedToNormalImage = normalImage;
            }

            if (invertImageLocation)
            {
                flowDirection = FlowDirection.RightToLeft;
            }
            else
            {
                flowDirection = FlowDirection.LeftToRight;
            }

            //Create the multi-state button view
            GuiWidget normal                = new TextImageWidget(label, normalFillColor, normalBorderColor, normalTextColor, borderWidth, Margin, normalImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight);
            GuiWidget normalHover           = new TextImageWidget(label, hoverFillColor, normalBorderColor, hoverTextColor, borderWidth, Margin, normalImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight);
            GuiWidget switchNormalToPressed = new TextImageWidget(label, pressedFillColor, normalBorderColor, pressedTextColor, borderWidth, Margin, normalToPressedImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight);
            GuiWidget pressed               = new TextImageWidget(label, pressedFillColor, pressedBorderColor, pressedTextColor, borderWidth, Margin, pressedImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight);
            GuiWidget pressedHover          = new TextImageWidget(label, hoverFillColor, pressedBorderColor, hoverTextColor, borderWidth, Margin, pressedImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight);
            GuiWidget switchPressedToNormal = new TextImageWidget(label, normalFillColor, pressedBorderColor, normalTextColor, borderWidth, Margin, pressedToNormalImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight);
            GuiWidget disabled              = new TextImageWidget(label, disabledFillColor, disabledBorderColor, disabledTextColor, borderWidth, Margin, normalImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight);

            CheckBoxViewStates checkBoxButtonViewWidget = new CheckBoxViewStates(normal, normalHover, switchNormalToPressed, pressed, pressedHover, switchPressedToNormal, disabled);

            return(checkBoxButtonViewWidget);
        }