public PreferencesWindow(GameCanvas parent, Editor editor) : base(parent, editor) { Title = "Preferences"; SetSize(450, 425); MinimumSize = Size; ControlBase bottom = new ControlBase(this) { Dock = Dock.Bottom, AutoSizeToContents = true, }; Button defaults = new Button(bottom) { Dock = Dock.Right, Margin = new Margin(0, 2, 0, 0), Text = "Restore Defaults" }; defaults.Clicked += (o, e) => RestoreDefaults(); _prefcontainer = new CollapsibleList(this) { Dock = Dock.Left, AutoSizeToContents = false, Width = 100, Margin = new Margin(0, 0, 5, 0) }; MakeModal(true); Setup(); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); CollapsibleList control = new CollapsibleList(this); //control.ClientBackColor = Color.CornflowerBlue; control.SetSize(100, 200); control.SetPosition(10, 10); control.ItemSelected += OnSelection; control.CategoryCollapsed += OnCollapsed; { CollapsibleCategory cat = control.Add("Category One"); cat.TextColor = Color.LightGreen; cat.UseCurrentColorAsNormal = true; cat.Add("Hello"); cat.Add("Two"); cat.Add("Three"); cat.Add("Four"); } { CollapsibleCategory cat = control.Add("Shopping"); cat.TextColor = Color.Yellow; cat.UseCurrentColorAsNormal = true; cat.Add("Special"); cat.Add("Two Noses"); cat.Add("Orange ears"); cat.Add("Beer"); cat.Add("Three Eyes"); cat.Add("Special"); cat.Add("Two Noses"); cat.Add("Orange ears"); cat.Add("Beer"); cat.Add("Three Eyes"); cat.Add("Special"); cat.Add("Two Noses"); cat.Add("Orange ears"); cat.Add("Beer"); cat.Add("Three Eyes"); } { CollapsibleCategory cat = control.Add("Category Two"); cat.TextColor = Color.Pink; cat.UseCurrentColorAsNormal = true; cat.Add("Hello 2"); cat.Add("Two 2"); cat.Add("Three 2"); cat.Add("Four 2"); } }
public CategoryTest(ControlBase parent) : base(parent) { FlowLayout container = new FlowLayout(parent); container.Dock = Dock.Fill; CollapsibleList list = new CollapsibleList(container); list.Width = 200; list.Height = 200; var l = list.Add("Hell0 i am cat"); l.Add("i have cats"); l.Add("meaow"); l = list.Add("Hi. I'm a kitten"); l.Add("I am proffesional."); l.Add("Mow."); }
public CollapsibleListTest(ControlBase parent) : base(parent) { CollapsibleList control = new CollapsibleList(this); control.Dock = Net.Dock.Fill; control.HorizontalAlignment = Net.HorizontalAlignment.Left; control.ItemSelected += OnSelection; control.CategoryCollapsed += OnCollapsed; { CollapsibleCategory cat = control.Add("Category One"); cat.Add("Hello"); cat.Add("Two"); cat.Add("Three"); cat.Add("Four"); } { CollapsibleCategory cat = control.Add("Shopping"); cat.Add("Special"); cat.Add("Two Noses"); cat.Add("Orange ears"); cat.Add("Beer"); cat.Add("Three Eyes"); cat.Add("Special"); cat.Add("Two Noses"); cat.Add("Orange ears"); cat.Add("Beer"); cat.Add("Three Eyes"); cat.Add("Special"); cat.Add("Two Noses"); cat.Add("Orange ears"); cat.Add("Beer"); cat.Add("Three Eyes"); } { CollapsibleCategory cat = control.Add("Category One"); cat.Add("Hello"); cat.Add("Two"); cat.Add("Three"); cat.Add("Four"); } }
public UnitTestHarnessControls(ControlBase parent) : base(parent) { Dock = Dock.Fill; DockBase dock = new DockBase(this); dock.Dock = Dock.Fill; m_List = new CollapsibleList(this); dock.LeftDock.TabControl.AddPage("Unit tests", m_List); dock.LeftDock.Width = 150; m_TextOutput = new ListBox(this); m_TextOutput.AlternateColor = false; dock.BottomDock.TabControl.AddPage("Output", m_TextOutput); dock.BottomDock.Height = 200; m_StatusBar = new StatusBar(this); m_StatusBar.Dock = Dock.Bottom; m_DebugCheck = new LabeledCheckBox(m_StatusBar); m_DebugCheck.Text = "Debug outlines"; m_DebugCheck.CheckChanged += DebugCheckChanged; m_IncScale = new Button(m_StatusBar); m_IncScale.HorizontalAlignment = HorizontalAlignment.Left; m_IncScale.VerticalAlignment = VerticalAlignment.Stretch; m_IncScale.Width = 30; m_IncScale.Margin = new Margin(0, 0, 8, 0); m_IncScale.TextPadding = new Padding(5, 0, 5, 0); m_IncScale.Text = "+"; m_IncScale.Clicked += (sender, arguments) => { m_UIScale.Value = Math.Min(m_UIScale.Value + 0.25f, 3.0f); }; m_UIScale = new TextBoxNumeric(m_StatusBar); m_UIScale.VerticalAlignment = VerticalAlignment.Stretch; m_UIScale.Width = 70; m_UIScale.Value = GetCanvas().Scale; m_UIScale.TextChanged += (sender, arguments) => { GetCanvas().Scale = m_UIScale.Value; }; m_DecScale = new Button(m_StatusBar); m_DecScale.HorizontalAlignment = HorizontalAlignment.Left; m_DecScale.VerticalAlignment = VerticalAlignment.Stretch; m_DecScale.Width = 30; m_DecScale.Margin = new Margin(4, 0, 0, 0); m_DecScale.TextPadding = new Padding(5, 0, 5, 0); m_DecScale.Text = "-"; m_DecScale.Clicked += (sender, arguments) => { m_UIScale.Value = Math.Max(m_UIScale.Value - 0.25f, 1.0f); }; m_UIScaleText = new Label(m_StatusBar); m_UIScaleText.VerticalAlignment = VerticalAlignment.Stretch; m_UIScaleText.Alignment = Alignment.Left | Alignment.CenterV; m_UIScaleText.Text = "Scale:"; m_Center = new DockLayout(dock); m_Center.Dock = Dock.Fill; List <Type> tests = typeof(UnitTestHarnessControls).Assembly.GetTypes().Where(t => t.IsDefined(typeof(UnitTestAttribute), false)).ToList(); tests.Sort((t1, t2) => { object[] a1s = t1.GetCustomAttributes(typeof(UnitTestAttribute), false); object[] a2s = t2.GetCustomAttributes(typeof(UnitTestAttribute), false); if (a1s.Length > 0 && a2s.Length > 0) { UnitTestAttribute a1 = a1s[0] as UnitTestAttribute; UnitTestAttribute a2 = a2s[0] as UnitTestAttribute; if (a1.Order == a2.Order) { if (a1.Category == a2.Category) { return(String.Compare(a1.Name != null ? a1.Name : t1.Name, a2.Name != null ? a2.Name : t2.Name, StringComparison.OrdinalIgnoreCase)); } else { return(String.Compare(a1.Category, a2.Category, StringComparison.OrdinalIgnoreCase)); } } return(a1.Order - a2.Order); } return(0); }); foreach (Type type in tests) { object[] attribs = type.GetCustomAttributes(typeof(UnitTestAttribute), false); if (attribs.Length > 0) { UnitTestAttribute attrib = attribs[0] as UnitTestAttribute; if (attrib != null) { CollapsibleCategory cat = m_List.FindChildByName(attrib.Category) as CollapsibleCategory; if (cat == null) { cat = m_List.Add(attrib.Category, attrib.Category); } GUnit test = Activator.CreateInstance(type, m_Center) as GUnit; RegisterUnitTest(attrib.Name != null ? attrib.Name : type.Name, cat, test); } } } m_StatusBar.SendToBack(); PrintText("Unit Test started!"); }
public override void _Ready() { organelleSelectionElements = GetTree().GetNodesInGroup("OrganelleSelectionElement"); membraneSelectionElements = GetTree().GetNodesInGroup("MembraneSelectionElement"); reportTabButton = GetNode <Button>(ReportTabButtonPath); patchMapButton = GetNode <Button>(PatchMapButtonPath); cellEditorButton = GetNode <Button>(CellEditorButtonPath); structureTab = GetNode <PanelContainer>(StructureTabPath); structureTabButton = GetNode <Button>(StructureTabButtonPath); appearanceTab = GetNode <PanelContainer>(ApperanceTabPath); appearanceTabButton = GetNode <Button>(AppearanceTabButtonPath); statisticsPanel = GetNode <PanelContainer>(OrganismStatisticsPath); sizeLabel = GetNode <Label>(SizeLabelPath); speedLabel = GetNode <Label>(SpeedLabelPath); hpLabel = GetNode <Label>(HpLabelPath); generationLabel = GetNode <Label>(GenerationLabelPath); mutationPointsLabel = GetNode <Label>(MutationPointsLabelPath); mutationPointsBar = GetNode <ProgressBar>(MutationPointsBarPath); mutationPointsSubtractBar = GetNode <ProgressBar>(MutationPointsSubtractBarPath); rigiditySlider = GetNode <Slider>(RigiditySliderPath); membraneColorPicker = GetNode <ColorPicker>(MembraneColorPickerPath); menuButton = GetNode <TextureButton>(MenuButtonPath); helpButton = GetNode <TextureButton>(HelpButtonPath); undoButton = GetNode <TextureButton>(UndoButtonPath); redoButton = GetNode <TextureButton>(RedoButtonPath); symmetryButton = GetNode <TextureButton>(SymmetryButtonPath); newCellButton = GetNode <TextureButton>(NewCellButtonPath); speciesNameEdit = GetNode <LineEdit>(SpeciesNameEditPath); finishButton = GetNode <Button>(FinishButtonPath); atpBalanceLabel = GetNode <Label>(ATPBalanceLabelPath); atpProductionLabel = GetNode <Label>(ATPProductionLabelPath); atpConsumptionLabel = GetNode <Label>(ATPConsumptionLabelPath); atpProductionBar = GetNode <SegmentedBar>(ATPProductionBarPath); atpConsumptionBar = GetNode <SegmentedBar>(ATPConsumptionBarPath); timeIndicator = GetNode <Label>(TimeIndicatorPath); glucoseReductionLabel = GetNode <Label>(GlucoseReductionLabelPath); autoEvoLabel = GetNode <Label>(AutoEvoLabelPath); externalEffectsLabel = GetNode <Label>(ExternalEffectsLabelPath); mapDrawer = GetNode <PatchMapDrawer>(MapDrawerPath); patchNothingSelected = GetNode <Control>(PatchNothingSelectedPath); patchDetails = GetNode <Control>(PatchDetailsPath); patchName = GetNode <Label>(PatchNamePath); patchPlayerHere = GetNode <Control>(PatchPlayerHerePath); patchBiome = GetNode <Label>(PatchBiomePath); patchDepth = GetNode <Label>(PatchDepthPath); patchTemperature = GetNode <Label>(PatchTemperaturePath); patchPressure = GetNode <Label>(PatchPressurePath); patchLight = GetNode <Label>(PatchLightPath); patchOxygen = GetNode <Label>(PatchOxygenPath); patchNitrogen = GetNode <Label>(PatchNitrogenPath); patchCO2 = GetNode <Label>(PatchCO2Path); patchHydrogenSulfide = GetNode <Label>(PatchHydrogenSulfidePath); patchAmmonia = GetNode <Label>(PatchAmmoniaPath); patchGlucose = GetNode <Label>(PatchGlucosePath); patchPhosphate = GetNode <Label>(PatchPhosphatePath); patchIron = GetNode <Label>(PatchIronPath); speciesListBox = GetNode <CollapsibleList>(SpeciesCollapsibleBoxPath); moveToPatchButton = GetNode <Button>(MoveToPatchButtonPath); symmetryIcon = GetNode <TextureRect>(SymmetryIconPath); patchTemperatureSituation = GetNode <TextureRect>(PatchTemperatureSituationPath); patchLightSituation = GetNode <TextureRect>(PatchLightSituationPath); patchHydrogenSulfideSituation = GetNode <TextureRect>(PatchHydrogenSulfideSituationPath); patchGlucoseSituation = GetNode <TextureRect>(PatchGlucoseSituationPath); patchIronSituation = GetNode <TextureRect>(PatchIronSituationPath); patchAmmoniaSituation = GetNode <TextureRect>(PatchAmmoniaSituationPath); patchPhosphateSituation = GetNode <TextureRect>(PatchPhosphateSituationPath); speedIndicator = GetNode <TextureRect>(SpeedIndicatorPath); hpIndicator = GetNode <TextureRect>(HpIndicatorPath); sizeIndicator = GetNode <TextureRect>(SizeIndicatorPath); negativeAtpPopup = GetNode <ConfirmationDialog>(NegativeAtpPopupPath); islandPopup = GetNode <AcceptDialog>(IslandErrorPath); menu = GetNode <PauseMenu>(MenuPath); mapDrawer.OnSelectedPatchChanged = drawer => { UpdateShownPatchDetails(); }; atpProductionBar.SelectedType = SegmentedBar.Type.ATP; atpProductionBar.IsProduction = true; atpConsumptionBar.SelectedType = SegmentedBar.Type.ATP; RegisterTooltips(); }
public String Note; // additional text to display in status bar public UnitTest(ZGE.Components.ZComponent parent) : base(parent) { Dock = Pos.Fill; SetSize(1024, 768); m_List = new Control.CollapsibleList(this); LeftDock.TabControl.AddPage("Unit tests", m_List); LeftDock.Width = 150; m_TextOutput = new Control.ListBox(BottomDock); m_Button = BottomDock.TabControl.AddPage("Output", m_TextOutput); BottomDock.Height = 200; m_DebugCheck = new Control.LabeledCheckBox(m_List); m_DebugCheck.Text = "Debug outlines"; m_DebugCheck.CheckChanged += DebugCheckChanged; m_StatusBar = new Control.StatusBar(this); m_StatusBar.Dock = Pos.Bottom; m_StatusBar.AddControl(m_DebugCheck, true); //m_Center = new Center(this); //m_Center.Dock = Pos.Fill; GUnit test; { CollapsibleCategory cat = m_List.Add("Non-Interactive"); { test = new Label(this); RegisterUnitTest("Label", cat, test); test = new RichLabel(this); RegisterUnitTest("RichLabel", cat, test); test = new GroupBox(this); RegisterUnitTest("GroupBox", cat, test); test = new ProgressBar(this); RegisterUnitTest("ProgressBar", cat, test); test = new ImagePanel(this); RegisterUnitTest("ImagePanel", cat, test); test = new StatusBar(this); RegisterUnitTest("StatusBar", cat, test); } } { CollapsibleCategory cat = m_List.Add("Standard"); { test = new Button(this); RegisterUnitTest("Button", cat, test); test = new TextBox(this); RegisterUnitTest("TextBox", cat, test); test = new CheckBox(this); RegisterUnitTest("CheckBox", cat, test); test = new RadioButton(this); RegisterUnitTest("RadioButton", cat, test); test = new ComboBox(this); RegisterUnitTest("ComboBox", cat, test); test = new ListBox(this); RegisterUnitTest("ListBox", cat, test); test = new NumericUpDown(this); RegisterUnitTest("NumericUpDown", cat, test); test = new Slider(this); RegisterUnitTest("Slider", cat, test); test = new MenuStrip(this); RegisterUnitTest("MenuStrip", cat, test); test = new CrossSplitter(this); RegisterUnitTest("CrossSplitter", cat, test); } } { CollapsibleCategory cat = m_List.Add("Containers"); { test = new Window(this); RegisterUnitTest("Window", cat, test); test = new TreeControl(this); RegisterUnitTest("TreeControl", cat, test); test = new Properties(this); RegisterUnitTest("Properties", cat, test); test = new TabControl(this); RegisterUnitTest("TabControl", cat, test); test = new ScrollControl(this); RegisterUnitTest("ScrollControl", cat, test); test = new Docking(this); RegisterUnitTest("Docking", cat, test); } } { CollapsibleCategory cat = m_List.Add("Non-standard"); { test = new CollapsibleList(this); RegisterUnitTest("CollapsibleList", cat, test); test = new ColorPickers(this); RegisterUnitTest("Color pickers", cat, test); } } m_StatusBar.SendToBack(); PrintText("Unit Test started!"); }
public void Create() { CreateStatusbar(); CollapsibleList list = new CollapsibleList(this); list.Margin = new Margin(0, 0, 1, 0); list.Dock = Dock.Left; list.AutoSizeToContents = true; var cat = list.Add("Basic"); var page = AddPage(cat, "Labels"); var label = new LabelTest(page); page = AddPage(cat, "Buttons"); var btn = new ButtonTest(page); page = AddPage(cat, "ProgressBar"); var prog = new ProgressBarTest(page); page = AddPage(cat, "Layout"); var layout = new LayoutTest(page); page = AddPage(cat, "Textbox"); var textbox = new TextBoxTest(page); page = AddPage(cat, "Slider"); var slider = new SliderTest(page); cat = list.Add("Containers"); page = AddPage(cat, "Generic Container"); var container = new ContainerTest(page); page = AddPage(cat, "Layout Container"); var layoutcontainer = new LayoutContainerTest(page); page = AddPage(cat, "Notification"); var notify = new NotificationTest(page); _focus = page; _focus.Show(); page = AddPage(cat, "Window"); var window = new WindowTest(page); page = AddPage(cat, "Tab Control"); var tab = new TabTest(page); cat = list.Add("Composite controls"); page = AddPage(cat, "ListBox"); var listbox = new ListBoxTest(page); page = AddPage(cat, "TreeControl"); var tree = new TreeTest(page); page = AddPage(cat, "Menu"); var menu = new MenuTest(page); page = AddPage(cat, "Property"); var prop = new PropertyTest(page); page = AddPage(cat, "Category"); var collapse = new CategoryTest(page); // page.FocusTab(); }
void OnSelection(ControlBase control, EventArgs args) { CollapsibleList list = control as CollapsibleList; UnitPrint(String.Format("CollapsibleList: Selected: {0}", list.GetSelectedButton().Text)); }