X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp%2FStateControl.hpp;h=d679a53ba211c3ad5fd498aeaf84443a51750ef2;hb=04bca2c5e74df466312c69abadf38e1f84aa70a9;hp=818bce5c0369ab0987d3736a28ea516bc52564c4;hpb=afd253b2dd10fdf2d4655d3d4a5766e6aa8c1a2c;p=blank.git diff --git a/src/app/StateControl.hpp b/src/app/StateControl.hpp index 818bce5..d679a53 100644 --- a/src/app/StateControl.hpp +++ b/src/app/StateControl.hpp @@ -6,30 +6,45 @@ namespace blank { -class Application; +class HeadlessApplication; class State; class StateControl { public: + // add state to the front void Push(State *s) { cue.emplace(PUSH, s); } + // swap state at the front void Switch(State *s) { cue.emplace(SWITCH, s); } + // remove state at the front void Pop() { cue.emplace(POP); } + // remove all states + // application will exit if nothing is pushed after this void PopAll() { cue.emplace(POP_ALL); } + // pop states until this one is on top + void PopAfter(State *s) { + cue.emplace(POP_AFTER, s); + } + + // pop states until this one is removed + void PopUntil(State *s) { + cue.emplace(POP_UNTIL, s); + } + - void Commit(Application &); + void Commit(HeadlessApplication &); private: enum Command { @@ -37,6 +52,8 @@ private: SWITCH, POP, POP_ALL, + POP_AFTER, + POP_UNTIL, }; struct Memo { State *state;