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

OgreMouseEvent.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 This source file is part of OGRE
00004     (Object-oriented Graphics Rendering Engine)
00005 For the latest info, see http://ogre.sourceforge.net/
00006 
00007 Copyright © 2000-2002 The OGRE Team
00008 Also see acknowledgements in Readme.html
00009 
00010 This program is free software; you can redistribute it and/or modify it under
00011 the terms of the GNU Lesser General  License as published by the Free Software
00012 Foundation; either version 2 of the License, or (at your option) any later
00013 version.
00014 
00015 This program is distributed in the hope that it will be useful, but WITHOUT
00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General  License for more details.
00018 
00019 You should have received a copy of the GNU Lesser General  License along with
00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
00022 http://www.gnu.org/copyleft/lesser.txt.
00023 -----------------------------------------------------------------------------
00024 */
00025 /***************************************************************************
00026 OgreMouseEvent.h  -  
00027  * An event which indicates that a mouse action occurred in a MouseTarget (e.g. MouseTarget).
00028  * This event is used both for mouse events (click, enter, exit) and mouse 
00029  * motion events (moves and drags). 
00030  * <P>
00031  * This low-level event is generated by a MouseTarget object for:
00032  * <ul>
00033  * <li>Mouse Events
00034  *     <ul>
00035  *     <li>a mouse button is pressed
00036  *     <li>a mouse button is released
00037  *     <li>a mouse button is clicked (pressed and released)
00038  *     <li>the mouse cursor enters a MouseTarget
00039  *     <li>the mouse cursor exits a MouseTarget
00040  *     </ul>
00041  * <li> Mouse Motion Events
00042  *     <ul>
00043  *     <li>the mouse is moved
00044  *     <li>the mouse is dragged
00045  *     </ul>
00046  * </ul>
00047  * <P>
00048  * A MouseEvent object is passed to every MouseListener
00049  * object which registered to receive 
00050  * the "interesting" mouse events using MouseTarget's 
00051  * <code>addMouseListener</code> method.
00052  *
00053  * A MouseEvent object is also passed to every MouseMotionListener
00054  * object which registered to receive 
00055  * mouse motion events using the MouseTarget's addMouseMotionListener
00056  * method
00057  *
00058  * When a mouse button is clicked, events are generated and sent to the
00059  * registered MouseListeners, with the button mask set in the modifier field.
00060  * For example, if the first mouse button is pressed, events are sent in the
00061  * following order:
00062  * <PRE>
00063  *    MOUSE_PRESSED:  BUTTON1_MASK
00064  *    MOUSE_RELEASED: BUTTON1_MASK
00065  *    MOUSE_CLICKED:  BUTTON1_MASK
00066  * </PRE>
00067  * When multiple mouse buttons are pressed, each press, release, and click
00068  * results in a separate event. The button mask in the modifier field reflects
00069  * only the button that changed state, not the current state of all buttons.
00070  * <P> 
00071  * For example, if the user presses button 1 followed by button 2 and
00072  * releases them in the same order, the following sequence of events is
00073  * generated:
00074  * <PRE>
00075  *    MOUSE_PRESSED:  BUTTON1_MASK
00076  *    MOUSE_PRESSED:  BUTTON2_MASK
00077  *    MOUSE_RELEASED: BUTTON1_MASK
00078  *    MOUSE_CLICKED:  BUTTON1_MASK
00079  *    MOUSE_RELEASED: BUTTON2_MASK
00080  *    MOUSE_CLICKED:  BUTTON2_MASK
00081  * </PRE>
00082  * If button2 is released first, the MOUSE_RELEASED/MOUSE_CLICKED pair
00083  * for BUTTON2_MASK arrives first, followed by the pair for BUTTON1_MASK.
00084  *
00085 -------------------
00086 begin                : Dec 03 2002
00087 copyright            : (C) 2002 by Kenny Sabir
00088 email                : kenny@sparksuit.com
00089 ***************************************************************************/
00090 #ifndef __MouseEvent_H__
00091 #define __MouseEvent_H__
00092 
00093 #include "OgrePrerequisites.h"
00094 #include "OgreInputEvent.h"
00095 #include "OgreMouseTarget.h"
00096 
00097 namespace Ogre {
00098 
00159     class _OgreExport MouseEvent : public InputEvent
00160     {
00161     protected:
00167         Real mX;
00173         Real mY;
00174 
00180         Real mZ;
00181 
00186         int mButtonID;
00190         int mClickCount;
00191 
00192 
00193 
00194 
00195     public:
00196 
00197         enum
00198         {
00199             ME_FIRST_EVENT = 500,
00200             ME_LAST_EVENT = 506
00201         };
00202 
00203         enum 
00204         {
00205             ME_MOUSE_CLICKED    = ME_FIRST_EVENT,
00206             ME_MOUSE_PRESSED,
00207             ME_MOUSE_RELEASED,
00208             ME_MOUSE_MOVED,
00209             ME_MOUSE_ENTERED,
00210             ME_MOUSE_EXITED,
00211             ME_MOUSE_DRAGGED
00212         };
00213 
00227         MouseEvent(PositionTarget* source, int id, int whichButton, Real when, int modifiers,
00228             Real x, Real y, Real z, int clickCount);
00234          int getClickCount();
00235 
00243          Real getX();
00244 
00252          Real getY();
00253 
00261          Real getZ();
00262 
00269          String paramString();
00270 
00278          void translatePoint(Real x, Real y);
00279 
00281          int getButtonID();
00282     };
00283 
00284 
00285 }
00286 
00287 
00288 #endif 
00289 

Copyright © 2002 by The OGRE Team