alternative to assert
[gtkD.git] / src / gtk / Label.d
blob87a28ad27863dbc48b91f51e2e97cf4a5d9f7304
1 /*
2 * This file is part of duit.
4 * duit is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * duit is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with duit; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GtkLabel.html
26 * outPack = gtk
27 * outFile = Label
28 * strct = GtkLabel
29 * realStrct=
30 * ctorStrct=
31 * clss = Label
32 * interf =
33 * class Code: Yes
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_label_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * - gtk_label_new
45 * - gtk_label_new_with_mnemonic
46 * imports:
47 * - glib.Str
48 * - gtk.Widget
49 * structWrap:
50 * - GtkWidget* -> Widget
51 * local aliases:
54 module gtk.Label;
56 private import gtk.gtktypes;
58 private import lib.gtk;
60 private import glib.Str;
61 private import gtk.Widget;
63 /**
64 * Description
65 * The GtkLabel widget displays a small amount of text. As the name
66 * implies, most labels are used to label another widget such as a
67 * GtkButton, a GtkMenuItem, or a GtkOptionMenu.
68 * Mnemonics
69 * Labels may contain mnemonics. Mnemonics are
70 * underlined characters in the label, used for keyboard navigation.
71 * Mnemonics are created by providing a string with an underscore before
72 * the mnemonic character, such as "_File", to the
73 * functions gtk_label_new_with_mnemonic() or
74 * gtk_label_set_text_with_mnemonic().
75 * Mnemonics automatically activate any activatable widget the label is
76 * inside, such as a GtkButton; if the label is not inside the
77 * mnemonic's target widget, you have to tell the label about the target
78 * using gtk_label_set_mnemonic_widget(). Here's a simple example where
79 * the label is inside a button:
80 * /+* Pressing Alt+H will activate this button +/
81 * button = gtk_button_new ();
82 * label = gtk_label_new_with_mnemonic ("_Hello");
83 * gtk_container_add (GTK_CONTAINER (button), label);
84 * There's a convenience function to create buttons with a mnemonic label
85 * already inside:
86 * /+* Pressing Alt+H will activate this button +/
87 * button = gtk_button_new_with_mnemonic ("_Hello");
88 * To create a mnemonic for a widget alongside the label, such as a
89 * GtkEntry, you have to point the label at the entry with
90 * gtk_label_set_mnemonic_widget():
91 * /+* Pressing Alt+H will focus the entry +/
92 * entry = gtk_entry_new ();
93 * label = gtk_label_new_with_mnemonic ("_Hello");
94 * gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
95 * <hr>
96 * Markup (styled text)
97 * To make it easy to format text in a label (changing colors, fonts,
98 * etc.), label text can be provided in a simple markup format.
99 * Here's how to create a label with a small font:
100 * label = gtk_label_new (NULL);
101 * gtk_label_set_markup (GTK_LABEL (label), "<small>Small text</small>");
102 * (See complete documentation of available
103 * tags in the Pango manual.)
104 * The markup passed to gtk_label_set_markup() must be valid; for example,
105 * literal </>/ characters must be escaped as lt;,
106 * gt;, and amp;. If you pass text obtained from the user, file,
107 * or a network to gtk_label_set_markup(), you'll want to escape it with
108 * g_markup_escape_text() or g_markup_printf_escaped().
109 * Markup strings are just a convenient way to set the PangoAttrList on
110 * a label; gtk_label_set_attributes() may be a simpler way to set
111 * attributes in some cases. Be careful though; PangoAttrList tends to
112 * cause internationalization problems, unless you're applying attributes
113 * to the entire string (i.e. unless you set the range of each attribute
114 * to [0, G_MAXINT)). The reason is that specifying the start_index and
115 * end_index for a PangoAttribute requires knowledge of the exact string
116 * being displayed, so translations will cause problems.
117 * <hr>
118 * Selectable labels
119 * Labels can be made selectable with gtk_label_set_selectable().
120 * Selectable labels allow the user to copy the label contents to
121 * the clipboard. Only labels that contain useful-to-copy information
122 * such as error messages should be made selectable.
123 * <hr>
124 * Text layout
125 * A label can contain any number of paragraphs, but will have
126 * performance problems if it contains more than a small number.
127 * Paragraphs are separated by newlines or other paragraph separators
128 * understood by Pango.
129 * Labels can automatically wrap text if you call
130 * gtk_label_set_line_wrap().
131 * gtk_label_set_justify() sets how the lines in a label align
132 * with one another. If you want to set how the label as a whole
133 * aligns in its available space, see gtk_misc_set_alignment().
135 private import gtk.Misc;
136 public class Label : Misc
139 /** the main Gtk struct */
140 protected GtkLabel* gtkLabel;
143 public GtkLabel* getLabelStruct()
145 return gtkLabel;
149 /** the main Gtk struct as a void* */
150 protected void* getStruct()
152 return cast(void*)gtkLabel;
156 * Sets our main struct and passes it to the parent class
158 public this (GtkLabel* gtkLabel)
160 super(cast(GtkMisc*)gtkLabel);
161 this.gtkLabel = gtkLabel;
165 * Creates a new GtkLabel, containing the text in str.
166 * If characters in str are preceded by an underscore, they are
167 * underlined. If you need a literal underscore character in a label, use
168 * '__' (two underscores). The first underlined character represents a
169 * keyboard accelerator called a mnemonic. The mnemonic key can be used
170 * to activate another widget, chosen automatically, or explicitly using
171 * gtk_label_set_mnemonic_widget().
172 * If gtk_label_set_mnemonic_widget()
173 * is not called, then the first activatable ancestor of the GtkLabel
174 * will be chosen as the mnemonic widget. For instance, if the
175 * label is inside a button or menu item, the button or menu item will
176 * automatically become the mnemonic widget and be activated by
177 * the mnemonic.
178 * str:
179 * The text of the label, with an underscore in front of the
180 * mnemonic character
181 * mnemonic: when false uses the literal text passed in without mnemonic
182 * Returns:
183 * the new GtkLabel
185 public this (char[] str, bit mnemonic=true)
187 if ( mnemonic )
189 // GtkWidget* gtk_label_new_with_mnemonic (const gchar *str);
190 this(cast(GtkLabel*)gtk_label_new_with_mnemonic(Str.toStringz(str)) );
192 else
194 // GtkWidget* gtk_label_new (const gchar *str);
195 this(cast(GtkLabel*)gtk_label_new(Str.toStringz(str)) );
202 // imports for the signal processing
203 private import gobject.Signals;
204 private import gdk.gdktypes;
205 int[char[]] connectedSignals;
207 void delegate(Label)[] onCopyClipboardListeners;
208 void addOnCopyClipboard(void delegate(Label) dlg)
210 if ( !("copy-clipboard" in connectedSignals) )
212 Signals.connectData(
213 getStruct(),
214 "copy-clipboard",
215 cast(GCallback)&callBackCopyClipboard,
216 this,
217 null,
218 cast(ConnectFlags)0);
219 connectedSignals["copy-clipboard"] = 1;
221 onCopyClipboardListeners ~= dlg;
223 extern(C) static void callBackCopyClipboard(GtkLabel* labelStruct, Label label)
225 bit consumed = false;
227 foreach ( void delegate(Label) dlg ; label.onCopyClipboardListeners )
229 dlg(label);
232 return consumed;
235 void delegate(GtkMovementStep, gint, gboolean, Label)[] onMoveCursorListeners;
236 void addOnMoveCursor(void delegate(GtkMovementStep, gint, gboolean, Label) dlg)
238 if ( !("move-cursor" in connectedSignals) )
240 Signals.connectData(
241 getStruct(),
242 "move-cursor",
243 cast(GCallback)&callBackMoveCursor,
244 this,
245 null,
246 cast(ConnectFlags)0);
247 connectedSignals["move-cursor"] = 1;
249 onMoveCursorListeners ~= dlg;
251 extern(C) static void callBackMoveCursor(GtkLabel* labelStruct, GtkMovementStep arg1, gint arg2, gboolean arg3, Label label)
253 bit consumed = false;
255 foreach ( void delegate(GtkMovementStep, gint, gboolean, Label) dlg ; label.onMoveCursorListeners )
257 dlg(arg1, arg2, arg3, label);
260 return consumed;
263 void delegate(GtkMenu*, Label)[] onPopulatePopupListeners;
264 void addOnPopulatePopup(void delegate(GtkMenu*, Label) dlg)
266 if ( !("populate-popup" in connectedSignals) )
268 Signals.connectData(
269 getStruct(),
270 "populate-popup",
271 cast(GCallback)&callBackPopulatePopup,
272 this,
273 null,
274 cast(ConnectFlags)0);
275 connectedSignals["populate-popup"] = 1;
277 onPopulatePopupListeners ~= dlg;
279 extern(C) static void callBackPopulatePopup(GtkLabel* labelStruct, GtkMenu* arg1, Label label)
281 bit consumed = false;
283 foreach ( void delegate(GtkMenu*, Label) dlg ; label.onPopulatePopupListeners )
285 dlg(arg1, label);
288 return consumed;
295 * Sets the text within the GtkLabel widget. It overwrites any text that
296 * was there before.
297 * This will also clear any previously set mnemonic accelerators.
298 * label:
299 * a GtkLabel
300 * str:
301 * The text you want to set.
303 public void setText(char[] str)
305 // void gtk_label_set_text (GtkLabel *label, const gchar *str);
306 gtk_label_set_text(gtkLabel, Str.toStringz(str));
310 * Sets a PangoAttrList; the attributes in the list are applied to the
311 * label text. The attributes set with this function will be ignored
312 * if the "use_underline" property or the "use_markup" property
313 * is TRUE.
314 * label:
315 * a GtkLabel
316 * attrs:
317 * a PangoAttrList
319 public void setAttributes(PangoAttrList* attrs)
321 // void gtk_label_set_attributes (GtkLabel *label, PangoAttrList *attrs);
322 gtk_label_set_attributes(gtkLabel, attrs);
326 * Parses str which is marked up with the Pango text markup language, setting the
327 * label's text and attribute list based on the parse results. If the str is
328 * external data, you may need to escape it with g_markup_escape_text() or
329 * g_markup_printf_escaped():
330 * char *markup;
331 * markup = g_markup_printf_escaped ("<span style=\"italic\">%s</span>", str);
332 * gtk_label_set_markup (GTK_LABEL (label), markup);
333 * g_free (markup);
334 * label:
335 * a GtkLabel
336 * str:
337 * a markup string (see Pango markup format)
339 public void setMarkup(char[] str)
341 // void gtk_label_set_markup (GtkLabel *label, const gchar *str);
342 gtk_label_set_markup(gtkLabel, Str.toStringz(str));
346 * Parses str which is marked up with the Pango text markup language,
347 * setting the label's text and attribute list based on the parse results.
348 * If characters in str are preceded by an underscore, they are underlined
349 * indicating that they represent a keyboard accelerator called a mnemonic.
350 * The mnemonic key can be used to activate another widget, chosen automatically,
351 * or explicitly using gtk_label_set_mnemonic_widget().
352 * label:
353 * a GtkLabel
354 * str:
355 * a markup string (see Pango markup format)
357 public void setMarkupWithMnemonic(char[] str)
359 // void gtk_label_set_markup_with_mnemonic (GtkLabel *label, const gchar *str);
360 gtk_label_set_markup_with_mnemonic(gtkLabel, Str.toStringz(str));
364 * The pattern of underlines you want under the existing text within the
365 * GtkLabel widget. For example if the current text of the label says
366 * "FooBarBaz" passing a pattern of "___ ___" will underline
367 * "Foo" and "Baz" but not "Bar".
368 * label:
369 * The GtkLabel you want to set the pattern to.
370 * pattern:
371 * The pattern as described above.
373 public void setPattern(char[] pattern)
375 // void gtk_label_set_pattern (GtkLabel *label, const gchar *pattern);
376 gtk_label_set_pattern(gtkLabel, Str.toStringz(pattern));
380 * Sets the alignment of the lines in the text of the label relative to
381 * each other. GTK_JUSTIFY_LEFT is the default value when the
382 * widget is first created with gtk_label_new(). If you instead want
383 * to set the alignment of the label as a whole, use
384 * gtk_misc_set_alignment() instead. gtk_label_set_justify() has no
385 * effect on labels containing only a single line.
386 * label:
387 * a GtkLabel
388 * jtype:
389 * a GtkJustification
391 public void setJustify(GtkJustification jtype)
393 // void gtk_label_set_justify (GtkLabel *label, GtkJustification jtype);
394 gtk_label_set_justify(gtkLabel, jtype);
398 * Sets the mode used to ellipsize (add an ellipsis: "...") to the text if there
399 * is not enough space to render the entire string.
400 * label:
401 * a GtkLabel
402 * mode:
403 * a PangoEllipsizeMode
404 * Since 2.6
406 public void setEllipsize(PangoEllipsizeMode mode)
408 // void gtk_label_set_ellipsize (GtkLabel *label, PangoEllipsizeMode mode);
409 gtk_label_set_ellipsize(gtkLabel, mode);
413 * Sets the desired width in characters of label to n_chars.
414 * label:
415 * a GtkLabel
416 * n_chars:
417 * the new desired width, in characters.
418 * Since 2.6
420 public void setWidthChars(int nChars)
422 // void gtk_label_set_width_chars (GtkLabel *label, gint n_chars);
423 gtk_label_set_width_chars(gtkLabel, nChars);
427 * Sets the desired maximum width in characters of label to n_chars.
428 * label:
429 * a GtkLabel
430 * n_chars:
431 * the new desired maximum width, in characters.
432 * Since 2.6
434 public void setMaxWidthChars(int nChars)
436 // void gtk_label_set_max_width_chars (GtkLabel *label, gint n_chars);
437 gtk_label_set_max_width_chars(gtkLabel, nChars);
441 * Warning
442 * gtk_label_get is deprecated and should not be used in newly-written code.
443 * Gets the current string of text within the GtkLabel and writes it to
444 * the given str argument. It does not make a copy of this string so you
445 * must not write to it.
446 * label:
447 * The GtkLabel widget you want to get the text from.
448 * str:
449 * The reference to the pointer you want to point to the text.
451 public void get(char** str)
453 // void gtk_label_get (GtkLabel *label, gchar **str);
454 gtk_label_get(gtkLabel, str);
458 * Warning
459 * gtk_label_parse_uline is deprecated and should not be used in newly-written code.
460 * Parses the given string for underscores and converts the next
461 * character to an underlined character. The last character that
462 * was underlined will have its lower-cased accelerator keyval returned (i.e.
463 * "_File" would return the keyval for "f". This is
464 * probably only used within the Gtk+ library itself for menu items and such.
465 * label:
466 * The GtkLabel you want to affect.
467 * string:
468 * The string you want to parse for underlines.
469 * Returns:
470 * The lowercase keyval of the last character underlined.
472 public uint parseUline(char[] string)
474 // guint gtk_label_parse_uline (GtkLabel *label, const gchar *string);
475 return gtk_label_parse_uline(gtkLabel, Str.toStringz(string));
479 * Toggles line wrapping within the GtkLabel widget. TRUE makes it break
480 * lines if text exceeds the widget's size. FALSE lets the text get cut off
481 * by the edge of the widget if it exceeds the widget size.
482 * Note that setting line wrapping to TRUE does not make the label
483 * wrap at its parent container's width, because GTK+ widgets
484 * conceptually can't make their requisition depend on the parent
485 * container's size. For a label that wraps at a specific position,
486 * set the label's width using gtk_widget_set_size_request().
487 * label:
488 * a GtkLabel
489 * wrap:
490 * the setting
492 public void setLineWrap(int wrap)
494 // void gtk_label_set_line_wrap (GtkLabel *label, gboolean wrap);
495 gtk_label_set_line_wrap(gtkLabel, wrap);
499 * If line wrapping is on (see gtk_label_set_line_wrap()) this controls how
500 * the line wrapping is done. The default is PANGO_WRAP_WORD which means
501 * wrap on word boundaries.
502 * label:
503 * a GtkLabel
504 * wrap_mode:
505 * the line wrapping mode
506 * Since 2.10
508 public void setLineWrapMode(PangoWrapMode wrapMode)
510 // void gtk_label_set_line_wrap_mode (GtkLabel *label, PangoWrapMode wrap_mode);
511 gtk_label_set_line_wrap_mode(gtkLabel, wrapMode);
516 * Obtains the coordinates where the label will draw the PangoLayout
517 * representing the text in the label; useful to convert mouse events
518 * into coordinates inside the PangoLayout, e.g. to take some action
519 * if some part of the label is clicked. Of course you will need to
520 * create a GtkEventBox to receive the events, and pack the label
521 * inside it, since labels are a GTK_NO_WINDOW widget. Remember
522 * when using the PangoLayout functions you need to convert to
523 * and from pixels using PANGO_PIXELS() or PANGO_SCALE.
524 * label:
525 * a GtkLabel
526 * x:
527 * location to store X offset of layout, or NULL
528 * y:
529 * location to store Y offset of layout, or NULL
531 public void getLayoutOffsets(int* x, int* y)
533 // void gtk_label_get_layout_offsets (GtkLabel *label, gint *x, gint *y);
534 gtk_label_get_layout_offsets(gtkLabel, x, y);
538 * If the label has been set so that it has an mnemonic key this function
539 * returns the keyval used for the mnemonic accelerator. If there is no
540 * mnemonic set up it returns GDK_VoidSymbol.
541 * label:
542 * a GtkLabel
543 * Returns:
544 * GDK keyval usable for accelerators, or GDK_VoidSymbol
546 public uint getMnemonicKeyval()
548 // guint gtk_label_get_mnemonic_keyval (GtkLabel *label);
549 return gtk_label_get_mnemonic_keyval(gtkLabel);
553 * Gets the value set by gtk_label_set_selectable().
554 * label:
555 * a GtkLabel
556 * Returns:
557 * TRUE if the user can copy text from the label
559 public int getSelectable()
561 // gboolean gtk_label_get_selectable (GtkLabel *label);
562 return gtk_label_get_selectable(gtkLabel);
566 * Fetches the text from a label widget, as displayed on the
567 * screen. This does not include any embedded underlines
568 * indicating mnemonics or Pango markup. (See gtk_label_get_label())
569 * label:
570 * a GtkLabel
571 * Returns:
572 * the text in the label widget. This is the internal
573 * string used by the label, and must not be modified.
575 public char[] getText()
577 // const gchar* gtk_label_get_text (GtkLabel *label);
578 return Str.toString(gtk_label_get_text(gtkLabel) );
583 * Selects a range of characters in the label, if the label is selectable.
584 * See gtk_label_set_selectable(). If the label is not selectable,
585 * this function has no effect. If start_offset or
586 * end_offset are -1, then the end of the label will be substituted.
587 * label:
588 * a GtkLabel
589 * start_offset:
590 * start offset (in characters not bytes)
591 * end_offset:
592 * end offset (in characters not bytes)
594 public void selectRegion(int startOffset, int endOffset)
596 // void gtk_label_select_region (GtkLabel *label, gint start_offset, gint end_offset);
597 gtk_label_select_region(gtkLabel, startOffset, endOffset);
601 * If the label has been set so that it has an mnemonic key (using
602 * i.e. gtk_label_set_markup_with_mnemonic(),
603 * gtk_label_set_text_with_mnemonic(), gtk_label_new_with_mnemonic()
604 * or the "use_underline" property) the label can be associated with a
605 * widget that is the target of the mnemonic. When the label is inside
606 * a widget (like a GtkButton or a GtkNotebook tab) it is
607 * automatically associated with the correct widget, but sometimes
608 * (i.e. when the target is a GtkEntry next to the label) you need to
609 * set it explicitly using this function.
610 * The target widget will be accelerated by emitting "mnemonic_activate" on it.
611 * The default handler for this signal will activate the widget if there are no
612 * mnemonic collisions and toggle focus between the colliding widgets otherwise.
613 * label:
614 * a GtkLabel
615 * widget:
616 * the target GtkWidget
618 public void setMnemonicWidget(Widget widget)
620 // void gtk_label_set_mnemonic_widget (GtkLabel *label, GtkWidget *widget);
621 gtk_label_set_mnemonic_widget(gtkLabel, (widget is null) ? null : widget.getWidgetStruct());
625 * Selectable labels allow the user to select text from the label, for
626 * copy-and-paste.
627 * label:
628 * a GtkLabel
629 * setting:
630 * TRUE to allow selecting text in the label
632 public void setSelectable(int setting)
634 // void gtk_label_set_selectable (GtkLabel *label, gboolean setting);
635 gtk_label_set_selectable(gtkLabel, setting);
639 * Sets the label's text from the string str.
640 * If characters in str are preceded by an underscore, they are underlined
641 * indicating that they represent a keyboard accelerator called a mnemonic.
642 * The mnemonic key can be used to activate another widget, chosen automatically,
643 * or explicitly using gtk_label_set_mnemonic_widget().
644 * label:
645 * a GtkLabel
646 * str:
647 * a string
649 public void setTextWithMnemonic(char[] str)
651 // void gtk_label_set_text_with_mnemonic (GtkLabel *label, const gchar *str);
652 gtk_label_set_text_with_mnemonic(gtkLabel, Str.toStringz(str));
656 * Gets the attribute list that was set on the label using
657 * gtk_label_set_attributes(), if any. This function does
658 * not reflect attributes that come from the labels markup
659 * (see gtk_label_set_markup()). If you want to get the
660 * effective attributes for the label, use
661 * pango_layout_get_attribute (gtk_label_get_layout (label)).
662 * label:
663 * a GtkLabel
664 * Returns:
665 * the attribute list, or NULL if none was set.
667 public PangoAttrList* getAttributes()
669 // PangoAttrList* gtk_label_get_attributes (GtkLabel *label);
670 return gtk_label_get_attributes(gtkLabel);
674 * Returns the justification of the label. See gtk_label_set_justify().
675 * label:
676 * a GtkLabel
677 * Returns:
678 * GtkJustification
680 public GtkJustification getJustify()
682 // GtkJustification gtk_label_get_justify (GtkLabel *label);
683 return gtk_label_get_justify(gtkLabel);
687 * Returns the ellipsizing position of the label. See gtk_label_set_ellipsize().
688 * label:
689 * a GtkLabel
690 * Returns:
691 * PangoEllipsizeMode
692 * Since 2.6
694 public PangoEllipsizeMode getEllipsize()
696 // PangoEllipsizeMode gtk_label_get_ellipsize (GtkLabel *label);
697 return gtk_label_get_ellipsize(gtkLabel);
701 * Retrieves the desired width of label, in characters. See
702 * gtk_label_set_width_chars().
703 * label:
704 * a GtkLabel
705 * Returns:
706 * the width of the label in characters.
707 * Since 2.6
709 public int getWidthChars()
711 // gint gtk_label_get_width_chars (GtkLabel *label);
712 return gtk_label_get_width_chars(gtkLabel);
716 * Retrieves the desired maximum width of label, in characters. See
717 * gtk_label_set_width_chars().
718 * label:
719 * a GtkLabel
720 * Returns:
721 * the maximum width of the label in characters.
722 * Since 2.6
724 public int getMaxWidthChars()
726 // gint gtk_label_get_max_width_chars (GtkLabel *label);
727 return gtk_label_get_max_width_chars(gtkLabel);
731 * Fetches the text from a label widget including any embedded
732 * underlines indicating mnemonics and Pango markup. (See
733 * gtk_label_get_text()).
734 * label:
735 * a GtkLabel
736 * Returns:
737 * the text of the label widget. This string is
738 * owned by the widget and must not be modified or freed.
740 public char[] getLabel()
742 // const gchar* gtk_label_get_label (GtkLabel *label);
743 return Str.toString(gtk_label_get_label(gtkLabel) );
747 * Gets the PangoLayout used to display the label.
748 * The layout is useful to e.g. convert text positions to
749 * pixel positions, in combination with gtk_label_get_layout_offsets().
750 * The returned layout is owned by the label so need not be
751 * freed by the caller.
752 * label:
753 * a GtkLabel
754 * Returns:
755 * the PangoLayout for this label
757 public PangoLayout* getLayout()
759 // PangoLayout* gtk_label_get_layout (GtkLabel *label);
760 return gtk_label_get_layout(gtkLabel);
764 * Returns whether lines in the label are automatically wrapped. See gtk_label_set_line_wrap().
765 * label:
766 * a GtkLabel
767 * Returns:
768 * TRUE if the lines of the label are automatically wrapped.
770 public int getLineWrap()
772 // gboolean gtk_label_get_line_wrap (GtkLabel *label);
773 return gtk_label_get_line_wrap(gtkLabel);
777 * Returns line wrap mode used by the label. See gtk_label_set_line_wrap_mode().
778 * label:
779 * a GtkLabel
780 * Returns:
781 * TRUE if the lines of the label are automatically wrapped.
782 * Since 2.10
784 public PangoWrapMode getLineWrapMode()
786 // PangoWrapMode gtk_label_get_line_wrap_mode (GtkLabel *label);
787 return gtk_label_get_line_wrap_mode(gtkLabel);
791 * Retrieves the target of the mnemonic (keyboard shortcut) of this
792 * label. See gtk_label_set_mnemonic_widget().
793 * label:
794 * a GtkLabel
795 * Returns:
796 * the target of the label's mnemonic, or NULL if none
797 * has been set and the default algorithm will be used.
799 public Widget getMnemonicWidget()
801 // GtkWidget* gtk_label_get_mnemonic_widget (GtkLabel *label);
802 return new Widget( gtk_label_get_mnemonic_widget(gtkLabel) );
806 * Gets the selected range of characters in the label, returning TRUE
807 * if there's a selection.
808 * label:
809 * a GtkLabel
810 * start:
811 * return location for start of selection, as a character offset
812 * end:
813 * return location for end of selection, as a character offset
814 * Returns:
815 * TRUE if selection is non-empty
817 public int getSelectionBounds(int* start, int* end)
819 // gboolean gtk_label_get_selection_bounds (GtkLabel *label, gint *start, gint *end);
820 return gtk_label_get_selection_bounds(gtkLabel, start, end);
824 * Returns whether the label's text is interpreted as marked up with
825 * the Pango text markup
826 * language. See gtk_label_set_use_markup().
827 * label:
828 * a GtkLabel
829 * Returns:
830 * TRUE if the label's text will be parsed for markup.
832 public int getUseMarkup()
834 // gboolean gtk_label_get_use_markup (GtkLabel *label);
835 return gtk_label_get_use_markup(gtkLabel);
839 * Returns whether an embedded underline in the label indicates a
840 * mnemonic. See gtk_label_set_use_underline().
841 * label:
842 * a GtkLabel
843 * Returns:
844 * TRUE whether an embedded underline in the label indicates
845 * the mnemonic accelerator keys.
847 public int getUseUnderline()
849 // gboolean gtk_label_get_use_underline (GtkLabel *label);
850 return gtk_label_get_use_underline(gtkLabel);
854 * Returns whether the label is in single line mode.
855 * label:
856 * a GtkLabel
857 * Returns:
858 * TRUE when the label is in single line mode.
859 * Since 2.6
861 public int getSingleLineMode()
863 // gboolean gtk_label_get_single_line_mode (GtkLabel *label);
864 return gtk_label_get_single_line_mode(gtkLabel);
868 * Gets the angle of rotation for the label. See
869 * gtk_label_set_angle.
870 * label:
871 * a GtkLabel
872 * Returns:
873 * the angle of rotation for the label
874 * Since 2.6
876 public double getAngle()
878 // gdouble gtk_label_get_angle (GtkLabel *label);
879 return gtk_label_get_angle(gtkLabel);
883 * Sets the text of the label. The label is interpreted as
884 * including embedded underlines and/or Pango markup depending
885 * on the values of label->use_underline and label->use_markup.
886 * label:
887 * a GtkLabel
888 * str:
889 * the new text to set for the label
891 public void setLabel(char[] str)
893 // void gtk_label_set_label (GtkLabel *label, const gchar *str);
894 gtk_label_set_label(gtkLabel, Str.toStringz(str));
898 * Sets whether the text of the label contains markup in Pango's text markup
899 * language. See gtk_label_set_markup().
900 * label:
901 * a GtkLabel
902 * setting:
903 * TRUE if the label's text should be parsed for markup.
905 public void setUseMarkup(int setting)
907 // void gtk_label_set_use_markup (GtkLabel *label, gboolean setting);
908 gtk_label_set_use_markup(gtkLabel, setting);
912 * If true, an underline in the text indicates the next character should be
913 * used for the mnemonic accelerator key.
914 * label:
915 * a GtkLabel
916 * setting:
917 * TRUE if underlines in the text indicate mnemonics
919 public void setUseUnderline(int setting)
921 // void gtk_label_set_use_underline (GtkLabel *label, gboolean setting);
922 gtk_label_set_use_underline(gtkLabel, setting);
926 * Sets whether the label is in single line mode.
927 * label:
928 * a GtkLabel
929 * single_line_mode:
930 * TRUE if the label should be in single line mode
931 * Since 2.6
933 public void setSingleLineMode(int singleLineMode)
935 // void gtk_label_set_single_line_mode (GtkLabel *label, gboolean single_line_mode);
936 gtk_label_set_single_line_mode(gtkLabel, singleLineMode);
940 * Sets the angle of rotation for the label. An angle of 90 reads from
941 * from bottom to top, an angle of 270, from top to bottom. The angle
942 * setting for the label is ignored if the label is selectable,
943 * wrapped, or ellipsized.
944 * label:
945 * a GtkLabel
946 * angle:
947 * the angle that the baseline of the label makes with
948 * the horizontal, in degrees, measured counterclockwise
949 * Since 2.6
950 * Property Details
951 * The "angle" property
952 * "angle" gdouble : Read / Write
953 * The angle that the baseline of the label makes with the horizontal,
954 * in degrees, measured counterclockwise. An angle of 90 reads from
955 * from bottom to top, an angle of 270, from top to bottom. Ignored
956 * if the label is selectable, wrapped, or ellipsized.
957 * Allowed values: [0,360]
958 * Default value: 0
959 * Since 2.6
961 public void setAngle(double angle)
963 // void gtk_label_set_angle (GtkLabel *label, gdouble angle);
964 gtk_label_set_angle(gtkLabel, angle);