class hiro::gui::CheckboxList — HIRO 0.7.0 documentation

# class hiro::gui::CheckboxList

## Overview

List of checkbox elements that can be managed in a group. More…

    #include <GuiTypes.h>

    class CheckboxList: public hiro::gui::TElement {
    public:
        // methods

        size_t AddItem(const std::string& title, bool state = false, const std::optional<size_t> id = std::nullopt);
        hiro::gui::CheckboxList* SetItemColor(size_t id, const cogs::Color3f& color);
        hiro::gui::CheckboxList* SubscribeItems(const std::function<void(uint32_t, bool)>& func);
    };

### Inherited Members

    public:
        // methods

        bool TestCondition() const;
        uint32_t GetId() const;
        C* SetConditionFunc(std::function<bool(void)> condition_func);
        C* SetConditionBool(bool* var, hiro::BoolFunc func = hiro::BoolFunc::equals_true);
        C* Subscribe(std::function<void(const C*)> callback_func);

    protected:
        // methods

        void SetConditionFuncImpl(std::function<bool(void)> condition_func);
        virtual void NotifyChange() const;

## Detailed Documentation

List of checkbox elements that can be managed in a group.

### Methods

    size_t AddItem(const std::string& title, bool state = false, const std::optional<size_t> id = std::nullopt)

Add checkbox element to the list.

Parameters:

title | Checkbox element title.
state | Initial state of checkbox.
id | User defined item identifier. When not specified, equal to the number of elements already in the list.

Returns:

Identifier of an item. Equal to parameter id when specified.

    hiro::gui::CheckboxList* SetItemColor(size_t id, const cogs::Color3f& color)

Assigns custom color to the item.

Parameters:

id | Identifier of an item.
color | Color used to highlight an item. Default black

    hiro::gui::CheckboxList* SubscribeItems(const std::function<void(uint32_t, bool)>& func)

Subscribe callback function that will be invoked on item state change.

When the state of any checkbox element in a list changes, the specified function will be invoked. The first parameter of a function holds an identifier of the checkbox whose state has been changed. The second parameter holds the new state of the checkbox.