public CargoConsoleOrderMenu() { IoCManager.InjectDependencies(this); Title = Loc.GetString("cargo-console-order-menu-title"); var vBox = new VBoxContainer(); var gridContainer = new GridContainer { Columns = 2 }; var requesterLabel = new Label { Text = Loc.GetString("cargo-console-order-menu-requester-label") }; Requester = new LineEdit(); gridContainer.AddChild(requesterLabel); gridContainer.AddChild(Requester); var reasonLabel = new Label { Text = Loc.GetString("cargo-console-order-menu-reason-label:") }; Reason = new LineEdit(); gridContainer.AddChild(reasonLabel); gridContainer.AddChild(Reason); var amountLabel = new Label { Text = Loc.GetString("cargo-console-order-menu-amount-label:") }; Amount = new SpinBox { HorizontalExpand = true, Value = 1 }; Amount.SetButtons(new List <int>() { -3, -2, -1 }, new List <int>() { 1, 2, 3 }); Amount.IsValid = (n) => { return(n > 0); }; gridContainer.AddChild(amountLabel); gridContainer.AddChild(Amount); vBox.AddChild(gridContainer); SubmitButton = new Button() { Text = Loc.GetString("cargo-console-order-menu-submit-button"), TextAlign = Label.AlignMode.Center, }; vBox.AddChild(SubmitButton); Contents.AddChild(vBox); }
public override void _Ready() { resourceSelect = GetNode <OptionButton>("Values/Resource/OptionButton"); resourceSelect.Connect("item_selected", this, nameof(Signal_ResourceSelected)); subrectX = GetNode <SpinBox>("Values/SubRectX/SpinBox"); subrectX.Connect("value_changed", this, nameof(Signal_SubRectUpdated)); subrectY = GetNode <SpinBox>("Values/SubRectY/SpinBox"); subrectY.Connect("value_changed", this, nameof(Signal_SubRectUpdated)); subrectW = GetNode <SpinBox>("Values/SubRectWidth/SpinBox"); subrectW.Connect("value_changed", this, nameof(Signal_SubRectUpdated)); subrectH = GetNode <SpinBox>("Values/SubRectHeight/SpinBox"); subrectH.Connect("value_changed", this, nameof(Signal_SubRectUpdated)); texturePreview = GetNode <TextureRect>("ImagePreview"); var button = GetNode <Button>("Values/ResetSubRectButton"); button.Connect("pressed", this, nameof(Signal_ResetSubRect)); var ui = GetTree().Root.GetNode <UI>("UI"); if (ui != null) { InitResources(ui.GetImageList(), ui.GetTexture); } if (pendingStartValue != null) { SetValues(pendingStartValue); } }
private SpinBox GetSpinner(Item item, bool minimum = true) { SpinBox spinner = new SpinBox(Control.Manager, SpinBoxMode.Range) { Name = string.Format("{0}-{1}", item.PrototypeID, (minimum) ? "minimum" : "maximum"), Value = (minimum) ? Data.Minimum(item.PrototypeID) : Data.Maximum(item.PrototypeID), Width = 75, Rounding = 0, Minimum = 0, Maximum = 5000, Step = 1, DisplayFormat = "f", Tag = item }; spinner.Init(); // spinner is bugged if Text is set above so do it here spinner.Text = (minimum) ? Data.Minimum(item.PrototypeID).ToString() : Data.Maximum(item.PrototypeID).ToString(); if (minimum) { spinner.TextChanged += new EventHandler(Spinner_MinimumTextChanged); } else { spinner.TextChanged += new EventHandler(Spinner_MaximumTextChanged); } return(spinner); }
public override Control BuildUI() { Range inputField; if (slider) { inputField = new HSlider(); inputField.RectMinSize = new Vector2(120, 0); } else { inputField = new SpinBox(); } inputField.MinValue = this.Min; inputField.MaxValue = this.Max; inputField.Step = 0.01; inputField.Value = (float)this.Value; inputField.Connect( "value_changed", Shaderer.instance, nameof(Shaderer.instance.OnApplyParam), new Godot.Collections.Array { this.NameCode }); return(inputField); }
private void SetupMinimumMaximum(Item item, TableRow row) { // the spin boxes are on if (Data.IsAccepting(item.PrototypeID)) { SpinBox spinner = GetSpinner(item, true); row.AddToRowAt(2, spinner); spinner = GetSpinner(item, false); row.AddToRowAt(3, spinner); } // the spinboxes are off else { row.AddToRowAt(2, new Label(Control.Manager) { Text = "---", Alignment = Alignment.MiddleCenter }, true); row.AddToRowAt(3, new Label(Control.Manager) { Text = "---", Alignment = Alignment.MiddleCenter }, true); } }
public CharacterWindow(String defaultName) { InitializeComponent(); this.defaultName = defaultName; this.levelBox = new SpinBox(); this.levelBox.Value = 1; this.levelBox.Minimum = 1; this.levelBox.ValueChanged += this.levelChanged; Grid.SetRow(this.levelBox, 1); Grid.SetColumn(this.levelBox, 1); Grid.SetColumnSpan(this.levelBox, 3); characterGrid.Children.Add(this.levelBox); this.totalXpBox = new SpinBox(); this.totalXpBox.Value = 0; this.totalXpBox.Minimum = 0; this.totalXpBox.ValueChanged += this.totalXpChanged; Grid.SetRow(this.totalXpBox, 2); Grid.SetColumn(this.totalXpBox, 1); Grid.SetColumnSpan(this.totalXpBox, 3); characterGrid.Children.Add(this.totalXpBox); this.unspentXpBox = new SpinBox(); this.unspentXpBox.Value = 0; this.unspentXpBox.Minimum = 0; this.unspentXpBox.ValueChanged += this.levelChanged; Grid.SetRow(this.unspentXpBox, 3); Grid.SetColumn(this.unspentXpBox, 1); Grid.SetColumnSpan(this.unspentXpBox, 3); characterGrid.Children.Add(this.unspentXpBox); }
public override Control BuildUI() { HBoxContainer VecUI = new HBoxContainer(); SpinBox spinboxX = new SpinBox(); SpinBox spinboxY = new SpinBox(); spinboxX.MaxValue = 10000; spinboxY.MaxValue = 10000; spinboxX.Step = 0.01; spinboxY.Step = 0.01; spinboxX.Value = ((Vector2)this.Value).x; spinboxY.Value = ((Vector2)this.Value).x; VecUI.AddChild(spinboxX); VecUI.AddChild(spinboxY); /* TODO Vec2Props currently not working because here I pass the individual spin box * values instead of a vector2 */ spinboxX.Connect( "value_changed", Shaderer.instance, nameof(Shaderer.instance.OnApplyParam), new Godot.Collections.Array { this.NameCode }); spinboxY.Connect( "value_changed", Shaderer.instance, nameof(Shaderer.instance.OnApplyParam), new Godot.Collections.Array { this.NameCode }); return(VecUI); }
protected override void InitializeComponent() { IsMargined = true; Child = hPanel; hPanel.Items.Add(vPanel); for (int i = 0; i < 10; i++) { SpinBox spinBox = new SpinBox(0, 100) { Value = new Random(DateTime.Now.Millisecond).Next(0, 101) }; spinBox.ValueChanged += SpinBoxOnValueChanged; vPanel.Items.Add(spinBox); spinBoxList.Add(spinBox); } colorPicker.ColorChanged += (sender, args) => { histogramSurface.QueueRedrawAll(); }; vPanel.Items.Add(colorPicker); histogramSurface = new Surface(new SurfaceHandler(colorPicker, spinBoxList)); hPanel.Items.Add(histogramSurface, true); }
public void OpenPopup() { var popup = new AcceptDialog(); popup.SizeFlagsHorizontal = (int)Control.SizeFlags.ExpandFill; popup.SizeFlagsVertical = (int)Control.SizeFlags.ExpandFill; popup.PopupExclusive = true; popup.WindowTitle = "Configure snap"; var container = new VBoxContainer(); var snapSpin = new SpinBox(); snapSpin.MinValue = 0; snapSpin.MaxValue = 99; snapSpin.Step = 0.0001f; snapSpin.Value = snapLength; snapSpin.Connect("value_changed", this, "SetSnapLength"); var snapHBox = new HBoxContainer(); var snapLabel = new Label(); snapLabel.Text = "Snap length"; snapHBox.AddChild(snapLabel); snapHBox.AddChild(snapSpin); container.AddChild(snapHBox); popup.AddChild(container); popup.Connect("popup_hide", popup, "queue_free"); baseControl.AddChild(popup); popup.PopupCentered(new Vector2(200, 100)); }
public void Visit(SpinBox style) { if (!IsNumeric(_current)) { _messages.AddError("Line: " + style.LineNumber + " | Spinbox widget cannot be applied to question of type " + _current + "."); } }
public CargoConsoleOrderMenu() { IoCManager.InjectDependencies(this); Title = Loc.GetString("Order Form"); var vBox = new VBoxContainer(); var gridContainer = new GridContainer { Columns = 2 }; var requesterLabel = new Label { Text = Loc.GetString("Name:") }; Requester = new LineEdit(); gridContainer.AddChild(requesterLabel); gridContainer.AddChild(Requester); var reasonLabel = new Label { Text = Loc.GetString("Reason:") }; Reason = new LineEdit(); gridContainer.AddChild(reasonLabel); gridContainer.AddChild(Reason); var amountLabel = new Label { Text = Loc.GetString("Amount:") }; Amount = new SpinBox { SizeFlagsHorizontal = SizeFlags.FillExpand, Value = 1 }; Amount.SetButtons(new List <int>() { -100, -10, -1 }, new List <int>() { 1, 10, 100 }); Amount.IsValid = (n) => { return(n > 0); }; gridContainer.AddChild(amountLabel); gridContainer.AddChild(Amount); vBox.AddChild(gridContainer); SubmitButton = new Button() { Text = Loc.GetString("OK"), TextAlign = Label.AlignMode.Center, }; vBox.AddChild(SubmitButton); Contents.AddChild(vBox); }
private void Spinner_MaximumTextChanged(object sender, EventArgs e) { SpinBox spinner = (SpinBox)sender; Item item = (Item)spinner.Tag; Data.SetMaximum(item.PrototypeID, (int)spinner.Value); }
public override void _Ready() { Torque = GetNode <SpinBox>(TorquePath); Impulse = GetNode <SpinBox>(ImpulsePath); Friction = GetNode <SpinBox>(FrictionPath); Torque2 = GetNode <SpinBox>(Torque2Path); }
public SpinBox AddSpinBox(Control field) { SpinBox editor = new SpinBox(); AddEditor(field, editor); return(editor); }
public override void DrawInterface(Control parent) { Control sizeScaleField = moduleInterface.AddField("Size Scale"); Control bouncinessField = moduleInterface.AddField("Bounciness"); Control marginField = moduleInterface.AddField("Margin"); SpinBox sizeScaleSpinBox = moduleInterface.AddSpinBox(sizeScaleField); SpinBox bouncinessSpinBox = moduleInterface.AddSpinBox(bouncinessField); SpinBox marginSpinBox = moduleInterface.AddSpinBox(marginField); sizeScaleSpinBox.MinValue = 0f; sizeScaleSpinBox.MaxValue = 1f; sizeScaleSpinBox.Step = 0.01f; sizeScaleSpinBox.Value = sizeScale; bouncinessSpinBox.MinValue = 0f; bouncinessSpinBox.MaxValue = 1f; bouncinessSpinBox.Step = 0.01f; bouncinessSpinBox.Value = bounciness; marginSpinBox.MinValue = 0f; marginSpinBox.MaxValue = 1f; marginSpinBox.Step = 0.01f; marginSpinBox.Value = margin; sizeScaleSpinBox.Connect("value_changed", this, "OnSizeScaleValueChanged"); bouncinessSpinBox.Connect("value_changed", this, "OnBouncinessValueChanged"); marginSpinBox.Connect("value_changed", this, "OnMarginValueChanged"); }
public override void _Ready() { // Options control buttons resetButton = GetNode <Button>(ResetButtonPath); saveButton = GetNode <Button>(SaveButtonPath); // Tab selector buttons graphicsButton = GetNode <Button>(GraphicsButtonPath); soundButton = GetNode <Button>(SoundButtonPath); performanceButton = GetNode <Button>(PerformanceButtonPath); miscButton = GetNode <Button>(MiscButtonPath); // Graphics graphicsTab = GetNode <Control>(GraphicsTabPath); vsync = GetNode <CheckBox>(VSyncPath); fullScreen = GetNode <CheckBox>(FullScreenPath); msaaResolution = GetNode <OptionButton>(MSAAResolutionPath); colourblindSetting = GetNode <OptionButton>(ColourblindSettingPath); chromaticAberrationToggle = GetNode <CheckBox>(ChromaticAberrationTogglePath); chromaticAberrationSlider = GetNode <Slider>(ChromaticAberrationSliderPath); // Sound soundTab = GetNode <Control>(SoundTabPath); masterVolume = GetNode <Slider>(MasterVolumePath); masterMuted = GetNode <CheckBox>(MasterMutedPath); musicVolume = GetNode <Slider>(MusicVolumePath); musicMuted = GetNode <CheckBox>(MusicMutedPath); ambianceVolume = GetNode <Slider>(AmbianceVolumePath); ambianceMuted = GetNode <CheckBox>(AmbianceMutedPath); sfxVolume = GetNode <Slider>(SFXVolumePath); sfxMuted = GetNode <CheckBox>(SFXMutedPath); guiVolume = GetNode <Slider>(GUIVolumePath); guiMuted = GetNode <CheckBox>(GUIMutedPath); // Performance performanceTab = GetNode <Control>(PerformanceTabPath); cloudInterval = GetNode <OptionButton>(CloudIntervalPath); cloudResolution = GetNode <OptionButton>(CloudResolutionPath); runAutoEvoDuringGameplay = GetNode <CheckBox>(RunAutoEvoDuringGameplayPath); // Misc miscTab = GetNode <Control>(MiscTabPath); playIntro = GetNode <CheckBox>(PlayIntroPath); playMicrobeIntro = GetNode <CheckBox>(PlayMicrobeIntroPath); tutorialsEnabledOnNewGame = GetNode <CheckBox>(TutorialsEnabledOnNewGamePath); cheats = GetNode <CheckBox>(CheatsPath); autosave = GetNode <CheckBox>(AutoSavePath); maxAutosaves = GetNode <SpinBox>(MaxAutoSavesPath); maxQuicksaves = GetNode <SpinBox>(MaxQuickSavesPath); tutorialsEnabled = GetNode <CheckBox>(TutorialsEnabledPath); customUsernameEnabled = GetNode <CheckBox>(CustomUsernameEnabledPath); customUsername = GetNode <LineEdit>(CustomUsernamePath); backConfirmationBox = GetNode <WindowDialog>(BackConfirmationBoxPath); defaultsConfirmationBox = GetNode <ConfirmationDialog>(DefaultsConfirmationBoxPath); errorAcceptBox = GetNode <AcceptDialog>(ErrorAcceptBoxPath); selectedOptionsTab = SelectedOptionsTab.Graphics; }
public override object VisitSpinBox(SpinBox spinBox) { if (!spinBox.SupportsDataType(_currentDataType)) { Report.AddError(spinBox.Position, MessageFormat, "spinbox", StringEnum.GetStringValue(_currentDataType)); } return(null); }
void loadComponents() { confirmButton = (Button)GetNode("ConfirmButton"); FootballersBrowser = (FootballersBrowser)GetNode("FootballersBrowser"); errorInfo = (Label)GetNode("ErrorInfo"); memberCountInfo = (Label)GetNode("MemberCountInfo"); teamAlias = (LineEdit)GetNode("TeamAlias"); memberCount = (SpinBox)GetNode("MemberCount"); }
public override void _Ready() { base._Ready(); Model.EventId = GameEventDispatcher.ITEM_TURNED_IN; _itemSelector = GetNode <QuestItemSelector>("VBoxContainer/HBoxContainer/QuestItemSelector"); _amountSpinBox = GetNode <SpinBox>("VBoxContainer/HBoxContainer2/SpinBox"); _amountSpinBox.Connect("value_changed", this, nameof(OnAmountChanged)); _itemSelector.Connect(nameof(QuestItemSelector.ItemSelected), this, nameof(OnItemSelected)); }
public override void _Ready() { base._Ready(); Model.EventId = GameEventDispatcher.PLAYER_INVENTORY_ITEM_UPDATED; _itemSelector = GetNode <QuestItemSelector>("VBoxContainer/HBoxContainer/QuestItemSelector"); _requiredSpinBox = GetNode <SpinBox>("VBoxContainer/HBoxContainer2/SpinBox"); _requiredSpinBox.Connect("value_changed", this, nameof(OnRequiredChanged)); _itemSelector.Connect(nameof(QuestItemSelector.ItemSelected), this, nameof(OnItemSelected)); }
void loadComponents() { backButton = (Button)GetNode("Panel").GetNode("BackButton"); confirmButton = (Button)GetNode("Panel").GetNode("ConfirmButton"); aliasField = (LineEdit)GetNode("Panel").GetNode("AliasField"); errorInfo = (Label)GetNode("Panel").GetNode("ErrorInfo"); maxRateField = (SpinBox)GetNode("Panel").GetNode("MaxRateField"); memberCountField = (SpinBox)GetNode("Panel").GetNode("MemberCountField"); schemesList = (VBoxContainer)GetNode("Panel").GetNode("ScrollContainer").GetNode("SchemesList"); }
public override void _Ready() { base._Ready(); Model = new QuestRewardModel(); _itemSelector = GetNode <QuestItemSelector>("VBoxContainer/QuestItemSelector"); _amountSpinBox = GetNode <SpinBox>("VBoxContainer/HBoxContainer/SpinBox"); _idLineEdit = GetNode <LineEdit>("VBoxContainer/LineEdit"); _itemSelector.Connect(nameof(QuestItemSelector.ItemSelected), this, nameof(OnItemSelected)); _amountSpinBox.Connect("value_changed", this, nameof(OnValueChanged)); }
public override void _Ready() { //General seed = (SpinBox)FindNode("Seed").GetChild(1); longitude = (SpinBox)FindNode("Longitude").GetChild(1); latitude = (SpinBox)FindNode("Latitude").GetChild(1); //Precipitation circulationIntensitySlider = (Slider)FindNode("Circulation intensity").GetChild(1); circulationIntensityBox = (SpinBox)FindNode("Circulation intensity").GetChild(2); precipitationIntesitySlider = (Slider)FindNode("Precipitation Intensity").GetChild(1); precipitationIntesityBox = (SpinBox)FindNode("Precipitation Intensity").GetChild(2); maxPrecipitationSlider = (Slider)FindNode("Max Precipitation").GetChild(1); maxPrecipitationBox = (SpinBox)FindNode("Max Precipitation").GetChild(2); //Circulation windIntesitySlider = (Slider)FindNode("Wind Intesity").GetChild(1); windIntesityBox = (SpinBox)FindNode("Wind Intesity").GetChild(2); windRangeSlider = (Slider)FindNode("Wind Range").GetChild(1); windRangeBox = (SpinBox)FindNode("Wind Range").GetChild(2); pressureAtSeaLevelBox = (SpinBox)FindNode("Pressure at sea level").GetChild(1); //Humidity transpirationSlider = (Slider)FindNode("Transpiration").GetChild(1); transpirationBox = (SpinBox)FindNode("Transpiration").GetChild(2); evaporationSlider = (Slider)FindNode("Evaporation").GetChild(1); evaporationBox = (SpinBox)FindNode("Evaporation").GetChild(2); //Temperature maxTemperatureSlider = (Slider)FindNode("Max Temperature").GetChild(1); maxTemperatureBox = (SpinBox)FindNode("Max Temperature").GetChild(2); minTemperatureSlider = (Slider)FindNode("Min Temperature").GetChild(1); minTemperatureBox = (SpinBox)FindNode("Min Temperature").GetChild(2); //Elevation minElevation = (SpinBox)FindNode("Min elevation").GetChild(1); maxElevation = (SpinBox)FindNode("Max elevation").GetChild(1); waterLevel = (SpinBox)FindNode("Water Level").GetChild(1); frequencySlider = (Slider)FindNode("Frequency").GetChild(1); frequencyBox = (SpinBox)FindNode("Frequency").GetChild(2); octavesSlider = (Slider)FindNode("Octaves").GetChild(1); octavesBox = (SpinBox)FindNode("Octaves").GetChild(2); }
public RangedMorphPanel( IMorph <float, RangedMorphDefinition> morph, Slider slider, SpinBox spinner, Label label, Godot.Control node, ILoggerFactory loggerFactory) : base(morph, label, node, loggerFactory) { Ensure.That(slider, nameof(slider)).IsNotNull(); Ensure.That(spinner, nameof(spinner)).IsNotNull(); Slider = slider; Spinner = spinner; }
public override void DrawInterface(Control parent) { Control field = moduleInterface.AddField("Rate"); SpinBox rateEditor = moduleInterface.AddSpinBox(field); rateEditor.MinValue = 0f; rateEditor.MaxValue = 100f; rateEditor.Step = .01f; rateEditor.AllowGreater = true; rateEditor.Value = rate; rateEditor.Connect("value_changed", this, "OnRateValueChanged"); }
public override void _Ready() { number = GetChild <SpinBox>(0); slider = GetChild <Slider>(1); number.Connect("value_changed", this, nameof(ValuesChanged)); slider.Connect("value_changed", this, nameof(ValuesChanged)); number.MaxValue = max; slider.MaxValue = max; slider.MinValue = min; number.MinValue = min; GetChild <RichTextLabel>(2).BbcodeText = "[center]" + name + "[/center]"; number.Value = SettingsOptions.GetSetting <float>(optionName) * multiplier; slider.Value = number.Value; SettingsOptions.RegisterUpdatedEvent(UpdateValue); }
public override void _Ready() { _backColorRect = this.GetNodeFromPath <ColorRect>(_backColorRectPath); _majorColorRect = this.GetNodeFromPath <ColorRect>(_majorColorRectPath); _minorColorRect = this.GetNodeFromPath <ColorRect>(_minorColorRectPath); _graphNavToggle = this.GetNodeFromPath <CheckBox>(_graphNavTogglePath); _autoToggle = this.GetNodeFromPath <CheckBox>(_autoTogglePath); _autoDelay = this.GetNodeFromPath <SpinBox>(_autoDelayPath); _backColorRect.Connect("gui_input", this, nameof(GetBackgroundColor)); _majorColorRect.Connect("gui_input", this, nameof(GetMajorColor)); _minorColorRect.Connect("gui_input", this, nameof(GetMinorColor)); Connect("about_to_show", this, nameof(OnPrep)); Connect("confirmed", this, nameof(OnConfirm)); }
public override void _Ready() { lbTitle = GetNode("title") as Label; nLayer = GetNode("CLayer/nLayer") as SpinBox; nCollision = GetNode("CColl/nColl") as SpinBox; addLayer = GetNode("CLayer/btAddLayer") as Button; addCollision = GetNode("CColl/btAddColl") as Button; layerContainer = GetNode("CLayer/grid") as GridContainer; collisionContainer = GetNode("CColl/grid") as GridContainer; nLayer.Connect("value_changed", this, nameof(changedLayerValue)); nCollision.Connect("value_changed", this, nameof(changedCollisionValue)); addLayer.Connect("pressed", this, nameof(addMaskLayer)); addCollision.Connect("pressed", this, nameof(addMaskCollision)); }
public override Control BuildUI() { SpinBox spinBox = new SpinBox(); //spinBox.RectMinSize = new Vector2(120, 0); spinBox.MinValue = 0; spinBox.MaxValue = this.max; spinBox.Value = (int)this.Value; spinBox.Connect( "value_changed", Shaderer.instance, nameof(Shaderer.instance.OnApplyParam), new Godot.Collections.Array { this.NameCode }); return(spinBox); }
public MainWindow() { InitializeComponent(); this.Closing += this.handleClose; this.dataDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); this.dataDir = System.IO.Path.Combine(this.dataDir, "XPCalc"); this.elBox = new SpinBox(); this.elBox.Value = 1; this.elBox.Minimum = 1; this.elBox.ValueChanged += this.calculateSimpleXp; Grid.SetRow(this.elBox, 0); Grid.SetColumn(this.elBox, 1); simpleGrid.Children.Add(this.elBox); this.partyLevelBox = new SpinBox(); this.partyLevelBox.Value = 1; this.partyLevelBox.Minimum = 1; this.partyLevelBox.ValueChanged += this.calculateSimpleXp; Grid.SetRow(this.partyLevelBox, 0); Grid.SetColumn(this.partyLevelBox, 3); simpleGrid.Children.Add(this.partyLevelBox); this.partySizeBox = new SpinBox(); this.partySizeBox.Value = 4; this.partySizeBox.Minimum = 1; this.partySizeBox.ValueChanged += this.calculateSimpleXp; Grid.SetRow(this.partySizeBox, 0); Grid.SetColumn(this.partySizeBox, 5); simpleGrid.Children.Add(this.partySizeBox); this.calculateSimpleXp(null, null); this.opponentList.Items.SortDescriptions.Add(new SortDescription("name", ListSortDirection.Ascending)); this.partyList.Items.SortDescriptions.Add(new SortDescription("name", ListSortDirection.Ascending)); //... this.partyXpBox = new SpinBox(); this.partyXpBox.Value = 0; Grid.SetRow(this.partyXpBox, 1); Grid.SetColumn(this.partyXpBox, 1); Grid.SetColumnSpan(this.partyXpBox, 3); xpGrid.Children.Add(this.partyXpBox); System.IO.Directory.CreateDirectory(this.dataDir); this.preferences = new DictionaryStore <string, string>(System.IO.Path.Combine(this.dataDir, "prefs.cfg")); this.opponents = new DictionaryStore <string, int>(System.IO.Path.Combine(this.dataDir, "opponents.db")); if (this.preferences.ContainsKey("partyFile")) { this.doPartyLoad(); } }
public TaskControls(Manager manager) : base(manager) { MinimumWidth = 340; MinimumHeight = 140; Height = 480; Center(); Text = "Controls Test"; TopPanel.Visible = true; Caption.Text = "Information"; Description.Text = "Demonstration of various controls available in Window Library"; Caption.TextColor = Description.TextColor = new Color(96, 96, 96); grpEdit = new GroupPanel(Manager); grpEdit.Init(); grpEdit.Parent = this; grpEdit.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right; grpEdit.Width = ClientWidth - 200; grpEdit.Height = 160; grpEdit.Left = 8; grpEdit.Top = TopPanel.Height + 8; grpEdit.Text = "EditBox"; pnlControls = new Panel(Manager); pnlControls.Init(); pnlControls.Passive = true; pnlControls.Parent = this; pnlControls.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right; pnlControls.Left = 8; pnlControls.Top = grpEdit.Top + grpEdit.Height + 8; pnlControls.Width = ClientWidth - 200; pnlControls.Height = BottomPanel.Top - 32 - pnlControls.Top; pnlControls.BevelBorder = EBevelBorder.All; pnlControls.BevelMargin = 1; pnlControls.BevelStyle = EBevelStyle.Etched; pnlControls.Color = Color.Transparent; lblEdit = new Label(manager); lblEdit.Init(); lblEdit.Parent = grpEdit; lblEdit.Left = 16; lblEdit.Top = 8; lblEdit.Text = "Testing field:"; lblEdit.Width = 128; lblEdit.Height = 16; txtEdit = new TextBox(manager); txtEdit.Init(); txtEdit.Parent = grpEdit; txtEdit.Left = 16; txtEdit.Top = 24; txtEdit.Width = grpEdit.ClientWidth - 32; txtEdit.Height = 20; txtEdit.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right | EAnchors.Bottom; txtEdit.Text = "Text"; rdbNormal = new RadioButton(manager); rdbNormal.Init(); rdbNormal.Parent = grpEdit; rdbNormal.Left = 16; rdbNormal.Top = 52; rdbNormal.Width = grpEdit.ClientWidth - 32; rdbNormal.Anchor = EAnchors.Left | EAnchors.Bottom | EAnchors.Right; rdbNormal.Checked = true; rdbNormal.Text = "Normal mode"; rdbNormal.ToolTip.Text = "Enables normal mode for TextBox control."; rdbNormal.CheckedChanged += new GodLesZ.Library.XNA.WindowLibrary.Controls.EventHandler(ModeChanged); rdbPassword = new RadioButton(manager); rdbPassword.Init(); rdbPassword.Parent = grpEdit; rdbPassword.Left = 16; rdbPassword.Top = 68; rdbPassword.Width = grpEdit.ClientWidth - 32; rdbPassword.Anchor = EAnchors.Left | EAnchors.Bottom | EAnchors.Right; rdbPassword.Checked = false; rdbPassword.Text = "Password mode"; rdbPassword.ToolTip.Text = "Enables password mode for TextBox control."; rdbPassword.CheckedChanged += new GodLesZ.Library.XNA.WindowLibrary.Controls.EventHandler(ModeChanged); chkBorders = new CheckBox(manager); chkBorders.Init(); chkBorders.Parent = grpEdit; chkBorders.Left = 16; chkBorders.Top = 96; chkBorders.Width = grpEdit.ClientWidth - 32; chkBorders.Anchor = EAnchors.Left | EAnchors.Bottom | EAnchors.Right; chkBorders.Checked = false; chkBorders.Text = "Borderless mode"; chkBorders.ToolTip.Text = "Enables or disables borderless mode for TextBox control."; chkBorders.CheckedChanged += new GodLesZ.Library.XNA.WindowLibrary.Controls.EventHandler(chkBorders_CheckedChanged); chkReadOnly = new CheckBox(manager); chkReadOnly.Init(); chkReadOnly.Parent = grpEdit; chkReadOnly.Left = 16; chkReadOnly.Top = 110; chkReadOnly.Width = grpEdit.ClientWidth - 32; chkReadOnly.Anchor = EAnchors.Left | EAnchors.Bottom | EAnchors.Right; chkReadOnly.Checked = false; chkReadOnly.Text = "Read only mode"; chkReadOnly.ToolTip.Text = "Enables or disables read only mode for TextBox control.\nThis mode is necessary to enable explicitly."; chkReadOnly.CheckedChanged += new GodLesZ.Library.XNA.WindowLibrary.Controls.EventHandler(chkReadOnly_CheckedChanged); string[] colors = new string[] {"Red", "Green", "Blue", "Yellow", "Orange", "Purple", "White", "Black", "Magenta", "Cyan", "Brown", "Aqua", "Beige", "Coral", "Crimson", "Gray", "Azure", "Ivory", "Indigo", "Khaki", "Orchid", "Plum", "Salmon", "Silver", "Gold", "Pink", "Linen", "Lime", "Olive", "Slate"}; spnMain = new SpinBox(manager, ESpinBoxMode.List); spnMain.Init(); spnMain.Parent = pnlControls; spnMain.Left = 16; spnMain.Top = 16; spnMain.Width = pnlControls.Width - 32; spnMain.Height = 20; spnMain.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right; spnMain.Items.AddRange(colors); spnMain.Mode = ESpinBoxMode.Range; spnMain.ItemIndex = 0; cmbMain = new ComboBox(manager); cmbMain.Init(); cmbMain.Parent = pnlControls; cmbMain.Left = 16; cmbMain.Top = 44; cmbMain.Width = pnlControls.Width - 32; cmbMain.Height = 20; cmbMain.ReadOnly = true; cmbMain.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right; cmbMain.Items.AddRange(colors); cmbMain.ItemIndex = 0; cmbMain.MaxItems = 5; cmbMain.ToolTip.Color = Color.Yellow; cmbMain.Movable = cmbMain.Resizable = true; cmbMain.OutlineMoving = cmbMain.OutlineResizing = true; trkMain = new TrackBar(manager); trkMain.Init(); trkMain.Parent = pnlControls; trkMain.Left = 16; trkMain.Top = 72; trkMain.Width = pnlControls.Width - 32; trkMain.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right; trkMain.Range = 64; trkMain.Value = 16; trkMain.ValueChanged += new GodLesZ.Library.XNA.WindowLibrary.Controls.EventHandler(trkMain_ValueChanged); lblTrack = new Label(manager); lblTrack.Init(); lblTrack.Parent = pnlControls; lblTrack.Left = 16; lblTrack.Top = 96; lblTrack.Width = pnlControls.Width - 32; lblTrack.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right; lblTrack.Alignment = EAlignment.TopRight; lblTrack.TextColor = new Color(32, 32, 32); trkMain_ValueChanged(this, null); // forcing label redraw with init values mnuListBox = new ContextMenu(manager); MenuItem i1 = new MenuItem("This is very long text"); MenuItem i2 = new MenuItem("Menu", true); MenuItem i3 = new MenuItem("Item", false); //i3.Enabled = false; MenuItem i4 = new MenuItem("Separated", true); MenuItem i11 = new MenuItem(); MenuItem i12 = new MenuItem(); MenuItem i13 = new MenuItem(); MenuItem i14 = new MenuItem(); MenuItem i111 = new MenuItem(); MenuItem i112 = new MenuItem(); MenuItem i113 = new MenuItem(); mnuListBox.Items.AddRange(new MenuItem[] { i1, i2, i3, i4 }); i2.Items.AddRange(new MenuItem[] { i11, i12, i13, i14 }); i13.Items.AddRange(new MenuItem[] { i111, i112, i113 }); lstMain = new ListBox(manager); lstMain.Init(); lstMain.Parent = this; lstMain.Top = TopPanel.Height + 8; lstMain.Left = grpEdit.Left + grpEdit.Width + 8; lstMain.Width = ClientWidth - lstMain.Left - 8; lstMain.Height = ClientHeight - 16 - BottomPanel.Height - TopPanel.Height; lstMain.Anchor = EAnchors.Top | EAnchors.Right | EAnchors.Bottom; lstMain.HideSelection = false; lstMain.Items.AddRange(colors); lstMain.ContextMenu = mnuListBox; prgMain = new ProgressBar(manager); prgMain.Init(); prgMain.Parent = this.BottomPanel; prgMain.Left = lstMain.Left; prgMain.Top = 10; prgMain.Width = lstMain.Width; prgMain.Height = 16; prgMain.Anchor = EAnchors.Top | EAnchors.Right; prgMain.Mode = EProgressBarMode.Infinite; prgMain.Passive = false; btnDisable = new Button(manager); btnDisable.Init(); btnDisable.Parent = BottomPanel; btnDisable.Left = 8; btnDisable.Top = 8; btnDisable.Text = "Disable"; btnDisable.Click += new Controls.EventHandler(btnDisable_Click); btnDisable.TextColor = Color.FromNonPremultiplied(255, 64, 32, 200); btnProgress = new Button(manager); btnProgress.Init(); btnProgress.Parent = BottomPanel; btnProgress.Left = prgMain.Left - 16; btnProgress.Top = prgMain.Top; btnProgress.Height = 16; btnProgress.Width = 16; btnProgress.Text = "!"; btnProgress.Anchor = EAnchors.Top | EAnchors.Right; btnProgress.Click += new Controls.EventHandler(btnProgress_Click); mnuMain = new MainMenu(manager); mnuMain.Items.Add(i2); mnuMain.Items.Add(i13); mnuMain.Items.Add(i3); mnuMain.Items.Add(i4); MainMenu = mnuMain; ToolBarPanel tlp = new ToolBarPanel(manager); ToolBarPanel = tlp; ToolBar tlb = new ToolBar(manager); ToolBar tlbx = new ToolBar(manager); tlb.FullRow = true; tlbx.Row = 1; tlbx.FullRow = false; tlp.Add(tlb); tlp.Add(tlbx); /* tlb.Init(); tlb.Width = 256; tlb.Parent = ToolBarPanel;*/ //tlbx.Init(); /* tlbx.Width = 512; tlbx.Top = 25; tlbx.Parent = ToolBarPanel;*/ /* ToolBarButton tb1 = new ToolBarButton(manager); tb1.Init(); tb1.Parent = tlb; tb1.Left = 10; tb1.Top = 1; tb1.Glyph = new Glyph(Manager.Skin.Images["Icon.Warning"].Resource); tb1.Glyph.SizeMode = SizeMode.Stretched; */ StatusBar stb = new StatusBar(Manager); StatusBar = stb; DefaultControl = txtEdit; OutlineMoving = true; OutlineResizing = true; BottomPanel.BringToFront(); SkinChanged += new GodLesZ.Library.XNA.WindowLibrary.Controls.EventHandler(TaskControls_SkinChanged); TaskControls_SkinChanged(null, null); }
public override object VisitSpinBox(SpinBox spinBox) { if (!spinBox.SupportsDataType(_currentDataType)) { Report.AddError(spinBox.Position, MessageFormat, "spinbox", StringEnum.GetStringValue(_currentDataType)); } return null; }