00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://www.ogre3d.org/ 00006 00007 Copyright (c) 2000-2005 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 00096 namespace Ogre { 00097 00158 class _OgreExport MouseEvent : public InputEvent 00159 { 00160 protected: 00166 Real mX; 00172 Real mY; 00173 00179 Real mZ; 00180 00181 00182 Real mRelX; 00183 Real mRelY; 00184 Real mRelZ; 00185 00190 int mButtonID; 00194 int mClickCount; 00195 00196 00197 00198 00199 public: 00200 00201 enum 00202 { 00203 ME_FIRST_EVENT = 500, 00204 ME_LAST_EVENT = 510 00205 }; 00206 00207 enum 00208 { 00209 ME_MOUSE_CLICKED = ME_FIRST_EVENT, 00210 ME_MOUSE_PRESSED, 00211 ME_MOUSE_RELEASED, 00212 ME_MOUSE_MOVED, 00213 ME_MOUSE_ENTERED, 00214 ME_MOUSE_EXITED, 00215 ME_MOUSE_DRAGGED, 00216 00217 ME_MOUSE_DRAGENTERED, 00218 ME_MOUSE_DRAGEXITED, 00219 ME_MOUSE_DRAGMOVED, 00220 ME_MOUSE_DRAGDROPPED 00221 }; 00222 00236 MouseEvent(PositionTarget* source, int id, int whichButton, Real when, int modifiers, 00237 Real x, Real y, Real z, int clickCount); 00238 00239 MouseEvent(PositionTarget* source, int id, int whichButton, Real when, int modifiers, 00240 Real x, Real y, Real z, Real relx, Real rely, Real relz, int clickCount); 00241 00247 int getClickCount(); 00248 00256 Real getX() const; 00257 00265 Real getY() const; 00266 00274 Real getZ() const; 00275 00277 Real getRelX() const {return mRelX;} 00278 00280 Real getRelY() const {return mRelY;} 00281 00283 Real getRelZ() const {return mRelZ;} 00284 00291 String paramString() const; 00292 00300 void translatePoint(Real x, Real y); 00301 00303 int getButtonID() const; 00304 }; 00305 00306 00307 } 00308 00309 00310 #endif 00311
Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Mar 12 14:37:44 2006