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

# class hiro::gui::Droplist

## Overview

List of items, where one of the items is selected. More…

    #include <GuiTypes.h>

    class Droplist: public hiro::gui::LinkedElement {
    public:
        // methods

        virtual hiro::gui::Droplist* Set(const int32_t value);
        int32_t Get() const;
        std::string GetText() const;
        hiro::gui::Droplist* AddItem(const std::string& name, int32_t value);
        hiro::gui::Droplist* AddItemIndexed(const std::string& name);
        hiro::gui::Droplist* AddItems(const std::vector<std::pair<std::string, int32_t>>& items);
        hiro::gui::Droplist* AddItemsIndexed(const std::vector<std::string>& items);
    };

### 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);
        virtual C* Set(const T new_value) = 0;
        virtual T Get() const = 0;
        C* SetLink(T* pointer);

    protected:
        // methods

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

## Detailed Documentation

List of items, where one of the items is selected.

Each item has a value defined, that can be used to identify it.

### Methods

    virtual hiro::gui::Droplist* Set(const int32_t value)

Selects an item that has a defined value.

When there are multiple items with the same value, selects the first one in the list.

    int32_t Get() const

Returns the value of currently selected item.

    std::string GetText() const

Returns the text of currently selected item.

    hiro::gui::Droplist* AddItem(const std::string& name, int32_t value)

Adds a single item to the list and assigns it a specified value.

    hiro::gui::Droplist* AddItemIndexed(const std::string& name)

Adds a single item to the list. Position in the list determines the value.

    hiro::gui::Droplist* AddItems(const std::vector<std::pair<std::string, int32_t>>& items)

Adds multiple items by pair <name,value>.

    hiro::gui::Droplist* AddItemsIndexed(const std::vector<std::string>& items)

Adds multiple items by name. Position in the list determines value of item.