00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef HEADER_WORLDVIEW_COMPONENT_HXX
00021 #define HEADER_WORLDVIEW_COMPONENT_HXX
00022
00023 #include "input_context.hxx"
00024 #include "zoom_graphic_context.hxx"
00025 #include "gui_component.hxx"
00026
00027 class Particle;
00028 class WorldViewTool;
00029 class WorldViewInsertTool;
00030 class WorldViewSelectTool;
00031 class WorldViewZoomTool;
00032 class WorldViewColliderTool;
00033
00036 class WorldViewComponent : public GUIComponent
00037 {
00038 public:
00039 enum Mode { INSERT_MODE, SELECT_MODE, ZOOM_MODE, COLLIDER_MODE };
00040
00041 private:
00042 Mode mode;
00043
00044 ZoomGraphicContext gc;
00045
00046 bool scrolling;
00047
00048 float scroll_pos_x;
00049 float scroll_pos_y;
00050
00051 float x_offset;
00052 float y_offset;
00053
00056 WorldViewTool* current_tool;
00057 WorldViewSelectTool* select_tool;
00058 WorldViewInsertTool* insert_tool;
00059 WorldViewZoomTool* zoom_tool;
00060 WorldViewColliderTool* collider_tool;
00061
00062 static WorldViewComponent* instance_;
00063 public:
00064 void set_mode (Mode m);
00065 Mode get_mode () { return mode; }
00066
00067 WorldViewComponent ();
00068 ~WorldViewComponent ();
00069
00070 static inline WorldViewComponent* instance() { return instance_; }
00071
00072 WorldViewInsertTool* get_insert_tool() { return insert_tool; }
00073
00074 ZoomGraphicContext* get_gc () { return &gc; }
00075 void draw (GraphicContext* parent_gc);
00076
00077 void on_primary_button_press (int x, int y);
00078 void on_primary_button_release (int x, int y);
00079
00080 void on_secondary_button_press (int x, int y);
00081 void on_secondary_button_release (int x, int y);
00082
00083 void on_tertiary_button_press (int x, int y);
00084 void on_tertiary_button_release (int x, int y);
00085
00086 void on_mouse_move (int x, int y, int of_x, int of_y);
00087
00088 void on_duplicate_press (int x, int y);
00089 void on_delete_press (int x, int y);
00090 void on_fix_press (int x, int y);
00091
00092 void on_button_press (int button_id, int x, int y);
00093
00094 void wheel_up (int x, int y);
00095 void wheel_down (int x, int y);
00096
00097 void scroll_left ();
00098 void scroll_right ();
00099 void scroll_up ();
00100 void scroll_down ();
00101
00102 float get_zoom ();
00103
00105 bool is_at (int x, int y) { return true; }
00106 };
00107
00108 #endif
00109
00110