#include <Widget/StaticItemSlot/ItemSlotButton/ItemSlotButton.hpp>

ItemSlotButton::ItemSlotButton(ItemStack stack, ClickCallback clickCallback) :
    StaticItemSlot([stack](){ return stack; }),
    clickCallback(clickCallback)
{}

void ItemSlotButton::onMouseUp(Uint8 button)
{
    if (button == SDL_BUTTON_LEFT && isMouseInside())
    {
        clickCallback();
        return;
    }

    StaticItemSlot::onMouseUp(button);
}