Beispiel #1
0
        public Slider(WndWindowDefinition wndWindow, ImageLoader imageLoader)
        {
            HighlightedBoxImage   = imageLoader.CreateFromWndDrawData(wndWindow.DisabledDrawData, 0);
            UnhighlightedBoxImage = imageLoader.CreateFromWndDrawData(wndWindow.DisabledDrawData, 1);

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

            Value = wndWindow.SliderData.MinValue + (wndWindow.SliderData.MaxValue - wndWindow.SliderData.MinValue) / 2;
        }
Beispiel #2
0
        private static Control CreateControl(WndWindowDefinition wndWindow, ImageLoader 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.ProgressBar:
                return(new ProgressBar(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.CreateFromWndDrawData(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);
            }
        }
Beispiel #3
0
        public CheckBox(WndWindowDefinition wndWindow, ImageLoader imageLoader)
        {
            UncheckedImage = imageLoader.CreateFromWndDrawData(wndWindow.EnabledDrawData, 1);
            CheckedImage   = imageLoader.CreateFromWndDrawData(wndWindow.EnabledDrawData, 2);

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

            DisabledUncheckedImage = imageLoader.CreateFromWndDrawData(wndWindow.DisabledDrawData, 1);
            DisabledCheckedImage   = imageLoader.CreateFromWndDrawData(wndWindow.DisabledDrawData, 2);
        }