Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

# OgreMouseMotionTarget.cpp

Go to the documentation of this file.

    00001
    00002 /*
    00003 -----------------------------------------------------------------------------
    00004 This source file is part of OGRE
    00005     (Object-oriented Graphics Rendering Engine)
    00006 For the latest info, see http://www.ogre3d.org/
    00007
    00008 Copyright © 2000-2002 The OGRE Team
    00009 Also see acknowledgements in Readme.html
    00010
    00011 This program is free software you can redistribute it and/or modify it under
    00012 the terms of the GNU Lesser General Public License as published by the Free Software
    00013 Foundation either version 2 of the License, or (at your option) any later
    00014 version.
    00015
    00016 This program is distributed in the hope that it will be useful, but WITHOUT
    00017 ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS
    00018 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
    00019
    00020 You should have received a copy of the GNU Lesser General Public License along with
    00021 this program if not, write to the Free Software Foundation, Inc., 59 Temple
    00022 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
    00023 http://www.gnu.org/copyleft/lesser.txt.
    00024 -----------------------------------------------------------------------------
    00025 */
    00026 #include "OgreStableHeaders.h"
    00027
    00028 #include "OgreMouseMotionTarget.h"
    00029
    00030 #include "OgreMouseEvent.h"
    00031 #include "OgreEventListeners.h"
    00032 #include "OgreEventMulticaster.h"
    00033
    00034
    00035
    00036 namespace Ogre {
    00037
    00038     MouseMotionTarget::MouseMotionTarget()
    00039     {
    00040         mMouseMotionListener = 0;
    00041     }
    00042
    00043     //-----------------------------------------------------------------------
    00044
    00045     void MouseMotionTarget::processMouseMotionEvent(MouseEvent* e)
    00046     {
    00047         MouseMotionListener* listener = mMouseMotionListener;
    00048         if (listener != NULL)
    00049         {
    00050             int id = e->getID();
    00051             switch(id)
    00052             {
    00053             case MouseEvent::ME_MOUSE_MOVED:
    00054                 listener->mouseMoved(e);
    00055                 break;
    00056             case MouseEvent::ME_MOUSE_DRAGGED:
    00057                 listener->mouseDragged(e);
    00058                 break;
    00059             case MouseEvent::ME_MOUSE_DRAGMOVED:
    00060                 listener->mouseDragMoved(e);
    00061                 break;
    00062             }
    00063         }
    00064     }
    00065
    00066     void MouseMotionTarget::addMouseMotionListener(MouseMotionListener* l)
    00067     {
    00068         if (l == NULL)
    00069         {
    00070             return;
    00071         }
    00072         mMouseMotionListener = EventMulticaster::add(mMouseMotionListener,l);
    00073     }
    00074
    00075     void MouseMotionTarget::removeMouseMotionListener(MouseMotionListener* l)
    00076     {
    00077         if (l == NULL)
    00078         {
    00079             return;
    00080         }
    00081         mMouseMotionListener = EventMulticaster::remove(mMouseMotionListener,l);
    00082     }
    00083 }
    00084

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:48:35 2004