1
(*********************************************************************************)
4
(* Copyright (C) 2005 Institut National de Recherche en Informatique et *)
5
(* en Automatique. All rights reserved. *)
7
(* This program is free software; you can redistribute it and/or modify *)
8
(* it under the terms of the GNU Library General Public License as *)
9
(* published by the Free Software Foundation; either version 2 of the *)
10
(* License, or any later version. *)
12
(* This program 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 *)
15
(* GNU Library General Public License for more details. *)
17
(* You should have received a copy of the GNU Library General Public *)
18
(* License along with this program; if not, write to the Free Software *)
19
(* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA *)
22
(* Contact: Maxence.Guesdon@inria.fr *)
24
(*********************************************************************************)
28
Once the lib is compiled and installed, you can use it by referencing
29
it with the [Okey] module. You must add [okey.cmo] or [okey.cmx]
30
on the commande line when you link.
33
type modifier = Gdk.Tags.modifier
35
(** Set the default modifier list. The first default value is [[]].*)
36
val set_default_modifiers : modifier list -> unit
38
(** Set the default modifier mask. The first default value is
39
[[`MOD2 ; `MOD3 ; `MOD4 ; `MOD5 ; `LOCK]].
40
The mask defines the modifiers not taken into account
41
when looking for the handler of a key press event.
43
val set_default_mask : modifier list -> unit
45
(** [add widget key callback] associates the [callback] function to the event
46
"key_press" with the given [key] for the given [widget].
48
@param remove when true, the previous handlers for the given key and modifier
50
@param cond this function is a guard: the [callback] function is not called
51
if the [cond] function returns [false].
52
The default [cond] function always returns [true].
54
@param mods the list of modifiers. If not given, the default modifiers
56
You can set the default modifiers with function {!Okey.set_default_modifiers}.
58
@param mask the list of modifiers which must not be taken
59
into account to trigger the given handler. [mods]
60
and [mask] must not have common modifiers. If not given, the default mask
62
You can set the default modifiers mask with function {!Okey.set_default_mask}.
65
< connect : < destroy : callback: (unit -> unit) -> GtkSignal.id; .. >;
66
event : GObj.event_ops; get_oid : int; .. > ->
67
?cond: (unit -> bool) ->
68
?mods: modifier list ->
69
?mask: modifier list ->
74
(** It calls {!Okey.add} for each given key.*)
76
< connect : < destroy : callback: (unit -> unit) -> GtkSignal.id; .. >;
77
event : GObj.event_ops; get_oid : int; .. > ->
78
?cond: (unit -> bool) ->
79
?mods: modifier list ->
80
?mask: modifier list ->
85
(** Like {!Okey.add} but the previous handlers for the
86
given modifiers and key are not kept.*)
88
< connect : < destroy : callback: (unit -> unit) -> GtkSignal.id; .. >;
89
event : GObj.event_ops; get_oid : int; .. > ->
90
?cond: (unit -> bool) ->
91
?mods: modifier list ->
92
?mask: modifier list ->
97
(** It calls {!Okey.set} for each given key.*)
99
< connect : < destroy : callback: (unit -> unit) -> GtkSignal.id; .. >;
100
event : GObj.event_ops; get_oid : int; .. > ->
101
?cond: (unit -> bool) ->
102
?mods: modifier list ->
103
?mask: modifier list ->
108
(** Remove the handlers associated to the given widget.
109
This is automatically done when a widget is destroyed but
110
you can do it yourself. *)
112
< connect : < destroy : callback: (unit -> unit) -> GtkSignal.id; .. >;
113
event : GObj.event_ops; get_oid : int; .. > ->