CrystalSpace

Public API Reference

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

csutil/inpnames.h

Go to the documentation of this file.
00001 /*
00002     Crystal Space input library
00003     Copyright (C) 2000 by Andrew Zabolotny <bit@eltech.ru>
00004     Copyright (C) 2002 by Mathew Sutcliffe <oktal@gmx.co.uk>
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 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     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public
00017     License along with this library; if not, write to the Free
00018     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019 */
00020 
00021 #ifndef __CS_UTIL_CSINPUTS_H__
00022 #define __CS_UTIL_CSINPUTS_H__
00023 
00028 #include "csextern.h"
00029 #include "iutil/evdefs.h"
00030 #include "iutil/event.h"
00031 #include "csstring.h"
00032 
00033 struct iEvent;
00034 
00035 // @@@ Document me
00036 class CS_CSUTIL_EXPORT csInputDefinition
00037 {
00038 protected:
00039   uint32 modifiersHonored;
00040   csKeyModifiers modifiers;
00041   int containedType;
00042   union
00043   {
00044     struct
00045     {
00046       utf32_char keyCode;
00047       bool codeIsCooked;
00048     } k;
00049     csEventMouseData m;
00050     csEventJoystickData j;
00051   };
00052 
00053   /* @@@ Not implemented, but probably useful.
00054   int CompareModifiers (const csKeyModifiers& m1, 
00055     const csKeyModifiers& m2, uint32 honorModifiers) const;*/
00056 
00057 public:
00058   csInputDefinition ();
00059   csInputDefinition (iEvent* event);
00060 
00061   void SetHonoredModifiers (uint32 honorModifiers = CSMASK_ALLSHIFTS);
00062   uint32 GetHonoredModifiers () const;
00063 
00064   bool Parse (const char* string, bool useCooked = true);
00065   csString GetDescription () const;
00066   bool FromEvent (iEvent* event, bool useCookedKey = true);
00067 
00068   uint32 ComputeHash () const;
00069   static uint32 ComputeEventHash (iEvent* event);
00070   int Compare (csInputDefinition const&) const;
00071   int Compare (iEvent*) const;
00072 };
00073 
00078 #define CSAXIS_X -1
00079 
00083 #define CSAXIS_Y -2
00084 
00091 CS_CSUTIL_EXPORT int csTypeOfInputDef (const char* str);
00092 
00107 CS_CSUTIL_EXPORT bool csParseKeyDef (const char* str, utf32_char* rawCode,
00108   utf32_char* cookedCode, csKeyModifiers* modifiers);
00109 
00121 CS_CSUTIL_EXPORT csString csGetKeyDesc (utf32_char code, 
00122                               const csKeyModifiers* modifiers,
00123                               bool distinguishModifiers = true);
00124 
00141 CS_CSUTIL_EXPORT bool csParseMouseDef(const char* str, int* x, int* y, 
00142                             int* button, csKeyModifiers* modifiers);
00143 
00159 CS_CSUTIL_EXPORT csString csGetMouseDesc (int x, int y, int button,
00160                               const csKeyModifiers* modifiers,
00161                               bool distinguishModifiers = true);
00162 
00178 CS_CSUTIL_EXPORT bool csParseJoystickDef(const char* str, int* x, int* y,
00179   int* button, csKeyModifiers* modifiers);
00180 
00196 CS_CSUTIL_EXPORT csString csGetJoystickDesc (int x, int y, int button,
00197                               const csKeyModifiers* modifiers,
00198                               bool distinguishModifiers = true);
00199 
00200 #endif // __CS_UTIL_CSINPUTS_H__

Generated for Crystal Space by doxygen 1.2.18