class EE::UI::Tools::UICodeEditorSplitter

#include <uicodeeditorsplitter.hpp>

class UICodeEditorSplitter {
public:
    // enums

    enum SplitDirection;

    // structs

    struct NavigationRecord;

    // classes

    class Client;

    // construction

    virtual ~UICodeEditorSplitter();

    // methods

    static const std::map<KeyBindings::Shortcut, std::string> getDefaultKeybindings();
    static const std::map<KeyBindings::Shortcut, std::string> getLocalDefaultKeybindings();
    static std::vector<std::string> getUnlockedCommands();
    static UICodeEditorSplitter* New(UICodeEditorSplitter::Client* client, UISceneNode* sceneNode, std::shared_ptr<ThreadPool> = nullptr, const std::vector<SyntaxColorScheme>& colorSchemes = {}, const std::string& initColorScheme = "");
    virtual bool tryTabClose(UIWidget* widget, UITabWidget::FocusTabBehavior focusTabBehavior, std::function<void()> onMsgBoxCloseCb = {});
    virtual bool tryCloseAllTabs(UIWidget* widget, UITabWidget::FocusTabBehavior focusTabBehavior);
    virtual bool tryCloseOtherTabs(UIWidget* widget, UITabWidget::FocusTabBehavior focusTabBehavior);
    virtual bool tryCloseCleanTabs(UIWidget* widget, UITabWidget::FocusTabBehavior focusTabBehavior);
    virtual bool tryCloseTabsToDirection(UIWidget* widget, UITabWidget::FocusTabBehavior focusTabBehavior, bool toTheRight);
    void closeTab(UIWidget* widget, UITabWidget::FocusTabBehavior focusTabBehavior);
    bool curEditorExistsAndFocused() const;
    UISplitter* split(const SplitDirection& direction, UIWidget* editor, bool openCurEditor = true);
    void switchToTab(Int32 index);
    UITabWidget* findPreviousSplit(UIWidget* widget);
    void switchPreviousSplit(UIWidget* widget);
    UITabWidget* findNextSplit(UIWidget* widget);
    void switchNextSplit(UIWidget* widget);
    void setCurrentEditor(UICodeEditor* editor);
    UITabWidget* tabWidgetFromEditor(UICodeEditor* editor) const;
    UITab* tabFromEditor(UICodeEditor* editor) const;
    UITabWidget* tabWidgetFromWidget(UIWidget* widget) const;
    UISplitter* splitterFromEditor(UICodeEditor* editor) const;
    UISplitter* splitterFromWidget(UIWidget* widget) const;
    std::pair<UITab*, UICodeEditor*> createCodeEditorInTabWidget(UITabWidget* tabWidget);
    std::pair<UITab*, UIWidget*> createWidgetInTabWidget(UITabWidget* tabWidget, UIWidget* widget, const std::string& tabName, bool focus = true);
    std::pair<UITab*, UIWidget*> createWidget(UIWidget* widget, const std::string& tabName, bool focus = true);
    std::vector<std::pair<UITab*, UITabWidget*>> getTabFromOwnedWidgetId(const std::string& id);
    bool removeTabWithOwnedWidgetId(const std::string& id, bool destroyOwnedNode = true, bool immediateClose = false);
    UICodeEditor* createCodeEditor();
    void focusSomeEditor(Node* searchFrom = nullptr);
    bool loadDocument(std::shared_ptr<TextDocument> doc, UICodeEditor* codeEditor = nullptr);
    std::pair<UITab*, UICodeEditor*> createEditorInNewTab();
    std::pair<UITab*, UICodeEditor*> loadDocumentInNewTab(std::shared_ptr<TextDocument> doc);
    bool loadFileFromPath(const std::string& path, UICodeEditor* codeEditor = nullptr);
    void loadAsyncFileFromPath(const std::string& path, UICodeEditor* codeEditor = nullptr, std::function<void(UICodeEditor*, const std::string&)> onLoaded = std::function<void(UICodeEditor*, const std::string&)>());
    std::pair<UITab*, UICodeEditor*> loadFileFromPathInNewTab(const std::string& path);
    void loadAsyncFileFromPathInNewTab(const std::string& path, std::function<void(UICodeEditor*, const std::string&)> onLoaded = std::function<void(UICodeEditor*, const std::string&)>());
    void loadAsyncFileFromPathInNewTab(const std::string& path, std::function<void(UICodeEditor*, const std::string&)> onLoaded, UITabWidget* tabWidget);
    void removeUnusedTab(UITabWidget* tabWidge, bool destroyOwnedNode = true, bool immediateCloset = true);
    UITabWidget* createEditorWithTabWidget(Node* parent, bool openCurEditor = true);
    UITab* isDocumentOpen(const std::string& path, bool checkOnlyInCurrentTabWidget = false, bool checkOpeningDocuments = false) const;
    UITab* isDocumentOpen(const URI& uri, bool checkOnlyInCurrentTabWidget = false, bool checkOpeningDocuments = false) const;
    UICodeEditor* editorFromTab(UITab* tab) const;
    UICodeEditor* findEditorFromPath(const std::string& path);
    void applyColorScheme(const SyntaxColorScheme& colorScheme);
    void forEachWidgetClass(const std::string& className, std::function<void(UIWidget*)> run) const;
    void forEachWidgetType(const UINodeType& nodeType, std::function<void(UIWidget*)> run) const;
    void forEachWidgetTypeStoppable(const UINodeType& nodeType, std::function<bool(UIWidget*)> run) const;
    void forEachWidgetStoppable(std::function<bool(UIWidget*)> run) const;
    void forEachWidget(std::function<void(UIWidget*)> run) const;
    void forEachEditor(std::function<void(UICodeEditor*)> run) const;
    void forEachDoc(std::function<void(TextDocument&doc)> run) const;
    void forEachDocSharedPtr(std::function<void(std::shared_ptr<TextDocument> doc) const;
    void forEachTabWidget(std::function<void(UITabWidget*)> run) const;
    void forEachTabWidgetStoppable(std::function<bool(UITabWidget*)> run) const;
    void zoomIn();
    void zoomOut();
    void zoomReset();
    void closeSplitter(UISplitter* splitter);
    void addRemainingTabWidgets(Node* widget);
    void closeTabWidgets(UISplitter* splitter);
    UICodeEditor* getCurEditor() const;
    bool curEditorIsNotNull() const;
    const SyntaxColorScheme& getCurrentColorScheme() const;
    const std::string& getCurrentColorSchemeName() const;
    void setColorScheme(const std::string& name);
    const std::map<std::string, SyntaxColorScheme>& getColorSchemes() const;
    bool editorExists(UICodeEditor* editor);
    bool isAnyEditorDirty();
    bool allEditorsEmpty();
    void forEachEditorStoppable(std::function<bool(UICodeEditor*)> run) const;
    std::vector<UICodeEditor*> getAllEditors();
    void forEachDocStoppable(std::function<bool(TextDocument&)> run) const;
    std::shared_ptr<TextDocument> findDocFromPath(const std::string& path);
    std::shared_ptr<TextDocument> findDocFromURI(const URI& uri);
    bool getHideTabBarOnSingleTab() const;
    void setHideTabBarOnSingleTab(bool hideTabBarOnSingleTab);
    const std::vector<UITabWidget*>& getTabWidgets() const;
    Node* getBaseLayout() const;
    UIWidget* getCurWidget() const;
    void setCurrentWidget(UIWidget* curWidget);
    bool curWidgetExists() const;
    bool isCurEditor(UICodeEditor* editor);
    UICodeEditor* getSomeEditor();
    size_t countEditorsOpeningDoc(const TextDocument& doc) const;

    template <typename T>
    void registerSplitterCommands(T& t);

    UISceneNode* getUISceneNode() const;
    bool curEditorExists() const;
    bool hasSplit() const;
    UIOrientation getMainSplitOrientation() const;
    void addCurrentPositionToNavigationHistory();
    void addEditorPositionToNavigationHistory(UICodeEditor* editor);
    void updateCurrentPositionInNavigationHistory();
    void goBackInNavigationHistory();
    void goForwardInNavigationHistory();
    void clearNavigationHistory();
    std::shared_ptr<ThreadPool> getThreadPool() const;
    void setThreadPool(const std::shared_ptr<ThreadPool>& threadPool);
    bool checkEditorExists(UICodeEditor*) const;
    bool checkWidgetExists(UIWidget*) const;
    void setOnTabWidgetCreateCb(std::function<void(UITabWidget*)> cb);
};