1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

widgets: Cleanup musicButton specific hacks

This commit is contained in:
Sandy Carter
2015-08-21 23:07:51 -04:00
parent bf353a4f5b
commit 236492ed39
2 changed files with 3 additions and 29 deletions

View File

@@ -419,8 +419,8 @@ void CToggleGroup::addToggle(int identifier, CToggleBase* bt)
buttons[identifier] = bt;
}
CToggleGroup::CToggleGroup(const CFunctionList<void(int)> &OnChange, bool musicLikeButtons)
: onChange(OnChange), selectedID(-2), musicLike(musicLikeButtons)
CToggleGroup::CToggleGroup(const CFunctionList<void(int)> &OnChange)
: onChange(OnChange), selectedID(-2)
{}
void CToggleGroup::setSelected(int id)
@@ -447,28 +447,6 @@ void CToggleGroup::selectionChanged(int to)
parent->redraw();
}
void CToggleGroup::show(SDL_Surface * to)
{
if (musicLike)
{
if (auto intObj = dynamic_cast<CIntObject*>(buttons[selectedID])) // hack-ish workagound to avoid diamond problem with inheritance
intObj->show(to);
}
else
CIntObject::show(to);
}
void CToggleGroup::showAll(SDL_Surface * to)
{
if (musicLike)
{
if (auto intObj = dynamic_cast<CIntObject*>(buttons[selectedID])) // hack-ish workagound to avoid diamond problem with inheritance
intObj->showAll(to);
}
else
CIntObject::showAll(to);
}
CVolumeSlider::CVolumeSlider(const Point &position, const std::string &defName, const int value,
const std::pair<std::string, std::string> * const help) :
value(value),