Exemplo n.º 1
0
        public CollapsibleList(ControlBase parent)
            : base(parent)
        {
            Control.CollapsibleList control = new Control.CollapsibleList(this);
            control.Dock = Dock.Fill;
            control.HorizontalAlignment = HorizontalAlignment.Left;
            control.ItemSelected       += OnSelection;
            control.CategoryCollapsed  += OnCollapsed;

            {
                Control.CollapsibleCategory cat = control.Add("Category One");
                cat.Add("Hello");
                cat.Add("Two");
                cat.Add("Three");
                cat.Add("Four");
            }

            {
                Control.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");
            }

            {
                Control.CollapsibleCategory cat = control.Add("Category One");
                cat.Add("Hello");
                cat.Add("Two");
                cat.Add("Three");
                cat.Add("Four");
            }
        }
Exemplo n.º 2
0
        public CollapsibleList(Base parent)
            : base(parent)
        {
            Control.CollapsibleList control = new Control.CollapsibleList(this);
            control.SetSize(100, 200);
            control.SetPosition(10, 10);
            control.ItemSelected += OnSelection;
            control.CategoryCollapsed += OnCollapsed;

            {
                Control.CollapsibleCategory cat = control.Add("Category One");
                cat.Add("Hello");
                cat.Add("Two");
                cat.Add("Three");
                cat.Add("Four");
            }

            {
                Control.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");
            }

            {
                Control.CollapsibleCategory cat = control.Add("Category One");
                cat.Add("Hello");
                cat.Add("Two");
                cat.Add("Three");
                cat.Add("Four");
            }
        }
        public CollapsibleList(Base parent)
            : base(parent)
        {
            Control.CollapsibleList control = new Control.CollapsibleList(this);
            control.SetSize(300, 200);
            control.SetPosition(10, 10);
            control.ItemSelected      += OnSelection;
            control.CategoryCollapsed += OnCollapsed;

            {
                Control.CollapsibleCategory cat = control.Add("Category One");
                cat.Add("Hello");
                cat.Add("Two");
                cat.Add("Three");
                cat.Add("Four");
            }

            {
                Control.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");
            }

            {
                Control.CollapsibleCategory cat = control.Add("Category One");
                cat.Add("Hello");
                cat.Add("Two");
                cat.Add("Three");
                cat.Add("Four");
            }
        }
        public string Note; // additional text to display in status bar

        public UnitTest(Base 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)
            {
                Text = "Debug outlines"
            };
            m_DebugCheck.CheckChanged += DebugCheckChanged;

            m_StatusBar = new Control.StatusBar(this)
            {
                Dock = Pos.Bottom
            };
            m_StatusBar.AddControl(m_DebugCheck, true);

            m_Center = new Center(this)
            {
                Dock = Pos.Fill
            };
            GUnit test;

            {
                CollapsibleCategory cat = m_List.Add("Non-Interactive");
                {
                    test = new Label(m_Center);
                    RegisterUnitTest("Label", cat, test);
                    test = new RichLabel(m_Center);
                    RegisterUnitTest("RichLabel", cat, test);
                    test = new GroupBox(m_Center);
                    RegisterUnitTest("GroupBox", cat, test);
                    test = new ProgressBar(m_Center);
                    RegisterUnitTest("ProgressBar", cat, test);
                    test = new ImagePanel(m_Center);
                    RegisterUnitTest("ImagePanel", cat, test);
                    test = new StatusBar(m_Center);
                    RegisterUnitTest("StatusBar", cat, test);
                }
            }

            {
                CollapsibleCategory cat = m_List.Add("Standard");
                {
                    test = new Button(m_Center);
                    RegisterUnitTest("Button", cat, test);
                    test = new TextBox(m_Center);
                    RegisterUnitTest("TextBox", cat, test);
                    test = new CheckBox(m_Center);
                    RegisterUnitTest("CheckBox", cat, test);
                    test = new RadioButton(m_Center);
                    RegisterUnitTest("RadioButton", cat, test);
                    test = new ComboBox(m_Center);
                    RegisterUnitTest("ComboBox", cat, test);
                    test = new ListBox(m_Center);
                    RegisterUnitTest("ListBox", cat, test);
                    test = new NumericUpDown(m_Center);
                    RegisterUnitTest("NumericUpDown", cat, test);
                    test = new Slider(m_Center);
                    RegisterUnitTest("Slider", cat, test);
                    test = new Menu(m_Center);
                    RegisterUnitTest("Menu", cat, test);
                    test = new CrossSplitter(m_Center);
                    RegisterUnitTest("CrossSplitter", cat, test);
                }
            }

            {
                CollapsibleCategory cat = m_List.Add("Containers");
                {
                    test = new Window(m_Center);
                    RegisterUnitTest("Window", cat, test);
                    test = new TreeControl(m_Center);
                    RegisterUnitTest("TreeControl", cat, test);
                    test = new Properties(m_Center);
                    RegisterUnitTest("Properties", cat, test);
                    test = new TabControl(m_Center);
                    RegisterUnitTest("TabControl", cat, test);
                    test = new ScrollControl(m_Center);
                    RegisterUnitTest("ScrollControl", cat, test);
                    test = new Docking(m_Center);
                    RegisterUnitTest("Docking", cat, test);
                }
            }

            {
                CollapsibleCategory cat = m_List.Add("Non-standard");
                {
                    test = new CollapsibleList(m_Center);
                    RegisterUnitTest("CollapsibleList", cat, test);
                    test = new ColorPickers(m_Center);
                    RegisterUnitTest("Color pickers", cat, test);
                }
            }

            m_StatusBar.SendToBack();
            PrintText("Unit Test started!");
        }
Exemplo n.º 5
0
        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!");
        }
Exemplo n.º 6
0
 void OnSelection(ControlBase control, EventArgs args)
 {
     Control.CollapsibleList list = control as Control.CollapsibleList;
     UnitPrint(String.Format("CollapsibleList: Selected: {0}", list.GetSelectedButton().Text));
 }
Exemplo n.º 7
0
        public string Note;        // additional text to display in status bar

        public UnitTest(ControlBase parent) : base(parent)
        {
            Dock = Dock.Fill;

            DockBase dock = new DockBase(this);

            dock.Dock = Dock.Fill;

            m_List = new Control.CollapsibleList(this);

            dock.LeftDock.TabControl.AddPage("Unit tests", m_List);
            dock.LeftDock.Width = 150;

            m_TextOutput = new Control.ListBox(this);
            m_TextOutput.AlternateColor = false;

            dock.BottomDock.TabControl.AddPage("Output", m_TextOutput);
            dock.BottomDock.Height = 200;

            m_StatusBar      = new Control.StatusBar(this);
            m_StatusBar.Dock = Dock.Bottom;

            m_DebugCheck               = new Control.LabeledCheckBox(m_StatusBar);
            m_DebugCheck.Text          = "Debug outlines";
            m_DebugCheck.CheckChanged += DebugCheckChanged;

            m_IncScale = new Control.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 Control.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 Control.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 Control.Label(m_StatusBar);
            m_UIScaleText.VerticalAlignment = VerticalAlignment.Stretch;
            m_UIScaleText.Alignment         = Alignment.Left | Alignment.CenterV;
            m_UIScaleText.Text = "Scale:";

            m_Center      = new Control.Layout.DockLayout(dock);
            m_Center.Dock = Dock.Fill;

            List <Type> tests = typeof(UnitTest).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!");
        }