Ejemplo n.º 1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);


            m_Splitter      = new Alt.GUI.Temporary.Gwen.Control.HorizontalSplitter(this);
            m_Splitter.Dock = Pos.Fill;


            Alt.GUI.Temporary.Gwen.Control.Base imageMainPanel = new Alt.GUI.Temporary.Gwen.Control.Base(m_Splitter);
            imageMainPanel.Dock = Pos.Fill;


            m_TopLabel = new Alt.GUI.Temporary.Gwen.Control.Label(this);            //imageMainPanel);
            m_TopLabel.AutoSizeToContents = true;
            m_TopLabel.Text      = label_TOP_text + " (please, wait while map image creating)";
            m_TopLabel.TextColor = Color.Yellow;
            m_TopLabel.Dock      = Pos.Top;
            m_TopLabel.Margin    = new Margin(0, 3, 0, 7);


            Alt.GUI.Temporary.Gwen.Control.ScrollControl scrollControl = new Alt.GUI.Temporary.Gwen.Control.ScrollControl(imageMainPanel);
            scrollControl.Margin = Margin.One;
            scrollControl.Dock   = Pos.Fill;
            scrollControl.EnableScroll(true, true);
            scrollControl.AutoHideBars = true;


            Alt.GUI.Temporary.Gwen.Control.Base logMainPanel = new Alt.GUI.Temporary.Gwen.Control.Base(m_Splitter);

            Alt.GUI.Temporary.Gwen.Control.Label label = new Alt.GUI.Temporary.Gwen.Control.Label(logMainPanel);
            label.AutoSizeToContents = true;
            label.Text      = "Processing Log:";
            label.TextColor = Color.Yellow;
            label.Dock      = Pos.Top;
            label.Margin    = new Margin(0, 0, 0, 5);

            m_Log      = new Alt.GUI.Temporary.Gwen.Control.ListBox(logMainPanel);
            m_Log.Dock = Pos.Fill;

            m_Splitter.SetPanel(0, imageMainPanel);
            m_Splitter.SetPanel(1, logMainPanel);
            m_Splitter.SetVValue(0.75f);


            m_ImagePanel          = new Base(scrollControl);
            m_ImagePanel.Margin   = Margin.Two;
            m_ImagePanel.Location = PointI.Zero;
            m_ImagePanel.Size     = new SizeI(100, 100);
            m_ImagePanel.Paint   += new GUI.PaintEventHandler(ImagePanel_Paint);


            m_BGThread = new Thread(new ThreadStart(this.CreateBitmap));
            m_BGThread.SetApartmentState(ApartmentState.STA);
            m_BGThread.Start();
        }
Ejemplo n.º 2
0
        void RowSelected(Base control)
        {
            Alt.GUI.Temporary.Gwen.Control.ListBox list = control as Alt.GUI.Temporary.Gwen.Control.ListBox;

            string list_SelectedRows_Last_Text = "";

            foreach (TableRow row in list.SelectedRows)
            {
                list_SelectedRows_Last_Text = row.Text;
            }
            UnitPrint(String.Format("ListBox: RowSelected: {0} [{1}]",
                                    //list.SelectedRows.Last().Text,
                                    list_SelectedRows_Last_Text,
                                    list[list.SelectedRowIndex].Text));
        }
Ejemplo n.º 3
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            {
                Alt.GUI.Temporary.Gwen.Control.ListBox ctrl = new Alt.GUI.Temporary.Gwen.Control.ListBox(this);
                ctrl.SetPosition(10, 10);

                ctrl.AddRow("First");
                ctrl.AddRow("Blue");
                ctrl.AddRow("Yellow");
                ctrl.AddRow("Orange");
                ctrl.AddRow("Brown");
                ctrl.AddRow("Black");
                ctrl.AddRow("Green");
                ctrl.AddRow("Dog");
                ctrl.AddRow("Cat Blue");
                ctrl.AddRow("Shoes");
                ctrl.AddRow("Shirts");
                ctrl.AddRow("Chair");
                ctrl.AddRow("I'm autosized");
                ctrl.AddRow("Last");

                ctrl.AllowMultiSelect = true;
                ctrl.SelectRowsByRegex("Bl.e|Dog");

                ctrl.RowSelected   += RowSelected;
                ctrl.RowUnselected += RowUnSelected;

                ctrl.SizeToContents();
            }

            {
                Alt.GUI.Temporary.Gwen.Control.Layout.Table ctrl = new Alt.GUI.Temporary.Gwen.Control.Layout.Table(this);
                ctrl.SetPosition(120, 10);

                ctrl.AddRow("First");
                ctrl.AddRow("Blue");
                ctrl.AddRow("Yellow");
                ctrl.AddRow("Orange");
                ctrl.AddRow("Brown");
                ctrl.AddRow("Black");
                ctrl.AddRow("Green");
                ctrl.AddRow("Dog");
                ctrl.AddRow("Cat Blue");
                ctrl.AddRow("Shoes");
                ctrl.AddRow("Shirts");
                ctrl.AddRow("Chair");
                ctrl.AddRow("I'm autosized");
                ctrl.AddRow("Last");

                ctrl.SizeToContents(0);
            }

            {
                Alt.GUI.Temporary.Gwen.Control.ListBox ctrl = new Alt.GUI.Temporary.Gwen.Control.ListBox(this);
                ctrl.SetBounds(220, 10, 200, 200);
                ctrl.ColumnCount = 3;
                //ctrl.AllowMultiSelect = true;
                ctrl.RowSelected   += RowSelected;
                ctrl.RowUnselected += RowUnSelected;

                {
                    Alt.GUI.Temporary.Gwen.Control.Layout.TableRow row = ctrl.AddRow("Baked Beans");
                    row.SetCellText(1, "Heinz");
                    row.SetCellText(2, "£3.50");
                }

                {
                    Alt.GUI.Temporary.Gwen.Control.Layout.TableRow row = ctrl.AddRow("Bananas");
                    row.SetCellText(1, "Trees");
                    row.SetCellText(2, "£1.27");
                }

                {
                    Alt.GUI.Temporary.Gwen.Control.Layout.TableRow row = ctrl.AddRow("Chicken");
                    row.SetCellText(1, "\u5355\u5143\u6D4B\u8BD5");
                    row.SetCellText(2, "£8.95");
                }
            }

            {
                // fixed-size table
                Alt.GUI.Temporary.Gwen.Control.Layout.Table table = new Alt.GUI.Temporary.Gwen.Control.Layout.Table(this);
                table.SetColumnCount(3);
                table.SetBounds(450, 10, 320, 100);
                table.SetColumnWidth(0, 100);
                table.SetColumnWidth(1, 100);
                table.SetColumnWidth(2, 100);
                var row1 = table.AddRow();
                row1.SetCellText(0, "Row 1");
                row1.SetCellText(1, "R1 cell 1");
                row1.SetCellText(2, "Row 1 cell 2");

                table.AddRow().Text = "Row 2, slightly bigger";
                table[1].SetCellText(1, "Center cell");

                table.AddRow().Text = "Row 3, medium";
                table[2].SetCellText(2, "Last cell");
            }

            {
                //Control.Label outer = new Label(this);
                //outer.SetBounds(340, 140, 300, 200);

                // autosized table
                Table table = new Table(this);
                table.SetColumnCount(3);
                table.SetPosition(450, 150);

                var row1 = table.AddRow();
                row1.SetCellText(0, "Row 1");
                row1.SetCellText(1, "R1 cell 1");
                row1.SetCellText(2, "Row 1 cell 2");

                table.AddRow().Text = "Row 2, slightly bigger";
                table[1].SetCellText(1, "Center cell");

                table.AddRow().Text = "Row 3, medium";
                table[2].SetCellText(2, "Last cell");

                table.SizeToContents(0);
            }
        }
Ejemplo n.º 4
0
        public UnitTest(Base parent, bool showStatusBar) :
            base(parent)
        {
            Dock = Alt.GUI.Temporary.Gwen.Pos.Fill;
            //NoNeed    SetSize(1024, 768);

            m_List = new CollapsibleList(this);
            m_List.ShouldCacheToTexture = true;

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

            m_TextOutput = new Alt.GUI.Temporary.Gwen.Control.ListBox(BottomDock);
            m_TextOutput.ShouldCacheToTexture = true;

            m_Button = BottomDock.TabControl.AddPage("Output", m_TextOutput);
            m_Button.ShouldCacheToTexture = true;
            BottomDock.Height             = 120;

            m_StatusBar      = new Alt.GUI.Temporary.Gwen.Control.StatusBar(this);
            m_StatusBar.Dock = Alt.GUI.Temporary.Gwen.Pos.Bottom;
            //m_StatusBar.ShouldCacheToTexture = true;
            m_StatusBar.IsHidden = !showStatusBar;

            m_DebugCheck               = new Alt.GUI.Temporary.Gwen.Control.LabeledCheckBox(m_StatusBar);
            m_DebugCheck.Text          = "Debug outlines";
            m_DebugCheck.CheckChanged += DebugCheckChanged;
            m_StatusBar.AddControl(m_DebugCheck, true);

            m_Center      = new Center(this);
            m_Center.Dock = Alt.GUI.Temporary.Gwen.Pos.Fill;
            GUnit test;

            bool cat_ShouldCacheToTexture = false;

            {
                CollapsibleCategory cat = m_List.Add("Non-Interactive");
                {
                    test = new GUnit_Label(m_Center);
                    RegisterUnitTest("Label", cat, test);
                    test = new GUnit_RichLabel(m_Center);
                    RegisterUnitTest("RichLabel", cat, test);
                    test = new GUnit_GroupBox(m_Center);
                    RegisterUnitTest("GroupBox", cat, test);
                    test = new GUnit_ProgressBar(m_Center);
                    RegisterUnitTest("ProgressBar", cat, test);
                    test = new GUnit_ImagePanel(m_Center);
                    RegisterUnitTest("ImagePanel", cat, test);
                    test = new GUnit_StatusBar(m_Center);
                    RegisterUnitTest("StatusBar", cat, test);
                }
                cat.ShouldCacheToTexture = cat_ShouldCacheToTexture;
            }

            {
                CollapsibleCategory cat = m_List.Add("Standard");
                {
                    test = new GUnit_Button(m_Center);
                    RegisterUnitTest("Button", cat, test);
                    test = new GUnit_TextBox(m_Center);
                    RegisterUnitTest("TextBox", cat, test);
                    test = new GUnit_CheckBox(m_Center);
                    RegisterUnitTest("CheckBox", cat, test);
                    test = new GUnit_RadioButton(m_Center);
                    RegisterUnitTest("RadioButton", cat, test);
                    test = new GUnit_ComboBox(m_Center);
                    RegisterUnitTest("ComboBox", cat, test);
                    test = new GUnit_ListBox(m_Center);
                    RegisterUnitTest("ListBox", cat, test);
                    test = new GUnit_NumericUpDown(m_Center);
                    RegisterUnitTest("NumericUpDown", cat, test);
                    test = new GUnit_Slider(m_Center);
                    RegisterUnitTest("Slider", cat, test);
                    test = new GUnit_MenuStrip(m_Center);
                    RegisterUnitTest("MenuStrip", cat, test);
                    test = new GUnit_CrossSplitter(m_Center);
                    RegisterUnitTest("CrossSplitter", cat, test);
                }
                cat.ShouldCacheToTexture = cat_ShouldCacheToTexture;
            }

            {
                CollapsibleCategory cat = m_List.Add("Containers");
                {
                    test = new GUnit_Window(m_Center);
                    RegisterUnitTest("Window", cat, test);
                    test = new GUnit_TreeControl(m_Center);
                    RegisterUnitTest("TreeControl", cat, test);
                    test = new GUnit_Properties(m_Center);
                    RegisterUnitTest("Properties", cat, test);
                    test = new GUnit_TabControl(m_Center);
                    RegisterUnitTest("TabControl", cat, test);
                    test = new GUnit_ScrollControl(m_Center);
                    RegisterUnitTest("ScrollControl", cat, test);
                    test = new GUnit_Docking(m_Center);
                    RegisterUnitTest("Docking", cat, test);
                }
                cat.ShouldCacheToTexture = cat_ShouldCacheToTexture;
            }

            {
                CollapsibleCategory cat = m_List.Add("Non-standard");
                {
                    test = new GUnit_CollapsibleList(m_Center);
                    RegisterUnitTest("CollapsibleList", cat, test);
                    test = new GUnit_ColorPickers(m_Center);
                    RegisterUnitTest("Color pickers", cat, test);
                    test = new GUnit_PictureBox(m_Center);
                    RegisterUnitTest("PictureBox", cat, test);
                }
                cat.ShouldCacheToTexture = cat_ShouldCacheToTexture;
            }

            m_StatusBar.SendToBack();
            PrintText("AltGUI.Temporary.Gwen Unit Test started!");
        }