class EE::UI::UICodeEditor

Overview

#include <uicodeeditor.hpp>

class UICodeEditor:
    public EE::UI::UIWidget,
    public EE::UI::Doc::TextDocument::Client {
public:
    // structs

    struct LastXOffset;
    struct MinimapConfig;
    struct PluginRequestedSpace;

    // construction

    UICodeEditor(const bool& autoRegisterBaseCommands = true, const bool& autoRegisterBaseKeybindings = true);
    virtual ~UICodeEditor();

    // methods

    static UICodeEditor* New();
    static UICodeEditor* NewOpt(const bool& autoRegisterBaseCommands, const bool& autoRegisterBaseKeybindings);
    static const std::map<KeyBindings::Shortcut, std::string> getDefaultKeybindings();
    virtual Uint32 getType() const;
    virtual bool isType(const Uint32& type) const;
    virtual void setTheme(UITheme* Theme);
    virtual void draw();
    virtual void scheduledUpdate(const Time& time);
    void reset();
    TextDocument::LoadStatus loadFromFile(const std::string& path);
    bool loadAsyncFromFile(const std::string& path, std::shared_ptr<ThreadPool> pool, std::function<void(std::shared_ptr<TextDocument>, bool);
    TextDocument::LoadStatus loadFromURL(const std::string& url, const EE::Network::Http::Request::FieldTable& headers = Http::Request::FieldTable());
    bool loadAsyncFromURL(const std::string& url, const Http::Request::FieldTable& headers = Http::Request::FieldTable(), std::function<void(std::shared_ptr<TextDocument>, bool);
    bool save();
    bool save(const std::string& path);
    bool save(IOStreamFile& stream);
    Font* getFont() const;
    const UIFontStyleConfig& getFontStyleConfig() const;
    UICodeEditor* setFont(Font* font);
    UICodeEditor* setFontSize(const Float& size);
    const Float& getFontSize() const;
    UICodeEditor* setFontColor(const Color& color);
    const Color& getFontColor() const;
    UICodeEditor* setFontSelectedColor(const Color& color);
    const Color& getFontSelectedColor() const;
    UICodeEditor* setFontSelectionBackColor(const Color& color);
    const Color& getFontSelectionBackColor() const;
    UICodeEditor* setFontShadowColor(const Color& color);
    const Color& getFontShadowColor() const;
    UICodeEditor* setFontStyle(const Uint32& fontStyle);
    const Uint32& getTabWidth() const;
    UICodeEditor* setTabWidth(const Uint32& tabWidth);
    const Uint32& getFontStyle() const;
    const Float& getOutlineThickness() const;
    UICodeEditor* setOutlineThickness(const Float& outlineThickness);
    const Color& getOutlineColor() const;
    UICodeEditor* setOutlineColor(const Color& outlineColor);
    const Float& getMouseWheelScroll() const;
    void setMouseWheelScroll(const Float& mouseWheelScroll);
    void setLineNumberPaddingLeft(const Float& dpLeft);
    void setLineNumberPaddingRight(const Float& dpRight);
    void setLineNumberPadding(const Float& dpPaddingLeft, const Float& dpPaddingRight);
    const Float& getLineNumberPaddingLeft() const;
    const Float& getLineNumberPaddingRight() const;
    size_t getLineNumberDigits() const;
    Float getLineNumberWidth() const;
    Float getInternalGutterWidth() const;
    virtual Float getGutterWidth() const;
    const bool& getShowLineNumber() const;
    void setShowLineNumber(const bool& showLineNumber);
    const Color& getLineNumberBackgroundColor() const;
    void setLineNumberBackgroundColor(const Color& lineNumberBackgroundColor);
    const Color& getCurrentLineBackgroundColor() const;
    void setCurrentLineBackgroundColor(const Color& currentLineBackgroundColor);
    const Color& getCaretColor() const;
    void setCaretColor(const Color& caretColor);
    const Color& getWhitespaceColor() const;
    void setWhitespaceColor(const Color& color);
    const SyntaxColorScheme& getColorScheme() const;
    void setColorScheme(const SyntaxColorScheme& colorScheme);
    bool hasDocument() const;
    std::shared_ptr<Doc::TextDocument> getDocumentRef() const;
    const Doc::TextDocument& getDocument() const;
    Doc::TextDocument& getDocument();
    void setDocument(std::shared_ptr<TextDocument> doc);
    bool isDirty() const;
    const bool& isLocked() const;
    void setLocked(bool locked);
    const Color& getLineNumberFontColor() const;
    void setLineNumberFontColor(const Color& lineNumberFontColor);
    const Color& getLineNumberActiveFontColor() const;
    void setLineNumberActiveFontColor(const Color& lineNumberActiveFontColor);
    bool isTextSelectionEnabled() const;
    void setTextSelection(const bool& active);
    KeyBindings& getKeyBindings();
    void setKeyBindings(const KeyBindings& keyBindings);
    void addKeyBindingString(const std::string& shortcut, const std::string& command, const bool& allowLocked = false);
    void addKeyBinding(const KeyBindings::Shortcut& shortcut, const std::string& command, const bool& allowLocked = false);
    void replaceKeyBindingString(const std::string& shortcut, const std::string& command, const bool& allowLocked = false);
    void replaceKeyBinding(const KeyBindings::Shortcut& shortcut, const std::string& command, const bool& allowLocked = false);
    void addKeyBindsString(const std::map<std::string, std::string>& binds, const bool& allowLocked = false);
    void addKeyBinds(const std::map<KeyBindings::Shortcut, std::string>& binds, const bool& allowLocked = false);
    const bool& getHighlightCurrentLine() const;
    void setHighlightCurrentLine(const bool& highlightCurrentLine);
    const Uint32& getLineBreakingColumn() const;
    void setLineBreakingColumn(const Uint32& lineBreakingColumn);
    void addUnlockedCommand(const std::string& command);
    void addUnlockedCommands(const std::vector<std::string>& commands);
    bool isUnlockedCommand(const std::string& command);
    virtual bool applyProperty(const StyleSheetProperty& attribute);
    virtual std::string getPropertyString(const PropertyDefinition* propertyDef, const Uint32& propertyIndex = 0) const;
    virtual std::vector<PropertyId> getPropertiesImplemented() const;
    const bool& getHighlightMatchingBracket() const;
    void setHighlightMatchingBracket(const bool& highlightMatchingBracket);
    const Color& getMatchingBracketColor() const;
    void setMatchingBracketColor(const Color& matchingBracketColor);
    const bool& getHighlightSelectionMatch() const;
    void setHighlightSelectionMatch(const bool& highlightSelection);
    const Color& getSelectionMatchColor() const;
    void setSelectionMatchColor(const Color& highlightSelectionMatchColor);
    const bool& getEnableColorPickerOnSelection() const;
    void setEnableColorPickerOnSelection(const bool& enableColorPickerOnSelection);
    void setSyntaxDefinition(const SyntaxDefinition& definition);
    void resetSyntaxDefinition();
    const SyntaxDefinition& getSyntaxDefinition() const;
    const bool& getHorizontalScrollBarEnabled() const;
    void setHorizontalScrollBarEnabled(const bool& horizontalScrollBarEnabled);
    bool getVerticalScrollBarEnabled() const;
    void setVerticalScrollBarEnabled(const bool& verticalScrollBarEnabled);
    const Time& getFindLongestLineWidthUpdateFrequency() const;
    void setFindLongestLineWidthUpdateFrequency(const Time& findLongestLineWidthUpdateFrequency);
    TextPosition moveToLineOffset(const TextPosition& position, int offset, const size_t& cursorIdx = 0);
    void moveToPreviousLine();
    void moveToNextLine();
    void moveToPreviousPage();
    void moveToNextPage();
    void moveToStartOfLine();
    void moveToEndOfLine();
    void moveToStartOfContent();
    void selectToPreviousLine();
    void selectToNextLine();
    void selectToStartOfContent();
    void selectToStartOfLine();
    void selectToEndOfLine();
    void registerKeybindings();
    void registerCommands();
    void moveScrollUp();
    void moveScrollDown();
    void jumpLinesUp();
    void jumpLinesDown();
    void jumpLinesUp(int offset);
    void jumpLinesDown(int offset);
    void indent();
    void unindent();
    void copy();
    void cut();
    void paste();
    void fontSizeGrow();
    void fontSizeShrink();
    void fontSizeReset();
    const bool& getShowWhitespaces() const;
    void setShowWhitespaces(const bool& showWhitespaces);
    const TextSearchParams& getHighlightWord() const;
    void setHighlightWord(const TextSearchParams& highlightWord);
    const TextRange& getHighlightTextRange() const;
    void setHighlightTextRange(const TextRange& highlightSelection);
    void registerPlugin(UICodeEditorPlugin* plugin);
    void unregisterPlugin(UICodeEditorPlugin* plugin);
    virtual Vector2d getTextPositionOffset(const TextPosition& pos, std::optional<Float> lineHeight = {}, bool allowVisualLineEnd = false) const;
    Vector2d getTextPositionOffsetSanitized(TextPosition pos, std::optional<Float> lineHeight = {}) const;
    virtual Int64 getColFromXOffset(VisibleIndex visibleIndex, const Float& x) const;
    std::vector<Rectf> getTextRangeRectangles(const TextRange& range, const Vector2f& startScroll, std::optional<const DocumentLineRange> lineRange = {}, std::optional<Float> lineHeight = {}, std::optional<DocumentViewLineRange> visibleLineRange = std::optional<DocumentViewLineRange>());
    virtual Float getLineWidth(const Int64& docLine);
    size_t characterWidth(const String& str) const;
    Float getTextWidth(const String& text) const;
    size_t characterWidth(const String::View& str) const;
    Float getTextWidth(const String::View& text) const;
    Float getLineHeight() const;
    Float getCharacterSize() const;
    Float getGlyphWidth() const;
    const bool& getColorPreview() const;
    void setColorPreview(bool colorPreview);
    void goToLine(const TextPosition& position, bool centered = true, bool forceExactPosition = false, bool scrollX = true);
    bool getAutoCloseBrackets() const;
    void setAutoCloseBrackets(bool autoCloseBracket);
    bool getInteractiveLinks() const;
    void setInteractiveLinks(bool newInteractiveLinks);
    UILoader* getLoader();
    bool getDisplayLoaderIfDocumentLoading() const;
    void setDisplayLoaderIfDocumentLoading(bool newDisplayLoaderIfDocumentLoading);
    size_t getMenuIconSize() const;
    void setMenuIconSize(size_t menuIconSize);
    bool getCreateDefaultContextMenuOptions() const;
    void setCreateDefaultContextMenuOptions(bool createDefaultContextMenuOptions);
    void openContainingFolder();
    void copyContainingFolderPath();
    void copyFilePath(bool copyPosition = false);
    void scrollToCursor(bool centered = true);
    void scrollTo(TextRange position, bool centered = false, bool forceExactPosition = false, bool scrollX = true);
    void scrollTo(TextPosition position, bool centered = false, bool forceExactPosition = false, bool scrollX = true);
    void scrollToVisibleIndex(Int64 visibleIndex, bool centered = false, bool forceExactPosition = false);
    const MinimapConfig& getMinimapConfig() const;
    void setMinimapConfig(const MinimapConfig& newMinimapConfig);
    bool isMinimapShown() const;
    void showMinimap(bool showMinimap);
    bool getAutoCloseXMLTags() const;
    void setAutoCloseXMLTags(bool autoCloseXMLTags);
    const Time& getCursorBlinkTime() const;
    void setCursorBlinkTime(const Time& blinkTime);
    Int64 getCurrentColumnCount() const;
    bool getFindReplaceEnabled() const;
    void setFindReplaceEnabled(bool findReplaceEnabled);
    const Vector2f& getScroll() const;
    DocumentLineRange getDocumentLineRange() const;
    DocumentViewLineRange getVisibleLineRange() const;
    virtual TextRange getVisibleRange() const;
    int getVisibleLinesCount() const;
    const StyleSheetLength& getLineSpacing() const;
    void setLineSpacing(const StyleSheetLength& lineSpace);
    Float getFontHeight() const;
    Float getLineOffset() const;
    bool registerGutterSpace(UICodeEditorPlugin* plugin, const Float& pixels, int order);
    bool unregisterGutterSpace(UICodeEditorPlugin* plugin);
    bool registerTopSpace(UICodeEditorPlugin* plugin, const Float& pixels, int order);
    bool unregisterTopSpace(UICodeEditorPlugin* plugin);
    void showFindReplace();
    Tools::UIDocFindReplace* getFindReplace();
    TextPosition resolveScreenPosition(const Vector2f& position, bool clamp = true) const;
    Rectf getScreenPosition(const TextPosition& position) const;
    Rectf getVisibleScrollArea() const;
    Sizef getViewportDimensions() const;
    const Float& getPluginsTopSpace() const;
    UICodeEditor* setFontShadowOffset(const Vector2f& offset);
    const Vector2f& getFontShadowOffset() const;
    void setScroll(const Vector2f& val, bool emmitEvent = true);
    bool getShowLineEndings() const;
    void setShowLineEndings(bool showLineEndings);
    Rectf getMinimapRect(const Vector2f& start) const;
    Float getMinimapWidth() const;
    void resetCursor();
    Vector2f getViewPortLineCount() const;
    Sizef getMaxScroll() const;
    void setScrollX(const Float& val, bool emmitEvent = true);
    void setScrollY(const Float& val, bool emmitEvent = true);
    Vector2f getScreenStart() const;
    Vector2f getScreenScroll() const;
    Float getViewportWidth(const bool& forceVScroll = false) const;
    Float getTopAreaWidth() const;
    bool getShowIndentationGuides() const;
    void setShowIndentationGuides(bool showIndentationGuides);
    Vector2f getRelativeScreenPosition(const TextPosition& pos);
    bool getShowLinesRelativePosition() const;
    void showLinesRelativePosition(bool showLinesRelativePosition);
    UIScrollBar* getVScrollBar() const;
    UIScrollBar* getHScrollBar() const;
    size_t getJumpLinesLength() const;
    void setJumpLinesLength(size_t jumpLinesLength);
    std::string getFileLockIconName() const;
    void setFileLockIconName(const std::string& fileLockIconName);
    bool getDisplayLockedIcon() const;
    void setDisplayLockedIcon(bool displayLockedIcon);
    void invalidateLongestLineWidth();
    const DocumentView& documentView() const;
    LineWrapMode getLineWrapMode() const;
    void setLineWrapMode(LineWrapMode mode);
    LineWrapType getLineWrapType() const;
    void setLineWrapType(LineWrapType lineWrapType);
    bool getLineWrapKeepIndentation() const;
    void setLineWrapKeepIndentation(bool keep);
    Float getMinimapLineSpacing() const;
    bool getShowFoldingRegion() const;
    void setShowFoldingRegion(bool showFoldingRegion);
    Drawable* getFoldDrawable() const;
    void setFoldDrawable(Drawable* foldDrawable);
    Drawable* getFoldedDrawable() const;
    void setFoldedDrawable(Drawable* foldedDrawable);
    bool getFoldsAlwaysVisible() const;
    void setFoldsAlwaysVisible(bool foldsAlwaysVisible);
    Time getFoldsRefreshTime() const;
    void setFoldsRefreshTime(const Time& foldsRefreshTime);
    void updateMouseCursor(const Vector2f& position);
    Uint32 getTabIndentCharacter() const;
    void setTabIndentCharacter(Uint32 chr);
    CharacterAlignment getTabIndentAlignment() const;
    void setTabIndentAlignment(CharacterAlignment alignment);
};

Inherited Members

public:
    // typedefs

    typedef std::function<void(const Event*)> EventCallback;
    typedef std::function<void(const Event*)> EventCallback;

    // methods

    virtual void setPosition(const Vector2f& position);
    virtual void setRotation(float angle);
    virtual void setScale(float factorX, float factorY);
    virtual void setScale(const Vector2f& factors);
    virtual void setScaleOrigin(float x, float y);
    virtual void setScaleOrigin(const Vector2f& origin);
    virtual void setRotationOrigin(float x, float y);
    virtual void setRotationOrigin(const Vector2f& origin);
    virtual const Vector2f& getRotationOrigin() const;
    virtual const Vector2f& getPosition() const;
    virtual const float& getRotation() const;
    virtual const Vector2f& getScale() const;
    virtual const Vector2f& getScaleOrigin() const;
    void move(float offsetX, float offsetY);
    void move(const Vector2f& offset);
    void rotate(float angle);
    void scale(float factorX, float factorY);
    void scale(const Vector2f& factor);
    const Transform& getTransform() const;
    const Transform& getInverseTransform() const;
    static Node* New();
    virtual void worldToNodeTranslation(Vector2f& position) const;
    virtual void nodeToWorldTranslation(Vector2f& position) const;
    virtual void worldToNode(Vector2i& pos) const;
    virtual void nodeToWorld(Vector2i& pos) const;
    virtual void worldToNode(Vector2f& pos) const;
    virtual void nodeToWorld(Vector2f& pos) const;
    virtual Uint32 getType() const;
    virtual bool isType(const Uint32& type) const;
    void messagePost(const NodeMessage* Msg);
    virtual void setPosition(const Vector2f& Pos);
    virtual Node* setPosition(const Float& x, const Float& y);
    virtual Node* setSize(const Sizef& size);
    Node* setSize(const Float& Width, const Float& Height);
    virtual const Sizef& getSize() const;
    const Sizef& getPixelsSize() const;
    Node* setVisible(const bool& visible, bool emitEventNotification = true);
    Node* setChildsVisibility(bool visible, bool emitEventNotification = true);
    bool isVisible() const;
    bool isHided() const;
    Node* setEnabled(const bool& enabled);
    bool isEnabled() const;
    bool isDisabled() const;
    Node* getParent() const;
    Node* setParent(Node* parent);
    virtual void close();
    virtual void draw();
    virtual void update(const Time& time);
    virtual void scheduledUpdate(const Time& time);
    Node* getNextNode() const;
    Node* getPrevNode() const;
    Node* getNextNodeLoop() const;
    Node* setData(const UintPtr& data);
    const UintPtr& getData() const;
    Node* setBlendMode(const BlendMode& blend);
    const BlendMode& getBlendMode() const;
    Node* toFront();
    Node* toBack();
    void toPosition(const Uint32& position);
    const Uint32& getNodeFlags() const;
    void setNodeFlags(const Uint32& flags);
    bool isSceneNode() const;
    bool isUISceneNode() const;
    bool isUINode() const;
    bool isWidget() const;
    bool isWindow() const;
    bool isLayout() const;
    bool isClipped() const;
    bool isRotated() const;
    bool isScaled() const;
    bool isFrameBuffer() const;
    bool isMouseOver() const;
    bool isMouseOverMeOrChilds() const;
    bool isMeOrParentTreeVisible() const;
    bool isMeOrParentTreeRotated() const;
    bool isMeOrParentTreeScaled() const;
    bool isMeOrParentTreeScaledOrRotated() const;
    bool isMeOrParentTreeScaledOrRotatedOrFrameBuffer() const;
    Uint32 addEventListener(const Uint32& eventType, const EventCallback& callback);
    Uint32 on(const Uint32& eventType, const EventCallback& callback);
    Uint32 onClick(const std::function<void(const MouseEvent*)>& callback, const MouseButton& button = MouseButton::EE_BUTTON_LEFT);
    void removeEventsOfType(const Uint32& eventType);
    void removeEventListener(const Uint32& callbackId);
    void removeEventListener(const std::vector<Uint32>& callbacksIds);
    void clearEventListener();
    Node* getFirstChild() const;
    Node* getLastChild() const;
    const Polygon2f& getWorldPolygon();
    const Rectf& getWorldBounds();
    bool isParentOf(const Node* node) const;
    void sendEvent(const Event* Event);
    void sendMouseEvent(const Uint32& Event, const Vector2i& position, const Uint32& flags);
    void sendCommonEvent(const Uint32& Event);
    void sendTextEvent(const Uint32& event, const std::string& text);
    void childsCloseAll();
    const std::string& getId() const;
    virtual Node* setId(const std::string& id);
    const String::HashType& getIdHash() const;
    Node* find(const std::string& id) const;
    Node* hasChild(const std::string& id) const;

    template <typename T>
    T* find(const std::string& id) const;

    template <typename T>
    T* bind(const std::string& id, T*& node);

    template <typename T>
    T* asType();

    template <typename T>
    const T* asConstType() const;

    Node* findByType(const Uint32& type) const;

    template <typename T>
    T* findByType(const Uint32& type) const;

    template <typename T>
    T* bindByType(const Uint32& type, T*& node);

    std::vector<Node*> findAllByType(const Uint32& type) const;

    template <typename T>
    std::vector<T*> findAllByType(const Uint32& type) const;

    bool inNodeTree(Node* node) const;
    bool isReverseDraw() const;
    void setReverseDraw(bool reverseDraw);
    void invalidateDraw();
    virtual void setRotation(float angle);
    void setRotation(const Float& angle, const OriginPoint& center);
    const OriginPoint& getRotationOriginPoint() const;
    void setRotationOriginPoint(const OriginPoint& center);
    void setRotationOriginPointX(const std::string& xEq);
    void setRotationOriginPointY(const std::string& yEq);
    Vector2f getRotationCenter() const;
    virtual void setScale(const Vector2f& scale);
    void setScale(const Vector2f& scale, const OriginPoint& center);
    void setScale(const Float& scale, const OriginPoint& center = OriginPoint::OriginCenter);
    const OriginPoint& getScaleOriginPoint() const;
    void setScaleOriginPoint(const OriginPoint& center);
    void setScaleOriginPointX(const std::string& xEq);
    void setScaleOriginPointY(const std::string& yEq);
    Vector2f getScaleCenter() const;
    virtual void setScale(float factorX, float factorY);
    virtual void setScaleOrigin(float x, float y);
    virtual void setRotationOrigin(float x, float y);
    const Float& getAlpha() const;
    virtual void setAlpha(const Float& alpha);
    virtual void setChildsAlpha(const Float& alpha);
    ActionManager* getActionManager() const;
    Node* runAction(Action* action);
    bool removeAction(Action* action);
    bool removeActions(const std::vector<Action*>& actions);
    bool removeActionsByTag(const String::HashType& tag);
    std::vector<Action*> getActions();
    std::vector<Action*> getActionsByTag(const Uint32& tag);
    void clearActions();
    Transform getLocalTransform() const;
    Transform getGlobalTransform() const;
    Transform getNodeToWorldTransform() const;
    Transform getWorldToNodeTransform() const;
    Vector2f convertToNodeSpace(const Vector2f& worldPoint) const;
    Vector2f convertToWorldSpace(const Vector2f& nodePoint) const;
    Rectf getLocalBounds() const;
    bool hasFocus() const;
    bool hasFocusWithin() const;
    virtual Node* setFocus(NodeFocusReason reason = NodeFocusReason::Unknown);
    Node* getFirstWidget() const;
    Node* getParentWidget() const;
    void enableReportSizeChangeToChilds();
    void disableReportSizeChangeToChilds();
    bool reportSizeChangeToChilds() const;
    Node* centerHorizontal();
    Node* centerVertical();
    Node* center();
    Node* clipEnable();
    Node* clipDisable();
    void writeNodeFlag(const Uint32& Flag, const Uint32& Val);
    SceneNode* getSceneNode() const;
    EventDispatcher* getEventDispatcher() const;
    virtual bool isDrawInvalidator() const;
    bool invalidated() const;
    virtual void invalidate(Node* invalidator);
    Uint32 getChildCount() const;
    Uint32 getChildOfTypeCount(const Uint32& type) const;
    Node* getChildAt(Uint32 Index) const;
    Uint32 getNodeIndex() const;
    Uint32 getNodeOfTypeIndex() const;
    void runOnMainThread(Actions::Runnable::RunnableFunc runnable, const Time& delay = Seconds(0), const Uint32& uniqueIdentifier = 0);
    void setTimeout(Actions::Runnable::RunnableFunc runnable, const Time& delay = Seconds(0), const Uint32& uniqueIdentifier = 0);
    void debounce(Actions::Runnable::RunnableFunc runnable, const Time& delay, const Uint32& uniqueIdentifier);
    void setInterval(Actions::Runnable::RunnableFunc runnable, const Time& interval, const Uint32& uniqueIdentifier = 0);
    bool isChild(Node* child) const;
    bool inParentTreeOf(Node* child) const;
    void setLoadingState(bool loading);
    bool isLoadingState() const;
    virtual void onIdChange();
    bool isClosing() const;
    bool isClosingChildren() const;
    virtual Node* overFind(const Vector2f& Point);
    void detach();
    void forEachNode(std::function<void(Node*)> func);
    void forEachChild(std::function<void(Node*)> func);
    virtual void nodeDraw();
    Uint32 forceKeyDown(const KeyEvent& event);
    Uint32 foceKeyUp(const KeyEvent& event);
    Uint32 forceTextInput(const TextInputEvent& Event);
    const Vector2f& getScreenPos() const;
    Rectf getScreenRect() const;
    bool hasEventsOfType(const Uint32& eventType) const;
    static UINode* New();
    virtual void worldToNodeTranslation(Vector2f& position) const;
    virtual void nodeToWorldTranslation(Vector2f& position) const;
    virtual void worldToNode(Vector2i& pos) const;
    virtual void nodeToWorld(Vector2i& pos) const;
    virtual void worldToNode(Vector2f& pos) const;
    virtual void nodeToWorld(Vector2f& pos) const;
    virtual Uint32 getType() const;
    virtual bool isType(const Uint32& type) const;
    virtual void setPosition(const Vector2f& Pos);
    virtual Node* setPosition(const Float& x, const Float& y);
    UINode* setPixelsPosition(const Vector2f& position);
    UINode* setPixelsPosition(const Float& x, const Float& y);
    virtual const Vector2f& getPosition() const;
    const Vector2f& getPixelsPosition() const;
    virtual Node* setSize(const Sizef& size);
    virtual Node* setSize(const Float& Width, const Float& Height);
    UINode* setPixelsSize(const Sizef& size);
    UINode* setPixelsSize(const Float& x, const Float& y);
    virtual const Sizef& getSize() const;
    Rect getRect() const;
    Rectf getRectBox() const;
    virtual void draw();
    Uint32 getHorizontalAlign() const;
    UINode* setHorizontalAlign(Uint32 halign);
    Uint32 getVerticalAlign() const;
    UINode* setVerticalAlign(Uint32 valign);
    UINode* setGravity(Uint32 hvalign);
    UINodeDrawable* setBackgroundFillEnabled(bool enabled);
    UINode* setBackgroundDrawable(Drawable* drawable, bool ownIt = false, int index = 0);
    UINode* setBackgroundDrawable(const std::string& drawable, int index);
    UINode* setBackgroundColor(const Color& color);
    UINode* setBackgroundTint(const Color& color, int index);
    UINode* setBackgroundPositionX(const std::string& positionX, int index = 0);
    UINode* setBackgroundPositionY(const std::string& positionY, int index = 0);
    UINode* setBackgroundRepeat(const std::string& repeatRule, int index = 0);
    UINode* setBackgroundSize(const std::string& size, int index = 0);
    Color getBackgroundColor() const;
    Color getBackgroundTint(int index = 0) const;
    UINode* setBorderRadius(const unsigned int& corners);
    UINode* setTopLeftRadius(const std::string& radius);
    UINode* setTopRightRadius(const std::string& radius);
    UINode* setBottomLeftRadius(const std::string& radius);
    UINode* setBottomRightRadius(const std::string& radius);
    Uint32 getBorderRadius() const;
    UINodeDrawable* setForegroundFillEnabled(bool enabled);
    UINode* setForegroundDrawable(Drawable* drawable, bool ownIt = false, int index = 0);
    UINode* setForegroundDrawable(const std::string& drawable, int index = 0);
    UINode* setForegroundColor(const Color& color);
    UINode* setForegroundTint(const Color& color, int index);
    UINode* setForegroundPositionX(const std::string& positionX, int index = 0);
    UINode* setForegroundPositionY(const std::string& positionY, int index = 0);
    UINode* setForegroundRepeat(const std::string& repeatRule, int index = 0);
    UINode* setForegroundSize(const std::string& size, int index = 0);
    Color getForegroundColor() const;
    Color getForegroundTint(int index) const;
    UINode* setForegroundRadius(const unsigned int& corners);
    Uint32 getForegroundRadius() const;
    UIBorderDrawable* setBorderEnabled(bool enabled) const;
    UINode* setBorderColor(const Color& color);
    Color getBorderColor();
    UINode* setBorderWidth(const unsigned int& width);
    Float getBorderWidth() const;
    const Uint32& getFlags() const;
    virtual UINode* setFlags(const Uint32& flags);
    virtual UINode* unsetFlags(const Uint32& flags);
    virtual UINode* resetFlags(Uint32 newFlags = 0);
    UINodeDrawable* getBackground() const;
    bool hasBackground() const;
    UINodeDrawable* getForeground() const;
    bool hasForeground() const;
    UIBorderDrawable* getBorder() const;
    void setThemeByName(const std::string& Theme);
    virtual void setTheme(UITheme* Theme);
    virtual UINode* setThemeSkin(UITheme* Theme, const std::string& skinName);
    virtual UINode* setThemeSkin(const std::string& skinName);
    void setThemeToChilds(UITheme* Theme);
    UISkin* getSkin() const;
    virtual UINode* setSkin(const UISkin& Skin);
    UINode* setSkin(UISkin* skin);
    UINode* setSkinColor(const Color& color);
    const Color& getSkinColor() const;
    void removeSkin();
    virtual void pushState(const Uint32& State, bool emitEvent = true);
    virtual void popState(const Uint32& State, bool emitEvent = true);
    Sizef getSkinSize(const Uint32& state = UIState::StateFlagNormal) const;
    void applyDefaultTheme();
    Node* getWindowContainer() const;
    bool isTabFocusable() const;
    bool isDragging() const;
    void setDragging(const bool& dragging);
    void startDragging(const Vector2f& position);
    bool ownsChildPosition() const;
    const Vector2f& getDragPoint() const;
    void setDragPoint(const Vector2f& Point);
    bool isDragEnabled() const;
    void setDragEnabled(const bool& enable);
    void setDragButton(const Uint32& Button);
    const Uint32& getDragButton() const;
    virtual Node* setFocus(NodeFocusReason reason = NodeFocusReason::Unknown);
    Float getPropertyRelativeTargetContainerLength(const CSS::PropertyRelativeTarget& relativeTarget, const Float& defaultValue = 0, const Uint32& propertyIndex = 0) const;
    virtual Float convertLength(const CSS::StyleSheetLength& length, const Float& containerLength) const;
    Float convertLengthAsDp(const CSS::StyleSheetLength& length, const Float& containerLength) const;
    Float lengthFromValue(const std::string& value, const CSS::PropertyRelativeTarget& relativeTarget, const Float& defaultValue = 0, const Uint32& propertyIndex = 0) const;
    Float lengthFromValue(const CSS::StyleSheetProperty& property, const Float& defaultValue = 0);
    Float lengthFromValueAsDp(const std::string& value, const CSS::PropertyRelativeTarget& relativeTarget, const Float& defaultValue = 0, const Uint32& propertyIndex = 0) const;
    Float lengthFromValueAsDp(const CSS::StyleSheetProperty& property, const Float& defaultValue = 0) const;
    UISceneNode* getUISceneNode() const;
    void setMinWidth(const Float& width);
    void setMinHeight(const Float& height);
    void setMinSize(const Sizef& size);
    const Sizef& getCurMinSize() const;
    Rectf getLocalDpBounds() const;
    virtual void nodeDraw();
    void clearForeground();
    void clearBackground();
    const ClipType& getClipType() const;
    UINode* setClipType(const ClipType& clipType);
    bool hasBorder() const;
    virtual const Rectf& getPixelsPadding() const;
    const std::string& getMinWidthEq() const;
    void setMinSizeEq(const std::string& minWidthEq, const std::string& minHeightEq);
    void setMinWidthEq(const std::string& minWidthEq);
    const std::string& getMinHeightEq() const;
    void setMinHeightEq(const std::string& minHeightEq);
    const std::string& getMaxWidthEq() const;
    void setMaxSizeEq(const std::string& maxWidthEq, const std::string& maxHeightEq);
    void setMaxWidthEq(const std::string& maxWidthEq);
    const std::string& getMaxHeightEq() const;
    void setMaxHeightEq(const std::string& maxHeightEq);
    Sizef getMinSize() const;
    Sizef getMaxSize() const;
    Sizef getMinSizePx() const;
    Sizef getMaxSizePx() const;
    Sizef fitMinMaxSizeDp(const Sizef& size) const;
    Sizef fitMinMaxSizePx(const Sizef& size) const;
    virtual bool isScrollable() const;
    static UIWidget* New();
    static UIWidget* NewWithTag(const std::string& tag);
    virtual Uint32 getType() const;
    virtual bool isType(const Uint32& type) const;
    virtual UINode* setFlags(const Uint32& flags);
    virtual UINode* unsetFlags(const Uint32& flags);
    virtual UIWidget* setAnchors(const Uint32& flags);
    virtual void setTheme(UITheme* Theme);
    virtual UINode* setThemeSkin(const std::string& skinName);
    virtual UINode* setThemeSkin(UITheme* Theme, const std::string& skinName);
    virtual Node* setId(const std::string& id);
    virtual bool acceptsDropOfWidget(const UIWidget* widget);
    UIWidget* acceptsDropOfWidgetInTree(const UIWidget* widget);
    UITooltip* getTooltip();
    void tooltipRemove();
    UIWidget* setTooltipText(const String& text);
    String getTooltipText();
    void updateAnchorsDistances();
    const Rectf& getLayoutMargin() const;
    const Rectf& getLayoutPixelsMargin() const;
    UIWidget* setLayoutMargin(const Rectf& margin);
    UIWidget* setLayoutMarginLeft(const Float& marginLeft);
    UIWidget* setLayoutMarginRight(const Float& marginRight);
    UIWidget* setLayoutMarginTop(const Float& marginTop);
    UIWidget* setLayoutMarginBottom(const Float& marginBottom);
    UIWidget* setLayoutPixelsMargin(const Rectf& margin);
    UIWidget* setLayoutPixelsMarginLeft(const Float& marginLeft);
    UIWidget* setLayoutPixelsMarginRight(const Float& marginRight);
    UIWidget* setLayoutPixelsMarginTop(const Float& marginTop);
    UIWidget* setLayoutPixelsMarginBottom(const Float& marginBottom);
    Float getLayoutWeight() const;
    UIWidget* setLayoutWeight(const Float& weight);
    Uint32 getLayoutGravity() const;
    UIWidget* setLayoutGravity(const Uint32& layoutGravity);
    const SizePolicy& getLayoutWidthPolicy() const;
    UIWidget* setLayoutWidthPolicy(const SizePolicy& widthPolicy);
    const SizePolicy& getLayoutHeightPolicy() const;
    UIWidget* setLayoutHeightPolicy(const SizePolicy& heightPolicy);
    UIWidget* setLayoutSizePolicy(const SizePolicy& widthPolicy, const SizePolicy& heightPolicy);
    UIWidget* setLayoutPositionPolicy(const PositionPolicy& layoutPositionPolicy, UIWidget* of);
    UIWidget* getLayoutPositionPolicyWidget() const;
    PositionPolicy getLayoutPositionPolicy() const;
    virtual void loadFromXmlNode(const pugi::xml_node& node);
    void notifyLayoutAttrChange();
    void notifyLayoutAttrChangeParent();
    void setStyleSheetInlineProperty(const std::string& name, const std::string& value, const Uint32& specificity = UINT32_MAX - 1);
    virtual bool applyProperty(const StyleSheetProperty& attribute);
    const Rectf& getPadding() const;
    virtual const Rectf& getPixelsPadding() const;
    UIWidget* setPadding(const Rectf& padding);
    UIWidget* setPaddingLeft(const Float& paddingLeft);
    UIWidget* setPaddingRight(const Float& paddingRight);
    UIWidget* setPaddingTop(const Float& paddingTop);
    UIWidget* setPaddingBottom(const Float& paddingBottom);
    UIWidget* setPaddingPixels(const Rectf& padding);
    UIWidget* setPaddingPixelsLeft(const Float& paddingLeft);
    UIWidget* setPaddingPixelsRight(const Float& paddingRight);
    UIWidget* setPaddingPixelsTop(const Float& paddingTop);
    UIWidget* setPaddingPixelsBottom(const Float& paddingBottom);
    const std::string& getStyleSheetTag() const;
    const std::string& getStyleSheetId() const;
    const std::vector<std::string>& getStyleSheetClasses() const;
    UIWidget* getStyleSheetParentElement() const;
    UIWidget* getStyleSheetPreviousSiblingElement() const;
    UIWidget* getStyleSheetNextSiblingElement() const;
    const std::vector<std::string>& getStyleSheetPseudoClasses() const;
    UIWidget* resetClass();
    UIWidget* setClass(const std::string& cls);
    UIWidget* setClasses(const std::vector<std::string>& classes);
    UIWidget* addClass(const std::string& cls);
    UIWidget* addClasses(const std::vector<std::string>& classes);
    UIWidget* removeClass(const std::string& cls);
    UIWidget* removeClasses(const std::vector<std::string>& classes);
    bool hasClass(const std::string& cls) const;
    void toggleClass(const std::string& cls);
    void setElementTag(const std::string& tag);
    const std::vector<std::string> getClasses() const;
    const std::string& getElementTag() const;
    virtual void pushState(const Uint32& State, bool emitEvent = true);
    virtual void popState(const Uint32& State, bool emitEvent = true);
    UIStyle* getUIStyle() const;
    void reloadStyle(const bool& reloadChilds = true, const bool& disableAnimations = false, const bool& reportStateChange = true, const bool& forceReApplyProperties = false);
    void beginAttributesTransaction();
    void endAttributesTransaction();
    const Uint32& getStyleState() const;
    const Uint32& getStylePreviousState() const;
    std::vector<UIWidget*> findAllByClass(const std::string& className);
    std::vector<UIWidget*> findAllByTag(const std::string& tag);
    UIWidget* findByClass(const std::string& className);

    template <typename T>
    T* findByClass(const std::string& className);

    UIWidget* findByTag(const std::string& tag);

    template <typename T>
    T* findByTag(const std::string& tag);

    UIWidget* querySelector(const CSS::StyleSheetSelector& selector);
    UIWidget* querySelector(const std::string& selector);

    template <typename T>
    T* querySelector(const std::string& selector);

    std::vector<UIWidget*> querySelectorAll(const CSS::StyleSheetSelector& selector);
    std::vector<UIWidget*> querySelectorAll(const std::string& selector);
    std::string getPropertyString(const std::string& property) const;
    virtual std::string getPropertyString(const PropertyDefinition* propertyDef, const Uint32& propertyIndex = 0) const;
    virtual std::vector<PropertyId> getPropertiesImplemented() const;
    bool isSceneNodeLoading() const;
    void reportStyleStateChangeRecursive(bool disableAnimations = false, bool forceReApplyStyles = false);
    UITooltip* createTooltip();
    bool isTabStop() const;
    void setTabStop();
    void unsetTabStop();
    bool isTabFocusable() const;
    void setTabFocusable();
    void unsetTabFocusable();
    UIWidget* getPrevTabWidget() const;
    UIWidget* getNextTabWidget() const;
    bool hasPseudoClass(const std::string& pseudoCls) const;
    bool isTooltipEnabled() const;
    void setTooltipEnabled(bool enabled);
    UIWidget* getPrevWidget() const;
    UIWidget* getNextWidget() const;
    String getTranslatorString(const std::string& str);
    String getTranslatorString(const std::string& str, const String& defaultValue);
    String i18n(const std::string& str);
    String i18n(const std::string& str, const String& defaultValue);
    virtual void onDocumentLoaded(TextDocument*);
    virtual void onDocumentTextChanged(const DocumentContentChange&) = 0;
    virtual void onDocumentUndoRedo(const UndoRedo& eventType) = 0;
    virtual void onDocumentCursorChange(const TextPosition&) = 0;
    virtual void onDocumentInterestingCursorChange(const TextPosition&);
    virtual void onDocumentSelectionChange(const TextRange&) = 0;
    virtual void onDocumentLineCountChange(const size_t& lastCount, const size_t& newCount) = 0;
    virtual void onDocumentLineChanged(const Int64& lineIndex) = 0;
    virtual void onDocumentSaved(TextDocument*) = 0;
    virtual void onDocumentClosed(TextDocument*) = 0;
    virtual void onDocumentDirtyOnFileSystem(TextDocument*) = 0;
    virtual void onDocumentMoved(TextDocument*) = 0;
    virtual void onDocumentReloaded(TextDocument* doc);
    virtual void onDocumentReset(TextDocument*) = 0;
    virtual void onDocumentSyntaxDefinitionChange(const SyntaxDefinition&);
    virtual void onDocumentLineMove(const Int64&, const Int64&, const Int64&);
    virtual TextRange getVisibleRange() const;
    virtual void onFoldRegionsUpdated(size_t, size_t);

Detailed Documentation

Methods

std::shared_ptr<Doc::TextDocument> getDocumentRef() const

If the document is managed by more than one client you need to NOT auto register base commands and implement your own logic for those commands, since are dependant of the client state.

See also:

registerCommands

void setLineBreakingColumn(const Uint32& lineBreakingColumn)

Set to 0 to hide.

TextPosition moveToLineOffset(const TextPosition& position, int offset, const size_t& cursorIdx = 0)

Doc commands executed in this editor.

const bool& getShowWhitespaces() const

Doc commands executed in this editor.

bool registerGutterSpace(UICodeEditorPlugin* plugin, const Float& pixels, int order)

Register a gutter space to be used by a plugin.

Parameters:

plugin

Plugin requesting it

pixels

Amount of pixels to request in the gutter

order

Order goes from left (lower number) to right (bigger number).

bool registerTopSpace(UICodeEditorPlugin* plugin, const Float& pixels, int order)

Register a top space to be used by a plugin.

Parameters:

plugin

Plugin requesting it

pixels

Amount of pixels to request in the gutter

order

Order goes from left (lower number) to right (bigger number).