Exemple #1
0
        public void AddClassAddsClass()
        {
            var button = new Button();

            button.AddClass("red");
            Assert.Equal("red", button.Class);
        }
            public TranslationTab(TranslationTabContainer tabControl, TranslationData tabTitle, Panel panel, string icon)
                : base(tabControl, TTTLanguage.ActiveLanguage.GetFormattedTranslation(tabTitle), icon, panel)
            {
                translationData = tabTitle;

                Button.AddClass("translationtab");
            }
Exemple #3
0
        public NumericTextbox(string name, NumericTheme theme = null, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default,
                              DocType docType = DocType.Default)
            : base(HtmlTag.Div, parsingMode, parsingOptions, docType)
        {
            if (theme == null)
            {
                theme = DefaultTheme;
            }
            Target = name.StartsWith("#") ? name : "#" + name;
            Attr("data-toggle", "numeric");
            AddClass(theme.Wrapper);
            _displayInput = new TextBox();
            Append(_displayInput.AddClass(theme.Input));
            _valueInput = new HiddenField {
                Name = name, Id = name
            };
            Append(_valueInput);

            _increaseButton = new Button();
            _increaseIcon   = new CommonElement(HtmlTag.I);
            _increaseButton.AddClass(theme.IncreaseButton).Append(_increaseIcon.AddClass(theme.IncreaseIcon));

            _decreaseButton = new Button();
            _decreaseIcon   = new CommonElement(HtmlTag.I);
            _decreaseButton.AddClass(theme.DecreaseButton).Append(_decreaseIcon.AddClass(theme.DecreaseIcon));

            _addon = new CommonElement(HtmlTag.Span);
            _addon.AddClass(theme.Addon).Append(_increaseButton).Append(_decreaseButton);
            Append(_addon);
        }
Exemple #4
0
        private Window(string jsonData) : base()
        {
            Instance = this;
            Nodes    = new();

            StyleSheet.Load("/ui/visual-programming/Window.scss");

            AddClass("fullscreen");
            AddClass("visualprogramming");

            Header.NavigationHeader.OnCreateWindowHeader = (header) =>
            {
                Button saveButton = new("", "save", () => Save());
                saveButton.AddClass("save");

                header.AddChild(saveButton);

                Button loadButton = new("", "folder_open", () => Load());
                loadButton.AddClass("load");

                header.AddChild(loadButton);

                BuildButton = new("", "play_arrow", () => Build());
                BuildButton.AddClass("play");

                header.AddChild(BuildButton);

                Button resetButton = new("", "delete", () => Reset());
                resetButton.AddClass("reset");

                header.AddChild(resetButton);
            };

            Header.NavigationHeader.Reload();

            Content.SetPanelContent((panelContent) =>
            {
                Workspace = new()
                {
                    Parent = panelContent
                };
                Sidebar = new(panelContent);

                LoadNodesFromStackJson(jsonData);

                foreach (Node node in Nodes)
                {
                    if (node is MainNode mainNode)
                    {
                        MainNode = mainNode;

                        break;
                    }
                }

                if (MainNode == null)
                {
                    MainNode = AddNode <MainNode>();
                    MainNode.Display();

                    Log.Warning("Missing main node in default visual programming stack");
                }
            });
        }