bsnes/hiro/core/action/menu.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

65 lines
1.3 KiB
C++

#if defined(Hiro_Menu)
auto mMenu::allocate() -> pObject* {
return new pMenu(*this);
}
auto mMenu::destruct() -> void {
for(auto& action : state.actions) action->destruct();
mAction::destruct();
}
//
auto mMenu::action(unsigned position) const -> Action {
if(position < actions()) return state.actions[position];
return {};
}
auto mMenu::actions() const -> unsigned {
return state.actions.size();
}
auto mMenu::append(sAction action) -> type& {
state.actions.append(action);
action->setParent(this, actions() - 1);
signal(append, *action);
return *this;
}
auto mMenu::icon() const -> image {
return state.icon;
}
auto mMenu::remove(sAction action) -> type& {
signal(remove, *action);
state.actions.remove(action->offset());
for(auto n : range(action->offset(), actions())) {
state.actions[n]->adjustOffset(-1);
}
action->setParent();
}
auto mMenu::reset() -> type& {
while(state.actions) remove(state.actions.last());
return *this;
}
auto mMenu::setIcon(const image& icon) -> type& {
state.icon = icon;
signal(setIcon, icon);
return *this;
}
auto mMenu::setText(const string& text) -> type& {
state.text = text;
signal(setText, text);
return *this;
}
auto mMenu::text() const -> string {
return state.text;
}
#endif