| 1 | #include "Layout/SimpleLayoutMenu.h" |
| 2 | |
| 3 | #include "Library/Layout/LayoutActionFunction.h" |
| 4 | #include "Library/Layout/LayoutInitInfo.h" |
| 5 | #include "Library/Nerve/NerveSetupUtil.h" |
| 6 | #include "Library/Nerve/NerveUtil.h" |
| 7 | |
| 8 | namespace { |
| 9 | NERVE_HOST_TYPE_IMPL(SimpleLayoutMenu, Appear); |
| 10 | NERVE_HOST_TYPE_IMPL(SimpleLayoutMenu, Wait); |
| 11 | NERVE_HOST_TYPE_IMPL(SimpleLayoutMenu, End); |
| 12 | NERVE_HOST_TYPE_IMPL(SimpleLayoutMenu, EndWait); |
| 13 | |
| 14 | NERVES_MAKE_STRUCT(HostType, Appear, End, EndWait, Wait); |
| 15 | } // namespace |
| 16 | |
| 17 | SimpleLayoutMenu::(const char* name, const char* layoutName, |
| 18 | const al::LayoutInitInfo& info, const char* archiveName, |
| 19 | bool localize) |
| 20 | : al::LayoutActor(name) { |
| 21 | if (localize) |
| 22 | al::initLayoutActorLocalized(this, info, layoutName, archiveName); |
| 23 | else |
| 24 | al::initLayoutActor(this, info, layoutName, archiveName); |
| 25 | |
| 26 | initNerve(&NrvHostType.Appear, 0); |
| 27 | } |
| 28 | |
| 29 | SimpleLayoutMenu::(al::LayoutActor* parent, const char* name, |
| 30 | const char* layoutName, const al::LayoutInitInfo& info, |
| 31 | const char* archiveName) |
| 32 | : al::LayoutActor(name) { |
| 33 | al::initLayoutPartsActor(this, parent, info, layoutName, archiveName); |
| 34 | initNerve(&NrvHostType.Appear, 0); |
| 35 | } |
| 36 | |
| 37 | void SimpleLayoutMenu::(const char* actionName) { |
| 38 | al::startAction(layout: this, actionName, paneName: nullptr); |
| 39 | al::LayoutActor::appear(); |
| 40 | setNerve(user: this, nerve: &NrvHostType.Appear); |
| 41 | } |
| 42 | |
| 43 | void SimpleLayoutMenu::(const char* actionName) { |
| 44 | if (al::isNerve(user: this, nerve: &NrvHostType.End) || isEndWait()) |
| 45 | return; |
| 46 | al::startAction(layout: this, actionName, paneName: nullptr); |
| 47 | al::setNerve(user: this, nerve: &NrvHostType.End); |
| 48 | } |
| 49 | |
| 50 | void SimpleLayoutMenu::() { |
| 51 | if (al::isActionEnd(layout: this, paneName: nullptr)) |
| 52 | al::setNerve(user: this, nerve: &NrvHostType.Wait); |
| 53 | } |
| 54 | |
| 55 | void SimpleLayoutMenu::() { |
| 56 | if (al::isFirstStep(user: this)) |
| 57 | al::startAction(layout: this, actionName: "Wait" , paneName: nullptr); |
| 58 | if (mWaitDuration >= 0 && al::isGreaterEqualStep(user: this, step: mWaitDuration)) |
| 59 | al::setNerve(user: this, nerve: &NrvHostType.End); |
| 60 | } |
| 61 | |
| 62 | void SimpleLayoutMenu::() { |
| 63 | if (al::isActionEnd(layout: this, paneName: nullptr)) |
| 64 | al::setNerve(user: this, nerve: &NrvHostType.EndWait); |
| 65 | } |
| 66 | |
| 67 | void SimpleLayoutMenu::() {} |
| 68 | |
| 69 | bool SimpleLayoutMenu::() const { |
| 70 | return isWait() || al::isNerve(user: this, nerve: &NrvHostType.Appear); |
| 71 | } |
| 72 | |
| 73 | bool SimpleLayoutMenu::() const { |
| 74 | return al::isNerve(user: this, nerve: &NrvHostType.Wait); |
| 75 | } |
| 76 | |
| 77 | bool SimpleLayoutMenu::() const { |
| 78 | return al::isNerve(user: this, nerve: &NrvHostType.EndWait); |
| 79 | } |
| 80 | |