mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-05-28 17:16:29 +03:00
Added documentation to Node, UINode, UIWidget, SceneNode and UISceneNode with the help of AI + human supervision (hopefully I didn't miss any important detail). I chose these classes given that they are core classes of the UI framework.
This commit is contained in:
@@ -307,7 +307,6 @@ literal = #ea5964
|
||||
string = #ea5964
|
||||
operator = #657085
|
||||
function = #ffffff
|
||||
preprocessor = #98c875
|
||||
|
||||
[monodark]
|
||||
background = #080808
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19,98 +19,400 @@ namespace EE { namespace Scene {
|
||||
|
||||
class EE_API SceneNode : public Node {
|
||||
public:
|
||||
/**
|
||||
* @brief Creates a new SceneNode instance.
|
||||
*
|
||||
* This is the factory method for creating SceneNode instances.
|
||||
*
|
||||
* @param window Pointer to the window to associate with this scene node.
|
||||
* If NULL, uses the current window from Engine.
|
||||
* @return Pointer to the newly created SceneNode instance.
|
||||
*/
|
||||
static SceneNode* New( EE::Window::Window* window = NULL );
|
||||
|
||||
/**
|
||||
* @brief Constructs a SceneNode with an optional window.
|
||||
*
|
||||
* Creates a SceneNode that can be used as a root node for rendering
|
||||
* and scene management. Optionally specifies which window to use.
|
||||
*
|
||||
* @param window Pointer to the window to associate with this scene node.
|
||||
* If NULL, uses the current window from Engine.
|
||||
*/
|
||||
SceneNode( EE::Window::Window* window = NULL );
|
||||
|
||||
/**
|
||||
* @brief Destroys the SceneNode and cleans up resources.
|
||||
*
|
||||
* Deletes associated action manager, event dispatcher, and frame buffer.
|
||||
* Also handles removal from window resize callback and closes children.
|
||||
*/
|
||||
~SceneNode();
|
||||
|
||||
/**
|
||||
* @brief Enables the use of a frame buffer for off-screen rendering.
|
||||
*
|
||||
* Creates a frame buffer if one doesn't exist. When enabled, rendering
|
||||
* will occur to the frame buffer first before being drawn to the screen.
|
||||
*/
|
||||
void enableFrameBuffer();
|
||||
|
||||
/**
|
||||
* @brief Disables frame buffer usage and deletes the frame buffer.
|
||||
*
|
||||
* Turns off off-screen rendering and releases the frame buffer resource.
|
||||
*/
|
||||
void disableFrameBuffer();
|
||||
|
||||
/**
|
||||
* @brief Checks if the node owns its frame buffer.
|
||||
*
|
||||
* Ownership means the scene node created and manages the frame buffer.
|
||||
*
|
||||
* @return True if the frame buffer is owned by this node, false otherwise.
|
||||
*/
|
||||
bool ownsFrameBuffer() const;
|
||||
|
||||
/**
|
||||
* @brief Draws the scene node and its children.
|
||||
*
|
||||
* This is the main rendering method. Handles frame buffer binding,
|
||||
* matrix transformations, clipping, and drawing children. Also draws
|
||||
* debug visualizations if enabled.
|
||||
*/
|
||||
virtual void draw();
|
||||
|
||||
/**
|
||||
* @brief Updates the scene node and its children.
|
||||
*
|
||||
* Called each frame to update the node's state, actions, event dispatcher,
|
||||
* and scheduled updates. Manages the update of children based on
|
||||
* mUpdateAllChildren flag.
|
||||
*
|
||||
* @param elapsed The time elapsed since the last update.
|
||||
*/
|
||||
virtual void update( const Time& elapsed );
|
||||
|
||||
/**
|
||||
* @brief Enables draw invalidation.
|
||||
*
|
||||
* When enabled, the node will use dirty rectangle rendering and only
|
||||
* redraw regions that have been invalidated. This can improve performance.
|
||||
*/
|
||||
void enableDrawInvalidation();
|
||||
|
||||
/**
|
||||
* @brief Disables draw invalidation.
|
||||
*
|
||||
* When disabled, the entire node will be redrawn every frame.
|
||||
*/
|
||||
void disableDrawInvalidation();
|
||||
|
||||
/**
|
||||
* @brief Gets the window associated with this scene node.
|
||||
*
|
||||
* @return Pointer to the Window object.
|
||||
*/
|
||||
EE::Window::Window* getWindow();
|
||||
|
||||
/**
|
||||
* @brief Gets the frame buffer used for off-screen rendering.
|
||||
*
|
||||
* @return Pointer to the FrameBuffer, or NULL if none is set.
|
||||
*/
|
||||
FrameBuffer* getFrameBuffer() const;
|
||||
|
||||
/**
|
||||
* @brief Sets the event dispatcher for this scene node.
|
||||
*
|
||||
* The event dispatcher handles input and other events. This allows
|
||||
* custom event handling for this scene.
|
||||
*
|
||||
* @param eventDispatcher Pointer to the EventDispatcher to set.
|
||||
*/
|
||||
void setEventDispatcher( EventDispatcher* eventDispatcher );
|
||||
|
||||
/**
|
||||
* @brief Gets the event dispatcher.
|
||||
*
|
||||
* @return Pointer to the EventDispatcher, or NULL if none set.
|
||||
*/
|
||||
EventDispatcher* getEventDispatcher() const;
|
||||
|
||||
/**
|
||||
* @brief Enables or disables debug data drawing.
|
||||
*
|
||||
* When enabled, additional debug information may be rendered (like
|
||||
* bounding boxes, invalidation regions, etc.).
|
||||
*
|
||||
* @param debug True to enable debug drawing, false to disable.
|
||||
*/
|
||||
void setDrawDebugData( bool debug );
|
||||
|
||||
/**
|
||||
* @brief Checks if debug data drawing is enabled.
|
||||
*
|
||||
* @return True if debug drawing is enabled, false otherwise.
|
||||
*/
|
||||
bool getDrawDebugData() const;
|
||||
|
||||
/**
|
||||
* @brief Enables or disables drawing of bounding boxes.
|
||||
*
|
||||
* When enabled, bounding boxes around nodes may be rendered for
|
||||
* debugging purposes.
|
||||
*
|
||||
* @param draw True to draw boxes, false to hide them.
|
||||
*/
|
||||
void setDrawBoxes( bool draw );
|
||||
|
||||
/**
|
||||
* @brief Checks if bounding boxes are being drawn.
|
||||
*
|
||||
* @return True if boxes are drawn, false otherwise.
|
||||
*/
|
||||
bool getDrawBoxes() const;
|
||||
|
||||
/**
|
||||
* @brief Enables or disables highlighting for mouse-over state.
|
||||
*
|
||||
* When enabled and a node is moused over, a highlight effect may be shown.
|
||||
*
|
||||
* @param Highlight True to enable highlight on mouse over, false to disable.
|
||||
*/
|
||||
void setHighlightOver( bool Highlight );
|
||||
|
||||
/**
|
||||
* @brief Checks if mouse-over highlighting is enabled.
|
||||
*
|
||||
* @return True if highlighting is enabled, false otherwise.
|
||||
*/
|
||||
bool getHighlightOver() const;
|
||||
|
||||
/**
|
||||
* @brief Enables or disables highlighting for focus state.
|
||||
*
|
||||
* When enabled and a node has focus, a highlight effect may be shown.
|
||||
*
|
||||
* @param Highlight True to enable highlight on focus, false to disable.
|
||||
*/
|
||||
void setHighlightFocus( bool Highlight );
|
||||
|
||||
/**
|
||||
* @brief Checks if focus highlighting is enabled.
|
||||
*
|
||||
* @return True if focus highlighting is enabled, false otherwise.
|
||||
*/
|
||||
bool getHighlightFocus() const;
|
||||
|
||||
/**
|
||||
* @brief Enables or disables highlighting for invalidation regions.
|
||||
*
|
||||
* When enabled, areas of the screen that are invalidated (need redrawing)
|
||||
* may be highlighted for debugging.
|
||||
*
|
||||
* @param Highlight True to enable invalidation highlighting, false to disable.
|
||||
*/
|
||||
void setHighlightInvalidation( bool Highlight );
|
||||
|
||||
/**
|
||||
* @brief Checks if invalidation highlighting is enabled.
|
||||
*
|
||||
* @return True if invalidation highlighting is enabled, false otherwise.
|
||||
*/
|
||||
bool getHighlightInvalidation() const;
|
||||
|
||||
/**
|
||||
* @brief Sets the color used for mouse-over highlighting.
|
||||
*
|
||||
* @param Color The highlight color to use.
|
||||
*/
|
||||
void setHighlightOverColor( const Color& Color );
|
||||
|
||||
/**
|
||||
* @brief Gets the mouse-over highlight color.
|
||||
*
|
||||
* @return The highlight color as a const Color reference.
|
||||
*/
|
||||
const Color& getHighlightOverColor() const;
|
||||
|
||||
/**
|
||||
* @brief Sets the color used for focus highlighting.
|
||||
*
|
||||
* @param Color The highlight color to use.
|
||||
*/
|
||||
void setHighlightFocusColor( const Color& Color );
|
||||
|
||||
/**
|
||||
* @brief Gets the focus highlight color.
|
||||
*
|
||||
* @return The highlight color as a const Color reference.
|
||||
*/
|
||||
const Color& getHighlightFocusColor() const;
|
||||
|
||||
/**
|
||||
* @brief Sets the color used for invalidation highlighting.
|
||||
*
|
||||
* @param Color The highlight color to use.
|
||||
*/
|
||||
void setHighlightInvalidationColor( const Color& Color );
|
||||
|
||||
/**
|
||||
* @brief Gets the invalidation highlight color.
|
||||
*
|
||||
* @return The highlight color as a const Color reference.
|
||||
*/
|
||||
const Color& getHighlightInvalidationColor() const;
|
||||
|
||||
/**
|
||||
* @brief Gets the elapsed time since the last frame.
|
||||
*
|
||||
* This is the time that was passed to the most recent update() call.
|
||||
*
|
||||
* @return The elapsed time as a const Time reference.
|
||||
*/
|
||||
const Time& getElapsed() const;
|
||||
|
||||
/**
|
||||
* @brief Checks if draw invalidation is being used.
|
||||
*
|
||||
* When using invalidation, only dirty regions are redrawn.
|
||||
*
|
||||
* @return True if invalidation is enabled, false otherwise.
|
||||
*/
|
||||
bool usesInvalidation() const;
|
||||
|
||||
void setUseGlobalCursors( const bool& use );
|
||||
/**
|
||||
* @brief Sets whether to use global cursor management.
|
||||
*
|
||||
* When enabled, cursor changes are managed globally through the window's
|
||||
* cursor manager. When disabled, cursor changes may be managed locally.
|
||||
*
|
||||
* @param use True to use global cursors, false for local cursor handling.
|
||||
*/
|
||||
void setUseGlobalCursors( bool use );
|
||||
|
||||
const bool& getUseGlobalCursors();
|
||||
/**
|
||||
* @brief Gets whether global cursor management is enabled.
|
||||
*
|
||||
* @return Reference to the boolean indicating global cursor usage.
|
||||
*/
|
||||
bool getUseGlobalCursors();
|
||||
|
||||
/**
|
||||
* @brief Sets the cursor type.
|
||||
*
|
||||
* Changes the cursor appearance if global cursors are enabled.
|
||||
*
|
||||
* @param cursor The cursor type to set (from Cursor::Type).
|
||||
*/
|
||||
void setCursor( Cursor::Type cursor );
|
||||
|
||||
/**
|
||||
* @brief Checks if this node is a draw invalidator.
|
||||
*
|
||||
* SceneNode always returns true, indicating it supports dirty rectangle
|
||||
* rendering and will invalidate itself when needed.
|
||||
*
|
||||
* @return Always true for SceneNode.
|
||||
*/
|
||||
virtual bool isDrawInvalidator() const;
|
||||
|
||||
/**
|
||||
* @brief Gets the action manager associated with this scene node.
|
||||
*
|
||||
* The action manager handles timed actions and animations.
|
||||
*
|
||||
* @return Pointer to the ActionManager.
|
||||
*/
|
||||
ActionManager* getActionManager() const;
|
||||
|
||||
/**
|
||||
* @brief Subscribes a node for scheduled updates.
|
||||
*
|
||||
* The specified node will receive scheduledUpdate() calls each frame.
|
||||
*
|
||||
* @param node Pointer to the node to subscribe.
|
||||
*/
|
||||
void subscribeScheduledUpdate( Node* node );
|
||||
|
||||
/**
|
||||
* @brief Unsubscribes a node from scheduled updates.
|
||||
*
|
||||
* The node will no longer receive scheduledUpdate() calls.
|
||||
*
|
||||
* @param node Pointer to the node to unsubscribe.
|
||||
*/
|
||||
void unsubscribeScheduledUpdate( Node* node );
|
||||
|
||||
/**
|
||||
* @brief Checks if a node is subscribed for scheduled updates.
|
||||
*
|
||||
* @param node Pointer to the node to check.
|
||||
* @return True if the node is subscribed, false otherwise.
|
||||
*/
|
||||
bool isSubscribedForScheduledUpdate( Node* node );
|
||||
|
||||
/**
|
||||
* @brief Adds a node to the mouse-over tracking list.
|
||||
*
|
||||
* This is used internally to track which nodes are currently under
|
||||
* the mouse cursor.
|
||||
*
|
||||
* @param node Pointer to the node to track.
|
||||
*/
|
||||
void addMouseOverNode( Node* node );
|
||||
|
||||
/**
|
||||
* @brief Removes a node from the mouse-over tracking list.
|
||||
*
|
||||
* @param node Pointer to the node to stop tracking.
|
||||
*/
|
||||
void removeMouseOverNode( Node* node );
|
||||
|
||||
const bool& getUpdateAllChildren() const;
|
||||
/**
|
||||
* @brief Gets whether all children are updated each frame.
|
||||
*
|
||||
* When enabled, all children receive update() calls. When disabled,
|
||||
* only specific nodes (like those with scheduled updates) are updated.
|
||||
*
|
||||
* @return Reference to the boolean indicating update-all-children mode.
|
||||
*/
|
||||
bool getUpdateAllChildren() const;
|
||||
|
||||
/**
|
||||
* @brief Sets whether to update all children each frame.
|
||||
*
|
||||
* Controls whether all children receive update() calls or only
|
||||
* subscribed nodes.
|
||||
*
|
||||
* @param updateAllChildren True to update all children, false to update selectively.
|
||||
*/
|
||||
void setUpdateAllChildren( bool updateAllChildren );
|
||||
|
||||
/**
|
||||
* @brief Gets the DPI (dots per inch) of the display.
|
||||
*
|
||||
* @return The DPI as a Float.
|
||||
*/
|
||||
const Float& getDPI() const;
|
||||
|
||||
/**
|
||||
* @brief Checks if verbose logging is enabled.
|
||||
*
|
||||
* When enabled, additional debug messages may be logged.
|
||||
*
|
||||
* @return True if verbose logging is enabled, false otherwise.
|
||||
*/
|
||||
bool getVerbose() const;
|
||||
|
||||
/**
|
||||
* @brief Enables or disables verbose logging.
|
||||
*
|
||||
* Controls whether detailed debug information is printed to the log.
|
||||
*
|
||||
* @param verbose True to enable verbose logging, false to disable.
|
||||
*/
|
||||
void setVerbose( bool verbose );
|
||||
|
||||
protected:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -26,152 +26,655 @@ class UIIcon;
|
||||
|
||||
class EE_API UISceneNode : public SceneNode {
|
||||
public:
|
||||
/**
|
||||
* @brief Creates a new UISceneNode instance.
|
||||
*
|
||||
* This is the factory method for creating UISceneNode instances.
|
||||
*
|
||||
* @param window Pointer to the window to associate with this UI scene node.
|
||||
* If NULL, uses the current window from Engine.
|
||||
* @return Pointer to the newly created UISceneNode instance.
|
||||
*/
|
||||
static UISceneNode* New( EE::Window::Window* window = NULL );
|
||||
|
||||
/**
|
||||
* @brief Destroys the UISceneNode and cleans up resources.
|
||||
*
|
||||
* Deletes theme managers, icon theme manager, font faces, and event dispatcher.
|
||||
* Also calls childDeleteAll() to ensure proper cleanup order (before thread pool).
|
||||
*/
|
||||
virtual ~UISceneNode();
|
||||
|
||||
/**
|
||||
* @brief Sets the size in density-independent pixels (dp).
|
||||
*
|
||||
* Override of SceneNode::setSize to also update dp size and trigger media changes.
|
||||
*
|
||||
* @param size The new size in dp.
|
||||
* @return Pointer to this node for method chaining.
|
||||
*/
|
||||
virtual Node* setSize( const Sizef& size );
|
||||
|
||||
/**
|
||||
* @brief Sets the size in density-independent pixels (dp).
|
||||
*
|
||||
* Override of SceneNode::setSize with individual dimensions.
|
||||
*
|
||||
* @param Width The width in dp.
|
||||
* @param Height The height in dp.
|
||||
* @return Pointer to this node for method chaining.
|
||||
*/
|
||||
virtual Node* setSize( const Float& Width, const Float& Height );
|
||||
|
||||
/**
|
||||
* @brief Sets the size in actual screen pixels.
|
||||
*
|
||||
* Sets the pixel size directly and updates the dp size accordingly.
|
||||
*
|
||||
* @param size The new size in pixels.
|
||||
* @return Pointer to this node for method chaining.
|
||||
*/
|
||||
UISceneNode* setPixelsSize( const Sizef& size );
|
||||
|
||||
/**
|
||||
* @brief Sets the size in actual screen pixels.
|
||||
*
|
||||
* Sets the pixel size using individual dimensions.
|
||||
*
|
||||
* @param x The width in pixels.
|
||||
* @param y The height in pixels.
|
||||
* @return Pointer to this node for method chaining.
|
||||
*/
|
||||
UISceneNode* setPixelsSize( const Float& x, const Float& y );
|
||||
|
||||
/**
|
||||
* @brief Gets the size in density-independent pixels (dp).
|
||||
*
|
||||
* @return The size as a const Sizef reference in dp.
|
||||
*/
|
||||
const Sizef& getSize() const;
|
||||
|
||||
/**
|
||||
* @brief Updates the UISceneNode.
|
||||
*
|
||||
* Override that adds UI-specific update logic including:
|
||||
* - Updating dirty styles, style states, and layouts
|
||||
* - Handling multiple invalidation passes if needed
|
||||
* - Processing scheduled updates
|
||||
*
|
||||
* @param elapsed The time elapsed since the last update.
|
||||
*/
|
||||
virtual void update( const Time& elapsed );
|
||||
|
||||
/**
|
||||
* @brief Sets the translator for internationalization.
|
||||
*
|
||||
* The translator is used to translate strings throughout the UI.
|
||||
*
|
||||
* @param translator The Translator object to set.
|
||||
*/
|
||||
void setTranslator( Translator translator );
|
||||
|
||||
/**
|
||||
* @brief Sets the translator for internationalization.
|
||||
*
|
||||
* The translator is used to translate strings throughout the UI.
|
||||
*
|
||||
* @param translator The Translator object to set.
|
||||
*/
|
||||
void setTranslator( Translator&& translator );
|
||||
|
||||
/**
|
||||
* @brief Gets the translator as a const reference.
|
||||
*
|
||||
* @return The const Translator reference.
|
||||
*/
|
||||
const Translator& getTranslator() const;
|
||||
|
||||
/**
|
||||
* @brief Gets the translator as a non-const reference.
|
||||
*
|
||||
* @return The Translator reference for modification.
|
||||
*/
|
||||
Translator& getTranslator();
|
||||
|
||||
/**
|
||||
* @brief Gets a translated string.
|
||||
*
|
||||
* Translates the given string using the translator. Supports special
|
||||
* @string syntax for lookups and function-style expressions.
|
||||
*
|
||||
* @param str The string to translate.
|
||||
* @return The translated string, or the original if no translation found.
|
||||
*/
|
||||
String getTranslatorString( const std::string& str );
|
||||
|
||||
/**
|
||||
* @brief Gets a translated string with default value.
|
||||
*
|
||||
* Similar to getTranslatorString() but returns defaultValue if translation
|
||||
* is not found.
|
||||
*
|
||||
* @param str The string to translate.
|
||||
* @param defaultValue The default value to use if translation fails.
|
||||
* @return The translated string or default value.
|
||||
*/
|
||||
String getTranslatorString( const std::string& str, const String& defaultValue );
|
||||
|
||||
/**
|
||||
* @brief Gets a translated string from a translation key.
|
||||
*
|
||||
* Looks up the translation using the specified key.
|
||||
*
|
||||
* @param key The translation key to look up.
|
||||
* @param defaultValue The default value if key not found.
|
||||
* @return The translated string or default value.
|
||||
*/
|
||||
String getTranslatorStringFromKey( const std::string& key, const String& defaultValue );
|
||||
|
||||
/**
|
||||
* @brief Translates a string (internationalization shorthand).
|
||||
*
|
||||
* Convenience method equivalent to getTranslatorStringFromKey().
|
||||
*
|
||||
* @param key The translation key.
|
||||
* @param defaultValue The default value if translation not found.
|
||||
* @return The translated string or default value.
|
||||
*/
|
||||
String i18n( const std::string& key, const String& defaultValue );
|
||||
|
||||
/**
|
||||
* @brief Loads UI layout from an XML node.
|
||||
*
|
||||
* Parses the XML node and creates UIWidgets accordingly.
|
||||
*
|
||||
* @param node The XML node to load from.
|
||||
* @param parent The parent node to attach widgets to (default: this).
|
||||
* @param marker A marker value to associate with loaded styles.
|
||||
* @return The root UIWidget created, or NULL if none.
|
||||
*/
|
||||
UIWidget* loadLayoutNodes( pugi::xml_node node, Node* parent, const Uint32& marker );
|
||||
|
||||
/**
|
||||
* @brief Loads a UI layout from a file.
|
||||
*
|
||||
* Parses an XML layout file and creates the UI hierarchy.
|
||||
*
|
||||
* @param layoutPath Path to the layout file.
|
||||
* @param parent Parent node for the layout (default: this).
|
||||
* @param marker Marker for style association.
|
||||
* @return The root widget, or NULL if loading failed.
|
||||
*/
|
||||
UIWidget* loadLayoutFromFile( const std::string& layoutPath, Node* parent = NULL,
|
||||
const Uint32& marker = 0 );
|
||||
|
||||
/**
|
||||
* @brief Loads a UI layout from a string.
|
||||
*
|
||||
* Parses an XML string and creates the UI hierarchy.
|
||||
*
|
||||
* @param layoutString The XML layout string.
|
||||
* @param parent Parent node for the layout (default: this).
|
||||
* @param marker Marker for style association.
|
||||
* @return The root widget, or NULL if parsing failed.
|
||||
*/
|
||||
UIWidget* loadLayoutFromString( const std::string& layoutString, Node* parent = NULL,
|
||||
const Uint32& marker = 0 );
|
||||
|
||||
/**
|
||||
* @brief Loads a UI layout from a C string.
|
||||
*
|
||||
* Parses an XML C-string and creates the UI hierarchy.
|
||||
*
|
||||
* @param layoutString The XML layout C-string.
|
||||
* @param parent Parent node for the layout (default: this).
|
||||
* @param marker Marker for style association.
|
||||
* @return The root widget, or NULL if parsing failed.
|
||||
*/
|
||||
UIWidget* loadLayoutFromString( const char* layoutString, Node* parent = NULL,
|
||||
const Uint32& marker = 0 );
|
||||
|
||||
/**
|
||||
* @brief Loads a UI layout from a memory buffer.
|
||||
*
|
||||
* Parses XML from a memory buffer and creates the UI hierarchy.
|
||||
*
|
||||
* @param buffer Pointer to the XML data in memory.
|
||||
* @param bufferSize Size of the buffer in bytes.
|
||||
* @param parent Parent node for the layout (default: this).
|
||||
* @param marker Marker for style association.
|
||||
* @return The root widget, or NULL if parsing failed.
|
||||
*/
|
||||
UIWidget* loadLayoutFromMemory( const void* buffer, Int32 bufferSize, Node* parent = NULL,
|
||||
const Uint32& marker = 0 );
|
||||
|
||||
/**
|
||||
* @brief Loads a UI layout from an I/O stream.
|
||||
*
|
||||
* Reads XML from an IOStream and creates the UI hierarchy.
|
||||
*
|
||||
* @param stream The input stream to read from.
|
||||
* @param parent Parent node for the layout (default: this).
|
||||
* @param marker Marker for style association.
|
||||
* @return The root widget, or NULL if reading or parsing failed.
|
||||
*/
|
||||
UIWidget* loadLayoutFromStream( IOStream& stream, Node* parent = NULL,
|
||||
const Uint32& marker = 0 );
|
||||
|
||||
/**
|
||||
* @brief Loads a UI layout from a pack file.
|
||||
*
|
||||
* Extracts XML from a pack (archive) and creates the UI hierarchy.
|
||||
*
|
||||
* @param pack Pointer to the Pack to read from.
|
||||
* @param FilePackPath Path within the pack to the layout file.
|
||||
* @param parent Parent node for the layout (default: this).
|
||||
* @return The root widget, or NULL if extraction or parsing failed.
|
||||
*/
|
||||
UIWidget* loadLayoutFromPack( Pack* pack, const std::string& FilePackPath,
|
||||
Node* parent = NULL );
|
||||
|
||||
/**
|
||||
* @brief Sets the stylesheet for this UISceneNode.
|
||||
*
|
||||
* Replaces the current stylesheet with a new one and optionally loads
|
||||
* the styles immediately.
|
||||
*
|
||||
* @param styleSheet The CSS StyleSheet to set.
|
||||
* @param loadStyle If true, applies the styles immediately (default: true).
|
||||
*/
|
||||
void setStyleSheet( const CSS::StyleSheet& styleSheet, bool loadStyle = true );
|
||||
|
||||
/**
|
||||
* @brief Sets the stylesheet from an inline CSS string.
|
||||
*
|
||||
* Parses the CSS string and sets it as the stylesheet.
|
||||
*
|
||||
* @param inlineStyleSheet The CSS stylesheet as a string.
|
||||
*/
|
||||
void setStyleSheet( const std::string& inlineStyleSheet );
|
||||
|
||||
void combineStyleSheet( const CSS::StyleSheet& styleSheet,
|
||||
const bool& forceReloadStyle = true );
|
||||
/**
|
||||
* @brief Combines a stylesheet with the existing one.
|
||||
*
|
||||
* Merges the given stylesheet into the current stylesheet.
|
||||
*
|
||||
* @param styleSheet The CSS StyleSheet to combine.
|
||||
* @param forceReloadStyle If true, forces immediate style reload (default: true).
|
||||
*/
|
||||
void combineStyleSheet( const CSS::StyleSheet& styleSheet, bool forceReloadStyle = true );
|
||||
|
||||
void combineStyleSheet( const std::string& inlineStyleSheet,
|
||||
const bool& forceReloadStyle = true, const Uint32& marker = 0 );
|
||||
/**
|
||||
* @brief Combines an inline stylesheet with the existing one.
|
||||
*
|
||||
* Parses the CSS string and merges it with the current stylesheet.
|
||||
*
|
||||
* @param inlineStyleSheet The CSS stylesheet as a string.
|
||||
* @param forceReloadStyle If true, forces immediate style reload (default: true).
|
||||
* @param marker Marker to associate with the new styles.
|
||||
*/
|
||||
void combineStyleSheet( const std::string& inlineStyleSheet, bool forceReloadStyle = true,
|
||||
const Uint32& marker = 0 );
|
||||
|
||||
/**
|
||||
* @brief Gets the reference to the current stylesheet.
|
||||
*
|
||||
* @return Reference to the CSS StyleSheet.
|
||||
*/
|
||||
CSS::StyleSheet& getStyleSheet();
|
||||
|
||||
/**
|
||||
* @brief Checks if a stylesheet is set.
|
||||
*
|
||||
* @return True if a non-empty stylesheet exists, false otherwise.
|
||||
*/
|
||||
bool hasStyleSheet();
|
||||
|
||||
const bool& isLoading() const;
|
||||
/**
|
||||
* @brief Checks if the UISceneNode is currently loading.
|
||||
*
|
||||
* This flag is set during layout loading operations.
|
||||
*
|
||||
* @return Const reference to the loading state boolean.
|
||||
*/
|
||||
bool isLoading() const;
|
||||
|
||||
/**
|
||||
* @brief Gets the UIThemeManager.
|
||||
*
|
||||
* The theme manager is responsible for loading and providing UI themes.
|
||||
*
|
||||
* @return Pointer to the UIThemeManager.
|
||||
*/
|
||||
UIThemeManager* getUIThemeManager() const;
|
||||
|
||||
/**
|
||||
* @brief Gets the root widget of this UISceneNode.
|
||||
*
|
||||
* The root is a UIRoot widget that contains all other UI widgets.
|
||||
*
|
||||
* @return Pointer to the root UIWidget.
|
||||
*/
|
||||
UIWidget* getRoot() const;
|
||||
|
||||
/**
|
||||
* @brief Invalidates the style of a widget.
|
||||
*
|
||||
* Marks the widget's style as needing to be reloaded. The widget will
|
||||
* have its CSS re-applied during the next update cycle.
|
||||
*
|
||||
* @param widget Pointer to the UIWidget to invalidate.
|
||||
* @param tryReinsert If true, attempts to reposition the widget in the dirty set.
|
||||
*/
|
||||
void invalidateStyle( UIWidget* widget, bool tryReinsert = false );
|
||||
|
||||
/**
|
||||
* @brief Invalidates the style state of a widget.
|
||||
*
|
||||
* Marks the widget's style state (pseudo-classes) as needing to be
|
||||
* re-evaluated and re-applied.
|
||||
*
|
||||
* @param widget Pointer to the UIWidget to invalidate.
|
||||
* @param disableCSSAnimations If true, disables CSS animations during the update.
|
||||
* @param tryReinsert If true, attempts to reposition the widget in the dirty set.
|
||||
*/
|
||||
void invalidateStyleState( UIWidget* widget, bool disableCSSAnimations = false,
|
||||
bool tryReinsert = false );
|
||||
|
||||
/**
|
||||
* @brief Invalidates the layout of a UILayout widget.
|
||||
*
|
||||
* Marks the layout as needing to be recalculated. The layout will be
|
||||
* updated during the next update cycle.
|
||||
*
|
||||
* @param widget Pointer to the UILayout to invalidate.
|
||||
*/
|
||||
void invalidateLayout( UILayout* widget );
|
||||
|
||||
/**
|
||||
* @brief Sets the loading state flag.
|
||||
*
|
||||
* This is typically managed internally but can be set manually if needed.
|
||||
*
|
||||
* @param isLoading The loading state to set.
|
||||
*/
|
||||
void setIsLoading( bool isLoading );
|
||||
|
||||
/**
|
||||
* @brief Updates all dirty layouts.
|
||||
*
|
||||
* Processes the mDirtyLayouts set and calls updateLayoutTree() on each
|
||||
* layout that needs recalculation.
|
||||
*/
|
||||
void updateDirtyLayouts();
|
||||
|
||||
/**
|
||||
* @brief Updates all dirty styles.
|
||||
*
|
||||
* Processes the mDirtyStyle set and calls reloadStyle() on each widget
|
||||
* that needs its CSS style re-applied.
|
||||
*/
|
||||
void updateDirtyStyles();
|
||||
|
||||
/**
|
||||
* @brief Updates all dirty style states.
|
||||
*
|
||||
* Processes the mDirtyStyleState set and calls
|
||||
* reportStyleStateChangeRecursive() on each widget that needs its
|
||||
* pseudo-class state re-evaluated.
|
||||
*/
|
||||
void updateDirtyStyleStates();
|
||||
|
||||
const bool& isUpdatingLayouts() const;
|
||||
/**
|
||||
* @brief Checks if dirty layouts are currently being updated.
|
||||
*
|
||||
* Useful to avoid re-entrancy or to check if layout updates are in progress.
|
||||
*
|
||||
* @return Const reference to the boolean indicating layout update status.
|
||||
*/
|
||||
bool isUpdatingLayouts() const;
|
||||
|
||||
/**
|
||||
* @brief Gets the UIIconThemeManager.
|
||||
*
|
||||
* The icon theme manager handles lookups of icon drawables by name.
|
||||
*
|
||||
* @return Pointer to the UIIconThemeManager.
|
||||
*/
|
||||
UIIconThemeManager* getUIIconThemeManager() const;
|
||||
|
||||
/**
|
||||
* @brief Finds an icon by name.
|
||||
*
|
||||
* Searches the icon theme manager for an icon with the specified name.
|
||||
*
|
||||
* @param iconName The name of the icon to find.
|
||||
* @return Pointer to the UIIcon, or nullptr if not found.
|
||||
*/
|
||||
UIIcon* findIcon( const std::string& iconName );
|
||||
|
||||
/** @param drawableSize Size in pixels */
|
||||
/**
|
||||
* @brief Finds an icon drawable by name and size.
|
||||
*
|
||||
* Convenience method that gets an icon and then retrieves a drawable
|
||||
* of the specified size.
|
||||
*
|
||||
* @param iconName The name of the icon to find.
|
||||
* @param drawableSize The desired size of the drawable in pixels.
|
||||
* @return Pointer to the Drawable, or nullptr if not found.
|
||||
*/
|
||||
Drawable* findIconDrawable( const std::string& iconName, const size_t& drawableSize );
|
||||
|
||||
/**
|
||||
* @brief Gets the keybindings manager.
|
||||
*
|
||||
* The keybindings system maps keyboard shortcuts to commands.
|
||||
*
|
||||
* @return Reference to the KeyBindings object.
|
||||
*/
|
||||
KeyBindings& getKeyBindings();
|
||||
|
||||
/**
|
||||
* @brief Sets the keybindings.
|
||||
*
|
||||
* Replaces the current keybindings with a new set.
|
||||
*
|
||||
* @param keyBindings The KeyBindings object to set.
|
||||
*/
|
||||
void setKeyBindings( const KeyBindings& keyBindings );
|
||||
|
||||
/**
|
||||
* @brief Adds a keybinding from string shortcut to command.
|
||||
*
|
||||
* Shortcut format is typically like "Ctrl+S" or "Alt+Enter".
|
||||
*
|
||||
* @param shortcut The string representation of the shortcut.
|
||||
* @param command The command to execute when shortcut is pressed.
|
||||
*/
|
||||
void addKeyBindingString( const std::string& shortcut, const std::string& command );
|
||||
|
||||
/**
|
||||
* @brief Adds a keybinding from Shortcut to command.
|
||||
*
|
||||
* @param shortcut The KeyBindings::Shortcut structure.
|
||||
* @param command The command to execute when shortcut is pressed.
|
||||
*/
|
||||
void addKeyBinding( const KeyBindings::Shortcut& shortcut, const std::string& command );
|
||||
|
||||
/**
|
||||
* @brief Replaces a keybinding using string shortcut.
|
||||
*
|
||||
* If the shortcut already exists, it is replaced; otherwise it is added.
|
||||
*
|
||||
* @param shortcut The string representation of the shortcut.
|
||||
* @param command The command to execute.
|
||||
*/
|
||||
void replaceKeyBindingString( const std::string& shortcut, const std::string& command );
|
||||
|
||||
/**
|
||||
* @brief Replaces a keybinding using Shortcut.
|
||||
*
|
||||
* If the shortcut already exists, it is replaced; otherwise it is added.
|
||||
*
|
||||
* @param shortcut The KeyBindings::Shortcut structure.
|
||||
* @param command The command to execute.
|
||||
*/
|
||||
void replaceKeyBinding( const KeyBindings::Shortcut& shortcut, const std::string& command );
|
||||
|
||||
/**
|
||||
* @brief Adds multiple keybindings from string map.
|
||||
*
|
||||
* @param binds Map of shortcut strings to command strings.
|
||||
*/
|
||||
void addKeyBindsString( const std::map<std::string, std::string>& binds );
|
||||
|
||||
/**
|
||||
* @brief Adds multiple keybindings from Shortcut map.
|
||||
*
|
||||
* @param binds Map of KeyBindings::Shortcut to command strings.
|
||||
*/
|
||||
void addKeyBinds( const std::map<KeyBindings::Shortcut, std::string>& binds );
|
||||
|
||||
typedef std::function<void()> KeyBindingCommand;
|
||||
|
||||
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 );
|
||||
|
||||
/**
|
||||
* @brief Sets a function to execute for a command.
|
||||
*
|
||||
* Associates a command string with a callable function. This allows
|
||||
* keybindings to trigger custom code.
|
||||
*
|
||||
* @param command The command string.
|
||||
* @param func The function to call when the command is executed.
|
||||
*/
|
||||
void setKeyBindingCommand( const std::string& command, KeyBindingCommand func );
|
||||
|
||||
/**
|
||||
* @brief Executes a keybinding command.
|
||||
*
|
||||
* Triggers the function associated with the given command string.
|
||||
*
|
||||
* @param command The command string to execute.
|
||||
*/
|
||||
void executeKeyBindingCommand( const std::string& command );
|
||||
|
||||
/**
|
||||
* @brief Gets the UI-specific event dispatcher.
|
||||
*
|
||||
* Casts the generic event dispatcher to a UIEventDispatcher.
|
||||
*
|
||||
* @return Pointer to the UIEventDispatcher, or nullptr if not set.
|
||||
*/
|
||||
UIEventDispatcher* getUIEventDispatcher() const;
|
||||
|
||||
/**
|
||||
* @brief Gets the current color scheme preference.
|
||||
*
|
||||
* @return The ColorSchemePreference (Light or Dark).
|
||||
*/
|
||||
ColorSchemePreference getColorSchemePreference() const;
|
||||
|
||||
/**
|
||||
* @brief Sets the color scheme preference from extended preference.
|
||||
*
|
||||
* Converts extended preference (Light/Dark/System) to standard preference.
|
||||
* For System, detects OS preference automatically.
|
||||
*
|
||||
* @param colorSchemePreference The extended ColorSchemeExtPreference.
|
||||
*/
|
||||
void setColorSchemePreference( const ColorSchemeExtPreference& colorSchemePreference );
|
||||
|
||||
/**
|
||||
* @brief Sets the color scheme preference directly.
|
||||
*
|
||||
* Controls whether the UI uses light or dark color scheme by default.
|
||||
*
|
||||
* @param colorSchemePreference The ColorSchemePreference.
|
||||
*/
|
||||
void setColorSchemePreference( const ColorSchemePreference& colorSchemePreference );
|
||||
|
||||
/**
|
||||
* @brief Gets the maximum invalidation depth.
|
||||
*
|
||||
* This controls how many times the update cycle will re-process dirty
|
||||
* states to ensure all cascading style/layout changes are applied.
|
||||
*
|
||||
* @return Const reference to max invalidation depth.
|
||||
*/
|
||||
const Uint32& getMaxInvalidationDepth() const;
|
||||
|
||||
/**
|
||||
* @brief Sets the maximum invalidation depth.
|
||||
*
|
||||
* @param maxInvalidationDepth The maximum number of invalidation passes.
|
||||
*/
|
||||
void setMaxInvalidationDepth( const Uint32& maxInvalidationDepth );
|
||||
|
||||
/**
|
||||
* @brief Transforms node-local coordinates to world coordinates.
|
||||
*
|
||||
* Override that uses dp (density-independent pixels) positions.
|
||||
*
|
||||
* @param Pos Reference to the position to transform (modified in place).
|
||||
*/
|
||||
void nodeToWorldTranslation( Vector2f& Pos ) const;
|
||||
|
||||
/**
|
||||
* @brief Reloads the UI styles.
|
||||
*
|
||||
* Forces all widgets to re-apply their CSS styles, optionally disabling
|
||||
* animations, forcing re-application, or resetting property caches.
|
||||
*
|
||||
* @param disableAnimations If true, CSS animations are disabled during reload.
|
||||
* @param forceReApplyProperties If true, all properties are re-applied even if unchanged.
|
||||
* @param resetPropertiesCache If true, property cache is cleared.
|
||||
*/
|
||||
void reloadStyle( bool disableAnimations = false, bool forceReApplyProperties = false,
|
||||
bool resetPropertiesCache = false );
|
||||
|
||||
/**
|
||||
* @brief Checks if a thread pool is available.
|
||||
*
|
||||
* @return True if a thread pool has been set, false otherwise.
|
||||
*/
|
||||
bool hasThreadPool() const;
|
||||
|
||||
/**
|
||||
* @brief Gets the thread pool.
|
||||
*
|
||||
* @return Shared pointer to the ThreadPool, or nullptr if none set.
|
||||
*/
|
||||
std::shared_ptr<ThreadPool> getThreadPool();
|
||||
|
||||
/**
|
||||
* @brief Sets the thread pool for background tasks.
|
||||
*
|
||||
* @param threadPool Shared pointer to the ThreadPool to use.
|
||||
*/
|
||||
void setThreadPool( const std::shared_ptr<ThreadPool>& threadPool );
|
||||
|
||||
/**
|
||||
* @brief Sets the theme for the entire UI scene.
|
||||
*
|
||||
* Applies the theme to the root widget and all children.
|
||||
*
|
||||
* @param theme Pointer to the UITheme to set.
|
||||
*/
|
||||
void setTheme( UITheme* theme );
|
||||
|
||||
/**
|
||||
* @brief Gets the current media features.
|
||||
*
|
||||
* Returns information about the current media environment (screen size,
|
||||
* resolution, color scheme, etc.) for CSS media queries.
|
||||
*
|
||||
* @return CSS::MediaFeatures structure with current media values.
|
||||
*/
|
||||
CSS::MediaFeatures getMediaFeatures() const;
|
||||
|
||||
protected:
|
||||
friend class EE::UI::UIWindow;
|
||||
friend class EE::UI::UIWidget;
|
||||
|
||||
UIWidget* mRoot{ nullptr };
|
||||
Sizef mDpSize;
|
||||
Uint32 mFlags;
|
||||
@@ -196,50 +699,212 @@ class EE_API UISceneNode : public SceneNode {
|
||||
Uint32 mCurOnSizeChangeListener{ 0 };
|
||||
std::shared_ptr<ThreadPool> mThreadPool;
|
||||
|
||||
/**
|
||||
* @brief Protected constructor.
|
||||
*
|
||||
* Creates a UISceneNode with optional window association.
|
||||
*
|
||||
* @param window Pointer to the window, or NULL for default.
|
||||
*/
|
||||
explicit UISceneNode( EE::Window::Window* window = NULL );
|
||||
|
||||
/**
|
||||
* @brief Handles node resize.
|
||||
*
|
||||
* Called when the window resizes. Updates the node size accordingly.
|
||||
*
|
||||
* @param win Pointer to the window that was resized.
|
||||
*/
|
||||
virtual void resizeNode( EE::Window::Window* win );
|
||||
|
||||
/**
|
||||
* @brief Called when debug data drawing setting changes.
|
||||
*
|
||||
* Override to respond to changes in drawDebugData flag.
|
||||
*/
|
||||
virtual void onDrawDebugDataChange();
|
||||
|
||||
/**
|
||||
* @brief Requests focus for this scene node.
|
||||
*
|
||||
* Delegates to the event dispatcher to set focus on the root widget.
|
||||
*
|
||||
* @param reason The reason for the focus request.
|
||||
* @return Pointer to this node, or nullptr if focus failed.
|
||||
*/
|
||||
virtual Node* setFocus( NodeFocusReason reason = NodeFocusReason::Unknown );
|
||||
|
||||
/**
|
||||
* @brief Called when this node's parent changes.
|
||||
*
|
||||
* Handles event dispatcher updates and size propagation.
|
||||
*/
|
||||
virtual void onParentChange();
|
||||
|
||||
/**
|
||||
* @brief Sets the internal pixel size without triggering update cycles.
|
||||
*
|
||||
* Used internally for size adjustments that shouldn't generate events.
|
||||
*
|
||||
* @param size The new size in pixels.
|
||||
*/
|
||||
void setInternalPixelsSize( const Sizef& size );
|
||||
|
||||
/**
|
||||
* @brief Sets the active window for this scene.
|
||||
*
|
||||
* @param window Pointer to the UIWindow to set as active.
|
||||
*/
|
||||
void setActiveWindow( UIWindow* window );
|
||||
|
||||
/**
|
||||
* @brief Manages focus when a window loses focus.
|
||||
*
|
||||
* Ensures proper focus restoration when switching windows.
|
||||
*
|
||||
* @param window The window that was focused.
|
||||
*/
|
||||
void setFocusLastWindow( UIWindow* window );
|
||||
|
||||
/**
|
||||
* @brief Adds a window to the scene's window list.
|
||||
*
|
||||
* @param win Pointer to the UIWindow to add.
|
||||
*/
|
||||
void windowAdd( UIWindow* win );
|
||||
|
||||
/**
|
||||
* @brief Removes a window from the scene's window list.
|
||||
*
|
||||
* @param win Pointer to the UIWindow to remove.
|
||||
*/
|
||||
void windowRemove( UIWindow* win );
|
||||
|
||||
/**
|
||||
* @brief Checks if a window exists in the scene's window list.
|
||||
*
|
||||
* @param win Pointer to the UIWindow to check.
|
||||
* @return True if the window is in the list, false otherwise.
|
||||
*/
|
||||
bool windowExists( UIWindow* win );
|
||||
|
||||
/**
|
||||
* @brief Sets the internal size in dp.
|
||||
*
|
||||
* Called internally when the size needs to be set in dp units.
|
||||
* Updates the dp size and triggers size change notifications.
|
||||
*
|
||||
* @param size The new size in dp.
|
||||
*/
|
||||
virtual void setInternalSize( const Sizef& size );
|
||||
|
||||
/**
|
||||
* @brief Handles media query changes.
|
||||
*
|
||||
* Called when media features might have changed (like DPI or size).
|
||||
* Updates stylesheet media queries and triggers style re-evaluation if needed.
|
||||
*
|
||||
* @param forceReApplyStyles If true, forces all styles to be re-applied.
|
||||
* @return True if media queries changed and styles were invalidated.
|
||||
*/
|
||||
bool onMediaChanged( bool forceReApplyStyles = false );
|
||||
|
||||
/**
|
||||
* @brief Called when a child is added or removed.
|
||||
*
|
||||
* Override to handle child count changes. Automatically re-parents
|
||||
* non-root children to the root widget.
|
||||
*
|
||||
* @param child The child node that changed.
|
||||
* @param removed True if removed, false if added.
|
||||
*/
|
||||
virtual void onChildCountChange( Node* child, const bool& removed );
|
||||
|
||||
/**
|
||||
* @brief Called when the node's size changes.
|
||||
*
|
||||
* Updates the root widget's pixel size and triggers size change events.
|
||||
*/
|
||||
virtual void onSizeChange();
|
||||
|
||||
/**
|
||||
* @brief Processes @font-face and @glyph-icon rules in a stylesheet.
|
||||
*
|
||||
* Extracts font face definitions and glyph icon definitions from
|
||||
* the stylesheet's at-rules and loads them.
|
||||
*
|
||||
* @param styleSheet The stylesheet to process.
|
||||
*/
|
||||
void processStyleSheetAtRules( const CSS::StyleSheet& styleSheet );
|
||||
|
||||
/**
|
||||
* @brief Loads font faces from @font-face rules.
|
||||
*
|
||||
* Parses font face styles and loads the fonts from various sources
|
||||
* (files, URLs, VFS).
|
||||
*
|
||||
* @param styles Vector of stylesheet styles from @font-face rules.
|
||||
*/
|
||||
void loadFontFaces( const CSS::StyleSheetStyleVector& styles );
|
||||
|
||||
/**
|
||||
* @brief Loads glyph icons from @glyph-icon rules.
|
||||
*
|
||||
* Parses glyph icon definitions and registers them with the icon theme manager.
|
||||
*
|
||||
* @param styles Vector of stylesheet styles from @glyph-icon rules.
|
||||
*/
|
||||
void loadGlyphIcon( const CSS::StyleSheetStyleVector& styles );
|
||||
|
||||
/**
|
||||
* @brief Handles key down events.
|
||||
*
|
||||
* Checks key bindings and executes associated commands. Override for
|
||||
* custom keyboard handling.
|
||||
*
|
||||
* @param event The key event.
|
||||
* @return 0 if the event was handled by a binding, otherwise base class return.
|
||||
*/
|
||||
virtual Uint32 onKeyDown( const KeyEvent& event );
|
||||
|
||||
/**
|
||||
* @brief Called when a node is deleted.
|
||||
*
|
||||
* Cleans up dirty state tracking for the deleted node if it's a widget.
|
||||
*
|
||||
* @param node The node that was deleted.
|
||||
*/
|
||||
void onWidgetDelete( Node* node );
|
||||
|
||||
/**
|
||||
* @brief Recursively resets tooltips for a node and its children.
|
||||
*
|
||||
* Used when debug mode is turned off to hide all tooltips.
|
||||
*
|
||||
* @param node The node to reset tooltips for.
|
||||
*/
|
||||
void resetTooltips( Node* node );
|
||||
|
||||
/**
|
||||
* @brief Loads UI nodes from XML.
|
||||
*
|
||||
* Core method that parses XML and creates widget hierarchy.
|
||||
*
|
||||
* @param node The XML node to parse.
|
||||
* @param parent The parent to attach widgets to.
|
||||
* @param marker Marker for style association.
|
||||
* @return Vector of root widgets created.
|
||||
*/
|
||||
std::vector<UIWidget*> loadNode( pugi::xml_node node, Node* parent, const Uint32& marker );
|
||||
|
||||
/**
|
||||
* @brief Applies a theme to a node and its subtree.
|
||||
*
|
||||
* Recursively applies the specified UITheme to all widgets in the subtree.
|
||||
*
|
||||
* @param theme Pointer to the UITheme to apply.
|
||||
* @param to The root node of the subtree to theme.
|
||||
*/
|
||||
void setTheme( UITheme* theme, Node* to );
|
||||
};
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -445,11 +445,11 @@ bool SceneNode::usesInvalidation() const {
|
||||
return mUseInvalidation;
|
||||
}
|
||||
|
||||
void SceneNode::setUseGlobalCursors( const bool& use ) {
|
||||
void SceneNode::setUseGlobalCursors( bool use ) {
|
||||
mUseGlobalCursors = use;
|
||||
}
|
||||
|
||||
const bool& SceneNode::getUseGlobalCursors() {
|
||||
bool SceneNode::getUseGlobalCursors() {
|
||||
return mUseGlobalCursors;
|
||||
}
|
||||
|
||||
@@ -496,7 +496,7 @@ void SceneNode::removeMouseOverNode( Node* node ) {
|
||||
mMouseOverNodes.erase( node );
|
||||
}
|
||||
|
||||
const bool& SceneNode::getUpdateAllChildren() const {
|
||||
bool SceneNode::getUpdateAllChildren() const {
|
||||
return mUpdateAllChildren;
|
||||
}
|
||||
|
||||
|
||||
@@ -159,6 +159,10 @@ void UISceneNode::setTranslator( Translator translator ) {
|
||||
mTranslator = translator;
|
||||
}
|
||||
|
||||
void UISceneNode::setTranslator( Translator&& translator ) {
|
||||
mTranslator = std::move( translator );
|
||||
}
|
||||
|
||||
const Translator& UISceneNode::getTranslator() const {
|
||||
return mTranslator;
|
||||
}
|
||||
@@ -367,8 +371,7 @@ void UISceneNode::setStyleSheet( const std::string& inlineStyleSheet ) {
|
||||
setStyleSheet( parser.getStyleSheet() );
|
||||
}
|
||||
|
||||
void UISceneNode::combineStyleSheet( const CSS::StyleSheet& styleSheet,
|
||||
const bool& forceReloadStyle ) {
|
||||
void UISceneNode::combineStyleSheet( const CSS::StyleSheet& styleSheet, bool forceReloadStyle ) {
|
||||
mStyleSheet.combineStyleSheet( styleSheet );
|
||||
processStyleSheetAtRules( styleSheet );
|
||||
onMediaChanged();
|
||||
@@ -376,8 +379,8 @@ void UISceneNode::combineStyleSheet( const CSS::StyleSheet& styleSheet,
|
||||
reloadStyle();
|
||||
}
|
||||
|
||||
void UISceneNode::combineStyleSheet( const std::string& inlineStyleSheet,
|
||||
const bool& forceReloadStyle, const Uint32& marker ) {
|
||||
void UISceneNode::combineStyleSheet( const std::string& inlineStyleSheet, bool forceReloadStyle,
|
||||
const Uint32& marker ) {
|
||||
CSS::StyleSheetParser parser;
|
||||
|
||||
if ( parser.loadFromString( inlineStyleSheet ) ) {
|
||||
@@ -639,7 +642,7 @@ void UISceneNode::onWidgetDelete( Node* node ) {
|
||||
}
|
||||
}
|
||||
|
||||
const bool& UISceneNode::isLoading() const {
|
||||
bool UISceneNode::isLoading() const {
|
||||
return mIsLoading;
|
||||
}
|
||||
|
||||
@@ -814,7 +817,7 @@ void UISceneNode::updateDirtyStyleStates() {
|
||||
}
|
||||
}
|
||||
|
||||
const bool& UISceneNode::isUpdatingLayouts() const {
|
||||
bool UISceneNode::isUpdatingLayouts() const {
|
||||
return mUpdatingLayouts;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user