2017-01-20 08:36:52 -05:00
|
|
|
#pragma once
|
|
|
|
|
2017-01-19 16:23:59 -05:00
|
|
|
namespace Components
|
|
|
|
{
|
|
|
|
class UIFeeder : public Component
|
|
|
|
{
|
|
|
|
public:
|
2017-01-21 16:14:23 -05:00
|
|
|
typedef Utils::Slot<unsigned int()> GetItemCount_t;
|
|
|
|
typedef Utils::Slot<const char*(unsigned int /*index*/, int /*column*/)> GetItemText_t;
|
|
|
|
typedef Utils::Slot<void(unsigned int /*index*/)> Select_t;
|
2017-01-19 16:23:59 -05:00
|
|
|
|
|
|
|
struct Callbacks
|
|
|
|
{
|
|
|
|
GetItemCount_t getItemCount;
|
|
|
|
GetItemText_t getItemText;
|
|
|
|
Select_t select;
|
|
|
|
};
|
|
|
|
|
|
|
|
UIFeeder();
|
|
|
|
~UIFeeder();
|
|
|
|
|
|
|
|
static void Add(float feeder, GetItemCount_t itemCountCb, GetItemText_t itemTextCb, Select_t selectCb);
|
|
|
|
|
|
|
|
private:
|
|
|
|
struct Container
|
|
|
|
{
|
|
|
|
float feeder;
|
|
|
|
int index;
|
|
|
|
int column;
|
|
|
|
};
|
|
|
|
|
|
|
|
static Container Current;
|
|
|
|
|
|
|
|
static void GetItemCountStub();
|
|
|
|
static unsigned int GetItemCount();
|
|
|
|
|
|
|
|
static void GetItemTextStub();
|
|
|
|
static const char* GetItemText();
|
|
|
|
|
|
|
|
static void SetItemSelectionStub();
|
|
|
|
static bool SetItemSelection();
|
|
|
|
|
|
|
|
static bool CheckFeeder();
|
2017-02-06 15:23:15 -05:00
|
|
|
static int CheckSelection(int feeder);
|
|
|
|
static void CheckSelectionStub();
|
2017-01-19 16:23:59 -05:00
|
|
|
|
|
|
|
static void MouseEnterStub();
|
|
|
|
static void MouseSelectStub();
|
|
|
|
static void HandleKeyStub();
|
|
|
|
static void PlaySoundStub();
|
|
|
|
|
2017-01-21 16:14:23 -05:00
|
|
|
static void Select(float feeder, unsigned int index);
|
|
|
|
|
2017-01-19 16:23:59 -05:00
|
|
|
static std::unordered_map<float, Callbacks> Feeders;
|
|
|
|
|
2017-01-21 16:14:23 -05:00
|
|
|
static unsigned int GetMapCount();
|
|
|
|
static const char* GetMapText(unsigned int index, int column);
|
|
|
|
static void SelectMap(unsigned int index);
|
|
|
|
static void ApplyMap(UIScript::Token token);
|
|
|
|
static void ApplyInitialMap(UIScript::Token token);
|
2017-01-19 16:23:59 -05:00
|
|
|
};
|
|
|
|
}
|