864237719872e1a181c3778aa13941232a170cc3
[potlatch2.git] / net / systemeD / potlatch2 / controller / ControllerState.as
1 package net.systemeD.potlatch2.controller {
2         import flash.events.*;
3         import flash.display.*;
4     import net.systemeD.halcyon.Map;
5     import net.systemeD.halcyon.MapPaint;
6     import net.systemeD.halcyon.connection.*;
7     import net.systemeD.potlatch2.EditController;
8         import net.systemeD.halcyon.Globals;
9
10     public class ControllerState {
11
12         protected var controller:EditController;
13         protected var previousState:ControllerState;
14
15         public function ControllerState() {}
16  
17         public function setController(controller:EditController):void {
18             this.controller = controller;
19         }
20
21         public function setPreviousState(previousState:ControllerState):void {
22             if ( this.previousState == null )
23                 this.previousState = previousState;
24         }
25    
26         public function processMouseEvent(event:MouseEvent, entity:Entity):ControllerState {
27             return this;
28         }
29         
30         public function processKeyboardEvent(event:KeyboardEvent):ControllerState {
31             return this;
32         }
33
34                 public function get map():Map {
35                         return controller.map;
36                 }
37
38         public function enterState():void {}
39         public function exitState():void {}
40
41                 public function toString():String {
42                         return "(No state)";
43                 }
44                 
45                 protected function getMapPaint(d:DisplayObject):MapPaint {
46                         while (d) {
47                                 if (d is MapPaint) { return MapPaint(d); }
48                                 d=d.parent;
49                         }
50                         return null;
51                 }
52
53     }
54 }