~ubuntu-branches/ubuntu/oneiric/cairo-dock/oneiric

« back to all changes in this revision

Viewing changes to src/cairo-dock-keybinder.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2010-08-09 23:26:12 UTC
  • mto: (18.1.1 cairo-dock) (19.1.1 cairo-dock)
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: james.westby@ubuntu.com-20100809232612-pocdxliaxjdetm37
Tags: upstream-2.2.0~0beta4
ImportĀ upstreamĀ versionĀ 2.2.0~0beta4

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
** cairo-dock-keybinder.h
3
 
** Login : <ctaf42@localhost.localdomain>
4
 
** Started on  Thu Jan 31 03:57:17 2008 Cedric GESTES
5
 
** $Id$
6
 
**
7
 
** Author(s)
8
 
**  - Cedric GESTES <ctaf42@gmail.com>
9
 
**  - Havoc Pennington
10
 
**  - Tim Janik
11
 
**
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.
17
 
**
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.
22
 
**
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
26
 
*
27
 
* imported from tomboy_key_binder.h
28
 
*/
29
 
 
30
 
 
31
 
#ifndef __CD_KEY_BINDER_H__
32
 
#define __CD_KEY_BINDER_H__
33
 
 
34
 
#include <glib/gtypes.h>
35
 
 
36
 
G_BEGIN_DECLS
37
 
 
38
 
/**
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 &lt;alt&gt;F1 or &lt;ctrl&gt;&lt;shift&gt;s.
41
 
42
 
* You bind an action to a shortcut with \ref cd_keybinder_bind, and unbind it with \ref cd_keybinder_unbind.
43
 
*/
44
 
 
45
 
/// Definition of a callback, called when a shortcut is pressed by the user.
46
 
typedef void (* CDBindkeyHandler) (const char *keystring, gpointer user_data);
47
 
 
48
 
void cd_keybinder_init (void);
49
 
void cd_keybinder_stop (void);
50
 
 
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.
56
 
*/
57
 
gboolean cd_keybinder_bind (const char           *keystring,
58
 
                            CDBindkeyHandler  handler,
59
 
                            gpointer              user_data);
60
 
 
61
 
/** Unbind a shortcut to an action.
62
 
 * @param keystring a shortcut.
63
 
 * @param handler the callback that was registered for this shortcut.
64
 
*/
65
 
void cd_keybinder_unbind   (const char           *keystring,
66
 
                            CDBindkeyHandler  handler);
67
 
 
68
 
gboolean cd_keybinder_is_modifier (guint keycode);
69
 
 
70
 
guint32 cd_keybinder_get_current_event_time (void);
71
 
 
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.
74
 
*/
75
 
gboolean cairo_dock_simulate_key_sequence (gchar *cKeyString);
76
 
 
77
 
G_END_DECLS
78
 
 
79
 
#endif /* __CD_KEY_BINDER_H__ */
80