2
** cairo-dock-keybinder.h
3
** Login : <ctaf42@localhost.localdomain>
4
** Started on Thu Jan 31 03:57:17 2008 Cedric GESTES
8
** - Cedric GESTES <ctaf42@gmail.com>
12
** Copyright (C) 2008 Cedric GESTES
13
** This program is free software; you can redistribute it and/or modify
14
** it under the terms of the GNU General Public License as published by
15
** the Free Software Foundation; either version 3 of the License, or
16
** (at your option) any later version.
18
** This program is distributed in the hope that it will be useful,
19
** but WITHOUT ANY WARRANTY; without even the implied warranty of
20
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
** GNU General Public License for more details.
23
** You should have received a copy of the GNU General Public License
24
** along with this program; if not, write to the Free Software
25
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27
* imported from tomboy_key_binder.h
31
#ifndef __CD_KEY_BINDER_H__
32
#define __CD_KEY_BINDER_H__
34
#include <glib/gtypes.h>
39
*@file cairo-dock-keybinder.h This class contains functions to easily bind a keyboard shortcut to an action. These shortcuts are defined globally in your session, that is to say they will be effective whatever window has the focus.
40
* Shortcuts are of the form <alt>F1 or <ctrl><shift>s.
42
* You bind an action to a shortcut with \ref cd_keybinder_bind, and unbind it with \ref cd_keybinder_unbind.
45
/// Definition of a callback, called when a shortcut is pressed by the user.
46
typedef void (* CDBindkeyHandler) (const char *keystring, gpointer user_data);
48
void cd_keybinder_init (void);
49
void cd_keybinder_stop (void);
51
/** Bind a shortcut to an action. Unbind it when you don't want it anymore, or when 'user_data' is freed.
52
* @param keystring a shortcut.
53
* @param handler callback to register for this shortcut.
54
* @param user_data data passed to the callback.
55
* @return TRUE if success.
57
gboolean cd_keybinder_bind (const char *keystring,
58
CDBindkeyHandler handler,
61
/** Unbind a shortcut to an action.
62
* @param keystring a shortcut.
63
* @param handler the callback that was registered for this shortcut.
65
void cd_keybinder_unbind (const char *keystring,
66
CDBindkeyHandler handler);
68
gboolean cd_keybinder_is_modifier (guint keycode);
70
guint32 cd_keybinder_get_current_event_time (void);
72
/** Trigger the given shortcut. It will be as if the user effectively pressed the shortcut on its keyboard. It uses the 'XTest' X extension.
73
* @param cKeyString a shortcut.
75
gboolean cairo_dock_simulate_key_sequence (gchar *cKeyString);
79
#endif /* __CD_KEY_BINDER_H__ */