~canonical-dx-team/ubuntu/maverick/gtk+2.0/menuproxy

« back to all changes in this revision

Viewing changes to docs/reference/gtk/tmpl/gtklabel.sgml

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-05-04 12:24:25 UTC
  • mfrom: (1.1.21 upstream)
  • Revision ID: james.westby@ubuntu.com-20070504122425-0m8midgzrp40y8w2
Tags: 2.10.12-1ubuntu1
* Sync with Debian
* New upstream version:
  Fixed bugs:
  - 379414 file chooser warnings when changing path in the entry
  - 418585 GtkFileChooserDefault sizing code is not DPI independent
  - 419568 Crash in search if start with special letter
  - 435062 build dies with icon cache validation
  - 379399 Segfault to call gtk_print_operation_run twice.
  - 387889 cups backend has problems when there are too many printers
  - 418531 invalid read to gtkicontheme.c gtk_icon_theme_lookup_icon...
  - 423916 crash in color scheme code
  - 424042 Segmentation fault while quickly pressing Alt+arrows
  - 415260 Protect against negative indices when setting values in G...
  - 419171 XGetVisualInfo() may not set nxvisuals
  - 128852 Gdk cursors don't look good on win32
  - 344657 Ctrl-H doesn't toggle "Show Hidden Files" setting
  - 345345 PrintOperation::paginate is not emitted for class handler
  - 347567 GtkPrintOperation::end-print is not emitted if it's cance...
  - 369112 gtk_ui_manager_add_ui should accept unnamed separator
  - 392015 Selected menu item invisible on Windows Vista
  - 399253 MS-Windows Theme Bottom Tab placement rendering glitches
  - 399425 gtk_input_dialog_fill_axes() adds child to gtkscrolledwin...
  - 403251 [patch] little memory leak in GtkPrintJob
  - 403267 [patch] memory leak in GtkPageSetupUnixDialog
  - 403470 MS-Windows Theme tab placement other than on top leaks a ...
  - 404506 Windows system fonts that have multi-byte font names cann...
  - 405089 Incorrect window placement for GtkEventBox private window
  - 405515 Minor leak in gtkfilesystemmodel.c
  - 405539 gdk_pixbuf_save() for PNG saver can return FALSE without ...
  - 415681 gdk_window_clear_area includes an extra line and column o...
  - 418219 GtkRecentChooser should apply filter before sorting and c...
  - 418403 Scroll to printer after selecting it from settings
  - 421985 _gtk_print_operation_platform_backend_launch_preview
  - 421990 gtk_print_job_get_surface
  - 421993 gtk_print_operation_init
  - 423064 Conditional jump or move depends on uninitialised value(s...
  - 423722 Fix printing header in gtk-demo
  - 424168 gtk_print_operation_run on async preview
  - 425655 Don't install gtk+-unix-print-2.0.pc on non-UNIX platforms
  - 425786 GDK segfaults if XineramaQueryScreens fails
  - 428665 Lpr Backend gets stuck in infinite loop during gtk_enumer...
  - 429902 GtkPrintOperation leaks cairo contextes
  - 431997 First delay of GdkPixbufAnimationIter is wrong
  - 433242 Inconsistent scroll arrow position calculations
  - 433972 Placing gtk.Expander inside a gtk.TextView() changes gtk....
  - 434261 _gtk_toolbar_elide_underscores incorrectly handles some s...
  - 383354 ctrl-L should make 'Location' entry disappear
  - 418673 gtk_recent_manager_add_item
  - 429732 gtk_accel_group_finalize accesses invalid memory
  - 435028 WM_CLIENT_LEADER is wrong on the leader_window
  - 431067 Background of the header window is not updated
  - 338843 add recent files support inside the ui manager
  - 148535 add drop shadow to menus, tooltips, etc. under Windows XP
* debian/control.in:
  - Conflicts on ubuntulooks (<= 0.9.11-1)
* debian/patches/15_default-fallback-icon-theme.patch:
  - patch from Debian, fallback on gnome icon theme

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!-- ##### SECTION Title ##### -->
 
2
GtkLabel
 
3
 
 
4
<!-- ##### SECTION Short_Description ##### -->
 
5
A widget that displays a small to medium amount of text
 
6
 
 
7
<!-- ##### SECTION Long_Description ##### -->
 
8
<para>
 
9
The #GtkLabel widget displays a small amount of text. As the name
 
10
implies, most labels are used to label another widget such as a
 
11
#GtkButton, a #GtkMenuItem, or a #GtkOptionMenu.
 
12
</para>
 
13
 
 
14
<refsect2>
 
15
<title>Mnemonics</title>
 
16
 
 
17
<para>
 
18
Labels may contain <firstterm>mnemonics</firstterm>. Mnemonics are
 
19
underlined characters in the label, used for keyboard navigation.
 
20
Mnemonics are created by providing a string with an underscore before
 
21
the mnemonic character, such as <literal>"_File"</literal>, to the
 
22
functions gtk_label_new_with_mnemonic() or
 
23
gtk_label_set_text_with_mnemonic().
 
24
</para>
 
25
 
 
26
<para>
 
27
Mnemonics automatically activate any activatable widget the label is
 
28
inside, such as a #GtkButton; if the label is not inside the
 
29
mnemonic's target widget, you have to tell the label about the target
 
30
using gtk_label_set_mnemonic_widget(). Here's a simple example where
 
31
the label is inside a button:
 
32
 
 
33
<informalexample>
 
34
<programlisting>
 
35
  /* Pressing Alt+H will activate this button */
 
36
  button = gtk_button_new (<!-- -->);
 
37
  label = gtk_label_new_with_mnemonic ("_Hello");
 
38
  gtk_container_add (GTK_CONTAINER (button), label);
 
39
</programlisting>
 
40
</informalexample>
 
41
There's a convenience function to create buttons with a mnemonic label 
 
42
already inside:
 
43
 
 
44
<informalexample>
 
45
<programlisting>
 
46
  /* Pressing Alt+H will activate this button */
 
47
  button = gtk_button_new_with_mnemonic ("_Hello");
 
48
</programlisting>
 
49
</informalexample>
 
50
 
 
51
To create a mnemonic for a widget alongside the label, such as a 
 
52
#GtkEntry, you have to point the label at the entry with 
 
53
gtk_label_set_mnemonic_widget():
 
54
<informalexample>
 
55
<programlisting>
 
56
  /* Pressing Alt+H will focus the entry */
 
57
  entry = gtk_entry_new (<!-- -->);
 
58
  label = gtk_label_new_with_mnemonic ("_Hello");
 
59
  gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
 
60
</programlisting>
 
61
</informalexample>
 
62
 
 
63
</para>
 
64
 
 
65
</refsect2>
 
66
 
 
67
<refsect2>
 
68
<title>Markup (styled text)</title>
 
69
 
 
70
<para>
 
71
To make it easy to format text in a label (changing colors, fonts,
 
72
etc.), label text can be provided in a simple <link
 
73
linkend="PangoMarkupFormat">markup format</link>.
 
74
Here's how to create a label with a small font:
 
75
<informalexample>
 
76
<programlisting>
 
77
  label = gtk_label_new (NULL);
 
78
  gtk_label_set_markup (GTK_LABEL (label), "&lt;small&gt;Small text&lt;/small&gt;");
 
79
</programlisting>
 
80
</informalexample>
 
81
(See <link
 
82
linkend="PangoMarkupFormat">complete documentation</link> of available
 
83
tags in the Pango manual.)
 
84
</para>
 
85
<para>
 
86
The markup passed to gtk_label_set_markup() must be valid; for example,
 
87
literal &lt;/&gt;/&amp; characters must be escaped as &amp;lt;,
 
88
&amp;gt;, and &amp;amp;. If you pass text obtained from the user, file,
 
89
or a network to gtk_label_set_markup(), you'll want to escape it with
 
90
g_markup_escape_text() or g_markup_printf_escaped().
 
91
</para>
 
92
<para>
 
93
Markup strings are just a convenient way to set the #PangoAttrList on
 
94
a label; gtk_label_set_attributes() may be a simpler way to set
 
95
attributes in some cases. Be careful though; #PangoAttrList tends to
 
96
cause internationalization problems, unless you're applying attributes
 
97
to the entire string (i.e. unless you set the range of each attribute
 
98
to [0, G_MAXINT)). The reason is that specifying the start_index and
 
99
end_index for a #PangoAttribute requires knowledge of the exact string
 
100
being displayed, so translations will cause problems.
 
101
</para>
 
102
</refsect2>
 
103
 
 
104
<refsect2>
 
105
<title>Selectable labels</title>
 
106
 
 
107
<para>
 
108
Labels can be made selectable with gtk_label_set_selectable(). 
 
109
Selectable labels allow the user to copy the label contents to 
 
110
the clipboard. Only labels that contain useful-to-copy information
 
111
&mdash; such as error messages &mdash; should be made selectable.
 
112
</para>
 
113
</refsect2>
 
114
 
 
115
<refsect2>
 
116
<title>Text layout</title>
 
117
 
 
118
<para>
 
119
A label can contain any number of paragraphs, but will have
 
120
performance problems if it contains more than a small number.
 
121
Paragraphs are separated by newlines or other paragraph separators
 
122
understood by Pango.
 
123
</para>
 
124
<para>
 
125
Labels can automatically wrap text if you call
 
126
gtk_label_set_line_wrap().
 
127
</para>
 
128
<para>
 
129
gtk_label_set_justify() sets how the lines in a label align 
 
130
with one another. If you want to set how the label as a whole 
 
131
aligns in its available space, see gtk_misc_set_alignment().
 
132
</para>
 
133
 
 
134
</refsect2>
 
135
 
 
136
<!-- ##### SECTION See_Also ##### -->
 
137
<para>
 
138
 
 
139
</para>
 
140
 
 
141
<!-- ##### SECTION Stability_Level ##### -->
 
142
 
 
143
 
 
144
<!-- ##### STRUCT GtkLabel ##### -->
 
145
<para>
 
146
This should not be accessed directly.  Use the accessor functions as
 
147
described below.
 
148
</para>
 
149
 
 
150
 
 
151
<!-- ##### SIGNAL GtkLabel::copy-clipboard ##### -->
 
152
<para>
 
153
 
 
154
</para>
 
155
 
 
156
@label: the object which received the signal.
 
157
 
 
158
<!-- ##### SIGNAL GtkLabel::move-cursor ##### -->
 
159
<para>
 
160
 
 
161
</para>
 
162
 
 
163
@label: the object which received the signal.
 
164
@arg1: 
 
165
@arg2: 
 
166
@arg3: 
 
167
 
 
168
<!-- ##### SIGNAL GtkLabel::populate-popup ##### -->
 
169
<para>
 
170
 
 
171
</para>
 
172
 
 
173
@label: the object which received the signal.
 
174
@arg1: 
 
175
 
 
176
<!-- ##### ARG GtkLabel:angle ##### -->
 
177
<para>
 
178
 
 
179
</para>
 
180
 
 
181
<!-- ##### ARG GtkLabel:attributes ##### -->
 
182
<para>
 
183
 
 
184
</para>
 
185
 
 
186
<!-- ##### ARG GtkLabel:cursor-position ##### -->
 
187
<para>
 
188
 
 
189
</para>
 
190
 
 
191
<!-- ##### ARG GtkLabel:ellipsize ##### -->
 
192
<para>
 
193
 
 
194
</para>
 
195
 
 
196
<!-- ##### ARG GtkLabel:justify ##### -->
 
197
<para>
 
198
 
 
199
</para>
 
200
 
 
201
<!-- ##### ARG GtkLabel:label ##### -->
 
202
<para>
 
203
 
 
204
</para>
 
205
 
 
206
<!-- ##### ARG GtkLabel:max-width-chars ##### -->
 
207
<para>
 
208
 
 
209
</para>
 
210
 
 
211
<!-- ##### ARG GtkLabel:mnemonic-keyval ##### -->
 
212
<para>
 
213
 
 
214
</para>
 
215
 
 
216
<!-- ##### ARG GtkLabel:mnemonic-widget ##### -->
 
217
<para>
 
218
 
 
219
</para>
 
220
 
 
221
<!-- ##### ARG GtkLabel:pattern ##### -->
 
222
<para>
 
223
 
 
224
</para>
 
225
 
 
226
<!-- ##### ARG GtkLabel:selectable ##### -->
 
227
<para>
 
228
 
 
229
</para>
 
230
 
 
231
<!-- ##### ARG GtkLabel:selection-bound ##### -->
 
232
<para>
 
233
 
 
234
</para>
 
235
 
 
236
<!-- ##### ARG GtkLabel:single-line-mode ##### -->
 
237
<para>
 
238
 
 
239
</para>
 
240
 
 
241
<!-- ##### ARG GtkLabel:use-markup ##### -->
 
242
<para>
 
243
 
 
244
</para>
 
245
 
 
246
<!-- ##### ARG GtkLabel:use-underline ##### -->
 
247
<para>
 
248
 
 
249
</para>
 
250
 
 
251
<!-- ##### ARG GtkLabel:width-chars ##### -->
 
252
<para>
 
253
 
 
254
</para>
 
255
 
 
256
<!-- ##### ARG GtkLabel:wrap ##### -->
 
257
<para>
 
258
 
 
259
</para>
 
260
 
 
261
<!-- ##### ARG GtkLabel:wrap-mode ##### -->
 
262
<para>
 
263
 
 
264
</para>
 
265
 
 
266
<!-- ##### FUNCTION gtk_label_new ##### -->
 
267
<para>
 
268
 
 
269
</para>
 
270
 
 
271
@str: 
 
272
@Returns: 
 
273
 
 
274
 
 
275
<!-- ##### FUNCTION gtk_label_set_text ##### -->
 
276
<para>
 
277
 
 
278
</para>
 
279
 
 
280
@label: 
 
281
@str: 
 
282
 
 
283
 
 
284
<!-- ##### FUNCTION gtk_label_set_attributes ##### -->
 
285
<para>
 
286
 
 
287
</para>
 
288
 
 
289
@label: 
 
290
@attrs: 
 
291
 
 
292
 
 
293
<!-- ##### FUNCTION gtk_label_set_markup ##### -->
 
294
<para>
 
295
 
 
296
</para>
 
297
 
 
298
@label: 
 
299
@str: 
 
300
 
 
301
 
 
302
<!-- ##### FUNCTION gtk_label_set_markup_with_mnemonic ##### -->
 
303
<para>
 
304
 
 
305
</para>
 
306
 
 
307
@label: 
 
308
@str: 
 
309
 
 
310
 
 
311
<!-- ##### FUNCTION gtk_label_set_pattern ##### -->
 
312
<para>
 
313
The pattern of underlines you want under the existing text within the
 
314
#GtkLabel widget.  For example if the current text of the label says
 
315
&quot;FooBarBaz&quot; passing a pattern of &quot;___   ___&quot; will underline
 
316
&quot;Foo&quot; and &quot;Baz&quot; but not &quot;Bar&quot;.
 
317
</para>
 
318
 
 
319
@label: The #GtkLabel you want to set the pattern to.
 
320
@pattern: The pattern as described above.
 
321
 
 
322
 
 
323
<!-- ##### FUNCTION gtk_label_set_justify ##### -->
 
324
<para>
 
325
 
 
326
</para>
 
327
 
 
328
@label: 
 
329
@jtype: 
 
330
 
 
331
 
 
332
<!-- ##### FUNCTION gtk_label_set_ellipsize ##### -->
 
333
<para>
 
334
 
 
335
</para>
 
336
 
 
337
@label: 
 
338
@mode: 
 
339
 
 
340
 
 
341
<!-- ##### FUNCTION gtk_label_set_width_chars ##### -->
 
342
<para>
 
343
 
 
344
</para>
 
345
 
 
346
@label: 
 
347
@n_chars: 
 
348
 
 
349
 
 
350
<!-- ##### FUNCTION gtk_label_set_max_width_chars ##### -->
 
351
<para>
 
352
 
 
353
</para>
 
354
 
 
355
@label: 
 
356
@n_chars: 
 
357
 
 
358
 
 
359
<!-- ##### FUNCTION gtk_label_get ##### -->
 
360
<para>
 
361
Gets the current string of text within the #GtkLabel and writes it to
 
362
the given @str argument.  It does not make a copy of this string so you
 
363
must not write to it.
 
364
</para>
 
365
 
 
366
@label: The #GtkLabel widget you want to get the text from.
 
367
@str: The reference to the pointer you want to point to the text.
 
368
 
 
369
 
 
370
<!-- ##### FUNCTION gtk_label_parse_uline ##### -->
 
371
<para>
 
372
Parses the given string for underscores and converts the next
 
373
character to an underlined character.  The last character that
 
374
was underlined will have its lower-cased accelerator keyval returned  (i.e.
 
375
&quot;_File&quot; would return the keyval for &quot;f&quot;.  This is
 
376
probably only used within the Gtk+ library itself for menu items and such.
 
377
</para>
 
378
 
 
379
@label: The #GtkLabel you want to affect.
 
380
@string: The string you want to parse for underlines.
 
381
@Returns: The lowercase keyval of the last character underlined.
 
382
 
 
383
 
 
384
<!-- ##### FUNCTION gtk_label_set_line_wrap ##### -->
 
385
<para>
 
386
 
 
387
</para>
 
388
 
 
389
@label: 
 
390
@wrap: 
 
391
 
 
392
 
 
393
<!-- ##### FUNCTION gtk_label_set_line_wrap_mode ##### -->
 
394
<para>
 
395
 
 
396
</para>
 
397
 
 
398
@label: 
 
399
@wrap_mode: 
 
400
 
 
401
 
 
402
<!-- ##### MACRO gtk_label_set ##### -->
 
403
<para>
 
404
Aliases gtk_label_set_text().  Probably used for backward compatibility with
 
405
Gtk+ 1.0.x.
 
406
</para>
 
407
 
 
408
 
 
409
 
 
410
<!-- ##### FUNCTION gtk_label_get_layout_offsets ##### -->
 
411
<para>
 
412
 
 
413
</para>
 
414
 
 
415
@label: 
 
416
@x: 
 
417
@y: 
 
418
 
 
419
 
 
420
<!-- ##### FUNCTION gtk_label_get_mnemonic_keyval ##### -->
 
421
<para>
 
422
 
 
423
</para>
 
424
 
 
425
@label: 
 
426
@Returns: 
 
427
 
 
428
 
 
429
<!-- ##### FUNCTION gtk_label_get_selectable ##### -->
 
430
<para>
 
431
 
 
432
</para>
 
433
 
 
434
@label: 
 
435
@Returns: 
 
436
 
 
437
 
 
438
<!-- ##### FUNCTION gtk_label_get_text ##### -->
 
439
<para>
 
440
 
 
441
</para>
 
442
 
 
443
@label: 
 
444
@Returns: 
 
445
 
 
446
 
 
447
<!-- ##### FUNCTION gtk_label_new_with_mnemonic ##### -->
 
448
<para>
 
449
 
 
450
</para>
 
451
 
 
452
@str: 
 
453
@Returns: 
 
454
 
 
455
 
 
456
<!-- ##### FUNCTION gtk_label_select_region ##### -->
 
457
<para>
 
458
 
 
459
</para>
 
460
 
 
461
@label: 
 
462
@start_offset: 
 
463
@end_offset: 
 
464
 
 
465
 
 
466
<!-- ##### FUNCTION gtk_label_set_mnemonic_widget ##### -->
 
467
<para>
 
468
 
 
469
</para>
 
470
 
 
471
@label: 
 
472
@widget: 
 
473
 
 
474
 
 
475
<!-- ##### FUNCTION gtk_label_set_selectable ##### -->
 
476
<para>
 
477
 
 
478
</para>
 
479
 
 
480
@label: 
 
481
@setting: 
 
482
 
 
483
 
 
484
<!-- ##### FUNCTION gtk_label_set_text_with_mnemonic ##### -->
 
485
<para>
 
486
 
 
487
</para>
 
488
 
 
489
@label: 
 
490
@str: 
 
491
 
 
492
 
 
493
<!-- ##### FUNCTION gtk_label_get_attributes ##### -->
 
494
<para>
 
495
 
 
496
</para>
 
497
 
 
498
@label: 
 
499
@Returns: 
 
500
 
 
501
 
 
502
<!-- ##### FUNCTION gtk_label_get_justify ##### -->
 
503
<para>
 
504
 
 
505
</para>
 
506
 
 
507
@label: 
 
508
@Returns: 
 
509
 
 
510
 
 
511
<!-- ##### FUNCTION gtk_label_get_ellipsize ##### -->
 
512
<para>
 
513
 
 
514
</para>
 
515
 
 
516
@label: 
 
517
@Returns: 
 
518
 
 
519
 
 
520
<!-- ##### FUNCTION gtk_label_get_width_chars ##### -->
 
521
<para>
 
522
 
 
523
</para>
 
524
 
 
525
@label: 
 
526
@Returns: 
 
527
 
 
528
 
 
529
<!-- ##### FUNCTION gtk_label_get_max_width_chars ##### -->
 
530
<para>
 
531
 
 
532
</para>
 
533
 
 
534
@label: 
 
535
@Returns: 
 
536
 
 
537
 
 
538
<!-- ##### FUNCTION gtk_label_get_label ##### -->
 
539
<para>
 
540
 
 
541
</para>
 
542
 
 
543
@label: 
 
544
@Returns: 
 
545
 
 
546
 
 
547
<!-- ##### FUNCTION gtk_label_get_layout ##### -->
 
548
<para>
 
549
 
 
550
</para>
 
551
 
 
552
@label: 
 
553
@Returns: 
 
554
 
 
555
 
 
556
<!-- ##### FUNCTION gtk_label_get_line_wrap ##### -->
 
557
<para>
 
558
 
 
559
</para>
 
560
 
 
561
@label: 
 
562
@Returns: 
 
563
 
 
564
 
 
565
<!-- ##### FUNCTION gtk_label_get_line_wrap_mode ##### -->
 
566
<para>
 
567
 
 
568
</para>
 
569
 
 
570
@label: 
 
571
@Returns: 
 
572
 
 
573
 
 
574
<!-- ##### FUNCTION gtk_label_get_mnemonic_widget ##### -->
 
575
<para>
 
576
 
 
577
</para>
 
578
 
 
579
@label: 
 
580
@Returns: 
 
581
 
 
582
 
 
583
<!-- ##### FUNCTION gtk_label_get_selection_bounds ##### -->
 
584
<para>
 
585
 
 
586
</para>
 
587
 
 
588
@label: 
 
589
@start: 
 
590
@end: 
 
591
@Returns: 
 
592
 
 
593
 
 
594
<!-- ##### FUNCTION gtk_label_get_use_markup ##### -->
 
595
<para>
 
596
 
 
597
</para>
 
598
 
 
599
@label: 
 
600
@Returns: 
 
601
 
 
602
 
 
603
<!-- ##### FUNCTION gtk_label_get_use_underline ##### -->
 
604
<para>
 
605
 
 
606
</para>
 
607
 
 
608
@label: 
 
609
@Returns: 
 
610
 
 
611
 
 
612
<!-- ##### FUNCTION gtk_label_get_single_line_mode ##### -->
 
613
<para>
 
614
 
 
615
</para>
 
616
 
 
617
@label: 
 
618
@Returns: 
 
619
 
 
620
 
 
621
<!-- ##### FUNCTION gtk_label_get_angle ##### -->
 
622
<para>
 
623
 
 
624
</para>
 
625
 
 
626
@label: 
 
627
@Returns: 
 
628
 
 
629
 
 
630
<!-- ##### FUNCTION gtk_label_set_label ##### -->
 
631
<para>
 
632
 
 
633
</para>
 
634
 
 
635
@label: 
 
636
@str: 
 
637
 
 
638
 
 
639
<!-- ##### FUNCTION gtk_label_set_use_markup ##### -->
 
640
<para>
 
641
 
 
642
</para>
 
643
 
 
644
@label: 
 
645
@setting: 
 
646
 
 
647
 
 
648
<!-- ##### FUNCTION gtk_label_set_use_underline ##### -->
 
649
<para>
 
650
 
 
651
</para>
 
652
 
 
653
@label: 
 
654
@setting: 
 
655
 
 
656
 
 
657
<!-- ##### FUNCTION gtk_label_set_single_line_mode ##### -->
 
658
<para>
 
659
 
 
660
</para>
 
661
 
 
662
@label: 
 
663
@single_line_mode: 
 
664
 
 
665
 
 
666
<!-- ##### FUNCTION gtk_label_set_angle ##### -->
 
667
<para>
 
668
 
 
669
</para>
 
670
 
 
671
@label: 
 
672
@angle: 
 
673
 
 
674