Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# keys.h

Go to the documentation of this file.

    00001 /*  Inti: Integrated Foundation Classes
    00002  *  Copyright (C) 2002-2003 The Inti Development Team.
    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  *  This program is distributed in the hope that it will be useful,
    00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00012  *  GNU Library General Public License for more details.
    00013  *
    00014  *  You should have received a copy of the GNU Library General Public License
    00015  *  along with this program; if not, write to the Free Software
    00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    00017  */
    00018
    00023
    00024 #ifndef INTI_GDK_KEYS_H
    00025 #define INTI_GDK_KEYS_H
    00026
    00027 #ifndef INTI_G_OBJECT_H
    00028 #include <inti/glib/object.h>
    00029 #endif
    00030
    00031 #ifndef INTI_GDK_TYPES_H
    00032 #include <inti/gdk/types.h>
    00033 #endif
    00034
    00035 #ifndef INTI_PANGO_TYPES_H
    00036 #include <inti/pango/types.h>
    00037 #endif
    00038
    00039 #ifndef _CPP_VECTOR
    00040 #include <vector>
    00041 #endif
    00042
    00043 namespace Inti {
    00044
    00045 namespace Gdk {
    00046
    00047 class Display;
    00048 class KeymapClass;
    00049 class Keyval;
    00050
    00055
    00056 class KeymapKey
    00057 {
    00058         GdkKeymapKey key_;
    00059
    00060 public:
    00063
    00064         KeymapKey();
    00066
    00067         KeymapKey(unsigned int keycode, int group, int level);
    00072
    00076
    00077         GdkKeymapKey* gdk_keymap_key() const { return const_cast<GdkKeymapKey*>(&key_); }
    00079
    00080         unsigned int keycode() const;
    00082
    00083         int group() const;
    00085
    00086         int level() const;
    00089
    00092
    00093         void set(unsigned int keycode, int group, int level);
    00107
    00109 };
    00110
    00160
    00161 class Keymap : public G::Object
    00162 {
    00163         friend class G::Object;
    00164         friend class KeymapClass;
    00165
    00166         Keymap(const Keymap&);
    00167         Keymap& operator=(const Keymap&);
    00168
    00169 protected:
    00172
    00173         explicit Keymap(GdkKeymap *keymap, bool reference = true);
    00180
    00184
    00185         virtual void on_direction_changed();
    00187
    00188         virtual void on_keys_changed();
    00190
    00192 //  Signals
    00193
    00194         typedef G::Signal0<void> DirectionChangedSignalType;
    00195         typedef G::SignalProxy<TypeInstance, DirectionChangedSignalType> DirectionChangedSignalProxy;
    00196         static const DirectionChangedSignalType direction_changed_signal;
    00197
    00198         typedef G::Signal0<void> KeysChangedSignalType;
    00199         typedef G::SignalProxy<TypeInstance, KeysChangedSignalType> KeysChangedSignalProxy;
    00200         static const KeysChangedSignalType keys_changed_signal;
    00201
    00202 public:
    00205
    00206         virtual ~Keymap();
    00208
    00210
    00211         static Keymap* get(const Display *display = 0);
    00215
    00218
    00219         GdkKeymap* gdk_keymap() const { return (GdkKeymap*)instance; }
    00221
    00222         GdkKeymapClass* gdk_keymap_class() const;
    00224
    00225         operator GdkKeymap* () const;
    00227
    00228         Pango::Direction get_direction() const;
    00230
    00234
    00235         Keyval lookup_key(const KeymapKey& key);
    00243
    00244         bool translate_keyboard_state
    00245         (
    00246                 unsigned int hardware_keycode,
    00247                 ModifierTypeField state,
    00248                 int group,
    00249                 Keyval& keyval,
    00250                 int *effective_group,
    00251                 int *level,
    00252                 ModifierTypeField *consumed_modifiers
    00253         );
    00271
    00272         bool get_entries_for_keyval(const Keyval& keyval, std::vector<KeymapKey>& keys);
    00286
    00287         bool get_entries_for_keycode(unsigned int hardware_keycode, std::vector<KeymapKey> *keys, std::vector<Keyval> *keyvals);
    00297
    00301
    00302         const DirectionChangedSignalProxy sig_direction_changed()
    00303         {
    00304                 return DirectionChangedSignalProxy(this, &direction_changed_signal);
    00305         }
    00307
    00308         const KeysChangedSignalProxy sig_keys_changed()
    00309         {
    00310                 return KeysChangedSignalProxy(this, &keys_changed_signal);
    00311         }
    00313
    00315 };
    00316
    00317 } // namespace Gdk
    00318
    00319 } // namespace Inti
    00320
    00321 #endif // INTI_GDK_KEYS_H
    00322

Main Page - Footer