mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-15 13:33:36 +02:00
Fix callbacks of toggle buttons. Fixes game options window
This commit is contained in:
parent
7927470d46
commit
062311d24a
@ -300,7 +300,7 @@ std::shared_ptr<CToggleButton> InterfaceObjectConfigurable::buildToggleButton(co
|
||||
assert(imgOrder.size() >= 4);
|
||||
button->setImageOrder(imgOrder[0].Integer(), imgOrder[1].Integer(), imgOrder[2].Integer(), imgOrder[3].Integer());
|
||||
}
|
||||
loadButtonCallback(button, config["callback"]);
|
||||
loadToggleButtonCallback(button, config["callback"]);
|
||||
return button;
|
||||
}
|
||||
|
||||
@ -340,6 +340,19 @@ void InterfaceObjectConfigurable::loadButtonBorderColor(std::shared_ptr<CButton>
|
||||
button->setBorderColor(color);
|
||||
}
|
||||
|
||||
void InterfaceObjectConfigurable::loadToggleButtonCallback(std::shared_ptr<CToggleButton> button, const JsonNode & config) const
|
||||
{
|
||||
if(config.isNull())
|
||||
return;
|
||||
|
||||
std::string callbackName = config.String();
|
||||
|
||||
if (callbacks.count(callbackName) > 0)
|
||||
button->addCallback(callbacks.at(callbackName));
|
||||
else
|
||||
logGlobal->error("Invalid callback '%s' in widget", callbackName );
|
||||
}
|
||||
|
||||
void InterfaceObjectConfigurable::loadButtonCallback(std::shared_ptr<CButton> button, const JsonNode & config) const
|
||||
{
|
||||
if(config.isNull())
|
||||
|
@ -75,6 +75,7 @@ protected:
|
||||
std::pair<std::string, std::string> readHintText(const JsonNode &) const;
|
||||
EShortcut readHotkey(const JsonNode &) const;
|
||||
|
||||
void loadToggleButtonCallback(std::shared_ptr<CToggleButton> button, const JsonNode & config) const;
|
||||
void loadButtonCallback(std::shared_ptr<CButton> button, const JsonNode & config) const;
|
||||
void loadButtonHotkey(std::shared_ptr<CButton> button, const JsonNode & config) const;
|
||||
void loadButtonBorderColor(std::shared_ptr<CButton> button, const JsonNode & config) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user