Example #1
0
        public UiYesNoBox(string message, string caption)
        {
            children = new List<UiComponent>();
            backgroundColor = GraphicScheme.uiBackgroundColor;

            Width = width;

            this.caption = new UiLabel(caption, GraphicScheme.font1);
            this.message = new UiLabel(message, GraphicScheme.font1);

            this.caption.X = 3;
            this.caption.Y = 3;
            this.message.X = 3;
            this.message.Y = 6 + this.caption.Height;

            AddChild(this.caption);
            AddChild(this.message);

            btnYes = new UiButton("Да", 20);
            btnNo = new UiButton("Не", 20);

            btnYes.X = 3;
            btnYes.Y = this.message.Y + this.message.Height + 3;

            btnNo.X = btnYes.Width + 6;
            btnNo.Y = btnYes.Y;

            AddChild(btnYes);
            AddChild(btnNo);

            Height = btnYes.Y + btnNo.Height + 3;          
        }
Example #2
0
        public UiVertexMenu(Vertex v, Graph g, float x, float y)
        {
            visible = true;
            children = new List<UiComponent>();

            X = (int)x;
            Y = (int)y;

            this.v = v;
            graph = g;
            topMenu = new UiVerticalMenu();
            topMenu.AddItem("Премахни връх", RemoveVertex);

            topMenu.X = 3;
            topMenu.Y = 3;

            Width = topMenu.Width + 6;
            Height = topMenu.Height + 6;

            AddChild(topMenu);

            int yp = topMenu.Height + 6; 

            if(v.edges.Count > 0)
            { // изброява всички ребра
                UiLabel label = new UiLabel("Премахни ребро:", GraphicScheme.font1);
                label.X = 3;
                label.Y = yp;
                yp += label.Height + 3;
                AddChild(label);

                bottomMenu = new UiVerticalMenu();

                bottomMenu.X = 3;
                bottomMenu.Y = yp;

                bottomMenu.Width = topMenu.Width;

                Edge e;
                Vertex vo;                

                for (int i = 0; i < v.edges.Count; i++)
                {
                    e = v.edges[i];
                    vo = e.source == v ? e.destination : e.source;
                    dict.Add(bottomMenu.AddItem(vo.id.ToString(), RemoveEdge).id, e);
                }

                AddChild(bottomMenu);
                yp += bottomMenu.Height;

                Height = yp + 3;
            }
            
        }
Example #3
0
        /// <summary>
        /// Създава бутон по текст и височина - автоматично настройва ширината
        /// </summary>
        /// <param name="text"></param>
        /// <param name="height"></param>
        public UiButton(string text, int height)
        {
            children = new List<UiComponent>();
            AddChild(new UiLabel(text, GraphicScheme.font1));

            caption = children[0] as UiLabel;

            Width = caption.Width + 6;
            Height = height;

            CenterText();

            backgroundColor = GraphicScheme.buttonIdle;
        }
Example #4
0
        private UiLabel caption; // текста на бутона
        public UiButton(string text, Font font, int width, int height)
        {
            children = new List<UiComponent>();
            AddChild(new UiLabel(text, font));

            caption = children[0] as UiLabel;

            box.Width = width;
            box.Height = height;

            CenterText();

            backgroundColor = GraphicScheme.buttonIdle;
        }
Example #5
0
        public UiPropertyPanel()
        {
            Width = minWidth;

            titleLabel = new UiLabel("null", GraphicScheme.font1);
            titleLabel.X = 3;
            titleLabel.Y = 3;

            children = new List<UiComponent>();
            AddChild(titleLabel);

            Height = titleLabel.Height + 6;

            for(int i = 0; i < maxProperties; i++)
            {
                propertyLabels[i] = new UiLabel();
                propertyLabels[i].font = GraphicScheme.font1;
                propertyLabels[i].X = 3;
                propertyLabels[i].visible = false;
                AddChild(propertyLabels[i]);
            }
        }
Example #6
0
        /// <summary>
        /// Слага всичките неща в Gui-то
        /// </summary>
        public void InitializeGui()
        {
            gui = new Gui(window);

            fileMenu = new UiVerticalMenu(true);
            fileMenu.AddItem("Зареди", menu_FileOpen);
            fileMenu.AddItem("Запази", menu_FileSave);

            fileMenu.X = 0;
            fileMenu.Y = 20;

            fileMenu.visible = false;

            gui.Add(fileMenu);

            arrangeMenu = new UiVerticalMenu(true);
            arrangeMenu.AddItem("В кръг", menu_Circle);
            arrangeMenu.AddItem("Центрирай", BtnCenterGraph);
            arrangeMenu.AddItem("Разбъракно", menu_Shuffle);

            arrangeMenu.X = 50;
            arrangeMenu.Y = 20;

            arrangeMenu.visible = false;

            gui.Add(arrangeMenu);

            menu = new UiHorizontalMenu(1024);

            menu.AddItem("Файл", menu_FileClicked);
            menu.AddItem("Подредба", menu_ArrangeClicked);
            edgeBtn = menu.AddItem("Добави ребра(включи)", BtnAddEdgeToggle);
            physBtn = menu.AddItem("Физика(включи)", BtnPhysToggle);
            menu.AddItem("Създай граф", menu_Generate);
            menu.AddItem("Изчисти", menu_Clear);
            directivityBtn = menu.AddItem("Насочен(не)", menu_Directivity);
            weightBtn = menu.AddItem("Претеглен(не)", menu_Weight);

            gui.Add(menu);

            #region Debug текстове

            dbgLabel1 = new UiLabel("Все още няма нужда от мен за дебъг!", GraphicScheme.font1);
            dbgLabel1.visible = false;
            dbgLabel1.Y = 25;
            dbgLabel1.X = 5;

            dbgLabel2 = new UiLabel("Все още няма нужда от мен за дебъг!", GraphicScheme.font1);
            dbgLabel2.visible = false;
            dbgLabel2.Y = 45;
            dbgLabel2.X = 5;

            dbgLabel3 = new UiLabel("Все още няма нужда от мен за дебъг!", GraphicScheme.font1);
            dbgLabel3.visible = false;
            dbgLabel3.Y = 65;
            dbgLabel3.X = 5;

            gui.Add(dbgLabel1);
            gui.Add(dbgLabel2);
            gui.Add(dbgLabel3);

            #endregion

            edgeInputLabel = new UiLabel("Въведете тегло на ребро(приключване с Enter или кликване)", GraphicScheme.font1);
            edgeInputLabel.X = 340;
            edgeInputLabel.Y = 50;
            edgeInputLabel.visible = false;
            gui.Add(edgeInputLabel);

            rmbMenu = new UiVerticalMenu();
            rmbMenu.visible = false;
            rmbMenu.AddItem("Добави връх", rmbMenu_AddVertex);
            rmbMenu.AddItem("Демаркирай", rmbMenu_Deselect);
            
            gui.Add(rmbMenu);
            //menu.movable = true;

            propertyPanel = new UiPropertyPanel();
            propertyPanel.X = 0;
            propertyPanel.Y = 500;

            gui.Add(propertyPanel);

            if (connector != null)
            { // менюто за контрол на алгоритъм се показва само когато има такъв
                algoControlMenu = new UiHorizontalMenu(200);

                algoControlMenu.X = 412;
                algoControlMenu.Y = 575;

                algoControlMenu.AddItem("Стъпка", BtnSingleStep);
                algoControlMenu.AddItem("Автоматично", MenuBtnPlay);
                algoControlMenu.AddItem("Пауза", MenuBtnPause);

                gui.Add(algoControlMenu);
            }

            
        }