# class hiro::GuiPanel

## Overview

Base class for panels in gui system. More…

    #include <GuiPanel.h>

    class GuiPanel {
    public:
        // construction

        GuiPanel();
        virtual ~GuiPanel();

        // methods

        virtual void SetHeight(uint32_t pixel_height);
        void SetCallbackClose(const std::function<void(void)>& callback);
        void SetCallbackPin(const std::function<void(void)>& callback);
        void Embed(CEGUI::VerticalLayoutContainer* parent_containter);
        void SetVisible(bool visible);
        bool IsVisible();
        void SetCallbackFocus(const CEGUI::Event::Subscriber& subscriber);
        CEGUI::Window* GetWidget();
        void SetTitle(const std::string& title);
        void SetFocusButtonEnabled(bool enabled);
        void SetPinButtonEnabled(bool enabled);
        void SetCloseButtonEnabled(bool enabled);

    protected:
        // fields

        static const float DEFAULT_LEFT_MARGIN;
        static const float DEFAULT_BOTTOM_MARGIN;

        // methods

        void CreateClientWindow(const std::string& layout_xml = "");
        void SetClientWindow(CEGUI::Window* client_window);
        void SetHeaderColor(const cogs::Color4hex& color);
        CEGUI::Window* GetClientWindow();
        void SetMargins(float left, float bottom);
    };

## Detailed Documentation

Base class for panels in gui system.

### Methods

    virtual void SetHeight(uint32_t pixel_height)

Sets the height of panel to the new value in pixels.

    void SetCallbackClose(const std::function<void(void)>& callback)

Sets callback which is evoked when user requests panel to close.

    void SetCallbackPin(const std::function<void(void)>& callback)

Sets callback which is evoked when user requests panel to pin.

    void Embed(CEGUI::VerticalLayoutContainer* parent_containter)

Places this to the children list of specified container.

    void SetVisible(bool visible)

Toggles visibility for this panel. Adds and removes it to/from parent container.

    void SetCallbackFocus(const CEGUI::Event::Subscriber& subscriber)

Sets callback which is evoked when user requests panel to focus.

    CEGUI::Window* GetWidget()

Returns pointer to the frame window.

    void SetTitle(const std::string& title)

Sets the title name in the header.

    void SetFocusButtonEnabled(bool enabled)

Enables/disables focus button in the header. Initially disabled.

    void SetPinButtonEnabled(bool enabled)

Enables/disables pin button in the header. Initially disabled.

    void SetCloseButtonEnabled(bool enabled)

Enables/disables close button in the header. Initially enabled.

    void CreateClientWindow(const std::string& layout_xml = "")

Creates custom client window element in the panel body.

    void SetClientWindow(CEGUI::Window* client_window)

Sets custom client window element in the panel body.

    void SetHeaderColor(const cogs::Color4hex& color)

Changes color of the header bar.

    CEGUI::Window* GetClientWindow()

Returns pointer to the client window in the panel body.

    void SetMargins(float left, float bottom)

Sets left and bottom margins for this.