1Gtk2::BindingSet(3)   User Contributed Perl Documentation  Gtk2::BindingSet(3)
2
3
4

NAME

6       Gtk2::BindingSet - wrapper for GtkBindingSet
7

DESCRIPTION

9       A "Gtk2::BindingSet" is basically a mapping from keyval+modifiers to a
10       named action signal to invoke and with argument values for the signal.
11       Bindings are normally run by the "Gtk2::Widget" default
12       "key-press-event" handler, but can also be activated explicitly.
13
14       Binding sets can be populated from program code with
15       "entry_add_signal", or created from an RC file or string (see
16       Gtk2::Rc).  If you use the RC note it doesn't parse and create anything
17       until there's someone interested in the result, such as
18       "Gtk2::Settings" for widgets.  This means binding sets in RC files or
19       strings don't exist for "Gtk2::BindingSet->find" to retrieve until at
20       least one widget has been created (or similar).
21
22       Currently there's no Perl-level access to the contents of a BindingSet,
23       except for "set_name".
24

HIERARCHY

26         Glib::Boxed
27         +----Gtk2::BindingSet
28

METHODS

30   GtkBindingSet = Gtk2::BindingSet->new ($set_name)
31       •   $set_name (string)
32
33   boolean = $binding_set->activate ($keyval, $modifiers, $object)
34       •   $keyval (integer)
35
36       •   $modifiers (Gtk2::Gdk::ModifierType)
37
38       •   $object (Gtk2::Object)
39
40   $binding_set->add_path ($path_type, $path_pattern, $priority)
41       •   $path_type (Gtk2::PathType)
42
43       •   $path_pattern (string)
44
45       •   $priority (integer)
46
47       The following constants are defined for standard priority levels,
48
49           Gtk2::GTK_PATH_PRIO_LOWEST
50           Gtk2::GTK_PATH_PRIO_GTK
51           Gtk2::GTK_PATH_PRIO_APPLICATION
52           Gtk2::GTK_PATH_PRIO_THEME
53           Gtk2::GTK_PATH_PRIO_RC
54           Gtk2::GTK_PATH_PRIO_HIGHEST
55
56       LOWEST, which is 0, and HIGHEST, which is 15, are the limits of the
57       allowed priorities.  The standard values are from the
58       "Gtk2::PathPriorityType" enum, but the parameter here is an integer,
59       not an enum string, so you can give a value for instance a little above
60       or below the pre-defined levels.
61
62   bindingset or undef = Gtk2::BindingSet->by_class ($name)
63       •   $name (string)
64
65   $binding_set->entry_add_signal ($keyval, $modifiers, $signal_name)
66   $binding_set->entry_add_signal ($keyval, $modifiers, $signal_name,
67       $type,$value, ...)
68       •   $keyval (integer)
69
70       •   $modifiers (Gtk2::Gdk::ModifierType)
71
72       •   $signal_name (string)
73
74       •   $value (scalar)
75
76       •   $type (string)
77
78       Add an entry to $binding_set.  $keyval and $modifier are setup as a
79       binding for $signal_name and with signal parameters given by $value
80       arguments.  Each value is preceded by a type (a string), which must be
81       one of
82
83           Glib::Long
84           Glib::Double
85           Glib::String
86           an enum type, ie. subtype of Glib::Enum
87           Glib::Flags, or a flags subtype
88
89       For example,
90
91           $binding_set->entry_add_signal
92               (Gtk2->keyval_from_name('Return'),
93                [ 'control-mask' ],   # modifiers
94                'some-signal-name',
95                'Glib::Double', 1.5,
96                'Glib::String,  'hello');
97
98       A parameter holds one of the three types Long, Double or String.  When
99       invoked they're coerced to the parameter types expected by the target
100       object or widget.  Use Glib::Long for any integer argument, including
101       chars and unichars by ordinal value.  Use Glib::Double for both single
102       and double precision floats.
103
104       Flags and enums are held as Longs in the BindingSet.  You can pass an
105       enum type and string and "entry_with_signal" will lookup and store
106       accordingly.  For example
107
108           $binding_set->entry_add_signal
109               (Gtk2->keyval_from_name('Escape), [],
110                'set-direction',
111                'Gtk2::Orientation', 'vertical');
112
113       Likewise flags from an arrayref,
114
115           $binding_set->entry_add_signal
116               (Gtk2->keyval_from_name('d'), [],
117                'initiate-drag',
118                'Gtk2::Gdk::DragAction', ['move,'ask']);
119
120       If you've got a Glib::Flags object, rather than just an arrayref, then
121       you can just give Glib::Flags as the type and the value is taken from
122       the object.  For example,
123
124           my $flags = Gtk2::DebugFlag->new (['tree', 'updates']);
125           $binding_set->entry_add_signal
126               (Gtk2->keyval_from_name('x'), ['control-mask'],
127                'change-debug',
128                'Glib::Flags', $flags);
129
130   $binding_set->entry_remove ($keyval, $modifiers)
131       •   $keyval (integer)
132
133       •   $modifiers (Gtk2::Gdk::ModifierType)
134
135   $binding_set->entry_skip ($keyval, $modifiers)
136       •   $keyval (integer)
137
138       •   $modifiers (Gtk2::Gdk::ModifierType)
139
140       Since: gtk+ 2.12
141
142   bindingset or undef = Gtk2::BindingSet->find ($name)
143       •   $name (string)
144
145   string = $binding_set->set_name
146       Return the name of $binding_set.
147

ENUMS AND FLAGS

149   flags Gtk2::Gdk::ModifierType
150       •   'shift-mask' / 'GDK_SHIFT_MASK'
151
152       •   'lock-mask' / 'GDK_LOCK_MASK'
153
154       •   'control-mask' / 'GDK_CONTROL_MASK'
155
156       •   'mod1-mask' / 'GDK_MOD1_MASK'
157
158       •   'mod2-mask' / 'GDK_MOD2_MASK'
159
160       •   'mod3-mask' / 'GDK_MOD3_MASK'
161
162       •   'mod4-mask' / 'GDK_MOD4_MASK'
163
164       •   'mod5-mask' / 'GDK_MOD5_MASK'
165
166       •   'button1-mask' / 'GDK_BUTTON1_MASK'
167
168       •   'button2-mask' / 'GDK_BUTTON2_MASK'
169
170       •   'button3-mask' / 'GDK_BUTTON3_MASK'
171
172       •   'button4-mask' / 'GDK_BUTTON4_MASK'
173
174       •   'button5-mask' / 'GDK_BUTTON5_MASK'
175
176       •   'super-mask' / 'GDK_SUPER_MASK'
177
178       •   'hyper-mask' / 'GDK_HYPER_MASK'
179
180       •   'meta-mask' / 'GDK_META_MASK'
181
182       •   'release-mask' / 'GDK_RELEASE_MASK'
183
184       •   'modifier-mask' / 'GDK_MODIFIER_MASK'
185
186   enum Gtk2::PathType
187       •   'widget' / 'GTK_PATH_WIDGET'
188
189       •   'widget-class' / 'GTK_PATH_WIDGET_CLASS'
190
191       •   'class' / 'GTK_PATH_CLASS'
192

SEE ALSO

194       Gtk2, Glib::Boxed
195
197       Copyright (C) 2003-2011 by the gtk2-perl team.
198
199       This software is licensed under the LGPL.  See Gtk2 for a full notice.
200
201
202
203perl v5.36.0                      2023-01-20               Gtk2::BindingSet(3)
Impressum