]> git.localhorst.tv Git - blank.git/blobdiff - src/app/StateControl.hpp
reorganized client state
[blank.git] / src / app / StateControl.hpp
index c072040bc12f57de2a31abc6a9465fbfa1e3a551..d679a53ba211c3ad5fd498aeaf84443a51750ef2 100644 (file)
@@ -12,22 +12,37 @@ 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(HeadlessApplication &);
 
@@ -37,6 +52,8 @@ private:
                SWITCH,
                POP,
                POP_ALL,
+               POP_AFTER,
+               POP_UNTIL,
        };
        struct Memo {
                State *state;