00001 /* 00002 * Copyright (C) 2005,2007 Roland Philippsen <roland dot philippsen at gmx net> 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00017 * USA 00018 */ 00019 00020 00021 #ifndef GFX_MOUSEHANDLER_HPP 00022 #define GFX_MOUSEHANDLER_HPP 00023 00024 00025 #include <boost/shared_ptr.hpp> 00026 #include <stddef.h> 00027 00028 00029 namespace estar { 00030 class FacadeReadInterface; 00031 class FacadeWriteInterface; 00032 } 00033 00034 00035 namespace gfx { 00036 00037 00039 class Mousehandler 00040 { 00041 public: 00042 virtual ~Mousehandler() {} 00043 virtual void HandleClick(double x, double y) = 0; 00044 }; 00045 00046 00048 class FacadeReadMousehandler 00049 : public Mousehandler 00050 { 00051 public: 00052 typedef boost::shared_ptr<estar::FacadeReadInterface const> fread_ptr; 00053 00054 explicit 00055 FacadeReadMousehandler(fread_ptr facade_read); 00056 00058 virtual void HandleClick(double x, double y); 00059 virtual void DoHandleClick(size_t ix, size_t iy) = 0; 00060 00061 protected: 00062 fread_ptr m_facade_read; 00063 }; 00064 00065 00067 class FacadeMousehandler 00068 : public FacadeReadMousehandler 00069 { 00070 public: 00071 typedef boost::shared_ptr<estar::FacadeWriteInterface> fwrite_ptr; 00072 00073 FacadeMousehandler(fread_ptr facade_read, fwrite_ptr facade_write); 00074 00075 protected: 00076 fwrite_ptr m_facade_write; 00077 }; 00078 00079 00081 class ObstacleMousehandler 00082 : public FacadeMousehandler 00083 { 00084 public: 00085 ObstacleMousehandler(fread_ptr facade_read, fwrite_ptr facade_write); 00086 00087 virtual void DoHandleClick(size_t ix, size_t iy); 00088 }; 00089 00090 00092 class GoalMousehandler 00093 : public FacadeMousehandler 00094 { 00095 public: 00096 GoalMousehandler(fread_ptr facade_read, fwrite_ptr facade_write); 00097 00098 virtual void DoHandleClick(size_t ix, size_t iy); 00099 }; 00100 00101 } 00102 00103 #endif // GFX_MOUSEHANDLER_HPP