• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

  • tdecore
kkeyserver_x11.h
1 /*
2  Copyright (C) 2001 Ellis Whitehead <ellis@kde.org>
3 
4  Win32 port:
5  Copyright (C) 2004 Jaroslaw Staniek <js@iidea.pl>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
22 
23 #ifndef _KKEYSERVER_X11_H
24 #define _KKEYSERVER_X11_H
25 
26 #include "tdeshortcut.h"
27 #include "kkeynative.h"
28 
34 namespace KKeyServer
35 {
40  enum ExtraModFlag { MODE_SWITCH = 0x2000 };
41 
47  struct TDECORE_EXPORT Sym
48  {
49  public:
51  uint m_sym;
52 
54  Sym()
55  { m_sym = 0; }
60  Sym( uint sym )
61  { m_sym = sym; }
67  Sym( const TQString& s )
68  { init( s ); }
69 
76  bool initQt( int keyQt );
77 
84  bool init( const TQString &s );
85 
90  int qt() const;
91 
95  TQString toStringInternal() const;
96 
101  TQString toString() const;
102 
110  uint getModsRequired() const;
111 
115  uint getSymVariation() const;
116 
120  operator uint() const { return m_sym; }
121 
125  Sym& operator =( uint sym ) { m_sym = sym; return *this; }
126 
127  private:
128  TQString toString( bool bUserSpace ) const;
129 
130  static void capitalizeKeyname( TQString& );
131  };
132 
137  struct TDECORE_EXPORT Key
138  {
140  enum { CODE_FOR_QT = 256 };
141 
143  uint m_code;
144 
146  uint m_mod;
147 
149  uint m_sym;
150 
159  bool init( const KKey& key, bool bQt );
160 
168  bool isNative() const { return m_code != CODE_FOR_QT; }
169 
174  uint code() const { return m_code; }
175 
180  uint mod() const { return m_mod; }
181 
186  uint sym() const { return m_sym; }
187 
192  int keyCodeQt() const { return (int) m_sym; }
193 
198  void setKeycodeQt( int keyQt )
199  { m_code = CODE_FOR_QT; m_sym = keyQt; }
200 
205  Key& operator =( const KKeyNative& key );
206 
218  int compare( const Key& key ) const;
219 
224  bool operator ==( const Key& b ) const
225  { return compare( b ) == 0; }
226 
231  bool operator <( const Key& b ) const
232  { return compare( b ) < 0; }
233 
238  KKey key() const;
239  };
240 
244  struct TDECORE_EXPORT Variations
245  {
246  enum { MAX_VARIATIONS = 4 };
247 
248  Key m_rgkey[MAX_VARIATIONS];
249  uint m_nVariations;
250 
251  Variations() { m_nVariations = 0; }
252 
253  void init( const KKey&, bool bQt );
254 
255  uint count() const { return m_nVariations; }
256  const Key& key( uint i ) const { return m_rgkey[i]; }
257  };
258 
260  TDECORE_EXPORT bool initializeMods();
261 
267  TDECORE_EXPORT uint modX( KKey::ModFlag modFlag );
268 
275  TDECORE_EXPORT bool keyboardHasWinKey();
276 
282  TDECORE_EXPORT uint modXShift();
283 
289  TDECORE_EXPORT uint modXLock();
290 
296  TDECORE_EXPORT uint modXCtrl();
297 
303  TDECORE_EXPORT uint modXAlt();
304 
310  TDECORE_EXPORT uint modXNumLock();
311 
318  TDECORE_EXPORT uint modXWin();
319 
325  TDECORE_EXPORT uint modXScrollLock();
326 
333  TDECORE_EXPORT uint modXModeSwitch();
334 
346  TDECORE_EXPORT uint accelModMaskX();
347 
357  TDECORE_EXPORT bool keyQtToSym( int keyQt, uint& sym );
358 
367  TDECORE_EXPORT bool keyQtToMod( int keyQt, uint& mod );
368 
377  TDECORE_EXPORT bool symToKeyQt( uint sym, int& keyQt );
378 
389  TDECORE_EXPORT bool modToModQt( uint mod, int& modQt );
390 
400  TDECORE_EXPORT bool modToModX( uint mod, uint& modX );
401 
411  //wrapped for win32
412  TDECORE_EXPORT bool modXToModQt( uint modX, int& modQt );
413 
417  TDECORE_EXPORT int qtButtonStateToMod( TQt::ButtonState s );
418 
428  TDECORE_EXPORT bool modXToMod( uint modX, uint& mod );
429 
441  TDECORE_EXPORT bool codeXToSym( uchar codeX, uint modX, uint& symX );
442 
446  TDECORE_EXPORT TQString modToStringInternal( uint mod );
447 
454  TDECORE_EXPORT TQString modToStringUser( uint mod );
455 
462  TDECORE_EXPORT uint stringUserToMod( const TQString& mod );
463 
468  TDECORE_EXPORT bool stringToSymMod( const TQString&, uint& sym, uint& mod );
469 
474  TDECORE_EXPORT void keyQtToKeyX( uint keyCombQt, unsigned char *pKeyCodeX, uint *pKeySymX, uint *pKeyModX );
475 }
476 
477 #endif // !_KKEYSERVER_X11_H
KKeyNative
Representation of a key in the format native of the windowing system (eg.
Definition: kkeynative.h:38
KKey
A KKey object represents a single key with possible modifiers (Shift, Ctrl, Alt, Win).
Definition: tdeshortcut.h:41
KKey::ModFlag
ModFlag
Flags to represent the modifiers.
Definition: tdeshortcut.h:53
KKeyServer
A collection of functions for the conversion of key presses and their modifiers from the window syste...
Definition: kkeyserver_x11.h:35
KKeyServer::modXModeSwitch
uint modXModeSwitch()
Returns the X11 Mode_switch modifier mask/flag.
KKeyServer::modX
uint modX(KKey::ModFlag modFlag)
Returns the equivalent X modifier mask of the given modifier flag.
KKeyServer::ExtraModFlag
ExtraModFlag
Supplement enum KKey::ModFlag.
Definition: kkeyserver_x11.h:40
KKeyServer::qtButtonStateToMod
int qtButtonStateToMod(TQt::ButtonState s)
Converts the Qt-compatible button state to x11 modifier.
KKeyServer::modXShift
uint modXShift()
Returns the X11 Shift modifier mask/flag.
KKeyServer::modXNumLock
uint modXNumLock()
Returns the X11 NumLock modifier mask/flag.
KKeyServer::keyQtToSym
bool keyQtToSym(int keyQt, uint &sym)
Extracts the symbol from the given Qt key and converts it to a symbol.
KKeyServer::modXToModQt
bool modXToModQt(uint modX, int &modQt)
Converts the mask of ORed X11 modifiers to a mask of ORed Qt key code modifiers.
KKeyServer::symToKeyQt
bool symToKeyQt(uint sym, int &keyQt)
Converts the given symbol to a Qt key code.
KKeyServer::modXWin
uint modXWin()
Returns the X11 Win (Mod3) modifier mask/flag.
KKeyServer::modXLock
uint modXLock()
Returns the X11 Lock modifier mask/flag.
KKeyServer::stringUserToMod
uint stringUserToMod(const TQString &mod)
Converts the modifier given as user-readable string to KKey::ModFlag modifier, or 0.
KKeyServer::keyboardHasWinKey
bool keyboardHasWinKey()
Returns true if the current keyboard layout supports the Win key.
KKeyServer::modToModX
bool modToModX(uint mod, uint &modX)
Converts the mask of ORed KKey::ModFlag modifiers to a mask of ORed X11 modifiers.
KKeyServer::codeXToSym
bool codeXToSym(uchar codeX, uint modX, uint &symX)
Converts a X11 key code and a mask of ORed X11 modifiers into a X11 symbol.
KKeyServer::modToModQt
bool modToModQt(uint mod, int &modQt)
Converts the mask of ORed KKey::ModFlag modifiers to a mask of ORed Qt key code modifiers.
KKeyServer::modToStringUser
TQString modToStringUser(uint mod)
Converts the mask of ORed KKey::ModFlag modifiers to a user-readable string.
KKeyServer::modXToMod
bool modXToMod(uint modX, uint &mod)
Converts the mask of ORed X11 modifiers to a mask of ORed KKey::ModFlag modifiers.
KKeyServer::accelModMaskX
uint accelModMaskX()
Returns bitwise OR'ed mask containing Shift, Ctrl, Alt, and Win (if available).
KKeyServer::modXAlt
uint modXAlt()
Returns the X11 Alt (Mod1) modifier mask/flag.
KKeyServer::modXScrollLock
uint modXScrollLock()
Returns the X11 ScrollLock modifier mask/flag.
KKeyServer::keyQtToMod
bool keyQtToMod(int keyQt, uint &mod)
Extracts the modifiers from the given Qt key and converts them in a mask of ORed KKey::ModFlag modifi...
KKeyServer::initializeMods
bool initializeMods()
TODO: please document.
KKeyServer::modXCtrl
uint modXCtrl()
Returns the X11 Ctrl modifier mask/flag.
KKeyServer::Key
Represents a key press.
Definition: kkeyserver_x11.h:138
KKeyServer::Key::isNative
bool isNative() const
Checks whether the key code is a native code.
Definition: kkeyserver_x11.h:168
KKeyServer::Key::sym
uint sym() const
Returns the symbol of the key.
Definition: kkeyserver_x11.h:186
KKeyServer::Key::key
KKey key() const
Converts this Key to a KKey.
KKeyServer::Key::setKeycodeQt
void setKeycodeQt(int keyQt)
Sets the qt key code.
Definition: kkeyserver_x11.h:198
KKeyServer::Key::m_code
uint m_code
The code of the key.
Definition: kkeyserver_x11.h:143
KKeyServer::Key::m_sym
uint m_sym
The symbol of the key.
Definition: kkeyserver_x11.h:149
KKeyServer::Key::code
uint code() const
Returns the code of the key.
Definition: kkeyserver_x11.h:174
KKeyServer::Key::keyCodeQt
int keyCodeQt() const
Returns the qt key code.
Definition: kkeyserver_x11.h:192
KKeyServer::Key::mod
uint mod() const
Returns the modifiers of the key.
Definition: kkeyserver_x11.h:180
KKeyServer::Key::compare
int compare(const Key &key) const
Compares this key with the given Key object.
KKeyServer::Key::m_mod
uint m_mod
The modifiers of the key.
Definition: kkeyserver_x11.h:146
KKeyServer::Key::init
bool init(const KKey &key, bool bQt)
Initializes the key with a KKey.
KKeyServer::Sym
Represents a key symbol.
Definition: kkeyserver_x11.h:48
KKeyServer::Sym::getSymVariation
uint getSymVariation() const
TODO: please find out what this method does and document it.
KKeyServer::Sym::qt
int qt() const
Returns the qt key code of the symbol.
KKeyServer::Sym::Sym
Sym(uint sym)
Creates asymbol with the given value.
Definition: kkeyserver_x11.h:60
KKeyServer::Sym::m_sym
uint m_sym
the actual value of the symbol
Definition: kkeyserver_x11.h:51
KKeyServer::Sym::initQt
bool initQt(int keyQt)
Initializes the symbol with the given Qt key code.
KKeyServer::Sym::toString
TQString toString() const
Returns the string representation of the symbol.
KKeyServer::Sym::getModsRequired
uint getModsRequired() const
Returns the mods that are required for this symbol as ORed KKey::ModFlag's.
KKeyServer::Sym::init
bool init(const TQString &s)
Initializes the key with the given string description.
KKeyServer::Sym::Sym
Sym()
Creates a null symbol.
Definition: kkeyserver_x11.h:54
KKeyServer::Sym::Sym
Sym(const TQString &s)
Creates a symbol from the given string description.
Definition: kkeyserver_x11.h:67
KKeyServer::Variations
TODO: please document this class.
Definition: kkeyserver_x11.h:245

tdecore

Skip menu "tdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.9.1
This website is maintained by Timothy Pearson.