Merge branch 'development' of
[Mograsim.git] / net.mograsim.logic.model.editor / src / net / mograsim / logic / model / editor / states / StateManager.java
diff --git a/net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/states/StateManager.java b/net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/states/StateManager.java
new file mode 100644 (file)
index 0000000..d4b3fc4
--- /dev/null
@@ -0,0 +1,78 @@
+package net.mograsim.logic.model.editor.states;
+
+import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
+import net.mograsim.logic.model.editor.Editor;
+import net.mograsim.logic.model.editor.handles.Handle.HandleClickInfo;
+
+public class StateManager
+{
+       private EditorState state;
+
+       public StateManager(Editor session)
+       {
+               state = new SelectionState(session, this);
+               state.onEntry();
+       }
+
+       public EditorState getState()
+       {
+               return state;
+       }
+
+       public void setState(EditorState state)
+       {
+               this.state.onExit();
+               this.state = state;
+               state.onEntry();
+       }
+
+       public void add()
+       {
+               state.add();
+       }
+
+       public void delete()
+       {
+               state.delete();
+       }
+
+       public void copy()
+       {
+               state.copy();
+       }
+
+       public void paste()
+       {
+               state.paste();
+       }
+
+       public void duplicate()
+       {
+               state.duplicate();
+       }
+
+       public void grab()
+       {
+               state.grab();
+       }
+
+       public void mouseMoved(double x, double y)
+       {
+               state.mouseMoved(x, y);
+       }
+
+       public void select(Point pos, boolean additive)
+       {
+               state.select(pos, additive);
+       }
+
+       public boolean clickedHandle(HandleClickInfo handleClickInfo)
+       {
+               return state.clickedHandle(handleClickInfo);
+       }
+
+       public void boxSelect()
+       {
+               state.boxSelect();
+       }
+}