uikeycombination.h

Go to the documentation of this file.
00001 /********************************************************************************/
00002 /*                                                                              */
00003 /*  Netrinjo-Engine - a library for game-development                            */
00004 /*  Copyright (C) 2005 by Tobias Nadler                                         */
00005 /*                                                                              */
00006 /*  This library is free software; you can redistribute it and/or               */
00007 /*  modify it under the terms of the GNU Lesser General Public                  */
00008 /*  License as published by the Free Software Foundation; either                */
00009 /*  version 2.1 of the License, or (at your option) any later version.          */
00010 /*                                                                              */
00011 /*  This library is distributed in the hope that it will be useful,             */
00012 /*  but WITHOUT ANY WARRANTY; without even the implied warranty of              */
00013 /*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU           */
00014 /*  Lesser General Public License for more details.                             */
00015 /*                                                                              */
00016 /*  You should have received a copy of the GNU Lesser General Public            */
00017 /*  License along with this library; if not, write to the Free Software         */
00018 /*  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   */
00019 /*                                                                              */
00020 /********************************************************************************/
00021 
00022 #ifndef UIKEYCOMBINATION_H
00023 #define UIKEYCOMBINATION_H
00024 
00025 #include <list>
00026 #include "SDL/SDL.h"
00027 
00028 #include "basicobject.h"
00029 #include "tinyxml.h"
00030 
00053 class DECLSPEC UiKeyCombination
00054 {
00055 public:
00056     DECLSPEC UiKeyCombination();
00057     virtual DECLSPEC ~UiKeyCombination();
00058 
00069     DECLSPEC void init( TiXmlElement *el );
00085     DECLSPEC void addCombination( SDLKey k, SDLMod m, BasicObject *aim_p, BasicObject::Callback p, BasicObject *aim_r = NULL, BasicObject::Callback r = NULL );
00093     DECLSPEC bool removeCombination( SDLKey k, SDLMod m );
00098     DECLSPEC void removeAll();
00107     DECLSPEC bool keyPressed( SDLKey k, SDLMod m );
00116     DECLSPEC bool keyReleased( SDLKey k, SDLMod m );
00117 
00121     static UiKeyCombination *the;
00129     static DECLSPEC UiKeyCombination *getThe();
00130 private:
00131     struct KeyComb
00132     {
00133         SDLMod mod;
00134         SDLKey key;
00135         BasicObject::FunctionData pressed, released;
00136     };
00137     std::list<KeyComb*> lKeyCombs;
00138     typedef std::list<KeyComb*>::iterator KeyCombIter;
00139 };
00140 
00141 #endif

Generated on Wed May 9 17:35:55 2007 for netrinjo by  doxygen 1.5.1