Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

Keymap.cpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004 Ivo Danihelka (ivo@danihelka.net)
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or
00007  * (at your option) any later version.
00008  */
00009 #include "Keymap.h"
00010 
00011 #include "Log.h"
00012 
00013 //-----------------------------------------------------------------
00014 void
00015 Keymap::registerKey(const KeyStroke &stroke, const KeyDesc &desc)
00016 {
00017     m_keys.insert(std::pair<KeyStroke,KeyDesc>(stroke, desc));
00018 }
00019 //-----------------------------------------------------------------
00020 /**
00021  * Return index of pressed key.
00022  * @return index or -1
00023  */
00024 int
00025 Keymap::indexPressed(const KeyStroke &stroke) const
00026 {
00027     int result = -1;
00028     t_keys::const_iterator it = m_keys.find(stroke);
00029     if (m_keys.end() != it) {
00030         result = it->second.getIndex();
00031     }
00032     return result;
00033 }
00034 

Generated on Wed Jun 1 09:54:31 2005 for Fish Fillets - Next Generation by  doxygen 1.4.2