class EE::UI::UIApplication

Overview

#include <uiapplication.hpp>

class UIApplication {
public:
    // enums

    enum QuitPolicy;

    // structs

    struct Settings;
    struct WindowEntry;

    // construction

    UIApplication(const WindowSettings& windowSettings, const Settings& appSettings = Settings(), const ContextSettings& contextSettings = ContextSettings());
    virtual ~UIApplication();

    // methods

    EE::Window::Window* getWindow() const;
    UISceneNode* getUI() const;
    UISceneNode* createWindow(const WindowSettings& windowSettings, const ContextSettings& contextSettings = ContextSettings());
    UISceneNode* getUI(EE::Window::Window* window) const;
    size_t getWindowCount() const;
    void closeWindow(EE::Window::Window* window);
    void requestQuit();
    bool isRunning() const;
    void setQuitPolicy(QuitPolicy policy);
    QuitPolicy getQuitPolicy() const;
    int run();
    void setShowMemoryManagerResult(bool show);
    bool showMemoryManagerResult() const;
    String::HashType getStyleSheetDefaultMarker() const;
    static void setSystemFontsEnabledByDefault(bool enabled);
    static bool systemFontsEnabledByDefault();
};

Detailed Documentation

Construction

virtual ~UIApplication()

All resources allocated by the library will be safetely released.

Methods

EE::Window::Window* getWindow() const

The main window.

UISceneNode* getUI() const

The UI scene node, this node handles the whole UI. This is the equivalent to the HTML DOM Document

UISceneNode* createWindow(const WindowSettings& windowSettings, const ContextSettings& contextSettings = ContextSettings())

Creates a secondary application-owned native window and its UISceneNode. The new scene inherits the primary scene’s font, theme, icon theme, stylesheet, and rendering policies. The returned scene remains owned by UIApplication.

Returns:

The new UI scene, or nullptr if native window creation failed.

UISceneNode* getUI(EE::Window::Window* window) const

Returns the application-owned UI scene associated with window, or nullptr when the window is not owned by this application.

size_t getWindowCount() const

Returns the number of application-owned windows pending or participating in the loop.

void closeWindow(EE::Window::Window* window)

Requests destruction of an application-owned window. The native window is hidden immediately and its scene and backend resources are destroyed at the safe point at the end of the current frame.

void requestQuit()

Requests termination of the application loop without changing the open state of its windows. Backend resources are released by UIApplication destruction.

bool isRunning() const

Returns whether the application main loop is currently running.

void setQuitPolicy(QuitPolicy policy)

Sets the condition under which window closure stops the application loop. The default is QuitPolicy::OnPrimaryWindowClosed.

QuitPolicy getQuitPolicy() const

Returns the current window-close policy.

int run()

Runs the application until window is closed

Returns:

EXIT_SUCCESS if application run successfully

void setShowMemoryManagerResult(bool show)

Set if the application must show the memory manager result after closing the main window.

static void setSystemFontsEnabledByDefault(bool enabled)

Controls the system-font fallback policy used by Settings::enableSystemFonts when unset. Enabled by default. Test runners can disable it before constructing any UIApplication.