mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-19 21:10:12 +02:00
Minor changes
This commit is contained in:
parent
c064b805c2
commit
c7ded69edc
@ -95,6 +95,7 @@ set(client_SRCS
|
|||||||
widgets/CComponent.cpp
|
widgets/CComponent.cpp
|
||||||
widgets/CGarrisonInt.cpp
|
widgets/CGarrisonInt.cpp
|
||||||
widgets/CreatureCostBox.cpp
|
widgets/CreatureCostBox.cpp
|
||||||
|
widgets/ComboBox.cpp
|
||||||
widgets/Images.cpp
|
widgets/Images.cpp
|
||||||
widgets/MiscWidgets.cpp
|
widgets/MiscWidgets.cpp
|
||||||
widgets/ObjectLists.cpp
|
widgets/ObjectLists.cpp
|
||||||
@ -253,6 +254,7 @@ set(client_HEADERS
|
|||||||
widgets/CComponent.h
|
widgets/CComponent.h
|
||||||
widgets/CGarrisonInt.h
|
widgets/CGarrisonInt.h
|
||||||
widgets/CreatureCostBox.h
|
widgets/CreatureCostBox.h
|
||||||
|
widgets/ComboBox.h
|
||||||
widgets/Images.h
|
widgets/Images.h
|
||||||
widgets/MiscWidgets.h
|
widgets/MiscWidgets.h
|
||||||
widgets/ObjectLists.h
|
widgets/ObjectLists.h
|
||||||
|
@ -35,7 +35,8 @@ void ComboBox::DropDown::Item::updateItem(int idx, const void * _item)
|
|||||||
if(auto w = widget<CLabel>("labelName"))
|
if(auto w = widget<CLabel>("labelName"))
|
||||||
{
|
{
|
||||||
item = _item;
|
item = _item;
|
||||||
w->setText(dropDown.comboBox.getItemText(idx, item));
|
if(dropDown.comboBox.getItemText)
|
||||||
|
w->setText(dropDown.comboBox.getItemText(idx, item));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +72,8 @@ ComboBox::DropDown::DropDown(const JsonNode & config, ComboBox & _comboBox):
|
|||||||
{
|
{
|
||||||
REGISTER_BUILDER("item", &ComboBox::DropDown::buildItem);
|
REGISTER_BUILDER("item", &ComboBox::DropDown::buildItem);
|
||||||
|
|
||||||
comboBox.onConstructItems(curItems);
|
if(comboBox.onConstructItems)
|
||||||
|
comboBox.onConstructItems(curItems);
|
||||||
|
|
||||||
addCallback("sliderMove", std::bind(&ComboBox::DropDown::sliderMove, this, std::placeholders::_1));
|
addCallback("sliderMove", std::bind(&ComboBox::DropDown::sliderMove, this, std::placeholders::_1));
|
||||||
|
|
||||||
@ -153,11 +155,6 @@ void ComboBox::DropDown::setItem(const void * item)
|
|||||||
GH.windows().popWindows(1);
|
GH.windows().popWindows(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComboBox::DropDown::constructItems()
|
|
||||||
{
|
|
||||||
comboBox.onConstructItems(curItems);
|
|
||||||
}
|
|
||||||
|
|
||||||
ComboBox::ComboBox(Point position, const std::string & defName, const std::pair<std::string, std::string> & help, const JsonNode & dropDownDescriptor, EShortcut key, bool playerColoredButton):
|
ComboBox::ComboBox(Point position, const std::string & defName, const std::pair<std::string, std::string> & help, const JsonNode & dropDownDescriptor, EShortcut key, bool playerColoredButton):
|
||||||
CButton(position, defName, help, 0, key, playerColoredButton)
|
CButton(position, defName, help, 0, key, playerColoredButton)
|
||||||
{
|
{
|
||||||
@ -169,8 +166,9 @@ ComboBox::ComboBox(Point position, const std::string & defName, const std::pair<
|
|||||||
|
|
||||||
void ComboBox::setItem(const void * item)
|
void ComboBox::setItem(const void * item)
|
||||||
{
|
{
|
||||||
if(auto w = std::dynamic_pointer_cast<CLabel>(overlay))
|
if(auto w = std::dynamic_pointer_cast<CLabel>(overlay); getItemText)
|
||||||
addTextOverlay(getItemText(0, item), w->font, w->color);
|
addTextOverlay(getItemText(0, item), w->font, w->color);
|
||||||
|
|
||||||
onSetItem(item);
|
if(onSetItem)
|
||||||
|
onSetItem(item);
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,6 @@ class ComboBox : public CButton
|
|||||||
public:
|
public:
|
||||||
DropDown(const JsonNode &, ComboBox &);
|
DropDown(const JsonNode &, ComboBox &);
|
||||||
|
|
||||||
void constructItems();
|
|
||||||
bool receiveEvent(const Point & position, int eventType) const override;
|
bool receiveEvent(const Point & position, int eventType) const override;
|
||||||
void clickPressed(const Point & cursorPosition) override;
|
void clickPressed(const Point & cursorPosition) override;
|
||||||
void setItem(const void *);
|
void setItem(const void *);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user