bsnes/hiro/core/action/menu-radio-item.cpp
Tim Allen 20cc6148cb Update to v094r27 release.
byuu says:

Added AWJ's fixes for alt/cpu (Tetris Attack framelines issue) and
alt/dsp (Thread::clock reset)

Added fix so that the taskbar entry appears when the application first
starts on Windows.

Fixed checkbox toggling inside of list views on Windows.

Updated nall/image to properly protect variables that should not be
written externally.

New Object syntax for hiro is in.

Fixed the backwards-typing on Windows with the state manager.
NOTE: the list view isn't redrawing when you change the description
text. It does so on the cheat editor because of the resizeColumns call;
but that shouldn't be necessary. I'll try and fix this for the next WIP.
2015-06-18 20:48:53 +10:00

58 lines
1.2 KiB
C++

#if defined(Hiro_MenuRadioItem)
auto mMenuRadioItem::allocate() -> pObject* {
return new pMenuRadioItem(*this);
}
//
auto mMenuRadioItem::checked() const -> bool {
return state.checked;
}
auto mMenuRadioItem::doActivate() const -> void {
if(state.onActivate) return state.onActivate();
}
auto mMenuRadioItem::group() const -> Group {
return state.group;
}
auto mMenuRadioItem::onActivate(const function<void ()>& callback) -> type& {
state.onActivate = callback;
return *this;
}
auto mMenuRadioItem::setChecked() -> type& {
if(auto group = this->group()) {
for(auto& weak : group->state.objects) {
if(auto object = weak.acquire()) {
if(auto menuRadioItem = dynamic_cast<mMenuRadioItem*>(object.data())) {
menuRadioItem->state.checked = false;
}
}
}
}
state.checked = true;
signal(setChecked);
return *this;
}
auto mMenuRadioItem::setGroup(sGroup group) -> type& {
state.group = group;
signal(setGroup, group);
return *this;
}
auto mMenuRadioItem::setText(const string& text) -> type& {
state.text = text;
signal(setText, text);
return *this;
}
auto mMenuRadioItem::text() const -> string {
return state.text;
}
#endif