1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389
|
<?xml version="1.0" standalone="no"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<refentry id="class-gtkaccellabel">
<refnamediv>
<refname>gtk.AccelLabel</refname>
<refpurpose>a label which displays accelerator info to the right of the text</refpurpose>
</refnamediv>
<refsect1>
<title>Synopsis</title>
<classsynopsis language="python">
<ooclass><classname>gtk.AccelLabel</classname></ooclass>
<ooclass><classname><link
linkend="class-gtklabel">gtk.Label</link></classname></ooclass>
<constructorsynopsis language="python">
<methodname><link linkend="constructor-gtkaccellabel">gtk.AccelLabel</link></methodname>
<methodparam><parameter
role="keyword">string</parameter></methodparam>
</constructorsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gtkaccellabel--accelerator-width">accelerator_width</link></methodname>
<methodparam></methodparam> </methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gtkaccellabel--get-accel-widget">get_accel_widget</link></methodname>
<methodparam></methodparam> </methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gtkaccellabel--get-accel-width">get_accel_width</link></methodname>
<methodparam></methodparam> </methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gtkaccellabel--set-accel-widget">set_accel_widget</link></methodname>
<methodparam><parameter
role="keyword">accel_widget</parameter></methodparam>
</methodsynopsis>
<!-- NOT IMPLEMENTED
<methodsynopsis language="python">
<methodname><link linkend="method-gtkaccellabel- -set-accel-closure">set_accel_closure</link></methodname>
<methodparam><parameter>accel_closure</parameter></methodparam>
</methodsynopsis>
END NOT IMPLEMENTED -->
<methodsynopsis language="python">
<methodname><link
linkend="method-gtkaccellabel--refetch">refetch</link></methodname>
<methodparam></methodparam>
</methodsynopsis>
</classsynopsis>
</refsect1>
<refsect1>
<title>Ancestry</title>
<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
+-- <link linkend="class-gtkobject">gtk.Object</link>
+-- <link linkend="class-gtkwidget">gtk.Widget</link>
+-- <link linkend="class-gtkmisc">gtk.Misc</link>
+-- <link linkend="class-gtklabel">gtk.Label</link>
+-- <link linkend="class-gtkaccellabel">gtk.AccelLabel</link>
</synopsis>
</refsect1>
<refsect1>
<title>Implemented Interfaces</title>
<para>
<link linkend="class-gtkaccellabel"><classname>gtk.AccelLabel</classname></link>
implements
<link linkend="class-gtkbuildable"><classname>gtk.Buildable</classname></link>
</para>
</refsect1>
<refsect1 id="properties-gtkaccellabel">
<title>gtk.AccelLabel Properties</title>
<para><link linkend="properties-gtkobject">gtk.Object Properties</link></para>
<para><link linkend="properties-gtkwidget">gtk.Widget Properties</link></para>
<para><link linkend="properties-gtkmisc">gtk.Misc Properties</link></para>
<para><link linkend="properties-gtklabel">gtk.Label Properties</link></para>
<blockquote role="properties">
<informaltable pgwide="1" frame="none">
<tgroup cols="3">
<colspec column="1" colwidth="1in"/>
<colspec column="2" colwidth="1in"/>
<colspec column="3" colwidth="4in"/>
<tbody>
<row valign="top">
<entry>"accel-closure"</entry>
<entry>Read-Write</entry>
<entry>The closure to be monitored for accelerator
changes</entry>
</row>
<row valign="top">
<entry>"accel-widget"</entry>
<entry>Read-Write</entry>
<entry>The widget associated with the accelerator
label</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</blockquote>
</refsect1>
<refsect1 id="style-properties-gtkaccellabel">
<title>gtk.AccelLabel Style Properties</title>
<para><link linkend="style-properties-gtkwidget">gtk.Widget Style Properties</link></para>
</refsect1>
<refsect1 id="signal-prototypes-gtkaccellabel">
<title>gtk.AccelLabel Signal Prototypes</title>
<para><link linkend="signal-prototypes-gobject">gobject.GObject Signal Prototypes</link></para>
<para><link linkend="signal-prototypes-gtkobject">gtk.Object Signal Prototypes</link></para>
<para><link linkend="signal-prototypes-gtkwidget">gtk.Widget Signal Prototypes</link></para>
<para><link linkend="signal-prototypes-gtklabel">gtk.Label Signal Prototypes</link></para>
</refsect1>
<refsect1>
<title>Description</title>
<para>The <link
linkend="class-gtkaccellabel"><classname>gtk.AccelLabel</classname></link>
widget is a subclass of <link
linkend="class-gtklabel"><classname>gtk.Label</classname></link> that
displays an accelerator string to the right of the label text, e.g.
<keycombo
action="simul"><keycap>Ctrl</keycap><keycap>S</keycap>
</keycombo>. It is commonly used in menus to show the keyboard
shortcuts for commands. The accelerator string to display is not set
explicitly; instead, the <link
linkend="class-gtkaccellabel"><classname>gtk.AccelLabel</classname></link>
displays the accelerators which have been added to the associated widget. A
widget is associated with the accelerator label by calling <link
linkend="method-gtkaccellabel--set-accel-widget"><methodname>set_accel_widget</methodname>()</link>.</para>
<para>For example, a <link
linkend="class-gtkmenuitem"><classname>gtk.MenuItem</classname></link>
widget may have an accelerator added to emit the "activate" signal when the
<keycombo
action="simul"><keycap>Ctrl</keycap><keycap>S</keycap>
</keycombo> key combination is pressed. A <link
linkend="class-gtkaccellabel"><classname>gtk.AccelLabel</classname></link>
is created and added to the <link
linkend="class-gtkmenuitem"><classname>gtk.MenuItem</classname></link>, and
<link
linkend="method-gtkaccellabel--set-accel-widget"><methodname>set_accel_widget</methodname>()</link> is called with the <link
linkend="class-gtkmenuitem"><classname>gtk.MenuItem</classname></link> as
the first argument. The <link
linkend="class-gtkaccellabel"><classname>gtk.AccelLabel</classname></link>
will now display <keycombo
action="simul"><keycap>Ctrl</keycap><keycap>S</keycap>
</keycombo> after its label.</para>
<para>Creating a <link
linkend="class-gtkmenuitem"><classname>gtk.MenuItem</classname></link> with
the <link
linkend="constructor-gtkmenuitem"><function>gtk.MenuItem</function>()</link>
function (or one of the similar functions <link
linkend="constructor-gtkcheckmenuitem"><function>gtk.CheckMenuItem</function>()</link>
and <link
linkend="constructor-gtkradiomenuitem"><function>gtk.RadioMenuItem</function>()</link>)
and specifying a label, automatically adds a <link
linkend="class-gtkaccellabel"><classname>gtk.AccelLabel</classname></link>
to the <link
linkend="class-gtkmenuitem"><classname>gtk.MenuItem</classname></link> and
calls <link
linkend="method-gtkaccellabel--set-accel-widget"><methodname>set_accel_widget</methodname>()</link>
to set it up for you.</para>
<para>A <link
linkend="class-gtkaccellabel"><classname>gtk.AccelLabel</classname></link>
will only display accelerators which have
<literal>gtk.ACCEL_VISIBLE</literal> set. A <link
linkend="class-gtkaccellabel"><classname>gtk.AccelLabel</classname></link>
can display multiple accelerators and even signal names, though it is almost
always used to display just one accelerator.</para>
<para>The following code fragment creates a simple menu item with an
accelerator and enables the display of the accelerator key string in the
menu item label:</para>
<example>
<title>Creating a simple menu item with an accelerator key.</title>
<programlisting>
# Create an accelgroup and add it to the window
accel_group = gtk.AccelGroup()
window.add_accel_group(accel_group)
# Create the menu item
save_item = gtk.MenuItem("Save")
save_item.show()
menu.add(save_item)
# Now add the accelerator to the menu item. Note that since we created
# the menu item with a label the AccelLabel is automatically setup to
# display the accelerators.
save_item.add_accelerator("activate", accel_group, ord("S"),
gtk.gdk.CONTROL_MASK, gtk.ACCEL_VISIBLE)
</programlisting>
</example>
</refsect1>
<refsect1 id="constructor-gtkaccellabel">
<title>Constructor</title>
<programlisting><constructorsynopsis language="python">
<methodname>gtk.AccelLabel</methodname>
<methodparam><parameter
role="keyword">string</parameter></methodparam>
</constructorsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">string</parameter> :</term>
<listitem><simpara>the label string</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a new <classname>gtk.AccelLabel</classname>
object</simpara></listitem>
</varlistentry>
</variablelist>
<para><function>gtk.AccelLabel</function>() creates a new <link
linkend="class-gtkaccellabel"><classname>gtk.AccelLabel</classname></link>
object. The <parameter>string</parameter> parameter specifies the text to be
displayed by the label. The accelerator text is automatically added by the
associated widget.</para>
</refsect1>
<refsect1>
<title>Methods</title>
<refsect2 id="method-gtkaccellabel--accelerator-width">
<title>gtk.AccelLabel.accelerator_width</title>
<programlisting><methodsynopsis language="python">
<methodname>accelerator_width</methodname>
<methodparam></methodparam> </methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>the width in pixels needed</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>accelerator_width</methodname>() method returns
the width in pixels needed to display the accelerator(s). It is used by
menus to align all of the <link
linkend="class-gtkmenuitem"><classname>gtk.MenuItem</classname></link>
widgets, and isn't usually needed by applications.</para>
<note><para><methodname>accelerator_width</methodname>() is deprecated
- use the <link
linkend="method-gtkaccellabel--get-accel-width"><methodname>get_accel_width</methodname>()</link>
method instead.</para>
</note>
</refsect2>
<refsect2 id="method-gtkaccellabel--get-accel-widget">
<title>gtk.AccelLabel.get_accel_widget</title>
<programlisting><methodsynopsis language="python">
<methodname>get_accel_widget</methodname>
<methodparam></methodparam> </methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>the widget associated with the accelerator
label, or <literal>None</literal>.</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>get_accel_widget</methodname>() method retrieves
the widget associated with this accelerator label. See <link
linkend="method-gtkaccellabel--set-accel-widget"><function>gtk.AccelLabel.set_accel_widget()</function></link>.
</para>
</refsect2>
<refsect2 id="method-gtkaccellabel--get-accel-width">
<title>gtk.AccelLabel.get_accel_width</title>
<programlisting><methodsynopsis language="python">
<methodname>get_accel_width</methodname>
<methodparam></methodparam> </methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>the width in pixels needed</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>get_accel_width</methodname>() method returns
the width in pixels needed to display the accelerator(s). It is used by
menus to align all of the <link
linkend="class-gtkmenuitem"><classname>gtk.MenuItem</classname></link>
widgets, and isn't usually needed by applications.</para>
</refsect2>
<refsect2 id="method-gtkaccellabel--set-accel-widget">
<title>gtk.AccelLabel.set_accel_widget</title>
<programlisting><methodsynopsis language="python">
<methodname>set_accel_widget</methodname>
<methodparam><parameter
role="keyword">accel_widget</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter
role="keyword">accel_widget</parameter> :</term>
<listitem><simpara>the widget to be
associated.</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>set_accel_widget</methodname>() method
associates the accelerator label with the widget specified by
<parameter>accel_widget</parameter>.</para>
</refsect2>
<!-- NOT IMPLEMENTED
<refsect2 id="method-gtkaccellabel- -set-accel-closure">
<title>gtk.AccelLabel.set_accel_closure</title>
<programlisting><methodsynopsis language="python">
<methodname>set_accel_closure</methodname>
<methodparam><parameter role="keyword">accel_closure</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">accel_closure</parameter> :</term>
<listitem><simpara>the closure to monitor for accelerator changes.</simpara></listitem>
</varlistentry>
</variablelist>
<para>
Sets the closure to be monitored by this accelerator label. The closure
must be connected to an accelerator group; see <link linkend="method-gtkaccelgroup- -connect"><function>gtk.AccelGroup.connect()</function></link>.
</para> </refsect2>
END NOT IMPLEMENTED -->
<refsect2 id="method-gtkaccellabel--refetch">
<title>gtk.AccelLabel.refetch</title>
<programlisting><methodsynopsis language="python">
<methodname>refetch</methodname>
<methodparam></methodparam> </methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>False</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>refetch</methodname>() method recreates the
accelerator label string holding the accelerator information when the
accelerator is changed. The size of the string is also recalculated.</para>
<para>This method is not usually needed by applications since the
accelerator label string is automatically updated whenever accelerators are
added or removed from the associated widget.</para>
</refsect2>
</refsect1>
</refentry>
|