namespace guip — HIRO 0.7.0 documentation

# namespace guip

## Overview

Proxy library for working with graphical user interface. More…

    namespace guip {

    // enums

    enum PushButtonTheme;

    // classes

    class ArrayPanel;
    class Combobox;
    class Editbox;
    class GuiSystem;
    class ListboxTextItem;
    class Spinner;
    class StatusIcon;
    class WaitCircle;

    // global functions

    template <typename CastType = float>
    glm::vec<2, CastType> ToVec(const CEGUI::Vector2f& vector);

    template <typename CastType = float>
    glm::vec<2, CastType> ToVec(const CEGUI::Sizef& size);

    GUIP_API std::string ToString(const CEGUI::UDim& dim);
    GUIP_API std::string ToString(const CEGUI::UVector2& vec);
    GUIP_API std::string ToString(const CEGUI::USize& siz);
    GUIP_API void SetTheme(PushButtonTheme theme, CEGUI::Window* btn);
    GUIP_API void SetPosition(CEGUI::Window* widget, float x_perc, float x_px, float y_perc, float y_px);
    GUIP_API void SetSize(CEGUI::Window* widget, float w_perc, float w_px, float h_perc, float h_px);
    GUIP_API void SetDestRect(CEGUI::Window* widget, float x_px, float y_px, float w_px, float h_px);

    template <typename WidgetType = CEGUI::Window>
    WidgetType* GetHandledObject(const CEGUI::EventArgs& e);

    template <typename WidgetType = CEGUI::Window>
    WidgetType* CreateWidget(const std::string& type, const std::string& name, CEGUI::Window* parent = nullptr);

    template <typename WidgetType = CEGUI::Window>
    WidgetType* CreateWidgetFromXml(const std::string& look_xml, CEGUI::Window* parent = nullptr);

    template <typename WidgetType = CEGUI::Window>
    WidgetType* CreateWidgetFromFile(const std::string& look_file, CEGUI::Window* parent = nullptr);

    template <typename WidgetType = CEGUI::Window>
    WidgetType* GetChild(const std::string& name, CEGUI::Window* parent);

    template <typename WidgetType = CEGUI::Window>
    WidgetType* GetChildRecursive(const std::string& name, CEGUI::Window* parent);

    template <class C, class P>
    CEGUI::Window* FindChild(const C& container, const P& Predicate);

    GUIP_API std::vector<CEGUI::Window*> GetChildWidgets(CEGUI::Window* widget, bool exclude_auto_widgets = true);
    GUIP_API void RemoveChildWidgets(CEGUI::Window* widget, bool exclude_auto_widgets = true);
    GUIP_API void DestroyChildWidgets(CEGUI::Window* widget, bool exclude_auto_widgets = true);
    GUIP_API void SetSelectedMuted(const bool state, CEGUI::ToggleButton* button);
    GUIP_API bool ImportImage(const std::string& internal_image_name, const std::string& img_path, const glm::uvec2& resolution);
    GUIP_API void PrintHierarchy(const CEGUI::Window* window, std::ostream& outs, size_t indent = 0);
    GUIP_API void PrintProperties(const CEGUI::Window* window, std::ostream& outs);

    } // namespace guip

## Detailed Documentation

Proxy library for working with graphical user interface.

Extensions to the CEGUI library.

### Global Functions

    template <typename CastType = float>
    glm::vec<2, CastType> ToVec(const CEGUI::Vector2f& vector)

Converts CEGUI Vector2f to glm::tvec2.

    template <typename CastType = float>
    glm::vec<2, CastType> ToVec(const CEGUI::Sizef& size)

Converts CEGUI Sizef to glm::tvec2.

    GUIP_API std::string ToString(const CEGUI::UDim& dim)

Converts UDim to a string form.

    GUIP_API std::string ToString(const CEGUI::UVector2& vec)

Converts UVector to a string form.

    GUIP_API std::string ToString(const CEGUI::USize& siz)

Converts USize to a string form.

    GUIP_API void SetTheme(PushButtonTheme theme, CEGUI::Window* btn)

Changes a color theme of a DarkHiro/PushButton element.

    GUIP_API void SetPosition(CEGUI::Window* widget, float x_perc, float x_px, float y_perc, float y_px)

Sets position for the widget.

    GUIP_API void SetSize(CEGUI::Window* widget, float w_perc, float w_px, float h_perc, float h_px)

Sets size for the widget.

    GUIP_API void SetDestRect(CEGUI::Window* widget, float x_px, float y_px, float w_px, float h_px)

Sets widgets destination as rectangle in pixels.

    template <typename WidgetType = CEGUI::Window>
    WidgetType* GetHandledObject(const CEGUI::EventArgs& e)

Returns a pointer to the WigetType as a handle object.

    template <typename WidgetType = CEGUI::Window>
    WidgetType* CreateWidget(const std::string& type, const std::string& name, CEGUI::Window* parent = nullptr)

Creates new widget and, if parent is not nullptr, assigns as a child to another widget.

    template <typename WidgetType = CEGUI::Window>
    WidgetType* CreateWidgetFromXml(const std::string& look_xml, CEGUI::Window* parent = nullptr)

Creates new widget from layout xml and, if parent is not nullptr, assigns as a child to another widget.

    template <typename WidgetType = CEGUI::Window>
    WidgetType* CreateWidgetFromFile(const std::string& look_file, CEGUI::Window* parent = nullptr)

Creates new widget from layout file and, if parent is not nullptr, assigns as a child to another widget.

    template <typename WidgetType = CEGUI::Window>
    WidgetType* GetChild(const std::string& name, CEGUI::Window* parent)

Return child of specified widget with exact name.

    template <typename WidgetType = CEGUI::Window>
    WidgetType* GetChildRecursive(const std::string& name, CEGUI::Window* parent)

Returns child of specified widget and all its sub-widgets with exact name.

    template <class C, class P>
    CEGUI::Window* FindChild(const C& container, const P& Predicate)

Find a child of a CEGUI container that passes given predicate function.

    GUIP_API std::vector<CEGUI::Window*> GetChildWidgets(CEGUI::Window* widget, bool exclude_auto_widgets = true)

Returns child widget of a specified window.

    GUIP_API void RemoveChildWidgets(CEGUI::Window* widget, bool exclude_auto_widgets = true)

Removes child widgets of a specified window.

    GUIP_API void DestroyChildWidgets(CEGUI::Window* widget, bool exclude_auto_widgets = true)

Removes and destroys child widgets of a specified window.

    GUIP_API void SetSelectedMuted(const bool state, CEGUI::ToggleButton* button)

Select or un-select specified ToggleButton without calling any events.

    GUIP_API bool ImportImage(const std::string& internal_image_name, const std::string& img_path, const glm::uvec2& resolution)

Loads a single image to CEGUI.

Parameters:

internal_image_name | Image set and image name in format [imageset name]/[image name].
img_path | Path to the image.
resolution | Resolution of the image.

    GUIP_API void PrintHierarchy(const CEGUI::Window* window, std::ostream& outs, size_t indent = 0)

Prints window hierarchy to output stream.

    GUIP_API void PrintProperties(const CEGUI::Window* window, std::ostream& outs)

Prints all properties of a specified widget to output stream.