Example #1
0
        public Slider(WndWindowDefinition wndWindow, WndImageLoader imageLoader)
        {
            HighlightedBoxImage   = imageLoader.CreateNormalImage(wndWindow.DisabledDrawData, 0);
            UnhighlightedBoxImage = imageLoader.CreateNormalImage(wndWindow.DisabledDrawData, 1);

            MinimumValue = wndWindow.SliderData.MinValue;
            MaximumValue = wndWindow.SliderData.MaxValue;

            Value = wndWindow.SliderData.MinValue + (wndWindow.SliderData.MaxValue - wndWindow.SliderData.MinValue) / 2;
        }
Example #2
0
        public CheckBox(WndWindowDefinition wndWindow, WndImageLoader imageLoader)
        {
            UncheckedImage = imageLoader.CreateNormalImage(wndWindow.EnabledDrawData, 1);
            CheckedImage   = imageLoader.CreateNormalImage(wndWindow.EnabledDrawData, 2);

            HoverUncheckedImage = imageLoader.CreateNormalImage(wndWindow.HiliteDrawData, 1);
            HoverCheckedImage   = imageLoader.CreateNormalImage(wndWindow.HiliteDrawData, 2);

            DisabledUncheckedImage = imageLoader.CreateNormalImage(wndWindow.DisabledDrawData, 1);
            DisabledCheckedImage   = imageLoader.CreateNormalImage(wndWindow.DisabledDrawData, 2);
        }
Example #3
0
        private static Control CreateControl(WndWindowDefinition wndWindow, WndImageLoader imageLoader)
        {
            switch (wndWindow.WindowType)
            {
            case WndWindowType.CheckBox:
                return(new CheckBox(wndWindow, imageLoader));

            case WndWindowType.ComboBox:
                return(new ComboBox(wndWindow, imageLoader));

            case WndWindowType.HorizontalSlider:
                return(new Slider(wndWindow, imageLoader));

            case WndWindowType.ListBox:
                return(new ListBox(wndWindow, imageLoader));

            case WndWindowType.PushButton:
                return(new Button(wndWindow, imageLoader));

            case WndWindowType.RadioButton:
                return(new RadioButton(wndWindow, imageLoader));

            case WndWindowType.StaticText:
                return(new Label(wndWindow));

            case WndWindowType.EntryField:
                return(new TextBox(wndWindow, imageLoader));

            default:     // TODO: Implement other window types.
                var control = new Control();
                if (wndWindow.Status.HasFlag(WndWindowStatusFlags.Image))
                {
                    control.BackgroundImage = imageLoader.CreateNormalImage(wndWindow.EnabledDrawData, 0);
                }
                else
                {
                    control.BackgroundColor = wndWindow.EnabledDrawData.Items[0].Color.ToColorRgbaF();
                }
                if (control.BackgroundImage == null)
                {
                    control.BorderColor = wndWindow.EnabledDrawData.Items[0].BorderColor.ToColorRgbaF();
                    control.BorderWidth = 1;
                }
                return(control);
            }
        }