private void CreateControls(Item item, string fields = "") { var textfields = GetTextFields(item); Fields.Controls.Clear(); foreach (var field in textfields) { var border = new GridPanel() { Width = Unit.Percentage(90), Columns = 2 }; var checkbox = new Checkbox() { Header = field.DisplayName, HeaderStyle = "font-weight:bold", ID = Control.GetUniqueID("ctl_cb"), Checked = fields.Contains(string.Concat("|", field.Name, "|")) }; border.Controls.Add(checkbox); border.Controls.Add(new Literal { Text = "<br/>" }); border.Controls.Add(new HtmlTextArea() { ID = checkbox.ID.Replace("cb","ta"), Rows = 5, Cols = 27, Value = field.Value, } ); Fields.Controls.Add(border); } }
public static MvcHtmlString UxCheckbox(this HtmlHelper htmlHelper, string label, string group, string value = "", bool selected = false, LabelPosition position = null, CheckColor color = CheckColor.Blue, bool disabled = false, string clientId = null) { var check = new Checkbox(label, group, value, selected, position, color, disabled, clientId); return htmlHelper.RenderUxControl(check); }
private void BuildCombat() { const int PAGE = 8; ScrollArea rightArea = new ScrollArea(190, 60, 390, 380, true); _innocentColorPickerBox = CreateClickableColorBox(rightArea, 0, 0, Engine.Profile.Current.InnocentHue, "Innocent color", 20, 0); _friendColorPickerBox = CreateClickableColorBox(rightArea, 0, 0, Engine.Profile.Current.FriendHue, "Friend color", 20, 0); _crimialColorPickerBox = CreateClickableColorBox(rightArea, 0, 0, Engine.Profile.Current.CriminalHue, "Criminal color", 20, 0); _genericColorPickerBox = CreateClickableColorBox(rightArea, 0, 0, Engine.Profile.Current.AnimalHue, "Animal color", 20, 0); _murdererColorPickerBox = CreateClickableColorBox(rightArea, 0, 0, Engine.Profile.Current.MurdererHue, "Murderer color", 20, 0); _enemyColorPickerBox = CreateClickableColorBox(rightArea, 0, 0, Engine.Profile.Current.EnemyHue, "Enemy color", 20, 0); _queryBeforAttackCheckbox = CreateCheckBox(rightArea, "Query before attack", Engine.Profile.Current.EnabledCriminalActionQuery, 0, 30); Add(rightArea, PAGE); }
Checkbox AddOption(float x, string text, string tip, bool isChecked) { Checkbox checkbox = new Checkbox(); checkbox.Label.Text = text; checkbox.Label.TextColor = selectedTextColor; checkbox.CheckBoxColor = selectedTextColor; checkbox.ToolTip = defaultToolTip; checkbox.ToolTipText = tip; checkbox.IsChecked = isChecked; checkbox.Position = new Vector2(x, optionPos); optionsPanel.Components.Add(checkbox); optionPos += optionSpacing; return(checkbox); }
/// <summary> /// See actions in XIB file. For Button acion is "ButtonPressed:" /// </summary> /// <param name="sender"></param> public void ButtonPressed(NSButton sender) { // coz there are bugs in mono JIT, so advanced techniques used to build assembly currently causes errors in some cases.. ( Microsoft's VES currenly normally handles such code ) // dont allow proxy objects be directly boxed like Console.WriteLine( "Pressed {0}", sender ); // also don't directly convert to base type line Console.WriteLine( "Pressed {0}", (NSObject)sender ); // use follow workaround Console.WriteLine( "Pressed {0}", new NSObject( sender ) ); //Console.WriteLine( "Pressed {0}", sender ); Console.WriteLine("Pressed {0}", sender.ToString()); var value = new Random().NextDouble(); Progress.setDoubleValue_(value); Slider.setDoubleValue_(value); SpinnedProgress.setDoubleValue_(value); Checkbox.setState_(Checkbox.state() ^ 1); }
Checkbox AddOption(float x, string key, bool isChecked) { Checkbox checkbox = new Checkbox(); checkbox.Label.Text = GetText(key); checkbox.Label.TextColor = selectedTextColor; checkbox.CheckBoxColor = selectedTextColor; checkbox.ToolTip = defaultToolTip; checkbox.ToolTipText = GetText(string.Format("{0}Info", key)); checkbox.IsChecked = isChecked; checkbox.Position = new Vector2(x, optionPos); optionsPanel.Components.Add(checkbox); optionPos += optionSpacing; return(checkbox); }
protected override View CreateControl(string bindingName, Type fieldType) { if (fieldType != typeof(bool) && fieldType != typeof(bool?)) { Debug.WriteLine($"field:{bindingName} error. Wrong type {fieldType.ToString()} should be bool"); return(null); } _checkbox = new Checkbox { }; _checkbox.SetBinding(Checkbox.CheckedProperty, new Binding(bindingName, BindingMode.TwoWay, new NullableConverter(), fieldType)); return(_checkbox); }
protected void NuevoEnvio(object sender, DirectEventArgs e) { grdArchivos.Disabled = true; for (int i = 1; i < 17; i++) { Checkbox chk = ComponentManager.Get("chkDoc" + i.ToString()) as Checkbox; chk.Value = 0; chk.ReadOnly = false; } fileSelector.ReadOnly = false; btnGuardarArchivo.Hidden = false; btnCancelarArchivo.Hidden = false; }
/// <summary> /// 绑定checkbox,点击Grid之后打勾 /// </summary> /// <param name="data"></param> /// <param name="chb"></param> public void BindCheck(string data, Checkbox chb, CheckboxGroup chbGroup) { string[] List = string.IsNullOrEmpty(data) ? new string[] { } : data.Split(','); CheckGroupClear(chb, chbGroup); foreach (string str in List) { for (int i = 0; i < chbGroup.Items.Count(); ++i) { if (chbGroup.Items[i].Tag.ToString().Trim().ToUpper() == str.Trim().ToUpper()) { chbGroup.Items[i].Checked = true; break; } } } }
public void ChooseModificationScope(Scope scope) { string name = ""; if (scope == Scope.OtherPartsOfTheStudy) { name = "Other parts of the study"; } if (scope == Scope.StudyTeamMemberInformation) { name = "Study team member information"; } Checkbox scopePurpose = new Checkbox(By.XPath(".//td[text()='" + name + "']/../td[1]/table/tbody/tr/td/input[1]")); scopePurpose.Click(); }
public override void Setup(Panel parent) { Vector2 pos = settingsStartPos; // About this effect AddTipPanel(parent, TextManager.Instance.GetLocalizedText("colorBoostTip")); // Enable toggle enableCheckbox = AddCheckbox(parent, TextManager.Instance.GetLocalizedText("enable"), ref pos); enableCheckbox.OnToggleState += EnableCheckbox_OnToggleState; // Radius slider radiusSlider = AddSlider(parent, TextManager.Instance.GetLocalizedText("radius"), 500, ref pos); radiusSlider.OnScroll += RadiusSlider_OnScroll; radiusSlider.SetIndicator(0.1f, 50.0f, DaggerfallUnity.Settings.ColorBoostRadius); StyleIndicator(radiusSlider); // Intensity slider intensitySlider = AddSlider(parent, TextManager.Instance.GetLocalizedText("intensity"), 10, ref pos); intensitySlider.OnScroll += IntensitySlider_OnScroll; intensitySlider.SetIndicator(0.0f, 1.0f, DaggerfallUnity.Settings.ColorBoostIntensity); StyleIndicator(intensitySlider); // Dungeon Scale slider dungeonScaleSlider = AddSlider(parent, TextManager.Instance.GetLocalizedText("dungeonScale"), 80, ref pos); dungeonScaleSlider.OnScroll += DungeonScaleSlider_OnScroll; dungeonScaleSlider.SetIndicator(0.0f, 8.0f, DaggerfallUnity.Settings.ColorBoostDungeonScale); StyleIndicator(dungeonScaleSlider); // Interior Scale slider interiorScaleSlider = AddSlider(parent, TextManager.Instance.GetLocalizedText("interiorScale"), 80, ref pos); interiorScaleSlider.OnScroll += InteriorScaleSlider_OnScroll; interiorScaleSlider.SetIndicator(0.0f, 8.0f, DaggerfallUnity.Settings.ColorBoostInteriorScale); StyleIndicator(interiorScaleSlider); // Exterior Scale slider exteriorScaleSlider = AddSlider(parent, TextManager.Instance.GetLocalizedText("exteriorScale"), 80, ref pos); exteriorScaleSlider.OnScroll += ExteriorScaleSlider_OnScroll; exteriorScaleSlider.SetIndicator(0.0f, 8.0f, DaggerfallUnity.Settings.ColorBoostExteriorScale); StyleIndicator(exteriorScaleSlider); // Dungeon falloff dungeonFalloffSlider = AddSlider(parent, TextManager.Instance.GetLocalizedText("dungeonFalloff"), 80, ref pos); dungeonFalloffSlider.OnScroll += DungeonFalloffSlider_OnScroll; dungeonFalloffSlider.SetIndicator(0.0f, 8.0f, DaggerfallUnity.Settings.ColorBoostDungeonFalloff); StyleIndicator(dungeonFalloffSlider); }
public TreeTest(ControlBase parent) : base(parent) { TreeControl tree = new TreeControl(parent); tree.SelectionChanged += (o, e) => { if (tree.SelectedChildren.Count == 2) { tree.SelectedChildren[1].Parent.RemoveChild(tree.SelectedChildren[1], true); } }; tree.Margin = Margin.Five; Checkbox cb = new Checkbox(parent); cb.Dock = Dock.Bottom; cb.Text = "Multiselect"; cb.CheckChanged += (o, e) => { tree.AllowMultiSelect = cb.IsChecked; }; tree.Dock = Dock.Fill; tree.AllowMultiSelect = true; cb.IsChecked = tree.AllowMultiSelect; for (int i = 0; i < 10; i++) { var root = tree.AddNode("root " + i); if (i == 0) { for (int ix = 0; ix < 100; ix++) { var node = root.AddNode("for large scale"); } } for (int ix = 0; ix < 10; ix++) { var node = root.AddNode("child " + ix + " of root " + i); if (i == 0) { node.AddNode("subnode that has a really long label so we can trigger the scrollbar................").AddNode("f**k you").AddNode("seriously").AddNode(" i want to die"); } } if (i == 1 || i == 5 || i == 8) { root.ExpandAll(); } } }
private void Video(Panel leftPanel, Panel rightPanel) { // Basic settings AddSectionTitle(leftPanel, "basic"); resolution = AddSlider(leftPanel, "resolution", Array.FindIndex(resolutions, x => x.width == DaggerfallUnity.Settings.ResolutionWidth && x.height == DaggerfallUnity.Settings.ResolutionHeight), resolutions.Select(x => string.Format("{0}x{1}", x.width, x.height)).ToArray()); resolution.OnScroll += Resolution_OnScroll; fullscreen = AddCheckbox(leftPanel, "fullscreen", DaggerfallUnity.Settings.Fullscreen); //exclusiveFullscreen = AddCheckbox(leftPanel, "exclusiveFullscreen", DaggerfallUnity.Settings.ExclusiveFullscreen); fullscreen.OnToggleState += Fullscreen_OnToggleState; //exclusiveFullscreen.OnToggleState += ExclusiveFullscreen_OnToggleState; runInBackground = AddCheckbox(leftPanel, "runInBackground", DaggerfallUnity.Settings.RunInBackground); qualityLevel = AddSlider(leftPanel, "qualityLevel", DaggerfallUnity.Settings.QualityLevel, QualitySettings.names); qualityLevel.OnScroll += QualityLevel_OnScroll; string[] filterModes = new string[] { "Point", "Bilinear", "Trilinear" }; mainFilterMode = AddSlider(leftPanel, "mainFilterMode", DaggerfallUnity.Settings.MainFilterMode, filterModes); guiFilterMode = AddSlider(leftPanel, "guiFilterMode", DaggerfallUnity.Settings.GUIFilterMode, filterModes); videoFilterMode = AddSlider(leftPanel, "videoFilterMode", DaggerfallUnity.Settings.VideoFilterMode, filterModes); y = 0; // Advanced settings AddSectionTitle(rightPanel, "advanced"); fovSlider = AddSlider(rightPanel, "fovSlider", 60, 80, DaggerfallUnity.Settings.FieldOfView); terrainDistance = AddSlider(rightPanel, "terrainDistance", 1, 4, DaggerfallUnity.Settings.TerrainDistance); shadowResolutionMode = AddSlider(rightPanel, "shadowResolutionMode", DaggerfallUnity.Settings.ShadowResolutionMode, "Low", "Medium", "High", "Very High"); dungeonLightShadows = AddCheckbox(rightPanel, "dungeonLightShadows", DaggerfallUnity.Settings.DungeonLightShadows); interiorLightShadows = AddCheckbox(rightPanel, "interiorLightShadows", DaggerfallUnity.Settings.InteriorLightShadows); exteriorLightShadows = AddCheckbox(rightPanel, "exteriorLightShadows", DaggerfallUnity.Settings.ExteriorLightShadows); string textureArrayLabel = "Texture Arrays: "; if (!SystemInfo.supports2DArrayTextures) { textureArrayLabel += "Unsupported"; } else { textureArrayLabel += DaggerfallUnity.Settings.EnableTextureArrays ? "Enabled" : "Disabled"; } AddInfo(rightPanel, textureArrayLabel, "Improved implementation of terrain textures, with better performance and modding support"); retroRenderingMode = AddSlider(rightPanel, "retroRenderingMode", DaggerfallUnity.Settings.RetroRenderingMode, "Off", "320x200", "640x400"); postProcessingInRetroMode = AddSlider(rightPanel, "postProcessingInRetroMode", DaggerfallUnity.Settings.PostProcessingInRetroMode, "Off", "Posterization (full)", "Posterization (-sky)", "Palettization (full)", "Palettization (-sky)"); }
public JournalGump() : base(Constants.JOURNAL_LOCALSERIAL, 0) { Height = 300; CanMove = true; CanCloseWithRightClick = true; Add(_gumpPic = new GumpPic(160, 0, 0x82D, 0)); Add(_background = new ExpandableScroll(0, _diffY, Height - _diffY, 0x1F40) { TitleGumpID = 0x82A }); const ushort DARK_MODE_JOURNAL_HUE = 903; string str = "Dark mode"; int width = FontsLoader.Instance.GetWidthASCII(6, str); Checkbox darkMode; Add(darkMode = new Checkbox(0x00D2, 0x00D3, str, 6, 0x0288, false) { X = _background.Width - width - 2, Y = _diffY + 7, IsChecked = ProfileManager.Current.JournalDarkMode }); Hue = (ushort)(ProfileManager.Current.JournalDarkMode ? DARK_MODE_JOURNAL_HUE : 0); darkMode.ValueChanged += (sender, e) => { var ok = ProfileManager.Current.JournalDarkMode = !ProfileManager.Current.JournalDarkMode; Hue = (ushort)(ok ? DARK_MODE_JOURNAL_HUE : 0); }; _scrollBar = new ScrollFlag(-25, _diffY + 36, Height - _diffY, true); Add(_journalEntries = new RenderedTextList(25, _diffY + 36, _background.Width - (_scrollBar.Width >> 1) - 5, 200, _scrollBar)); Add(_scrollBar); Add(_hitBox = new HitBox(160, 0, 23, 24)); _hitBox.MouseUp += _hitBox_MouseUp; _gumpPic.MouseDoubleClick += _gumpPic_MouseDoubleClick; InitializeJournalEntries(); World.Journal.EntryAdded += AddJournalEntry; }
/// <summary> /// Builds the Checkboxes to select indexes /// </summary> /// <param name="name"> /// The name. /// </param> /// <param name="header"> /// The header. /// </param> /// <param name="selected"> /// The selected. /// </param> /// <param name="indexMap"> /// The index map. /// </param> private void BuildIndexCheckbox(string name, string header, ListString selected, ListString indexMap) { Assert.ArgumentNotNull(name, "name"); Assert.ArgumentNotNull(header, "header"); Assert.ArgumentNotNull(selected, "selected"); Assert.ArgumentNotNull(indexMap, "indexMap"); var child = new Checkbox(); this.Indexes.Controls.Add(child); child.ID = Control.GetUniqueID("dk_"); child.Header = header; child.Value = name; child.Checked = selected.Contains(name); indexMap.Add(child.ID); indexMap.Add(name); this.Indexes.Controls.Add(new LiteralControl("<br />")); }
protected IActionResult CommonReplaces(string htmlName) { var html = this.getHtml.GetContent(htmlName); var script = TagHelper.ToHtml(HtmlHelper.GetBodyScript()); html = html.Replace("{{script}}", script); var css = TagHelper.ToHtml(HtmlHelper.GetHeadCss()); html = html.Replace("{{css}}", css); html = html.Replace("{{copyright}}", HtmlHelper.GetCopyRight()); html = html.Replace("{{navbar}}", Navigation.GetNavbar()); html = html.Replace("{{footernav}}", HtmlHelper.GetFooter()); if (htmlName == HtmlFile.ContactUsHtml) { html = html.Replace("navbar navbar-primary navbar-transparent navbar-absolute", "navbar navbar-inverse navbar-fixed-top"); } if (htmlName == HtmlFile.IndexHtml) { html = html.Replace("{{ManualRotatingCards}}", new ManualRotatingCard().ToHtml()); html = html.Replace("{{table}}", new Table().ToHtml()); html = html.Replace("{{Tooltips}}", Tooltip.Generate()); html = html.Replace("{{Popovers}}", Popovers.Generate()); html = html.Replace("{{buttons}}", Button.Generate()); html = html.Replace("{{pickSizeButtons}}", XSmallButton.Generate()); html = html.Replace("{{ColoredButton}}", ColoredButton.Generate()); html = html.Replace("{{Input}}", LabeledInput.Generate()); html = html.Replace("{{Checkbox}}", Checkbox.Generate()); html = html.Replace("{{RadioButton}}", RadioButton.Generate()); html = html.Replace("{{ToggleButton}}", ToggleButton.Generate()); html = html.Replace("{{Dropdown}}", new Dropdown().ToHtml()); html = html.Replace("{{Textarea}}", new Textarea().ToHtml()); html = html.Replace("{{SelectPicker}}", new SingleSelect().ToHtml()); html = html.Replace("{{MultipleSelect}}", new MultipleSelect().ToHtml()); html = html.Replace("{{Tags}}", new HtmlTag().ToHtml()); } if (htmlName == HtmlFile.ScheduleHtml) { html = html.Replace("{{ManualRotatingCards}}", new SchedulePage().ToHtml()); } return(this.HtmlResult(html)); }
/// <summary> /// Функция инициализации чекбоксов версии ПО /// </summary> private void Initialize_CheckBox_Software_Labels() { Query_Dysplay_Checkboxes_Software_Label = new List <Checkbox>(); foreach (string str in m.Software_Labels) { Checkbox added_checkbox = new Checkbox(str); added_checkbox.CheckboxChanged += CheckboxChanged_Handler; Query_Dysplay_Checkboxes_Software_Label.Add(added_checkbox); } // получение статистики foreach (Checkbox checkbox in Query_Dysplay_Checkboxes_Software_Label) { IEnumerable <Model.Verification_Results_by_Case> results = m.Results_by_Case.Where(x => x.Software_Label.Equals(checkbox.Name)).Select(x => x); checkbox.Amount = results.Count(); } }
public void CheckboxDiscovery() { Driver.Navigate().GoToUrl("http://the-internet.herokuapp.com/checkboxes"); IReadOnlyCollection <IWebElement> Checkboxes = Driver.FindElements(By.CssSelector("input[type=\"checkbox\"]")); Console.Write("With .attribute('checked')"); foreach (IWebElement Checkbox in Checkboxes) { Console.WriteLine(Checkbox.GetAttribute("checked")); } Console.WriteLine("With .selected?"); foreach (IWebElement Checkbox in Checkboxes) { Console.WriteLine(Checkbox.Selected); } }
/// <summary> /// Add a checkbox option. /// </summary> private Checkbox AddCheckbox(Panel panel, string text, string tip, bool isChecked) { Checkbox checkbox = new Checkbox(); checkbox.Label.Text = text; checkbox.Label.TextColor = itemColor; checkbox.Label.TextScale = itemTextScale; checkbox.CheckBoxColor = itemColor; checkbox.ToolTip = defaultToolTip; checkbox.ToolTipText = tip; checkbox.IsChecked = isChecked; checkbox.Position = new Vector2(0, y); panel.Components.Add(checkbox); y += itemSpacing; return(checkbox); }
public void WhenCheckBoxInvoked_ThenViewModelIsUpdated(string key, string value) { var values = new Dictionary <string, string>() { { key, value } }; var component = new Checkbox(); component.ViewComponentContext = ViewComponentTestHelper.GetViewComponentContext(); ViewViewComponentResult result = component.Invoke(values) as ViewViewComponentResult; CheckBoxModel resultModel = (CheckBoxModel)result.ViewData.Model; //Assert Assert.AreEqual(value, ViewComponentTestHelper.GetPropertyValue(resultModel, key)); }
private void SetChannelValue(string function, ComboBox combo, Checkbox check, InputManager.JoyStickAxis defaultAxis) { bool inverted = false; InputManager.JoyStickAxis axis = owner.InputManager.GetAxis(function, out inverted); switch (axis) { case InputManager.JoyStickAxis.X: combo.SetSelectedByData(1); break; case InputManager.JoyStickAxis.Y: combo.SetSelectedByData(2); break; case InputManager.JoyStickAxis.Z: combo.SetSelectedByData(3); break; case InputManager.JoyStickAxis.Rx: combo.SetSelectedByData(4); break; case InputManager.JoyStickAxis.Ry: combo.SetSelectedByData(5); break; case InputManager.JoyStickAxis.Rz: combo.SetSelectedByData(6); break; case InputManager.JoyStickAxis.Slider1: combo.SetSelectedByData(7); break; case InputManager.JoyStickAxis.Slider2: combo.SetSelectedByData(8); break; case InputManager.JoyStickAxis.None: combo.SetSelectedByData(9); break; } check.IsChecked = inverted; }
public MatchLobbyPlayerSection(Player Player, MatchLobby Lobby, bool Enabled) : base("match-lobby-player-section") { this.Player = Player; var header = new Button("match-lobby-player-section-header") { DisplayedString = Player.Name }; var select = new Select <ArmyConfiguration>("match-lobby-player-section-select"); var ready = new Checkbox("match-lobby-player-section-checkbox"); select.Add(new SelectionOption <ArmyConfiguration>("match-lobby-player-section-select-option") { DisplayedString = "Spectator", Value = null }); foreach (ArmyConfiguration a in Lobby.Scenario.ArmyConfigurations) { select.Add(new SelectionOption <ArmyConfiguration>("match-lobby-player-section-select-option") { DisplayedString = a.Faction.Name, Value = a }); } if (Enabled) { select.OnChange += HandleArmyConfigurationSelected; } select.Position = new Vector2f(0, header.Size.Y + 6); select.Enabled = Enabled && !Lobby.GetPlayerReady(Player); select.SetValue(i => i.Value == Lobby.GetPlayerArmy(Player)); if (Enabled) { ready.OnChange += HandlePlayerReadyStateChanged; } ready.Position = new Vector2f(Size.X - ready.Size.X - 16, 0); ready.Value = Lobby.GetPlayerReady(Player); ready.Enabled = Enabled; Add(header); Add(select); Add(ready); }
public override void Setup(Panel parent) { Vector2 pos = settingsStartPos; // About this effect AddTipPanel(parent, TextManager.Instance.GetLocalizedText("retroModeTip")); // Mode slider string[] modes = new string[] { TextManager.Instance.GetLocalizedText("retroModeOff"), TextManager.Instance.GetLocalizedText("retroMode320x200"), TextManager.Instance.GetLocalizedText("retroMode640x400"), }; modeSlider = AddSlider(parent, TextManager.Instance.GetLocalizedText("mode"), modes.Length, ref pos); modeSlider.OnScroll += ModeSlider_OnScroll; modeSlider.SetIndicator(modes, DaggerfallUnity.Settings.RetroRenderingMode); StyleIndicator(modeSlider); // PostProcess Slider string[] postProcessModes = new string[] { TextManager.Instance.GetLocalizedText("off"), TextManager.Instance.GetLocalizedText("posterizationFull"), TextManager.Instance.GetLocalizedText("posterizationMinusSky"), TextManager.Instance.GetLocalizedText("palettizationFull"), TextManager.Instance.GetLocalizedText("palettizationMinusSky"), }; postProcessSlider = AddSlider(parent, TextManager.Instance.GetLocalizedText("postProcess"), postProcessModes.Length, ref pos); postProcessSlider.OnScroll += PostProcessSlider_OnScroll; postProcessSlider.SetIndicator(postProcessModes, DaggerfallUnity.Settings.PostProcessingInRetroMode); StyleIndicator(postProcessSlider); // Aspect Correction Checkboxes // Not using a slider as the sudden rescale in UI can cause aspect to bounce back and forth based on mouse position while dragging slider thumb AddLabel(parent, TextManager.Instance.GetLocalizedText("retroModeAspectCorrection"), ref pos); pos.y += yIncrement; aspectCorrectionOff = AddCheckbox(parent, TextManager.Instance.GetLocalizedText("off"), ref pos); aspectCorrectionOff.OnToggleState += AspectCorrectionOff_OnToggleState; aspectCorrectionFourThree = AddCheckbox(parent, TextManager.Instance.GetLocalizedText("FourThree"), ref pos); aspectCorrectionFourThree.OnToggleState += AspectCorrectionFourThree_OnToggleState; aspectCorrectionSixteenTen = AddCheckbox(parent, TextManager.Instance.GetLocalizedText("SixteenTen"), ref pos); aspectCorrectionSixteenTen.OnToggleState += AspectCorrectionSixteenTen_OnToggleState; UpdateAspectButtons(); }
static Checkbox LoadCheckbox(Stream fs) { var obj = new Checkbox(ReadString(fs), ReadString(fs), ReadFont(fs), ReadInt(fs), ReadInt(fs), ReadBool(fs)) { Enabled = ReadBool(fs), Visible = ReadBool(fs), Width = ReadInt(fs), Height = ReadInt(fs), BackgroundBottom = ReadColor(fs), BackgroundTop = ReadColor(fs), BorderColor = ReadColor(fs), ForeColor = ReadColor(fs), MarkColor = ReadColor(fs), MarkSelectedColor = ReadColor(fs) }; return(obj); }
public TimePeriodsPage VerifyTimeViewsOnCalendar(List <string> months) { LoggerPage.LogStart(MethodBase.GetCurrentMethod().Name); foreach (var month in months) { var validateTimePeriod = new Checkbox(By.XPath( $"//*[@id='timePeriods-panel']//div[@class='applied-values__item-name' and contains(text(),'{month}')]")) .IsChecked(); Assert.IsTrue(validateTimePeriod); } LoggerPage.LogEnd(MethodBase.GetCurrentMethod().Name); return(this); }
public void chkTipoPessoa_Check(object sender, DirectEventArgs e) { Checkbox chk = (Checkbox)sender; int IdTipoPessoa = int.Parse(e.ExtraParams["IdTipoPessoa"]); if (chk != null) { if (IdTipoPessoa == (int)Constantes.TipoPessoa.Aluno) { PanelResponsaveis.Disabled = !chk.Checked; } if (IdTipoPessoa == (int)Constantes.TipoPessoa.Responsavel) { PanelCadastroDependentes.Disabled = !chk.Checked; } } }
private void RefreshControls() { Controls.Clear(); GameObject[] temp = GameObject.FindGameObjectsWithTag("Button"); for (int i = 0; i < temp.Length; i++) { Button button = temp[i].GetComponent <Button>(); if (!Controls.Contains(button)) { Controls.Add(button); } } temp = GameObject.FindGameObjectsWithTag("Slider"); for (int i = 0; i < temp.Length; i++) { Slider slider = temp[i].GetComponent <Slider>(); if (!Controls.Contains(slider)) { Controls.Add(slider); } } temp = GameObject.FindGameObjectsWithTag("Checkbox"); for (int i = 0; i < temp.Length; i++) { Checkbox checkbox = temp[i].GetComponent <Checkbox>(); if (!Controls.Contains(checkbox)) { Controls.Add(checkbox); } } temp = GameObject.FindGameObjectsWithTag("Spin"); for (int i = 0; i < temp.Length; i++) { Spin spin = temp[i].GetComponent <Spin>(); if (!Controls.Contains(spin)) { Controls.Add(spin); } } }
private void BuildSounds() { const int PAGE = 2; ScrollArea rightArea = new ScrollArea(190, 60, 390, 380, true); _enableSounds = CreateCheckBox(rightArea, "Sounds", Engine.Profile.Current.EnableSound, 0, 0); ScrollAreaItem item = new ScrollAreaItem(); Label text = new Label("- Sounds volume:", true, 0, 0, 1); _soundsVolume = new HSliderBar(150, 5, 180, 0, 100, Engine.Profile.Current.SoundVolume, HSliderBarStyle.MetalWidgetRecessedBar, true, 1); item.Add(text); item.Add(_soundsVolume); rightArea.Add(item); _enableMusic = CreateCheckBox(rightArea, "Music", Engine.Profile.Current.EnableMusic, 0, 0); item = new ScrollAreaItem(); text = new Label("- Music volume:", true, 0, 0, 1); _musicVolume = new HSliderBar(150, 5, 180, 0, 100, Engine.Profile.Current.MusicVolume, HSliderBarStyle.MetalWidgetRecessedBar, true, 1); item.Add(text); item.Add(_musicVolume); rightArea.Add(item); _footStepsSound = CreateCheckBox(rightArea, "Footsteps sound", Engine.Profile.Current.EnableFootstepsSound, 0, 30); _combatMusic = CreateCheckBox(rightArea, "Combat music", Engine.Profile.Current.EnableCombatMusic, 0, 0); _musicInBackground = CreateCheckBox(rightArea, "Reproduce music when ClassicUO is not focused", Engine.Profile.Current.ReproduceSoundsInBackground, 0, 0); _loginMusic = CreateCheckBox(rightArea, "Login music", Engine.GlobalSettings.LoginMusic, 0, 40); item = new ScrollAreaItem(); text = new Label("- Login music volume:", true, 0, 0, 1); _loginMusicVolume = new HSliderBar(150, 5, 180, 0, 100, Engine.GlobalSettings.LoginMusicVolume, HSliderBarStyle.MetalWidgetRecessedBar, true, 1); item.Add(text); item.Add(_loginMusicVolume); rightArea.Add(item); Add(rightArea, PAGE); }
public FCheckBox() { InitializeComponent(); myLayout.Margin = new Thickness(10, 0, 10, 0); var myScroll = new ScrollView(); var myStack = new StackLayout(); myScroll.Content = myStack; //myLayout.Children.Add(myScroll); HtmlLabel kerdes = new HtmlLabel(); kerdes.Text = Constans.aktQuestion.question_title; kerdes.FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)); kerdes.Margin = new Thickness(1, 1, 1, 10); myStack.Children.Add(kerdes); foreach (var item in Constans.aktQuestion.choices) { string buttonDuma = item; Checkbox button = new Checkbox(); if (item.Substring(item.Length - 2, 2) == ";O") { button.KellEOther = true; buttonDuma = item.Substring(0, item.Length - 2 - 1); } button.Text = buttonDuma; //button.HorizontalOptions = LayoutOptions.Start; //button.FontSize = "Large"; button.FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)); button.BackgroundColor = Color.Transparent; button.Margin = new Thickness(10, 0, 10, 0); button.Padding = new Thickness(1, -5, 1, -5); listCheckbox.Add(button); //button.Opacity = 1; button.CheckedChange += Button_CheckedChange; button.EntryChange += Button_EntryChange; myStack.Children.Add(button); } myLayout.Children.Add(myScroll); }
public MapSelectView() { mTitleLabel = new Label { FontSize = 30.0f, Position = new Vector2(30.0f, 15.0f), Size = new Vector2(float.MaxValue, 40.0f), Text = "Please select the map you want to edit" }; mLabelScroll = new Scrollbar { Vertical = true }; mAlphabeticCheckbox = new Checkbox { Checked = true, Text = "Sort alphabetically", Size = 16 }; mFilterBox = new EditBox { Width = 200 }; mFilterDesc = new Label { Color = Brushes.White, FontSize = 16, HorizontalAlignment = TextAlignment.Leading, VerticalAlignment = ParagraphAlignment.Center, Size = new Vector2(float.MaxValue, 18), Multiline = false, Text = "Filter maps:" }; mFilterBox.TextChanged += OnUpdateFilterText; mAlphabeticCheckbox.CheckChanged += (box, check) => OnChangeAlphabeticalOrder(check); mLabelScroll.ScrollChanged += OnScroll; }
private void load() { Add(pauseCheckbox = new OsuCheckbox { LabelText = "Pause", RelativeSizeAxes = Axes.None, AutoSizeAxes = Axes.Y, Width = 100, Origin = Anchor.TopLeft, Anchor = Anchor.TopLeft, Margin = new MarginPadding { Top = 40f, Left = 10f }, Depth = Single.NegativeInfinity, Current = { BindTarget = pausedBindable } }); pausedBindable.ValueChanged += e => Player?.SetGameplayClockPaused(e.NewValue); }
public void SelectRoles(params Roles[] roles) { string name = ""; foreach (var role in roles) { switch (role) { case Roles.CoInvestigator: { name = "Co-investigator"; break; } case Roles.DataAnalyst: { name = "Data Analyst"; break; } case Roles.ResearchAssistant: { name = "Research Assistant"; break; } case Roles.Statistician: { name = "Statistician"; break; } case Roles.LayObserver: { name = "Lay Observer"; break; } } var chkbox = new Checkbox(By.XPath(".//td[contains(.,'" + name + "')]/../td/table/tbody/tr/td/input[1]")); chkbox.Click(); Trace.WriteLine("Checking option: " + role); } }
protected override void Initialize() { base.Initialize(); _checkbox1 = new Checkbox { Location = new Point { Left = 3, Top = 4 }, Text = "Checkbox tentative" }; RootPanel.AddChild(_checkbox1); _img1 = new Image() { }; }
/// <summary> /// Displays all current publishing schedules ordered by date and time /// </summary> private void RenderAllSchedules() { StringBuilder sbHeader = new StringBuilder(); sbHeader.Append("<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\">"); sbHeader.Append("<col />"); sbHeader.Append("<col />"); sbHeader.Append("<col />"); sbHeader.Append("<col />"); sbHeader.Append("<tr style=\"background:#e9e9e9\">"); sbHeader.Append("<td nowrap=\"nowrap\"><b>" + "Item" + "</b></td>"); sbHeader.Append("<td nowrap=\"nowrap\"><b>" + "Action" + "</b></td>"); sbHeader.Append("<td nowrap=\"nowrap\"><b>" + "Date" + "</b></td>"); sbHeader.Append("<td nowrap=\"nowrap\"><b>" + "Delete" + "</b></td>"); sbHeader.Append("</tr>"); AllSchedules.Controls.Add(new LiteralControl(sbHeader.ToString())); IEnumerable<PublishSchedule> allSchedules = _scheduledPublishRepo.AllUnpublishedSchedules; foreach (var schedule in allSchedules) { if (schedule.InnerItem != null) { StringBuilder sbItem = new StringBuilder(); // Item name and path sbItem.Append("<tr style='background:#cedff2;border-bottom:1px solid #F0F1F2;'>"); Item scheduledItem = schedule.ItemToPublish; sbItem.Append("<td><b>" + scheduledItem.DisplayName + "</b><br />" + scheduledItem.Paths.FullPath + "</td>"); // Is publishing/unpublishing sbItem.Append("<td style='border-left:1px solid #F0F1F2;'>"); string isUnpublishing = schedule.Unpublish ? "Unpublish" : "Publish"; sbItem.Append(isUnpublishing); sbItem.Append("</td><td style='border-left:1px solid #F0F1F2;'>"); // Current scheudled publish date and time AllSchedules.Controls.Add(new LiteralControl(sbItem.ToString())); DateTime pbDate = schedule.PublishDate; AllSchedules.Controls.Add(new LiteralControl(pbDate.ToString(_culture))); // Pick new date and time DateTimePicker dtPicker = new DateTimePicker(); dtPicker.ID = "dt_" + schedule.InnerItem.ID; dtPicker.Width = new Unit(100.0, UnitType.Percentage); dtPicker.Value = DateUtil.ToIsoDate(schedule.PublishDate); AllSchedules.Controls.Add(dtPicker); AllSchedules.Controls.Add(new LiteralControl("</td>")); // Delete schedule AllSchedules.Controls.Add(new LiteralControl("<td style='border-left:1px solid #F0F1F2;'>")); Checkbox deleteCheckbox = new Checkbox(); deleteCheckbox.ID = "del_" + schedule.InnerItem.ID; AllSchedules.Controls.Add(deleteCheckbox); AllSchedules.Controls.Add(new LiteralControl("</td></tr>")); } } AllSchedules.Controls.Add(new LiteralControl("</table")); }
/// <summary> /// Create the credits screen, an overlay screen, and its contents. /// </summary> public OptionScreen() : base(new Point(800, 600), new Rectangle(0, 0, Core.ClientBounds.Width, Core.ClientBounds.Height), Color.White, 0.9f) { // Load textures. mFrameHor = Core.Content.Load<Texture2D>("Textures/wallTop"); mFrameVer = Core.Content.Load<Texture2D>("Textures/wallSide"); // Calculate frame positions. int width = 52; mFrameHorPos1 = new Rectangle(mPosition.X, mPosition.Y, mPosition.Width, width); mFrameHorPos2 = new Rectangle(mPosition.X, mPosition.Y + mPosition.Height - width, mPosition.Width, width); mFrameVerPos1 = new Rectangle(mPosition.X, mPosition.Y + width, width, mPosition.Height - width * 2); mFrameVerPos2 = new Rectangle(mPosition.X + mPosition.Width - width, mPosition.Y + width, width, mPosition.Height - width * 2); // Create checkboxes. int chkX = mPosition.X + 96; int chkStartY = mPosition.Y + 128; mChkFullscreen = new Checkbox(new Vector2(chkX, chkStartY), "Show in fullscreen"); int chkStrideY = mChkFullscreen.Size.Y + 16; mChkPlaySounds = new Checkbox(new Vector2(chkX, chkStartY + chkStrideY), "Play sounds"); mChkShowShapes = new Checkbox(new Vector2(chkX, chkStartY + chkStrideY * 2), "Show shapes on balls"); mChkShowHelpAim = new Checkbox(new Vector2(chkX, chkStartY + chkStrideY * 3), "Show helper aim"); // Create shortcut keys text list. mShortcutKeys = new List<TextLine>(); float textScale = 0.8f; int txtEndX = mPosition.X + mPosition.Width - 96; Color txtKeyCol = Color.Goldenrod; mShortcutKeys.Add(new TextLine("Ctrl + Enter", txtKeyCol, new Vector2(txtEndX, mChkFullscreen.TextPosition.Y), false, textScale)); mShortcutKeys.Add(new TextLine("S or F8", txtKeyCol, new Vector2(txtEndX, mChkPlaySounds.TextPosition.Y), false, textScale)); mShortcutKeys.Add(new TextLine("F1", txtKeyCol, new Vector2(txtEndX, mChkShowShapes.TextPosition.Y), false, textScale)); mShortcutKeys.Add(new TextLine("F2", txtKeyCol, new Vector2(txtEndX, mChkShowHelpAim.TextPosition.Y), false, textScale)); // Create other texts. Color titleColour = new Color(142, 217, 184, 255); Color txtCol = Color.Ivory; int infoStartY = chkStartY + chkStrideY * 4 + 16; mSettingsTitle = new TextLine("Settings", titleColour, new Vector2(chkX, chkStartY - 64)); mShortcutTitle = new TextLine("Shortcut", titleColour, new Vector2(txtEndX, chkStartY - 64), false); mInfoTitle = new TextLine("In-game key commands", titleColour, new Vector2(chkX, infoStartY)); mInfoText1 = new TextLine("To pause the game, press the 'P' key.\n", txtCol, new Vector2(chkX, infoStartY + chkStrideY), true, textScale); mInfoText2 = new TextLine("To move the mouse cursor to the middle\nof the score board, " + "press the 'Space' key.", txtCol, new Vector2(chkX, infoStartY + chkStrideY * 2 - 8), true, textScale); mShortcutKeys.Add(new TextLine("P", txtKeyCol, new Vector2(chkX + 452, infoStartY + chkStrideY), true, textScale)); mShortcutKeys.Add(new TextLine("\nSpace", txtKeyCol, new Vector2(chkX + 448, infoStartY + chkStrideY * 2 - 8), true, textScale)); // Add buttons. mButtons = new List<Button>(); int centerX = (int)(mPosition.X + mPosition.Width * 0.5f); int btnWidth = 336; int btnHeight = (int)(width * 0.95f); int btnHalfPadding = 16; int btnY = mPosition.Y + mPosition.Height - btnHeight; mButtons.Add(new Button(BtnCloseClick, new Rectangle(centerX - btnWidth - btnHalfPadding, btnY, btnWidth, btnHeight), "Cancel")); mButtons.Add(new Button(BtnSaveClick, new Rectangle(centerX + btnHalfPadding, btnY, btnWidth, btnHeight), "Save & Return")); }
static void Main(string[] args) { var mainPanel = new Panel(); mainPanel.Name = "mainPanle"; mainPanel.Width = Application.STANDARD_ROOT_BOUNDARY.Width - 12; mainPanel.Height = Application.STANDARD_ROOT_BOUNDARY.Height - 6; mainPanel.Top = 3; mainPanel.Left = 6; #region Left Side var leftBox = new Groupbox(); leftBox.Name = "leftBox"; leftBox.Header = "Left Box"; leftBox.Top = leftBox.Left = 0; leftBox.Width = mainPanel.Width / 2; leftBox.Height = mainPanel.Height; var lblLeftStatus = new Label("Status:"); lblLeftStatus.Name = "lblLeftStatus"; lblLeftStatusText = new Label(); lblLeftStatusText.Name = "lblLeftStatusText"; lblLeftStatusText.Left = lblLeftStatus.Text.Length; lblLeftStatusText.Width = leftBox.Width - lblLeftStatus.Width; lblLeftStatusText.Align = ContentAlign.Right; var btnLeftIncrement = new Button("Increment"); btnLeftIncrement.Top = 1; btnLeftIncrement.Name = "btnLeftIncrement"; btnLeftIncrement.Pressed += BtnLeftIncrementOnPressed; var btnLeftClear = new Button("Clear"); btnLeftClear.Top = 2; btnLeftClear.Name = "btnLeftClear"; btnLeftClear.Pressed += (sender, eventArgs) => lblLeftStatusText.Text = ""; var txtLeftText = new Textbox(); txtLeftText.Text = "asd123"; txtLeftText.Top = 3; txtLeftText.Left = 21; txtLeftText.Width = 10; txtLeftText.BackColor = ConsoleColor.Gray; txtLeftText.ForeColor = ConsoleColor.Black; txtLeftText.Name = "txtLeftText"; txtLeftText.EnterPressed += (sender, eventArgs) => lblLeftStatusText.Text = txtLeftText.Text; var btnLeftSetText = new Button("Set this text =>"); btnLeftSetText.Top = 3; btnLeftSetText.Name = "btnLeftSetText"; btnLeftSetText.Pressed += (sender, eventArgs) => lblLeftStatusText.Text = txtLeftText.Text; var chkLeftMoveDir = new Checkbox("Move button up"); chkLeftMoveDir.Top = 5; chkLeftMoveDir.Left = 12; chkLeftMoveDir.Name = "chkLeftMoveDir"; chkLeftMoveDir.Checked = CheckState.Unchecked; var prgLeftMoveButton = new Progressbar(); prgLeftMoveButton.Top = 6; prgLeftMoveButton.Left = 12; prgLeftMoveButton.Name = "prgLeftMoveButton"; prgLeftMoveButton.Width = chkLeftMoveDir.Text.Length + 4; prgLeftMoveButton.Value = 10; var lblLeftPrgDesc = new Label(@"^ Progressbar ^"); lblLeftPrgDesc.Top = 7; lblLeftPrgDesc.Left = 14; lblLeftPrgDesc.Name = "lblLeftPrgDesc"; var myPlayground = new Playground(7, 14); myPlayground.Name = "playground"; myPlayground.Top = 9; myPlayground.Left = 14; myPlayground.BackColor = ConsoleColor.Blue; myPlayground.ForeColor = ConsoleColor.Red; myPlayground[0, 0] = 'x'; myPlayground[2, 2] = 'x'; myPlayground[4, 4] = 'x'; myPlayground[6, 6] = 'o'; myPlayground[4, 8] = 'x'; myPlayground[2, 10] = 'x'; myPlayground[0, 12] = 'x'; var btnLeftMove = new Button("Move"); btnLeftMove.Top = 4; btnLeftMove.Name = "btnLeftMove"; btnLeftMove.Pressed += (sender, eventArgs) => { var mv = chkLeftMoveDir.Checked == CheckState.Checked ? -1 : 1; if(btnLeftMove.Top + mv < btnLeftMove.Container.Height - 3 && btnLeftMove.Top + mv > 3) btnLeftMove.Top += mv; prgLeftMoveButton.Value = (int)(((btnLeftMove.Top - 2) / (float)(btnLeftMove.Container.Height - 6)) * 100); }; leftBox.Add(lblLeftStatus); leftBox.Add(lblLeftStatusText); leftBox.Add(btnLeftIncrement); leftBox.Add(btnLeftClear); leftBox.Add(btnLeftSetText); leftBox.Add(txtLeftText); leftBox.Add(btnLeftMove); leftBox.Add(chkLeftMoveDir); leftBox.Add(prgLeftMoveButton); leftBox.Add(lblLeftPrgDesc); leftBox.Add(myPlayground); #endregion #region Right Side var rightBox = new Groupbox(); rightBox.Name = "rightBox"; rightBox.Header = "Right Box"; rightBox.Top = 0; rightBox.Left = mainPanel.Width / 2; rightBox.Width = mainPanel.Width / 2; rightBox.Height = mainPanel.Height; var rightRightBox = new Groupbox(); rightRightBox.Name = "rightRightBox"; rightRightBox.Header = "Checkbox!"; rightRightBox.Top = 1; rightRightBox.Width = rightBox.Width / 2 - 2; rightRightBox.Height = 8; for (int i = 0; i < 4; i++) rightRightBox.Add(new Checkbox("Foo" + i) { Name = "foo" + i, Top = i }); var rightLeftBox = new Groupbox(); rightLeftBox.Name = "rightLeftBox"; rightLeftBox.Header = "Radiobutton!"; rightLeftBox.Top = 1; rightLeftBox.Left = rightBox.Width / 2 - 2; rightLeftBox.Width = rightBox.Width / 2 + 2; rightLeftBox.Height = 8; for (int i = 0; i < 4; i++) rightLeftBox.Add(new RadioButton("Bar" + i) { Name = "bar" + i, Top = i }); var lblRightRadioDesc = new Label("Radiobuttons can have groups:"); lblRightRadioDesc.Top = rightLeftBox.Height + 2; lblRightRadioDesc.Name = "lblDesc"; for (int i = 0; i < 6; i++) rightBox.Add(new RadioButton("asd" + i) { Text = "Group" + (i / 3), Name = "chk" + i.ToString(), Top = (i % 3) + rightRightBox.Height + 3, Left = (i / 3) * 15 + 2, ComboboxGroup = "grp" + (i / 3) }); rightBox.Add(rightRightBox); rightBox.Add(rightLeftBox); rightBox.Add(lblRightRadioDesc); #endregion mainPanel.Add(leftBox); mainPanel.Add(rightBox); var app = new Application(mainPanel); app.FocusManager = new FocusManager(mainPanel, btnLeftIncrement); app.Name = "FoggyConsole"; app.Run(); }
private System.Web.UI.Control GetVariableEditor(Hashtable variable) { object value = variable["Value"]; string name = (string) variable["Name"]; string editor = variable["Editor"] as string; Type type = value.GetType(); if (type == typeof (DateTime) || (!string.IsNullOrEmpty(editor) && (editor.IndexOf("date", StringComparison.OrdinalIgnoreCase) > -1 || editor.IndexOf("time", StringComparison.OrdinalIgnoreCase) > -1))) { var dateTimePicker = new DateTimePicker { ID = Control.GetUniqueID("variable_" + name + "_"), ShowTime = (variable["ShowTime"] != null && (bool) variable["ShowTime"]) || (!string.IsNullOrEmpty(editor) && editor.IndexOf("time", StringComparison.OrdinalIgnoreCase) > -1), }; dateTimePicker.Value = value is DateTime ? DateUtil.ToIsoDate((DateTime)value) : (string)value; return dateTimePicker; } if (type == typeof (Item) || (!string.IsNullOrEmpty(editor) && (editor.IndexOf("item", StringComparison.OrdinalIgnoreCase) > -1))) { var item = (Item) value; var dataContext = new DataContext { DefaultItem = item.Paths.Path, ID = Control.GetUniqueID("dataContext"), DataViewName = "Master", Root = variable["Root"] as string ?? "/sitecore", Parameters = "databasename=" + item.Database.Name, Database = item.Database.Name, Selected = new[] {new DataUri(item.ID, item.Language, item.Version)}, Folder = item.ID.ToString(), Language = item.Language, Version = item.Version }; DataContextPanel.Controls.Add(dataContext); var treePicker = new TreePicker { ID = Control.GetUniqueID("variable_" + name + "_"), Value = item.ID.ToString(), DataContext = dataContext.ID }; treePicker.Class += " treePicker"; return treePicker; } if (type == typeof(bool) || (!string.IsNullOrEmpty(editor) && (editor.IndexOf("bool", StringComparison.OrdinalIgnoreCase) > -1))) { var checkBox = new Checkbox { ID = Control.GetUniqueID("variable_" + name + "_"), Header = (string) variable["Title"], HeaderStyle = "margin-top:20px; display:inline-block;", Checked = (bool) value }; checkBox.Class = "varCheckbox"; return checkBox; } if (!string.IsNullOrEmpty(editor)) { bool showRoles = editor.IndexOf("role", StringComparison.OrdinalIgnoreCase) > -1; bool showUsers = editor.IndexOf("user", StringComparison.OrdinalIgnoreCase) > -1; bool multiple = editor.IndexOf("multiple", StringComparison.OrdinalIgnoreCase) > -1; if (showRoles || showUsers) { UserPicker picker = new UserPicker(); picker.Style.Add("float", "left"); picker.ID = Control.GetUniqueID("variable_" + name + "_"); picker.Class += " scContentControl textEdit clr" + value.GetType().Name; picker.Value = value.ToString(); picker.ExcludeRoles = !showRoles; picker.ExcludeUsers = !showUsers; picker.DomainName = variable["Domain"] as string ?? variable["DomainName"] as string; picker.Multiple = multiple; picker.Click = "UserPickerClick(" + picker.ID + ")"; return picker; } } Control edit; if (variable["lines"] != null && ((int)variable["lines"] > 1)) { edit = new Memo(); edit.Attributes.Add("rows", variable["lines"].ToString()); } else if (variable["Options"] != null) { edit = new Combobox(); string[] options = ((string) variable["Options"]).Split('|'); int i = 0; while (i < options.Length) { var item = new ListItem() { Header = options[i++], Value = options[i++], }; edit.Controls.Add(item); } } else { edit = new Edit(); } if (!string.IsNullOrEmpty((string)variable["Tooltip"])) { edit.ToolTip = (string)variable["Tooltip"]; } edit.Style.Add("float", "left"); edit.ID = Control.GetUniqueID("variable_" + name + "_"); edit.Class += " scContentControl textEdit clr"+value.GetType().Name; edit.Value = value.ToString(); return edit; }
protected virtual void BuildIndexCheckbox(string name, string header, ListString selected, ListString indexMap) { Assert.ArgumentNotNull(name, "name"); Assert.ArgumentNotNull(header, "header"); Assert.ArgumentNotNull(selected, "selected"); Assert.ArgumentNotNull(indexMap, "indexMap"); var child = new Checkbox(); Indexes.Controls.Add(child); child.ID = Control.GetUniqueID("dk_"); child.Header = header; child.Value = name; child.Checked = selected.Contains(name); indexMap.Add(child.ID); indexMap.Add(name); Indexes.Controls.Add(new LiteralControl("<br />")); }
protected override void Initialize() { _checkbox1 = new Checkbox { Location = new Point { Left = 3, Top = 4 }, Text = "Checkbox tentative" }; _checkbox1.CheckedChanged += checkbox1_CheckedChanged; RootPanel.AddChild(_checkbox1); _checkbox2 = new Checkbox { Location = new Point { Left = 3, Top = 6 }, IsChecked = true, Text = "Checkbox checked" }; RootPanel.AddChild(_checkbox2); _checkbox3 = new Checkbox { Location = new Point { Left = 3, Top = 8 }, IsChecked = false, Text = "Checkbox unchecked" }; RootPanel.AddChild(_checkbox3); _checkbox4 = new Checkbox { Location = new Point { Left = 3, Top = 10 }, IsChecked = false, Text = "Checkbox disabled", IsEnabled = false }; RootPanel.AddChild(_checkbox4); _label1 = new Label { Location = new Point { Left = 3, Top = 12 }, Text = "Label" }; RootPanel.AddChild(_label1); _radioButton1 = new RadioButton { Location = new Point { Left = 3, Top = 14 }, Text = "Radio unchecked" }; RootPanel.AddChild(_radioButton1); _radioButton2 = new RadioButton { Location = new Point { Left = 3, Top = 16 }, Text = "Radio checked", IsChecked = true }; RootPanel.AddChild(_radioButton2); _radioButton3 = new RadioButton { Location = new Point { Left = 3, Top = 18 }, Text = "Radio checked", IsChecked = true, IsEnabled = false }; RootPanel.AddChild(_radioButton3); _textBox1 = new TextBox { Location = new Point { Left = 3, Top = 20 } }; _textBox1.TextChanged += textBox1_TextChanged; RootPanel.AddChild(_textBox1); _button1 = new Button { Location = new Point { Left = 3, Top = 22 }, Width = 10 }; _button1.Pressed += button1_Pressed; RootPanel.AddChild(_button1); _button2 = new Button { Location = new Point { Left = 16, Top = 22 }, Width = 10, IsEnabled = false, Text = "Disabled button" }; _button2.Pressed += button2_Pressed; RootPanel.AddChild(_button2); _progressBar1 = new ProgressBar { Location = new Point { Left = 3, Top = 2 }, Width = 74 }; RootPanel.AddChild(_progressBar1); _bnext1 = new Button { Location = new Point { Left = 40, Top = 22 }, Width = 10, Text = "Next 1", Tag = 1 }; _bnext1.Pressed += bNextPressed; RootPanel.AddChild(_bnext1); _bnext2 = new Button { Location = new Point { Left = 51, Top = 22 }, Width = 10, Text = "Next 2", Tag = 2 }; _bnext2.Pressed += bNextPressed; RootPanel.AddChild(_bnext2); _bnext3 = new Button { Location = new Point { Left = 62, Top = 22 }, Width = 10, Text = "Next 3", Tag = 3 }; _bnext3.Pressed += bNextPressed; RootPanel.AddChild(_bnext3); _panel1 = new BorderPanel { Location = new Point { Left = 28, Top = 3 }, Size = new Size { Height = 7, Width = 25 } }; RootPanel.AddChild(_panel1); var subRadiobuton1 = new RadioButton { Location = new Point { Left = 1, Top = 1 } }; _panel1.AddChild(subRadiobuton1); var subRadiobuton2 = new RadioButton { Location = new Point { Left = 1, Top = 3 } }; _panel1.AddChild(subRadiobuton2); var subRadiobuton3 = new RadioButton { Location = new Point { Left = 1, Top = 5 } }; _panel1.AddChild(subRadiobuton3); _comboBox1 = new ComboBox { Location = new Point {Left = 29, Top = 12}, VisibleItemsCount = 7 }; _comboBox1.Items.AddRange(new[] { "EntityFX", "Green.Dragon", "Guzalianna", "Prozz", "Aik2029", "Zombie", "Wesker", "Perez", "Chuvak", "Magistr", "Mad", "XOBAH", }); RootPanel.AddChild(_comboBox1); RootPanel.AddChild(new Checkbox { Location = new Point { Left = 29, Top = 14 }, Text = "Checkbox for overlapp" }); RootPanel.AddChild(new BorderPanel { Location = new Point { Left = 29, Top = 16 }, Size = new Size {Width = 15, Height = 3} }); StatusStrip = new StatusStrip(); StatusStrip.AddChild(new StatusStripLabel { Text = "Item 1" }); StatusStrip.AddChild(new StatusStripLabel { Text = "Item 2" }); _timeStripItem = new StatusStripLabel { Text = "Item 3", ItemLocation = StatusStripItemLocationEnum.Right }; StatusStrip.AddChild(_timeStripItem); StatusStrip.AddChild(new StatusStripLabel { Text = "Item 4", ItemLocation = StatusStripItemLocationEnum.Right }); StatusStrip.AddChild(new StatusStripButton { Text = "But 1", ItemLocation = StatusStripItemLocationEnum.Left }); StatusStrip.AddChild(new StatusStripButton { Text = "But 2", ItemLocation = StatusStripItemLocationEnum.Left }); _statusStripProgressBar = new StatusStripProgressBar { Text = "P: {0}", Width = 14, Minimum = 0, Value = 16, Maximum = 25 }; StatusStrip.AddChild(_statusStripProgressBar); Initializetable(); _timer.Elapsed += timer_Elapsed; _timer.Start(); _timer2.Elapsed += _timer2_Elapsed; _timer2.Start(); }
public override void OnEnter() { DefaultFont = Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Default); GUI = new DwarfGUI(Game, DefaultFont, Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Title), Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Small), Input); IsInitialized = true; Drawer = new Drawer2D(Game.Content, Game.GraphicsDevice); MainWindow = new Panel(GUI, GUI.RootComponent) { LocalBounds = new Rectangle(EdgePadding, EdgePadding, Game.GraphicsDevice.Viewport.Width - EdgePadding * 2, Game.GraphicsDevice.Viewport.Height - EdgePadding * 2) }; Layout = new GridLayout(GUI, MainWindow, 10, 6); Label label = new Label(GUI, Layout, "Options", GUI.TitleFont); Layout.SetComponentPosition(label, 0, 0, 1, 1); TabSelector = new TabSelector(GUI, Layout, 6); Layout.SetComponentPosition(TabSelector, 0, 1, 6, 8); TabSelector.Tab graphicsTab = TabSelector.AddTab("Graphics"); GroupBox graphicsBox = new GroupBox(GUI, graphicsTab, "Graphics") { WidthSizeMode = GUIComponent.SizeMode.Fit, HeightSizeMode = GUIComponent.SizeMode.Fit }; Categories["Graphics"] = graphicsBox; CurrentBox = graphicsBox; GridLayout graphicsLayout = new GridLayout(GUI, graphicsBox, 6, 5); Label resolutionLabel = new Label(GUI, graphicsLayout, "Resolution", GUI.DefaultFont) { Alignment = Drawer2D.Alignment.Right }; ComboBox resolutionBox = new ComboBox(GUI, graphicsLayout) { ToolTip = "Sets the size of the screen.\nSmaller for higher framerates." }; foreach(DisplayMode mode in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes) { if(mode.Format != SurfaceFormat.Color) { continue; } if (mode.Width <= 640) continue; string s = mode.Width + " x " + mode.Height; DisplayModes[s] = mode; if(mode.Width == GameSettings.Default.ResolutionX && mode.Height == GameSettings.Default.ResolutionY) { resolutionBox.AddValue(s); resolutionBox.CurrentValue = s; } else { resolutionBox.AddValue(s); } } graphicsLayout.SetComponentPosition(resolutionLabel, 0, 0, 1, 1); graphicsLayout.SetComponentPosition(resolutionBox, 1, 0, 1, 1); resolutionBox.OnSelectionModified += resolutionBox_OnSelectionModified; Checkbox fullscreenCheck = new Checkbox(GUI, graphicsLayout, "Fullscreen", GUI.DefaultFont, GameSettings.Default.Fullscreen) { ToolTip = "If this is checked, the game takes up the whole screen." }; graphicsLayout.SetComponentPosition(fullscreenCheck, 0, 1, 1, 1); fullscreenCheck.OnCheckModified += fullscreenCheck_OnClicked; Label drawDistance = new Label(GUI, graphicsLayout, "Draw Distance", GUI.DefaultFont); Slider chunkDrawSlider = new Slider(GUI, graphicsLayout, "", GameSettings.Default.ChunkDrawDistance, 1, 1000, Slider.SliderMode.Integer) { ToolTip = "Maximum distance at which terrain will be drawn\nSmaller for faster." }; graphicsLayout.SetComponentPosition(drawDistance, 0, 2, 1, 1); graphicsLayout.SetComponentPosition(chunkDrawSlider, 1, 2, 1, 1); chunkDrawSlider.OnValueModified += ChunkDrawSlider_OnValueModified; Label cullDistance = new Label(GUI, graphicsLayout, "Cull Distance", GUI.DefaultFont); Slider cullSlider = new Slider(GUI, graphicsLayout, "", GameSettings.Default.VertexCullDistance, 0.1f, 1000, Slider.SliderMode.Integer) { ToolTip = "Maximum distance at which anything will be drawn\n Smaller for faster." }; cullSlider.OnValueModified += CullSlider_OnValueModified; graphicsLayout.SetComponentPosition(cullDistance, 0, 3, 1, 1); graphicsLayout.SetComponentPosition(cullSlider, 1, 3, 1, 1); Label generateDistance = new Label(GUI, graphicsLayout, "Generate Distance", GUI.DefaultFont); Slider generateSlider = new Slider(GUI, graphicsLayout, "", GameSettings.Default.ChunkGenerateDistance, 1, 1000, Slider.SliderMode.Integer) { ToolTip = "Maximum distance at which terrain will be generated." }; generateSlider.OnValueModified += GenerateSlider_OnValueModified; graphicsLayout.SetComponentPosition(generateDistance, 0, 4, 1, 1); graphicsLayout.SetComponentPosition(generateSlider, 1, 4, 1, 1); Checkbox glowBox = new Checkbox(GUI, graphicsLayout, "Enable Glow", GUI.DefaultFont, GameSettings.Default.EnableGlow) { ToolTip = "When checked, there will be a fullscreen glow effect." }; graphicsLayout.SetComponentPosition(glowBox, 1, 1, 1, 1); glowBox.OnCheckModified += glowBox_OnCheckModified; Label aaLabel = new Label(GUI, graphicsLayout, "Antialiasing", GUI.DefaultFont) { Alignment = Drawer2D.Alignment.Right }; ComboBox aaBox = new ComboBox(GUI, graphicsLayout) { ToolTip = "Determines how much antialiasing (smoothing) there is.\nHigher means more smooth, but is slower." }; aaBox.AddValue("None"); aaBox.AddValue("FXAA"); aaBox.AddValue("2x MSAA"); aaBox.AddValue("4x MSAA"); aaBox.AddValue("16x MSAA"); foreach(string s in AAModes.Keys.Where(s => AAModes[s] == GameSettings.Default.AntiAliasing)) { aaBox.CurrentValue = s; } aaBox.OnSelectionModified += AABox_OnSelectionModified; graphicsLayout.SetComponentPosition(aaLabel, 2, 0, 1, 1); graphicsLayout.SetComponentPosition(aaBox, 3, 0, 1, 1); Checkbox reflectTerrainBox = new Checkbox(GUI, graphicsLayout, "Reflect Chunks", GUI.DefaultFont, GameSettings.Default.DrawChunksReflected) { ToolTip = "When checked, water will reflect terrain." }; reflectTerrainBox.OnCheckModified += reflectTerrainBox_OnCheckModified; graphicsLayout.SetComponentPosition(reflectTerrainBox, 2, 1, 1, 1); Checkbox refractTerrainBox = new Checkbox(GUI, graphicsLayout, "Refract Chunks", GUI.DefaultFont, GameSettings.Default.DrawChunksRefracted) { ToolTip = "When checked, water will refract terrain." }; refractTerrainBox.OnCheckModified += refractTerrainBox_OnCheckModified; graphicsLayout.SetComponentPosition(refractTerrainBox, 2, 2, 1, 1); Checkbox reflectEntities = new Checkbox(GUI, graphicsLayout, "Reflect Entities", GUI.DefaultFont, GameSettings.Default.DrawEntityReflected) { ToolTip = "When checked, water will reflect trees, dwarves, etc." }; reflectEntities.OnCheckModified += reflectEntities_OnCheckModified; graphicsLayout.SetComponentPosition(reflectEntities, 3, 1, 1, 1); Checkbox refractEntities = new Checkbox(GUI, graphicsLayout, "Refract Entities", GUI.DefaultFont, GameSettings.Default.DrawEntityReflected) { ToolTip = "When checked, water will reflect trees, dwarves, etc." }; refractEntities.OnCheckModified += refractEntities_OnCheckModified; graphicsLayout.SetComponentPosition(refractEntities, 3, 2, 1, 1); Checkbox sunlight = new Checkbox(GUI, graphicsLayout, "Sunlight", GUI.DefaultFont, GameSettings.Default.CalculateSunlight) { ToolTip = "When checked, terrain will be lit/shadowed by the sun." }; sunlight.OnCheckModified += sunlight_OnCheckModified; graphicsLayout.SetComponentPosition(sunlight, 2, 3, 1, 1); Checkbox ao = new Checkbox(GUI, graphicsLayout, "Ambient Occlusion", GUI.DefaultFont, GameSettings.Default.AmbientOcclusion) { ToolTip = "When checked, terrain will smooth shading effects." }; ao.OnCheckModified += AO_OnCheckModified; graphicsLayout.SetComponentPosition(ao, 3, 3, 1, 1); Checkbox ramps = new Checkbox(GUI, graphicsLayout, "Ramps", GUI.DefaultFont, GameSettings.Default.CalculateRamps) { ToolTip = "When checked, some terrain will have smooth ramps." }; ramps.OnCheckModified += ramps_OnCheckModified; graphicsLayout.SetComponentPosition(ramps, 2, 4, 1, 1); Checkbox cursorLight = new Checkbox(GUI, graphicsLayout, "Cursor Light", GUI.DefaultFont, GameSettings.Default.CursorLightEnabled) { ToolTip = "When checked, a light will follow the player cursor." }; cursorLight.OnCheckModified += cursorLight_OnCheckModified; graphicsLayout.SetComponentPosition(cursorLight, 2, 5, 1, 1); Checkbox entityLight = new Checkbox(GUI, graphicsLayout, "Entity Lighting", GUI.DefaultFont, GameSettings.Default.EntityLighting) { ToolTip = "When checked, dwarves, objects, etc. will be lit\nby the sun, lamps, etc." }; entityLight.OnCheckModified += entityLight_OnCheckModified; graphicsLayout.SetComponentPosition(entityLight, 3, 4, 1, 1); Checkbox selfIllum = new Checkbox(GUI, graphicsLayout, "Ore Glow", GUI.DefaultFont, GameSettings.Default.SelfIlluminationEnabled) { ToolTip = "When checked, some terrain elements will glow." }; selfIllum.OnCheckModified += selfIllum_OnCheckModified; graphicsLayout.SetComponentPosition(selfIllum, 3, 5, 1, 1); Checkbox particlePhysics = new Checkbox(GUI, graphicsLayout, "Particle Body", GUI.DefaultFont, GameSettings.Default.ParticlePhysics) { ToolTip = "When checked, some particles will bounce off terrain." }; particlePhysics.OnCheckModified += particlePhysics_OnCheckModified; graphicsLayout.SetComponentPosition(particlePhysics, 0, 5, 1, 1); TabSelector.Tab graphics2Tab = TabSelector.AddTab("Graphics II"); GroupBox graphicsBox2 = new GroupBox(GUI, graphics2Tab, "Graphics II") { HeightSizeMode = GUIComponent.SizeMode.Fit, WidthSizeMode = GUIComponent.SizeMode.Fit }; Categories["Graphics II"] = graphicsBox2; GridLayout graphicsLayout2 = new GridLayout(GUI, graphicsBox2, 6, 5); Checkbox moteBox = new Checkbox(GUI, graphicsLayout2, "Generate Motes", GUI.DefaultFont, GameSettings.Default.GrassMotes) { ToolTip = "When checked, trees, grass, etc. will be visible." }; moteBox.OnCheckModified += MoteBox_OnCheckModified; graphicsLayout2.SetComponentPosition(moteBox, 1, 2, 1, 1); Label numMotes = new Label(GUI, graphicsLayout2, "Num Motes", GUI.DefaultFont); Slider motesSlider = new Slider(GUI, graphicsLayout2, "", (int) (GameSettings.Default.NumMotes * 100), 0, 1000, Slider.SliderMode.Integer) { ToolTip = "Determines the maximum amount of trees/grass that will be visible." }; graphicsLayout2.SetComponentPosition(numMotes, 0, 1, 1, 1); graphicsLayout2.SetComponentPosition(motesSlider, 1, 1, 1, 1); motesSlider.OnValueModified += MotesSlider_OnValueModified; TabSelector.Tab gameplayTab = TabSelector.AddTab("Gameplay"); GroupBox gameplayBox = new GroupBox(GUI, gameplayTab, "Gameplay") { WidthSizeMode = GUIComponent.SizeMode.Fit, HeightSizeMode = GUIComponent.SizeMode.Fit }; Categories["Gameplay"] = gameplayBox; GridLayout gameplayLayout = new GridLayout(GUI, gameplayBox, 6, 5); Label moveSpeedLabel = new Label(GUI, gameplayLayout, "Camera Move Speed", GUI.DefaultFont); Slider moveSlider = new Slider(GUI, gameplayLayout, "", GameSettings.Default.CameraScrollSpeed, 0.0f, 20.0f, Slider.SliderMode.Float) { ToolTip = "Determines how fast the camera will move when keys are pressed." }; gameplayLayout.SetComponentPosition(moveSpeedLabel, 0, 0, 1, 1); gameplayLayout.SetComponentPosition(moveSlider, 1, 0, 1, 1); moveSlider.OnValueModified += MoveSlider_OnValueModified; Label zoomSpeedLabel = new Label(GUI, gameplayLayout, "Zoom Speed", GUI.DefaultFont); Slider zoomSlider = new Slider(GUI, gameplayLayout, "", GameSettings.Default.CameraZoomSpeed, 0.0f, 2.0f, Slider.SliderMode.Float) { ToolTip = "Determines how fast the camera will go\nup and down with the scroll wheel." }; gameplayLayout.SetComponentPosition(zoomSpeedLabel, 0, 1, 1, 1); gameplayLayout.SetComponentPosition(zoomSlider, 1, 1, 1, 1); zoomSlider.OnValueModified += ZoomSlider_OnValueModified; Checkbox invertZoomBox = new Checkbox(GUI, gameplayLayout, "Invert Zoom", GUI.DefaultFont, GameSettings.Default.InvertZoom) { ToolTip = "When checked, the scroll wheel is reversed\nfor zooming." }; gameplayLayout.SetComponentPosition(invertZoomBox, 2, 1, 1, 1); invertZoomBox.OnCheckModified += InvertZoomBox_OnCheckModified; Checkbox edgeScrollBox = new Checkbox(GUI, gameplayLayout, "Edge Scrolling", GUI.DefaultFont, GameSettings.Default.EnableEdgeScroll) { ToolTip = "When checked, the camera will scroll\nwhen the cursor is at the edge of the screen." }; gameplayLayout.SetComponentPosition(edgeScrollBox, 0, 2, 1, 1); edgeScrollBox.OnCheckModified += EdgeScrollBox_OnCheckModified; Checkbox introBox = new Checkbox(GUI, gameplayLayout, "Play Intro", GUI.DefaultFont, GameSettings.Default.DisplayIntro) { ToolTip = "When checked, the intro will be played when the game starts" }; gameplayLayout.SetComponentPosition(introBox, 1, 2, 1, 1); introBox.OnCheckModified += IntroBox_OnCheckModified; Checkbox fogOfWarBox = new Checkbox(GUI, gameplayLayout, "Fog of War", GUI.DefaultFont, GameSettings.Default.FogofWar) { ToolTip = "When checked, unexplored blocks will be blacked out" }; gameplayLayout.SetComponentPosition(fogOfWarBox, 2, 2, 1, 1); fogOfWarBox.OnCheckModified += fogOfWarBox_OnCheckModified; /* Label chunkWidthLabel = new Label(GUI, gameplayLayout, "Chunk Width", GUI.DefaultFont); Slider chunkWidthSlider = new Slider(GUI, gameplayLayout, "", GameSettings.Default.ChunkWidth, 4, 256, Slider.SliderMode.Integer) { ToolTip = "Determines the number of blocks in a chunk of terrain." }; gameplayLayout.SetComponentPosition(chunkWidthLabel, 0, 3, 1, 1); gameplayLayout.SetComponentPosition(chunkWidthSlider, 1, 3, 1, 1); chunkWidthSlider.OnValueModified += ChunkWidthSlider_OnValueModified; Label chunkHeightLabel = new Label(GUI, gameplayLayout, "Chunk Height", GUI.DefaultFont); Slider chunkHeightSlider = new Slider(GUI, gameplayLayout, "", GameSettings.Default.ChunkHeight, 4, 256, Slider.SliderMode.Integer) { ToolTip = "Determines the maximum depth,\nin blocks, of a chunk of terrain." }; gameplayLayout.SetComponentPosition(chunkHeightLabel, 2, 3, 1, 1); gameplayLayout.SetComponentPosition(chunkHeightSlider, 3, 3, 1, 1); chunkHeightSlider.OnValueModified += ChunkHeightSlider_OnValueModified; Label worldWidthLabel = new Label(GUI, gameplayLayout, "World Width", GUI.DefaultFont); Slider worldWidthSlider = new Slider(GUI, gameplayLayout, "", GameSettings.Default.WorldWidth, 4, 2048, Slider.SliderMode.Integer) { ToolTip = "Determines the size of the overworld." }; gameplayLayout.SetComponentPosition(worldWidthLabel, 0, 4, 1, 1); gameplayLayout.SetComponentPosition(worldWidthSlider, 1, 4, 1, 1); worldWidthSlider.OnValueModified += WorldWidthSlider_OnValueModified; Label worldHeightLabel = new Label(GUI, gameplayLayout, "World Height", GUI.DefaultFont); Slider worldHeightSlider = new Slider(GUI, gameplayLayout, "", GameSettings.Default.WorldHeight, 4, 2048, Slider.SliderMode.Integer) { ToolTip = "Determines the size of the overworld." }; gameplayLayout.SetComponentPosition(worldHeightLabel, 2, 4, 1, 1); gameplayLayout.SetComponentPosition(worldHeightSlider, 3, 4, 1, 1); worldHeightSlider.OnValueModified += WorldHeightSlider_OnValueModified; Label worldScaleLabel = new Label(GUI, gameplayLayout, "World Scale", GUI.DefaultFont); Slider worldScaleSlider = new Slider(GUI, gameplayLayout, "", GameSettings.Default.WorldScale, 2, 128, Slider.SliderMode.Integer) { ToolTip = "Determines the number of voxel\nper pixel of the overworld" }; gameplayLayout.SetComponentPosition(worldScaleLabel, 0, 5, 1, 1); gameplayLayout.SetComponentPosition(worldScaleSlider, 1, 5, 1, 1); worldScaleSlider.OnValueModified += WorldScaleSlider_OnValueModified; */ TabSelector.Tab audioTab = TabSelector.AddTab("Audio"); GroupBox audioBox = new GroupBox(GUI, audioTab, "Audio") { WidthSizeMode = GUIComponent.SizeMode.Fit, HeightSizeMode = GUIComponent.SizeMode.Fit }; Categories["Audio"] = audioBox; GridLayout audioLayout = new GridLayout(GUI, audioBox, 6, 5); Label masterLabel = new Label(GUI, audioLayout, "Master Volume", GUI.DefaultFont); Slider masterSlider = new Slider(GUI, audioLayout, "", GameSettings.Default.MasterVolume, 0.0f, 1.0f, Slider.SliderMode.Float); audioLayout.SetComponentPosition(masterLabel, 0, 0, 1, 1); audioLayout.SetComponentPosition(masterSlider, 1, 0, 1, 1); masterSlider.OnValueModified += MasterSlider_OnValueModified; Label sfxLabel = new Label(GUI, audioLayout, "SFX Volume", GUI.DefaultFont); Slider sfxSlider = new Slider(GUI, audioLayout, "", GameSettings.Default.SoundEffectVolume, 0.0f, 1.0f, Slider.SliderMode.Float); audioLayout.SetComponentPosition(sfxLabel, 0, 1, 1, 1); audioLayout.SetComponentPosition(sfxSlider, 1, 1, 1, 1); sfxSlider.OnValueModified += SFXSlider_OnValueModified; Label musicLabel = new Label(GUI, audioLayout, "Music Volume", GUI.DefaultFont); Slider musicSlider = new Slider(GUI, audioLayout, "", GameSettings.Default.MusicVolume, 0.0f, 1.0f, Slider.SliderMode.Float); audioLayout.SetComponentPosition(musicLabel, 0, 2, 1, 1); audioLayout.SetComponentPosition(musicSlider, 1, 2, 1, 1); musicSlider.OnValueModified += MusicSlider_OnValueModified; TabSelector.Tab keysTab = TabSelector.AddTab("Keys"); GroupBox keysBox = new GroupBox(GUI, keysTab, "Keys") { WidthSizeMode = GUIComponent.SizeMode.Fit, HeightSizeMode = GUIComponent.SizeMode.Fit }; Categories["Keys"] = keysBox; KeyEditor keyeditor = new KeyEditor(GUI, keysBox, new KeyManager(), 8, 4); GridLayout keyLayout = new GridLayout(GUI, keysBox, 1, 1); keyLayout.SetComponentPosition(keyeditor, 0, 0, 1, 1); keyLayout.UpdateSizes(); keyeditor.UpdateLayout(); /* GroupBox customBox = new GroupBox(GUI, Layout, "Customization") { IsVisible = false }; Categories["Customization"] = customBox; TabSelector.AddItem("Customization"); GridLayout customBoxLayout = new GridLayout(GUI, customBox, 6, 5); List<string> assets = TextureManager.DefaultContent.Keys.ToList(); AssetManager assetManager = new AssetManager(GUI, customBoxLayout, assets); customBoxLayout.SetComponentPosition(assetManager, 0, 0, 5, 6); */ Button apply = new Button(GUI, Layout, "Apply", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.Check)); Layout.SetComponentPosition(apply, 5, 9, 1, 1); apply.OnClicked += apply_OnClicked; Button back = new Button(GUI, Layout, "Back", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.LeftArrow)); Layout.SetComponentPosition(back, 4, 9, 1, 1); back.OnClicked += back_OnClicked; Layout.UpdateSizes(); TabSelector.UpdateSize(); TabSelector.SetTab("Graphics"); base.OnEnter(); }
internal static HandleRef getCPtr(Checkbox obj) { return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; }
private void BuildFormPanel() { this.cbxReminder = new Checkbox { Ref = "../../../hasReminder", BoxLabel = "Reminder:", DataIndex = "HasReminder", Checked = false }; this.dfReminder = new DateField { Ref = "../../../reminder", Disabled = true, DataIndex = "Reminder", Width = 135 }; this.taskSubject = new TextField { AllowBlank = false, FieldLabel = "Task Subject", DataIndex = "Title", Anchor = "100%" }; this.dueDate = new DateField { AllowBlank = false, FieldLabel = "Due Date", DataIndex = "DueDate", Width = 135 }; this.taskCategory = new DropDownField { AllowBlank = false, LazyInit = false, FieldLabel = "Task List", DataIndex = "Name", Editable = false, Mode = DropDownMode.ValueText, Ref = "../../../taskCategory", Component = { new TreePanel { Height = 150, Shadow = ShadowMode.None, UseArrows = true, AutoScroll = true, Animate = true, RootVisible = false, Cls = "tasks-tree", Root = { new TreeNode("root") }, SelectionModel = { new DefaultSelectionModel() } } } }; this.description = new HtmlEditor { HideLabel = true, DataIndex = "Description", Anchor = "100% -150", EnableSourceEdit = false, EnableFont = false }; this.formPanel = new FormPanel { Region = Ext.Net.Region.Center, LabelWidth = 75, ButtonAlign = Alignment.Right, MinButtonWidth = 80, BaseCls = "x-plain", Ref = "taskForm", Cls = "task-window", RenderFormElement = false, CustomConfig = { new ConfigItem("margins", "10 10 5 10", ParameterMode.Value) }, Items = { new BoxComponent { Hidden = true, Ref = "../taskMessage", AutoEl = { Cls = "taskMessage" } }, taskSubject, new Container { Cls = "x-plain", Layout = "Hbox", Anchor = "100%", Height = 30, Items = { new Container { Width = 250, Layout = "Form", Cls = "x-pain", Items = { dueDate } }, new Container { Flex = 1, Layout = "Form", Cls = "x-plain", LabelWidth = 55, Items = { taskCategory } } } }, new BoxComponent { AutoEl = { Cls = "divider" } }, new Container { Layout = "HBox", Anchor = "100%", Cls = "x-plain", Height = 30, Items = { new Container { Width = 80, Layout = "Form", Cls = "x-plain", HideLabels = true, Items = { cbxReminder } }, new Container { Flex = 1, Layout = "Form", Cls = "x-plain", HideLabels = true, Items = { dfReminder } } } }, description } }; this.Buttons.Add(new Button ("OK")); this.Buttons.Add(new Button ("Cancel")); this.Items.Add(this.formPanel); }
public override void OnEnter() { DefaultFont = Game.Content.Load<SpriteFont>("Default"); GUI = new DwarfGUI(Game, DefaultFont, Game.Content.Load<SpriteFont>("Title"), Game.Content.Load<SpriteFont>("Small"), Input); IsInitialized = true; Drawer = new Drawer2D(Game.Content, Game.GraphicsDevice); MainWindow = new Panel(GUI, GUI.RootComponent); MainWindow.LocalBounds = new Rectangle(EdgePadding, EdgePadding, Game.GraphicsDevice.Viewport.Width - EdgePadding * 2, Game.GraphicsDevice.Viewport.Height - EdgePadding * 2); Layout = new GridLayout(GUI, MainWindow, 10, 4); Label label = new Label(GUI, Layout, "GUI Elements", GUI.TitleFont); Layout.SetComponentPosition(label, 0, 0, 1, 1); Checkbox check = new Checkbox(GUI, Layout, "Check 1", GUI.DefaultFont, true); Layout.SetComponentPosition(check, 0, 1, 1, 1); Checkbox check2 = new Checkbox(GUI, Layout, "Check 2", GUI.DefaultFont, true); Layout.SetComponentPosition(check2, 0, 2, 1, 1); Button apply = new Button(GUI, Layout, "Apply", GUI.DefaultFont, Button.ButtonMode.PushButton, null); Layout.SetComponentPosition(apply, 2, 9, 1, 1); Button back = new Button(GUI, Layout, "Back", GUI.DefaultFont, Button.ButtonMode.PushButton, null); Layout.SetComponentPosition(back, 3, 9, 1, 1); Label sliderLabel = new Label(GUI, Layout, "Slider", GUI.DefaultFont); Layout.SetComponentPosition(sliderLabel, 0, 3, 1, 1); sliderLabel.Alignment = Drawer2D.Alignment.Right; Slider slider = new Slider(GUI, Layout, "Slider", 0, -1000, 1000, Slider.SliderMode.Integer); Layout.SetComponentPosition(slider, 1, 3, 1, 1); Label comboLabel = new Label(GUI, Layout, "Combobox", GUI.DefaultFont); comboLabel.Alignment = Drawer2D.Alignment.Right; Layout.SetComponentPosition(comboLabel, 0, 4, 1, 1); ComboBox combo = new ComboBox(GUI, Layout); combo.AddValue("Foo"); combo.AddValue("Bar"); combo.AddValue("Baz"); combo.AddValue("Quz"); combo.CurrentValue = "Foo"; Layout.SetComponentPosition(combo, 1, 4, 1, 1); back.OnClicked += back_OnClicked; GroupBox groupBox = new GroupBox(GUI, Layout, ""); Layout.SetComponentPosition(groupBox, 2, 1, 2, 6); Layout.UpdateSizes(); /* Texture2D Image = Game.Content.Load<Texture2D>("pine"); string[] tags = {""}; DraggableItem image = new DraggableItem(GUI, groupBox,new GItem("Item", new ImageFrame(Image, Image.Bounds), 0, 1, 1, tags)); image.LocalBounds = new Rectangle(50, 50, Image.Width, Image.Height); Label imageLabel = new Label(GUI, image, "Image Panel", GUI.DefaultFont); imageLabel.LocalBounds = new Rectangle(0, 0, Image.Width, Image.Height); imageLabel.Alignment = Drawer2D.Alignment.Top | Drawer2D.Alignment.Left; */ GridLayout groupLayout = new GridLayout(GUI, groupBox, 1, 2); DragManager dragManager = new DragManager(); DragGrid dragGrid = new DragGrid(GUI, groupLayout, dragManager, 32, 32); DragGrid dragGrid2 = new DragGrid(GUI, groupLayout, dragManager, 32, 32); groupLayout.SetComponentPosition(dragGrid, 0, 0, 1, 1); groupLayout.SetComponentPosition(dragGrid2, 1, 0, 1, 1); Layout.UpdateSizes(); groupLayout.UpdateSizes(); dragGrid.SetupLayout(); dragGrid2.SetupLayout(); foreach(Resource r in ResourceLibrary.Resources.Values) { if(r.ResourceName != "Container") { GItem gitem = new GItem(r.ResourceName, r.Image, 0, 32, 2, 1); gitem.CurrentAmount = 2; dragGrid.AddItem(gitem); } } ProgressBar progress = new ProgressBar(GUI, Layout, 0.7f); Label progressLabel = new Label(GUI, Layout, "Progress Bar", GUI.DefaultFont); progressLabel.Alignment = Drawer2D.Alignment.Right; Layout.SetComponentPosition(progressLabel, 0, 5, 1, 1); Layout.SetComponentPosition(progress, 1, 5, 1, 1); LineEdit line = new LineEdit(GUI, Layout, ""); Label lineLabel = new Label(GUI, Layout, "Line Edit", GUI.DefaultFont); lineLabel.Alignment = Drawer2D.Alignment.Right; Layout.SetComponentPosition(lineLabel, 0, 6, 1, 1); Layout.SetComponentPosition(line, 1, 6, 1, 1); base.OnEnter(); }