# class guip::Combobox

## Overview

Widget that allows user to pick an item from the dropdown list. Each item can have an index assigned. More…

    #include <Combobox.h>

    class Combobox: public Combobox {
    public:
        // fields

        static CEGUI::String WidgetTypeName;

        // construction

        Combobox(const CEGUI::String& type, const CEGUI::String& name);

        // methods

        void SetSelectedByText(const std::string& text);
        std::string GetTextOfSelected() const;
        void SetSelectedByValue(const int32_t value);
        int32_t GetValueOfSelected() const;
        void AddItem(const std::string& name);
        void AddValueItem(const std::string& name, int32_t value);
        void AddItems(const std::vector<std::string>& items);
        void AddValueItems(const std::vector<std::pair<std::string, int32_t>>& items);
        void ClearItems();
    };

## Detailed Documentation

Widget that allows user to pick an item from the dropdown list. Each item can have an index assigned.

### Fields

    static CEGUI::String WidgetTypeName

Unique gui system identifier.

### Methods

    void SetSelectedByText(const std::string& text)

Selects first item which has defined text.

    std::string GetTextOfSelected() const

Returns text of selected item.

    void SetSelectedByValue(const int32_t value)

Selects first item which has defined value.

    int32_t GetValueOfSelected() const

Returns value of selected item. If no item is selected, returns -1.

    void AddItem(const std::string& name)

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

    void AddValueItem(const std::string& name, int32_t value)

Adds a single item to the list.

    void AddItems(const std::vector<std::string>& items)

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

    void AddValueItems(const std::vector<std::pair<std::string, int32_t>>& items)

Adds multiple items by pair <name,value>.

    void ClearItems()

Removes all items from selection list.