#ifndef ITEM_FILTER_DROPDOWN_HPP_
#define ITEM_FILTER_DROPDOWN_HPP_

#include <ItemStack/ItemStack.hpp>
#include <Widget/Widget.hpp>
#include <functional>

/**
 * @brief A widget which can be clicked to open a popup allowing the selection of an item, or "any item".
 */
class ItemFilterDropdown : public Widget
{
public:
    typedef std::function<void()> ChangedCallback;

private:
    ItemStack &selection;
    bool shouldClosePopup = false;
    ChangedCallback onChanged;

public:
    ItemFilterDropdown(ItemStack &selection, ChangedCallback onChanged = [](){});

    virtual void draw(GraphicsContext &context) override;
    virtual glm::ivec2 getMinSize() override;
    virtual void onMouseUp(Uint8 button) override;
};

#endif