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

OgreInputEvent.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://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 /***************************************************************************
00027 OgreInputEvent.h  -  
00028      * The root event class for all GuiElement-level input events.
00029      *
00030      * Input events are delivered to listeners before they are
00031      * processed normally by the source where they originated.
00032      * This allows listeners and GuiElement subclasses to "consume"
00033      * the event so that the source will not process them in their
00034      * default manner.  For example, consuming mousePressed events
00035      * on a Button GuiElement will prevent the Button from being
00036      * activated.
00037 -------------------
00038 begin                : Nov 19 2002
00039 copyright            : (C) 2002 by Kenny Sabir
00040 email                : kenny@sparksuit.com
00041 ***************************************************************************/
00042 
00043 #ifndef __InputEvent_H__
00044 #define __InputEvent_H__
00045 
00046 #include "OgrePrerequisites.h"
00047 
00048 namespace Ogre {
00049 
00060     class _OgreExport InputEvent
00061     {
00062     protected:
00063 
00067         Real mWhen;
00072         int mModifiers;
00073 
00078         EventTarget* mSource;
00079 
00083         int mId;
00084 
00088         bool mConsumed;
00089 
00090     public:
00091     
00092         
00093         enum        // using the enum hack cause VC6 doesn't support static const in classes
00094         {
00099             SHIFT_MASK      = 1 << 0,
00100             
00105             CTRL_MASK       = 1 << 1,
00106             
00113              META_MASK      = 1 << 2,
00119             ALT_MASK            = 1 << 3,
00120             BUTTON0_MASK        = 1 << 4,
00121             BUTTON1_MASK        = 1 << 5,
00122             BUTTON2_MASK        = 1 << 6,
00123             BUTTON3_MASK        = 1 << 7,
00124             BUTTON_ANY_MASK     = 0xF << 4
00125         };
00126 
00127 
00128 
00137         InputEvent(EventTarget* source, int id, long when, int modifiers);
00138 
00143         void consume();
00144 
00148         int getModifiers() const;
00149         
00153         Real getWhen() const;
00154 
00158         bool isAltDown() const;
00159 
00164         bool isConsumed() const;
00165 
00169         bool isControlDown() const;
00170 
00174         bool isMetaDown() const;
00175 
00179         bool isShiftDown() const;
00180 
00181         bool isEventBetween(int start, int end) const;
00182         int getID() const;
00183 
00184         EventTarget* getSource() const;
00185     };
00186 }
00187 
00188 
00189 #endif  // __InputEvent_H__
00190 

Copyright © 2000-2005 by The OGRE Team
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Mar 12 14:37:43 2006