class guip::GuiSystem — HIRO 0.7.0 documentation

# class guip::GuiSystem

## Overview

Manages context, rendering and live span for all created widgets. More…

    #include <GuiSystem.h>

    class GuiSystem: public glw::WindowEventObserver {
    public:
        // classes

        class LoggerProxy;

        // construction

        GuiSystem();
        ~GuiSystem();

        // methods

        bool Initialize(const std::string& resource_dir, std::shared_ptr<glw::Window> window);
        void Update(float time_delta);
        void Draw();
        bool IsDirty();
        CEGUI::GUIContext* GetContext();
        CEGUI::Window* GetRoot();

    protected:
        // methods

        virtual void OnMouseDown(int button, int mods);
        virtual void OnMouseUp(int button, int mods);
        virtual void OnMouseWheel(double xoffset, double yoffset);
        virtual void OnMouseMove(double xpos, double ypos);
        virtual void OnCharacter(char codepoint);
        virtual void OnKeyDown(int key, int mods, bool is_repeat);
        virtual void OnKeyUp(int key, int mods);
        virtual void OnWindowResize(int width, int height);
        virtual void OnContentScale(float xscale, float yscale);
    };

### Inherited Members

    protected:
        // methods

        virtual void OnMouseMove(double xpos, double ypos);
        virtual void OnMouseDown(int button, int mods);
        virtual void OnMouseUp(int button, int mods);
        virtual void OnMouseWheel(double xoffset, double yoffset);
        virtual void OnCharacter(char codepoint);
        virtual void OnKeyDown(int key, int mods, bool is_repeat);
        virtual void OnKeyUp(int key, int mods);
        virtual void OnTouch(unsigned int num_of_contacts, unsigned int* id, double* xpos, double* ypos, double* cwidth, double* cheight);
        virtual void OnTouchGestBegin();
        virtual void OnTouchGestEnd();
        virtual void OnTouchGestZoom(double distance, double xpos, double ypos);
        virtual void OnTouchGestPan(double distance, double xpos, double ypos);
        virtual void OnWindowMove(int xpos, int ypos);
        virtual void OnWindowRefresh();
        virtual void OnWindowResize(int width, int height);
        virtual void OnContentScale(float xscale, float yscale);
        virtual void OnFramebufferResize(int width, int height);
        virtual void OnWindowIconify(int is_iconified);
        virtual void OnWindowFocus(int is_focused);
        virtual void OnWindowClose();
        virtual void OnFilesDropped(const std::vector<std::string>& files);

## Detailed Documentation

Manages context, rendering and live span for all created widgets.

The class automatically creates and destroys gui context as it exists.

### Methods

    bool Initialize(const std::string& resource_dir, std::shared_ptr<glw::Window> window)

Creates context. Without invoking this function, gui will not work.

    void Draw()

Renders GUI into currently bound gl frame buffer.

    bool IsDirty()

Whether GUI should be rendered.

    CEGUI::GUIContext* GetContext()

Returns context of CEGUI system.

    CEGUI::Window* GetRoot()

Returns the root window widget.