source: OGRE/trunk/ogrenew/OgreMain/src/OgreMouseMotionTarget.cpp @ 692

Revision 692, 2.5 KB checked in by mattausch, 19 years ago (diff)

adding ogre 1.2 and dependencies

RevLine 
[692]1
2/*
3-----------------------------------------------------------------------------
4This source file is part of OGRE
5    (Object-oriented Graphics Rendering Engine)
6For the latest info, see http://www.ogre3d.org/
7
8Copyright (c) 2000-2005 The OGRE Team
9Also see acknowledgements in Readme.html
10
11This program is free software you can redistribute it and/or modify it under
12the terms of the GNU Lesser General Public License as published by the Free Software
13Foundation either version 2 of the License, or (at your option) any later
14version.
15
16This program is distributed in the hope that it will be useful, but WITHOUT
17ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS
18FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
19
20You should have received a copy of the GNU Lesser General Public License along with
21this program if not, write to the Free Software Foundation, Inc., 59 Temple
22Place - Suite 330, Boston, MA 02111-1307, USA, or go to
23http://www.gnu.org/copyleft/lesser.txt.
24-----------------------------------------------------------------------------
25*/
26#include "OgreStableHeaders.h"
27
28#include "OgreMouseMotionTarget.h"
29#include "OgreMouseEvent.h"
30#include "OgreEventListeners.h"
31
32
33namespace Ogre {
34
35    //-----------------------------------------------------------------------
36        void MouseMotionTarget::processMouseMotionEvent(MouseEvent* e)
37        {
38        // Remove all marked listeners
39        std::set<MouseMotionListener*>::iterator i;
40        for (i = mRemovedListeners.begin(); i != mRemovedListeners.end(); i++)
41        {
42            mMouseMotionListeners.erase(*i);
43        }
44        mRemovedListeners.clear();
45
46        // Tell all listeners
47        for (i= mMouseMotionListeners.begin(); i != mMouseMotionListeners.end(); i++)
48        {
49                    MouseMotionListener* listener = *i;
50                    if (listener != 0)
51                    {
52                            int id = e->getID();
53                            switch(id)
54                            {
55                            case MouseEvent::ME_MOUSE_MOVED:
56                                    listener->mouseMoved(e);
57                                    break;
58                            case MouseEvent::ME_MOUSE_DRAGGED:
59                                    listener->mouseDragged(e);
60                                    break;
61                            case MouseEvent::ME_MOUSE_DRAGMOVED:
62                                    listener->mouseDragMoved(e);
63                                    break;
64                            }
65            }
66                }
67        }
68
69        void MouseMotionTarget::addMouseMotionListener(MouseMotionListener* l)
70        {
71        mMouseMotionListeners.insert(l);
72        }
73
74        void MouseMotionTarget::removeMouseMotionListener(MouseMotionListener* l)
75        {
76        mRemovedListeners.insert(l);
77        }
78}
79
Note: See TracBrowser for help on using the repository browser.