1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Refactor combo box

This commit is contained in:
nordsoft
2023-08-25 14:07:38 +04:00
parent 39fbdd300d
commit c064b805c2
7 changed files with 301 additions and 217 deletions

View File

@@ -51,43 +51,6 @@ private:
std::set<int> playerCountAllowed, playerTeamsAllowed, compCountAllowed, compTeamsAllowed;
};
class TemplatesDropBox : public InterfaceObjectConfigurable
{
struct ListItem : public InterfaceObjectConfigurable
{
TemplatesDropBox & dropBox;
const CRmgTemplate * item = nullptr;
ListItem(const JsonNode &, TemplatesDropBox &, Point position);
void updateItem(int index, const CRmgTemplate * item = nullptr);
void hover(bool on) override;
void clickPressed(const Point & cursorPosition) override;
void clickReleased(const Point & cursorPosition) override;
};
friend struct ListItem;
public:
TemplatesDropBox(RandomMapTab & randomMapTab, int3 size);
bool receiveEvent(const Point & position, int eventType) const override;
void clickPressed(const Point & cursorPosition) override;
void setTemplate(const CRmgTemplate *);
private:
std::shared_ptr<CIntObject> buildListItem(const JsonNode & config);
void sliderMove(int slidPos);
void updateListItems();
RandomMapTab & randomMapTab;
std::vector<std::shared_ptr<ListItem>> listItems;
std::vector<const CRmgTemplate *> curItems;
};
class TeamAlignmentsWidget: public InterfaceObjectConfigurable
{
public: