class EE::UI::UISceneNode

Overview

#include <uiscenenode.hpp>

class UISceneNode: public EE::Scene::SceneNode {
public:
    // typedefs

    typedef std::function<void()> KeyBindingCommand;

    // construction

    UISceneNode(EE::Window::Window* window = NULL);
    virtual ~UISceneNode();

    // methods

    static UISceneNode* New(EE::Window::Window* window = NULL);
    virtual Node* setSize(const Sizef& size);
    virtual Node* setSize(const Float& Width, const Float& Height);
    UISceneNode* setPixelsSize(const Sizef& size);
    UISceneNode* setPixelsSize(const Float& x, const Float& y);
    virtual const Sizef& getSize() const;
    virtual void update(const Time& elapsed);
    void setTranslator(Translator translator);
    const Translator& getTranslator() const;
    Translator& getTranslator();
    String getTranslatorString(const std::string& str);
    String getTranslatorString(const std::string& str, const String& defaultValue);
    String getTranslatorStringFromKey(const std::string& key, const String& defaultValue);
    String i18n(const std::string& key, const String& defaultValue);
    UIWidget* loadLayoutNodes(pugi::xml_node node, Node* parent, const Uint32& marker);
    UIWidget* loadLayoutFromFile(const std::string& layoutPath, Node* parent = NULL, const Uint32& marker = 0);
    UIWidget* loadLayoutFromString(const std::string& layoutString, Node* parent = NULL, const Uint32& marker = 0);
    UIWidget* loadLayoutFromString(const char* layoutString, Node* parent = NULL, const Uint32& marker = 0);
    UIWidget* loadLayoutFromMemory(const void* buffer, Int32 bufferSize, Node* parent = NULL, const Uint32& marker = 0);
    UIWidget* loadLayoutFromStream(IOStream& stream, Node* parent = NULL, const Uint32& marker = 0);
    UIWidget* loadLayoutFromPack(Pack* pack, const std::string& FilePackPath, Node* parent = NULL);
    void setStyleSheet(const CSS::StyleSheet& styleSheet);
    void setStyleSheet(const std::string& inlineStyleSheet);
    void combineStyleSheet(const CSS::StyleSheet& styleSheet, const bool& forceReloadStyle = true);
    void combineStyleSheet(const std::string& inlineStyleSheet, const bool& forceReloadStyle = true, const Uint32& marker = 0);
    CSS::StyleSheet& getStyleSheet();
    bool hasStyleSheet();
    const bool& isLoading() const;
    UIThemeManager* getUIThemeManager() const;
    UIWidget* getRoot() const;
    void invalidateStyle(UIWidget* widget, bool tryReinsert = false);
    void invalidateStyleState(UIWidget* widget, bool disableCSSAnimations = false, bool tryReinsert = false);
    void invalidateLayout(UILayout* widget);
    void setIsLoading(bool isLoading);
    void updateDirtyLayouts();
    void updateDirtyStyles();
    void updateDirtyStyleStates();
    const bool& isUpdatingLayouts() const;
    UIIconThemeManager* getUIIconThemeManager() const;
    UIIcon* findIcon(const std::string& iconName);
    Drawable* findIconDrawable(const std::string& iconName, const size_t& drawableSize);
    KeyBindings& getKeyBindings();
    void setKeyBindings(const KeyBindings& keyBindings);
    void addKeyBindingString(const std::string& shortcut, const std::string& command);
    void addKeyBinding(const KeyBindings::Shortcut& shortcut, const std::string& command);
    void replaceKeyBindingString(const std::string& shortcut, const std::string& command);
    void replaceKeyBinding(const KeyBindings::Shortcut& shortcut, const std::string& command);
    void addKeyBindsString(const std::map<std::string, std::string>& binds);
    void addKeyBinds(const std::map<KeyBindings::Shortcut, std::string>& binds);
    void setKeyBindingCommand(const std::string& command, KeyBindingCommand func);
    void executeKeyBindingCommand(const std::string& command);
    UIEventDispatcher* getUIEventDispatcher() const;
    ColorSchemePreference getColorSchemePreference() const;
    void setColorSchemePreference(const ColorSchemePreference& colorSchemePreference);
    const Uint32& getMaxInvalidationDepth() const;
    void setMaxInvalidationDepth(const Uint32& maxInvalidationDepth);
    virtual void nodeToWorldTranslation(Vector2f& Pos) const;
    void reloadStyle(bool disableAnimations = false, bool forceReApplyProperties = false);
    bool hasThreadPool() const;
    std::shared_ptr<ThreadPool> getThreadPool();
    void setThreadPool(const std::shared_ptr<ThreadPool>& threadPool);
    void setTheme(UITheme* theme);
};

Inherited Members

public:
    // typedefs

    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 SceneNode* New(EE::Window::Window* window = NULL);
    void enableFrameBuffer();
    void disableFrameBuffer();
    bool ownsFrameBuffer() const;
    virtual void draw();
    virtual void update(const Time& elapsed);
    void enableDrawInvalidation();
    void disableDrawInvalidation();
    EE::Window::Window* getWindow();
    FrameBuffer* getFrameBuffer() const;
    void setEventDispatcher(EventDispatcher* eventDispatcher);
    EventDispatcher* getEventDispatcher() const;
    void setDrawDebugData(bool debug);
    bool getDrawDebugData() const;
    void setDrawBoxes(bool draw);
    bool getDrawBoxes() const;
    void setHighlightOver(bool Highlight);
    bool getHighlightOver() const;
    void setHighlightFocus(bool Highlight);
    bool getHighlightFocus() const;
    void setHighlightInvalidation(bool Highlight);
    bool getHighlightInvalidation() const;
    void setHighlightOverColor(const Color& Color);
    const Color& getHighlightOverColor() const;
    void setHighlightFocusColor(const Color& Color);
    const Color& getHighlightFocusColor() const;
    void setHighlightInvalidationColor(const Color& Color);
    const Color& getHighlightInvalidationColor() const;
    const Time& getElapsed() const;
    bool usesInvalidation() const;
    void setUseGlobalCursors(const bool& use);
    const bool& getUseGlobalCursors();
    void setCursor(Cursor::Type cursor);
    virtual bool isDrawInvalidator() const;
    ActionManager* getActionManager() const;
    void subscribeScheduledUpdate(Node* node);
    void unsubscribeScheduledUpdate(Node* node);
    bool isSubscribedForScheduledUpdate(Node* node);
    void addMouseOverNode(Node* node);
    void removeMouseOverNode(Node* node);
    const bool& getUpdateAllChilds() const;
    void setUpdateAllChilds(const bool& updateAllChilds);
    const Float& getDPI() const;
    bool getVerbose() const;
    void setVerbose(bool verbose);

Detailed Documentation

Methods

Drawable* findIconDrawable(const std::string& iconName, const size_t& drawableSize)

Parameters:

drawableSize

Size in pixels