1Gtk2::ActionGroup(3) User Contributed Perl Documentation Gtk2::ActionGroup(3)
2
3
4
6 Gtk2::ActionGroup - wrapper for GtkActionGroup
7
8 NOTE: Translation
9 In C, gtk+'s action groups can use the translation domain to ensure
10 that action labels and tooltips are translated along with the rest of
11 the app. However, the translation function was not available for
12 calling by the Perl bindings until gtk+ 2.6; that is, setting the
13 translation domain had no effect. Translation of action groups is
14 supported in Perl as of Gtk2 1.080 using gtk+ 2.6.0 or later.
15
17 Glib::Object
18 +----Gtk2::ActionGroup
19
21 Gtk2::Buildable
22
24 actiongroup = Gtk2::ActionGroup->new ($name)
25 · $name (string)
26
27 action = $action_group->get_action ($action_name)
28 · $action_name (string)
29
30 $action_group->add_action ($action)
31 · $action (Gtk2::Action)
32
33 $action_group->add_action_with_accel ($action, $accelerator)
34 · $action (Gtk2::Action)
35
36 · $accelerator (string or undef)
37
38 $action_group->add_actions ($action_entries, $user_data=undef)
39 · $action_entries (scalar)
40
41 · $user_data (scalar)
42
43 $action_group->add_radio_actions ($radio_action_entries, $value,
44 $on_change, $user_data=undef)
45 · $radio_action_entries (scalar)
46
47 · $value (integer)
48
49 · $on_change (scalar)
50
51 · $user_data (scalar)
52
53 Create and add a set of "Gtk2::RadioAction" actions to $action_group.
54 For example
55
56 $action_group->add_radio_actions
57 ([ [ "Red", undef, "_Red", "<Control>R", "Blood", 1 ],
58 [ "Green", undef, "_Green", "<Control>G", "Grass", 2 ],
59 [ "Blue", undef, "_Blue", "<Control>B", "Sky", 3 ],
60 ],
61 2, # initial, or -1 for no initial
62 sub {
63 my ($first_action, $selected_action, $userdata) = @_;
64 print "now: ", $selected_action->get_name, "\n";
65 },
66 $userdata);
67
68 "radio_action_entries" is an arrayref, each element of which is either
69 a ref to a 6-element array
70
71 [ $name, # string
72 $stock_id, # string, or undef
73 $label, # string, or undef to use stock label
74 $accelerator, # string key name, or undef for no accel
75 $tooltip, # string, or undef for no tooltip
76 $value # integer, for $action->set_current_value etc
77 ]
78
79 or a ref to a hash of named fields similarly. A "name" is mandatory,
80 the rest are optional. "value" defaults to 0 if absent or "undef".
81
82 { name => $name,
83 stock_id => $stock_id,
84 label => $label,
85 accelerator => $accelerator,
86 tooltip => $tooltip,
87 value => $value }
88
89 If $on_change is not "undef" then it's a signal handler function which
90 is connected to the "changed" signal on the first action created. See
91 Gtk2::RadioAction for that signal.
92
93 $action_group->add_toggle_actions ($toggle_action_entries,
94 $user_data=undef)
95 · $toggle_action_entries (scalar)
96
97 · $user_data (scalar)
98
99 list = $action_group->list_actions
100 string = $action_group->get_name
101 $action_group->remove_action ($action)
102 · $action (Gtk2::Action)
103
104 boolean = $action_group->get_sensitive
105 $action_group->set_sensitive ($sensitive)
106 · $sensitive (boolean)
107
108 $action_group->set_translate_func ($func, $data=undef)
109 · $func (scalar)
110
111 · $data (scalar)
112
113 Since: gtk+ 2.6
114
115 string = $action_group->translate_string ($string)
116 · $string (string)
117
118 Since: gtk+ 2.6
119
120 $action_group->set_translation_domain ($domain)
121 · $domain (string)
122
123 boolean = $action_group->get_visible
124 $action_group->set_visible ($sensitive)
125 · $sensitive (boolean)
126
128 'name' (string : default undef : readable / writable / construct-only /
129 private)
130 A name for the action group.
131
132 'sensitive' (boolean : default true : readable / writable / private)
133 Whether the action group is enabled.
134
135 'visible' (boolean : default true : readable / writable / private)
136 Whether the action group is visible.
137
139 connect-proxy (Gtk2::ActionGroup, Gtk2::Action, Gtk2::Widget)
140 disconnect-proxy (Gtk2::ActionGroup, Gtk2::Action, Gtk2::Widget)
141 post-activate (Gtk2::ActionGroup, Gtk2::Action)
142 pre-activate (Gtk2::ActionGroup, Gtk2::Action)
143
145 Gtk2, Glib::Object
146
148 Copyright (C) 2003-2011 by the gtk2-perl team.
149
150 This software is licensed under the LGPL. See Gtk2 for a full notice.
151
152
153
154perl v5.28.0 2018-07-18 Gtk2::ActionGroup(3)