private void renderTopBar()
        {
            Vector2 pos = ImGui.GetCursorScreenPos();

            ImGui.SetCursorScreenPos(new Vector2(pos.X, pos.Y + 5));
            ImGui.Text(FontAwesome5.FolderOpen);
            ImGui.SameLine();
            Vector2 posAfter = ImGui.GetCursorScreenPos();

            ImGui.SetCursorScreenPos(new Vector2(posAfter.X, pos.Y));
            ImGui.PushItemWidth(-40);
            bool modified = false;

            modified = ImGuiNETExtensions.InputText("##current-dir", ref _currentDir);
            ImGui.SameLine();
            if (ImGui.Button("Up", new Vector2(30, 0)))
            {
                goToParentDir();
            }

            if (modified)
            {
                invalidateFileList();
            }
        }
Exemple #2
0
        private void renderNull(JsonNode node)
        {
            ImGui.AlignTextToFramePadding();
            string key = node.Key ?? "null";
            string s   = "null";

            ImGui.Text(key);
            ImGui.NextColumn();
            ImGui.PushItemWidth(-1);
            ImGuiNETExtensions.InputText($"##{node.GetHashCode()}", ref s, 1024U, InputTextFlags.ReadOnly);
            ImGui.PopItemWidth();
            ImGui.NextColumn();
            _renderCount++;
        }
        private void renderBottomBar()
        {
            if (Type == DialogType.Save)
            {
                ImGui.PushItemWidth(-48 - (_fileSaveType.Length * 7) - 16);
            }
            else
            {
                ImGui.PushItemWidth(-48 - 9);
            }

            ImGuiNETExtensions.InputText("##bottombar", ref _bottomBarText);

            if (Type == DialogType.Save)
            {
                ImGui.SameLine();
                ImGui.Text(_fileSaveType);
            }

            ImGui.SameLine();
            if (Type == DialogType.Open)
            {
                if (ImGui.Button("Open", new Vector2(48, 0)))
                {
                    if (_selectedFile >= _directoriesInCurrentDir.Count)
                    {
                        // selected file was a file
                        dialogAccept();
                    }
                    else
                    {
                        // it was a directory
                        _currentDir = Path.Combine(_currentDir, _bottomBarText);
                        invalidateFileList();
                    }
                }
            }
            else
            {
                if (ImGui.Button("Save", new Vector2(48, 0)))
                {
                    FilePath = Path.Combine(_currentDir, _bottomBarText + _fileSaveType);
                    dialogAccept();
                }
            }
        }
Exemple #4
0
        private void renderString(JsonNode node)
        {
            ImGui.AlignTextToFramePadding();
            string key = node.Key ?? "string";
            string s   = node.AsString;

            ImGui.Text(key);
            ImGui.NextColumn();
            ImGui.PushItemWidth(-1);
            ImGuiNETExtensions.InputText($"##{_renderCount}", ref s);
            ImGui.PopItemWidth();
            ImGui.NextColumn();
            if (node.Schema != null && !node.AsString.Equals(s))
            {
                //node.Token.Validate(node.Schema, _validationEventHandler);
            }
            node.AsString = s;
            _renderCount++;
        }