private void CreateColorControl(String name, int y) { const int colorSize = 12; GroupBox colorGroup = new GroupBox(this); colorGroup.SetPosition(10, y); colorGroup.SetText(name); colorGroup.SetSize(160, 35); colorGroup.Name = name + "groupbox"; ColorDisplay disp = new ColorDisplay(colorGroup); disp.Name = name; disp.SetBounds(0, 10, colorSize, colorSize); TextBoxNumeric numeric = new TextBoxNumeric(colorGroup); numeric.Name = name + "Box"; numeric.SetPosition(105, 7); numeric.SetSize(26, 16); numeric.SelectAllOnFocus = true; numeric.TextChanged += NumericTyped; HorizontalSlider slider = new HorizontalSlider(colorGroup); slider.SetPosition(colorSize + 5, 10); slider.SetRange(0, 255); slider.SetSize(80, colorSize); slider.Name = name + "Slider"; slider.ValueChanged += SlidersMoved; }
private void CreateColorControl(String name, int y) { const int colorSize = 12; GroupBox colorGroup = new GroupBox(this); colorGroup.SetPosition(10, y); colorGroup.SetText(name); colorGroup.SetSize(160, 35); colorGroup.Name = name + "groupbox"; ColorDisplay disp = new ColorDisplay(colorGroup); disp.Name = name; disp.SetBounds(0, 10, colorSize, colorSize); TextBoxNumeric numeric = new TextBoxNumeric(colorGroup); numeric.Name = name + "Box"; numeric.SetPosition(105, 7); numeric.SetSize(26, 16); numeric.SelectAllOnFocus = true; numeric.TextChanged += NumericTyped; HorizontalSlider slider = new HorizontalSlider(colorGroup); slider.SetPosition(colorSize + 5, 10); slider.SetRange(0, 255); slider.SetSize(80, colorSize); slider.Name = name + "Slider"; slider.ValueChanged += SlidersMoved; }
ControlBase CreateControls(ControlBase subject, int dock_idx, String name, int x, int y) { Control.GroupBox gb = new Control.GroupBox(this); gb.SetBounds(x, y, 200, 150); gb.Text = name; Control.Label l_width = new Control.Label(gb); l_width.SetSize(35, 15); l_width.Text = "Width:"; Control.HorizontalSlider width = new HorizontalSlider(gb); width.Name = "Width"; width.UserData = subject; width.Min = 50; width.Max = 350; width.Value = 100; width.SetSize(55, 15); width.ValueChanged += WidthChanged; Align.PlaceRightBottom(width, l_width); Control.Label l_height = new Control.Label(gb); l_height.SetSize(35, 15); l_height.Text = "Height:"; Align.PlaceRightBottom(l_height, width, 10); Control.HorizontalSlider height = new Control.HorizontalSlider(gb); height.Name = "Height"; height.UserData = subject; height.Min = 50; height.Max = 350; height.Value = 100; height.SetSize(55, 15); height.ValueChanged += HeightChanged; Align.PlaceRightBottom(height, l_height); Control.RadioButtonGroup dock = new RadioButtonGroup(gb, "Dock"); dock.UserData = subject; // store control that we are controlling dock.AddOption("Left"); dock.AddOption("Top"); dock.AddOption("Right"); dock.AddOption("Bottom"); dock.AddOption("Fill"); dock.SetSelection(dock_idx); Align.PlaceDownLeft(dock, l_width, 5); //dock.DrawDebugOutlines = true; dock.Invalidate(); Control.Label l_margin = new Control.Label(gb); l_margin.Text = "Margin:"; l_margin.SetBounds(75, 20, 35, 15); //Align.PlaceRightBottom(l_margin, dock); // can't use Align to anchor with 'dock' because radio group is resized only after layout ~_~ // this is become really cumbersome //l_margin.DrawDebugOutlines = true; Control.HorizontalSlider margin = new HorizontalSlider(gb); margin.Name = "Margin"; margin.UserData = subject; margin.Min = 0; margin.Max = 50; margin.Value = 10; margin.SetSize(55, 15); margin.ValueChanged += MarginChanged; Align.PlaceRightBottom(margin, l_margin); dock.SelectionChanged += DockChanged; return gb; }
public Screen_Settings(Base parent) : base(parent) { SetSize(parent.Width, parent.Height); Gwen.Control.Label label = new Gwen.Control.Label(this); label.Text = "Settings"; label.SetPosition(30, 30); label.TextColor = Color.FromArgb(200, 80, 0, 250); label.Font = Program.fontLogo; Gwen.Control.WindowControl settingsWindow = new Gwen.Control.WindowControl(this); settingsWindow.Width = parent.Width / 2; settingsWindow.Height = parent.Height / 2; settingsWindow.SetPosition(parent.Width / 2 - settingsWindow.Width / 2, parent.Height / 2 - settingsWindow.Height / 2); Gwen.Control.Label musicLabel = new Gwen.Control.Label(settingsWindow); musicLabel.Text = "Music:"; musicLabel.SetPosition(parent.Width / 10, parent.Height / 10); musicLabel.TextColor = Color.FromArgb(255, 0, 0, 0); musicLabel.Font = Program.fontText; Gwen.Control.HorizontalSlider musicSlider = new Gwen.Control.HorizontalSlider(settingsWindow); musicSlider.SetPosition(parent.Width / 5, parent.Height / 10); musicSlider.SetSize(parent.Width / 10, musicLabel.Height); Gwen.Control.Label sfxLabel = new Gwen.Control.Label(settingsWindow); sfxLabel.Text = "SFX:"; sfxLabel.SetPosition(parent.Width / 10, musicLabel.Y + musicLabel.Height); sfxLabel.TextColor = Color.FromArgb(255, 0, 0, 0); sfxLabel.Font = Program.fontText; Gwen.Control.CheckBox sfxCheckBox = new Gwen.Control.CheckBox(settingsWindow); sfxCheckBox.SetPosition(parent.Width / 5, musicLabel.Y + musicLabel.Height); Gwen.Control.Label fpsLabel = new Gwen.Control.Label(settingsWindow); fpsLabel.Text = "FPS Limit:"; fpsLabel.SetPosition(parent.Width / 10, sfxLabel.Y + sfxLabel.Height); fpsLabel.TextColor = Color.FromArgb(255, 0, 0, 0); fpsLabel.Font = Program.fontText; Gwen.Control.HorizontalSlider fpsSlider = new Gwen.Control.HorizontalSlider(settingsWindow); fpsSlider.SetPosition(parent.Width / 5, sfxLabel.Y + sfxLabel.Height); fpsSlider.SetSize(parent.Width / 10, sfxLabel.Height); Gwen.Control.Label resolutionLabel = new Gwen.Control.Label(settingsWindow); resolutionLabel.Text = "Resolution:"; resolutionLabel.SetPosition(parent.Width / 10, fpsLabel.Y + fpsLabel.Height); resolutionLabel.TextColor = Color.FromArgb(255, 0, 0, 0); resolutionLabel.Font = Program.fontText; Gwen.Control.ComboBox resolution = new ComboBox(settingsWindow); resolution.AddItem("800x600"); resolution.AddItem("1024x768"); resolution.SetPosition(parent.Width / 5, fpsLabel.Y + fpsLabel.Height); resolution.SetSize(parent.Width / 10, resolutionLabel.Height); Gwen.Control.Label fullScreenLabel = new Gwen.Control.Label(settingsWindow); fullScreenLabel.Text = "Full screen:"; fullScreenLabel.SetPosition(parent.Width / 10, resolutionLabel.Y + resolutionLabel.Height); fullScreenLabel.TextColor = Color.FromArgb(255, 0, 0, 0); fullScreenLabel.Font = Program.fontText; Gwen.Control.CheckBox fullScreenCheckBox = new Gwen.Control.CheckBox(settingsWindow); fullScreenCheckBox.SetPosition(parent.Width / 5, resolutionLabel.Y + resolutionLabel.Height); if (fullScreen == true) { fullScreenCheckBox.Toggle(); } fullScreenCheckBox.Checked += fullScreenEnable; fullScreenCheckBox.UnChecked += fullScreenDisable; Gwen.Control.Button buttonOK = new Gwen.Control.Button(this); buttonOK.Text = "OK"; buttonOK.Font = Program.fontButtonLabels; buttonOK.SetBounds(550, 500, 200, 50); buttonOK.Clicked += onButtonOKClick; }