Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

worldview_component.hxx

Go to the documentation of this file.
00001 //  $Id: worldview_component.hxx,v 1.15 2003/01/08 02:25:30 grumbel Exp $
00002 // 
00003 //  Construo - A wire-frame construction game
00004 //  Copyright (C) 2002 Ingo Ruhnke <[email protected]>
00005 //
00006 //  This program is free software; you can redistribute it and/or
00007 //  modify it under the terms of the GNU General Public License
00008 //  as published by the Free Software Foundation; either version 2
00009 //  of the License, or (at your option) any later version.
00010 //
00011 //  This program is distributed in the hope that it will be useful,
00012 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //  GNU General Public License for more details.
00015 // 
00016 //  You should have received a copy of the GNU General Public License
00017 //  along with this program; if not, write to the Free Software
00018 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
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 /* EOF */

Generated on Thu Jul 24 10:24:31 2003 for Construo by doxygen1.3-rc3