| 1 | #include "Layout/FilterScope.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_IMPL(FilterScope, Appear); |
| 10 | NERVE_IMPL(FilterScope, Wait); |
| 11 | NERVE_IMPL(FilterScope, End); |
| 12 | |
| 13 | NERVES_MAKE_NOSTRUCT(FilterScope, Appear, Wait, End); |
| 14 | } // namespace |
| 15 | |
| 16 | FilterScope::FilterScope(const char* name, const al::LayoutInitInfo& info, const char* suffix) |
| 17 | : al::LayoutActor(name) { |
| 18 | al::initLayoutActor(this, info, "FilterScope" , suffix); |
| 19 | initNerve(&Appear, 0); |
| 20 | kill(); |
| 21 | } |
| 22 | |
| 23 | void FilterScope::startAppear() { |
| 24 | appear(); |
| 25 | al::setNerve(user: this, nerve: &Appear); |
| 26 | } |
| 27 | |
| 28 | void FilterScope::end() { |
| 29 | al::setNerve(user: this, nerve: &End); |
| 30 | } |
| 31 | |
| 32 | void FilterScope::exeAppear() { |
| 33 | if (al::isFirstStep(user: this)) |
| 34 | al::startAction(layout: this, actionName: "Appear" , paneName: 0); |
| 35 | if (al::isActionEnd(layout: this, paneName: 0)) |
| 36 | al::setNerve(user: this, nerve: &Wait); |
| 37 | } |
| 38 | |
| 39 | void FilterScope::exeWait() { |
| 40 | if (al::isFirstStep(user: this)) |
| 41 | al::startAction(layout: this, actionName: "Wait" , paneName: 0); |
| 42 | } |
| 43 | |
| 44 | void FilterScope::exeEnd() { |
| 45 | if (al::isFirstStep(user: this)) |
| 46 | al::startAction(layout: this, actionName: "End" , paneName: 0); |
| 47 | if (al::isActionEnd(layout: this, paneName: 0)) |
| 48 | kill(); |
| 49 | } |
| 50 | |
| 51 | bool FilterScope::isEnd() const { |
| 52 | return !isAlive() || al::isNerve(user: this, nerve: &End); |
| 53 | } |
| 54 | |