alternative to assert
[gtkD.git] / gtkD / src / gtk / Label.d
blob3c904a538669fe55a7b00ea6cf608b1e15721e88
1 /*
2 * This file is part of gtkD.
4 * gtkD 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 * gtkD 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 gtkD; 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 * module aliases:
52 * local aliases:
55 module gtk.Label;
57 version(noAssert)
59 version(Tango)
61 import tango.io.Stdout; // use the tango loging?
65 private import gtkc.gtktypes;
67 private import gtkc.gtk;
70 private import glib.Str;
71 private import gtk.Widget;
76 /**
77 * Description
78 * The GtkLabel widget displays a small amount of text. As the name
79 * implies, most labels are used to label another widget such as a
80 * GtkButton, a GtkMenuItem, or a GtkOptionMenu.
81 * Mnemonics
82 * Labels may contain mnemonics. Mnemonics are
83 * underlined characters in the label, used for keyboard navigation.
84 * Mnemonics are created by providing a string with an underscore before
85 * the mnemonic character, such as "_File", to the
86 * functions gtk_label_new_with_mnemonic() or
87 * gtk_label_set_text_with_mnemonic().
88 * Mnemonics automatically activate any activatable widget the label is
89 * inside, such as a GtkButton; if the label is not inside the
90 * mnemonic's target widget, you have to tell the label about the target
91 * using gtk_label_set_mnemonic_widget(). Here's a simple example where
92 * the label is inside a button:
93 * /+* Pressing Alt+H will activate this button +/
94 * button = gtk_button_new ();
95 * label = gtk_label_new_with_mnemonic ("_Hello");
96 * gtk_container_add (GTK_CONTAINER (button), label);
97 * There's a convenience function to create buttons with a mnemonic label
98 * already inside:
99 * /+* Pressing Alt+H will activate this button +/
100 * button = gtk_button_new_with_mnemonic ("_Hello");
101 * To create a mnemonic for a widget alongside the label, such as a
102 * GtkEntry, you have to point the label at the entry with
103 * gtk_label_set_mnemonic_widget():
104 * /+* Pressing Alt+H will focus the entry +/
105 * entry = gtk_entry_new ();
106 * label = gtk_label_new_with_mnemonic ("_Hello");
107 * gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
108 * <hr>
109 * Markup (styled text)
110 * To make it easy to format text in a label (changing colors, fonts,
111 * etc.), label text can be provided in a simple markup format.
112 * Here's how to create a label with a small font:
113 * label = gtk_label_new (NULL);
114 * gtk_label_set_markup (GTK_LABEL (label), "<small>Small text</small>");
115 * (See complete documentation of available
116 * tags in the Pango manual.)
117 * The markup passed to gtk_label_set_markup() must be valid; for example,
118 * literal </>/ characters must be escaped as lt;,
119 * gt;, and amp;. If you pass text obtained from the user, file,
120 * or a network to gtk_label_set_markup(), you'll want to escape it with
121 * g_markup_escape_text() or g_markup_printf_escaped().
122 * Markup strings are just a convenient way to set the PangoAttrList on
123 * a label; gtk_label_set_attributes() may be a simpler way to set
124 * attributes in some cases. Be careful though; PangoAttrList tends to
125 * cause internationalization problems, unless you're applying attributes
126 * to the entire string (i.e. unless you set the range of each attribute
127 * to [0, G_MAXINT)). The reason is that specifying the start_index and
128 * end_index for a PangoAttribute requires knowledge of the exact string
129 * being displayed, so translations will cause problems.
130 * <hr>
131 * Selectable labels
132 * Labels can be made selectable with gtk_label_set_selectable().
133 * Selectable labels allow the user to copy the label contents to
134 * the clipboard. Only labels that contain useful-to-copy information
135 * such as error messages should be made selectable.
136 * <hr>
137 * Text layout
138 * A label can contain any number of paragraphs, but will have
139 * performance problems if it contains more than a small number.
140 * Paragraphs are separated by newlines or other paragraph separators
141 * understood by Pango.
142 * Labels can automatically wrap text if you call
143 * gtk_label_set_line_wrap().
144 * gtk_label_set_justify() sets how the lines in a label align
145 * with one another. If you want to set how the label as a whole
146 * aligns in its available space, see gtk_misc_set_alignment().
148 private import gtk.Misc;
149 public class Label : Misc
152 /** the main Gtk struct */
153 protected GtkLabel* gtkLabel;
156 public GtkLabel* getLabelStruct()
158 return gtkLabel;
162 /** the main Gtk struct as a void* */
163 protected void* getStruct()
165 return cast(void*)gtkLabel;
169 * Sets our main struct and passes it to the parent class
171 public this (GtkLabel* gtkLabel)
173 version(noAssert)
175 if ( gtkLabel is null )
177 int zero = 0;
178 version(Tango)
180 Stdout("struct gtkLabel is null on constructor").newline;
182 else
184 printf("struct gtkLabel is null on constructor");
186 zero = zero / zero;
189 else
191 assert(gtkLabel !is null, "struct gtkLabel is null on constructor");
193 super(cast(GtkMisc*)gtkLabel);
194 this.gtkLabel = gtkLabel;
198 * Creates a new GtkLabel, containing the text in str.
199 * If characters in str are preceded by an underscore, they are
200 * underlined. If you need a literal underscore character in a label, use
201 * '__' (two underscores). The first underlined character represents a
202 * keyboard accelerator called a mnemonic. The mnemonic key can be used
203 * to activate another widget, chosen automatically, or explicitly using
204 * gtk_label_set_mnemonic_widget().
205 * If gtk_label_set_mnemonic_widget()
206 * is not called, then the first activatable ancestor of the GtkLabel
207 * will be chosen as the mnemonic widget. For instance, if the
208 * label is inside a button or menu item, the button or menu item will
209 * automatically become the mnemonic widget and be activated by
210 * the mnemonic.
211 * str:
212 * The text of the label, with an underscore in front of the
213 * mnemonic character
214 * mnemonic: when false uses the literal text passed in without mnemonic
215 * Returns:
216 * the new GtkLabel
218 public this (char[] str, bool mnemonic=true)
220 if ( mnemonic )
222 // GtkWidget* gtk_label_new_with_mnemonic (const gchar *str);
223 this(cast(GtkLabel*)gtk_label_new_with_mnemonic(Str.toStringz(str)) );
225 else
227 // GtkWidget* gtk_label_new (const gchar *str);
228 this(cast(GtkLabel*)gtk_label_new(Str.toStringz(str)) );
235 // imports for the signal processing
236 private import gobject.Signals;
237 private import gtkc.gdktypes;
238 int[char[]] connectedSignals;
240 void delegate(Label)[] onCopyClipboardListeners;
241 void addOnCopyClipboard(void delegate(Label) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
243 if ( !("copy-clipboard" in connectedSignals) )
245 Signals.connectData(
246 getStruct(),
247 "copy-clipboard",
248 cast(GCallback)&callBackCopyClipboard,
249 cast(void*)this,
250 null,
251 connectFlags);
252 connectedSignals["copy-clipboard"] = 1;
254 onCopyClipboardListeners ~= dlg;
256 extern(C) static void callBackCopyClipboard(GtkLabel* labelStruct, Label label)
258 bool consumed = false;
260 foreach ( void delegate(Label) dlg ; label.onCopyClipboardListeners )
262 dlg(label);
265 return consumed;
268 void delegate(GtkMovementStep, gint, gboolean, Label)[] onMoveCursorListeners;
269 void addOnMoveCursor(void delegate(GtkMovementStep, gint, gboolean, Label) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
271 if ( !("move-cursor" in connectedSignals) )
273 Signals.connectData(
274 getStruct(),
275 "move-cursor",
276 cast(GCallback)&callBackMoveCursor,
277 cast(void*)this,
278 null,
279 connectFlags);
280 connectedSignals["move-cursor"] = 1;
282 onMoveCursorListeners ~= dlg;
284 extern(C) static void callBackMoveCursor(GtkLabel* labelStruct, GtkMovementStep arg1, gint arg2, gboolean arg3, Label label)
286 bool consumed = false;
288 foreach ( void delegate(GtkMovementStep, gint, gboolean, Label) dlg ; label.onMoveCursorListeners )
290 dlg(arg1, arg2, arg3, label);
293 return consumed;
296 void delegate(GtkMenu*, Label)[] onPopulatePopupListeners;
297 void addOnPopulatePopup(void delegate(GtkMenu*, Label) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
299 if ( !("populate-popup" in connectedSignals) )
301 Signals.connectData(
302 getStruct(),
303 "populate-popup",
304 cast(GCallback)&callBackPopulatePopup,
305 cast(void*)this,
306 null,
307 connectFlags);
308 connectedSignals["populate-popup"] = 1;
310 onPopulatePopupListeners ~= dlg;
312 extern(C) static void callBackPopulatePopup(GtkLabel* labelStruct, GtkMenu* arg1, Label label)
314 bool consumed = false;
316 foreach ( void delegate(GtkMenu*, Label) dlg ; label.onPopulatePopupListeners )
318 dlg(arg1, label);
321 return consumed;
328 * Sets the text within the GtkLabel widget. It overwrites any text that
329 * was there before.
330 * This will also clear any previously set mnemonic accelerators.
331 * label:
332 * a GtkLabel
333 * str:
334 * The text you want to set.
336 public void setText(char[] str)
338 // void gtk_label_set_text (GtkLabel *label, const gchar *str);
339 gtk_label_set_text(gtkLabel, Str.toStringz(str));
343 * Sets a PangoAttrList; the attributes in the list are applied to the
344 * label text. The attributes set with this function will be ignored
345 * if the "use_underline" property or the "use_markup" property
346 * is TRUE.
347 * label:
348 * a GtkLabel
349 * attrs:
350 * a PangoAttrList
352 public void setAttributes(PangoAttrList* attrs)
354 // void gtk_label_set_attributes (GtkLabel *label, PangoAttrList *attrs);
355 gtk_label_set_attributes(gtkLabel, attrs);
359 * Parses str which is marked up with the Pango text markup language, setting the
360 * label's text and attribute list based on the parse results. If the str is
361 * external data, you may need to escape it with g_markup_escape_text() or
362 * g_markup_printf_escaped():
363 * char *markup;
364 * markup = g_markup_printf_escaped ("<span style=\"italic\">%s</span>", str);
365 * gtk_label_set_markup (GTK_LABEL (label), markup);
366 * g_free (markup);
367 * label:
368 * a GtkLabel
369 * str:
370 * a markup string (see Pango markup format)
372 public void setMarkup(char[] str)
374 // void gtk_label_set_markup (GtkLabel *label, const gchar *str);
375 gtk_label_set_markup(gtkLabel, Str.toStringz(str));
379 * Parses str which is marked up with the Pango text markup language,
380 * setting the label's text and attribute list based on the parse results.
381 * If characters in str are preceded by an underscore, they are underlined
382 * indicating that they represent a keyboard accelerator called a mnemonic.
383 * The mnemonic key can be used to activate another widget, chosen automatically,
384 * or explicitly using gtk_label_set_mnemonic_widget().
385 * label:
386 * a GtkLabel
387 * str:
388 * a markup string (see Pango markup format)
390 public void setMarkupWithMnemonic(char[] str)
392 // void gtk_label_set_markup_with_mnemonic (GtkLabel *label, const gchar *str);
393 gtk_label_set_markup_with_mnemonic(gtkLabel, Str.toStringz(str));
397 * The pattern of underlines you want under the existing text within the
398 * GtkLabel widget. For example if the current text of the label says
399 * "FooBarBaz" passing a pattern of "___ ___" will underline
400 * "Foo" and "Baz" but not "Bar".
401 * label:
402 * The GtkLabel you want to set the pattern to.
403 * pattern:
404 * The pattern as described above.
406 public void setPattern(char[] pattern)
408 // void gtk_label_set_pattern (GtkLabel *label, const gchar *pattern);
409 gtk_label_set_pattern(gtkLabel, Str.toStringz(pattern));
413 * Sets the alignment of the lines in the text of the label relative to
414 * each other. GTK_JUSTIFY_LEFT is the default value when the
415 * widget is first created with gtk_label_new(). If you instead want
416 * to set the alignment of the label as a whole, use
417 * gtk_misc_set_alignment() instead. gtk_label_set_justify() has no
418 * effect on labels containing only a single line.
419 * label:
420 * a GtkLabel
421 * jtype:
422 * a GtkJustification
424 public void setJustify(GtkJustification jtype)
426 // void gtk_label_set_justify (GtkLabel *label, GtkJustification jtype);
427 gtk_label_set_justify(gtkLabel, jtype);
431 * Sets the mode used to ellipsize (add an ellipsis: "...") to the text if there
432 * is not enough space to render the entire string.
433 * label:
434 * a GtkLabel
435 * mode:
436 * a PangoEllipsizeMode
437 * Since 2.6
439 public void setEllipsize(PangoEllipsizeMode mode)
441 // void gtk_label_set_ellipsize (GtkLabel *label, PangoEllipsizeMode mode);
442 gtk_label_set_ellipsize(gtkLabel, mode);
446 * Sets the desired width in characters of label to n_chars.
447 * label:
448 * a GtkLabel
449 * n_chars:
450 * the new desired width, in characters.
451 * Since 2.6
453 public void setWidthChars(int nChars)
455 // void gtk_label_set_width_chars (GtkLabel *label, gint n_chars);
456 gtk_label_set_width_chars(gtkLabel, nChars);
460 * Sets the desired maximum width in characters of label to n_chars.
461 * label:
462 * a GtkLabel
463 * n_chars:
464 * the new desired maximum width, in characters.
465 * Since 2.6
467 public void setMaxWidthChars(int nChars)
469 // void gtk_label_set_max_width_chars (GtkLabel *label, gint n_chars);
470 gtk_label_set_max_width_chars(gtkLabel, nChars);
474 * Warning
475 * gtk_label_get is deprecated and should not be used in newly-written code.
476 * Gets the current string of text within the GtkLabel and writes it to
477 * the given str argument. It does not make a copy of this string so you
478 * must not write to it.
479 * label:
480 * The GtkLabel widget you want to get the text from.
481 * str:
482 * The reference to the pointer you want to point to the text.
484 public void get(char** str)
486 // void gtk_label_get (GtkLabel *label, gchar **str);
487 gtk_label_get(gtkLabel, str);
491 * Warning
492 * gtk_label_parse_uline is deprecated and should not be used in newly-written code.
493 * Parses the given string for underscores and converts the next
494 * character to an underlined character. The last character that
495 * was underlined will have its lower-cased accelerator keyval returned (i.e.
496 * "_File" would return the keyval for "f". This is
497 * probably only used within the Gtk+ library itself for menu items and such.
498 * label:
499 * The GtkLabel you want to affect.
500 * string:
501 * The string you want to parse for underlines.
502 * Returns:
503 * The lowercase keyval of the last character underlined.
505 public uint parseUline(char[] string)
507 // guint gtk_label_parse_uline (GtkLabel *label, const gchar *string);
508 return gtk_label_parse_uline(gtkLabel, Str.toStringz(string));
512 * Toggles line wrapping within the GtkLabel widget. TRUE makes it break
513 * lines if text exceeds the widget's size. FALSE lets the text get cut off
514 * by the edge of the widget if it exceeds the widget size.
515 * Note that setting line wrapping to TRUE does not make the label
516 * wrap at its parent container's width, because GTK+ widgets
517 * conceptually can't make their requisition depend on the parent
518 * container's size. For a label that wraps at a specific position,
519 * set the label's width using gtk_widget_set_size_request().
520 * label:
521 * a GtkLabel
522 * wrap:
523 * the setting
525 public void setLineWrap(int wrap)
527 // void gtk_label_set_line_wrap (GtkLabel *label, gboolean wrap);
528 gtk_label_set_line_wrap(gtkLabel, wrap);
532 * If line wrapping is on (see gtk_label_set_line_wrap()) this controls how
533 * the line wrapping is done. The default is PANGO_WRAP_WORD which means
534 * wrap on word boundaries.
535 * label:
536 * a GtkLabel
537 * wrap_mode:
538 * the line wrapping mode
539 * Since 2.10
541 public void setLineWrapMode(PangoWrapMode wrapMode)
543 // void gtk_label_set_line_wrap_mode (GtkLabel *label, PangoWrapMode wrap_mode);
544 gtk_label_set_line_wrap_mode(gtkLabel, wrapMode);
549 * Obtains the coordinates where the label will draw the PangoLayout
550 * representing the text in the label; useful to convert mouse events
551 * into coordinates inside the PangoLayout, e.g. to take some action
552 * if some part of the label is clicked. Of course you will need to
553 * create a GtkEventBox to receive the events, and pack the label
554 * inside it, since labels are a GTK_NO_WINDOW widget. Remember
555 * when using the PangoLayout functions you need to convert to
556 * and from pixels using PANGO_PIXELS() or PANGO_SCALE.
557 * label:
558 * a GtkLabel
559 * x:
560 * location to store X offset of layout, or NULL
561 * y:
562 * location to store Y offset of layout, or NULL
564 public void getLayoutOffsets(int* x, int* y)
566 // void gtk_label_get_layout_offsets (GtkLabel *label, gint *x, gint *y);
567 gtk_label_get_layout_offsets(gtkLabel, x, y);
571 * If the label has been set so that it has an mnemonic key this function
572 * returns the keyval used for the mnemonic accelerator. If there is no
573 * mnemonic set up it returns GDK_VoidSymbol.
574 * label:
575 * a GtkLabel
576 * Returns:
577 * GDK keyval usable for accelerators, or GDK_VoidSymbol
579 public uint getMnemonicKeyval()
581 // guint gtk_label_get_mnemonic_keyval (GtkLabel *label);
582 return gtk_label_get_mnemonic_keyval(gtkLabel);
586 * Gets the value set by gtk_label_set_selectable().
587 * label:
588 * a GtkLabel
589 * Returns:
590 * TRUE if the user can copy text from the label
592 public int getSelectable()
594 // gboolean gtk_label_get_selectable (GtkLabel *label);
595 return gtk_label_get_selectable(gtkLabel);
599 * Fetches the text from a label widget, as displayed on the
600 * screen. This does not include any embedded underlines
601 * indicating mnemonics or Pango markup. (See gtk_label_get_label())
602 * label:
603 * a GtkLabel
604 * Returns:
605 * the text in the label widget. This is the internal
606 * string used by the label, and must not be modified.
608 public char[] getText()
610 // const gchar* gtk_label_get_text (GtkLabel *label);
611 return Str.toString(gtk_label_get_text(gtkLabel) );
616 * Selects a range of characters in the label, if the label is selectable.
617 * See gtk_label_set_selectable(). If the label is not selectable,
618 * this function has no effect. If start_offset or
619 * end_offset are -1, then the end of the label will be substituted.
620 * label:
621 * a GtkLabel
622 * start_offset:
623 * start offset (in characters not bytes)
624 * end_offset:
625 * end offset (in characters not bytes)
627 public void selectRegion(int startOffset, int endOffset)
629 // void gtk_label_select_region (GtkLabel *label, gint start_offset, gint end_offset);
630 gtk_label_select_region(gtkLabel, startOffset, endOffset);
634 * If the label has been set so that it has an mnemonic key (using
635 * i.e. gtk_label_set_markup_with_mnemonic(),
636 * gtk_label_set_text_with_mnemonic(), gtk_label_new_with_mnemonic()
637 * or the "use_underline" property) the label can be associated with a
638 * widget that is the target of the mnemonic. When the label is inside
639 * a widget (like a GtkButton or a GtkNotebook tab) it is
640 * automatically associated with the correct widget, but sometimes
641 * (i.e. when the target is a GtkEntry next to the label) you need to
642 * set it explicitly using this function.
643 * The target widget will be accelerated by emitting "mnemonic_activate" on it.
644 * The default handler for this signal will activate the widget if there are no
645 * mnemonic collisions and toggle focus between the colliding widgets otherwise.
646 * label:
647 * a GtkLabel
648 * widget:
649 * the target GtkWidget
651 public void setMnemonicWidget(Widget widget)
653 // void gtk_label_set_mnemonic_widget (GtkLabel *label, GtkWidget *widget);
654 gtk_label_set_mnemonic_widget(gtkLabel, (widget is null) ? null : widget.getWidgetStruct());
658 * Selectable labels allow the user to select text from the label, for
659 * copy-and-paste.
660 * label:
661 * a GtkLabel
662 * setting:
663 * TRUE to allow selecting text in the label
665 public void setSelectable(int setting)
667 // void gtk_label_set_selectable (GtkLabel *label, gboolean setting);
668 gtk_label_set_selectable(gtkLabel, setting);
672 * Sets the label's text from the string str.
673 * If characters in str are preceded by an underscore, they are underlined
674 * indicating that they represent a keyboard accelerator called a mnemonic.
675 * The mnemonic key can be used to activate another widget, chosen automatically,
676 * or explicitly using gtk_label_set_mnemonic_widget().
677 * label:
678 * a GtkLabel
679 * str:
680 * a string
682 public void setTextWithMnemonic(char[] str)
684 // void gtk_label_set_text_with_mnemonic (GtkLabel *label, const gchar *str);
685 gtk_label_set_text_with_mnemonic(gtkLabel, Str.toStringz(str));
689 * Gets the attribute list that was set on the label using
690 * gtk_label_set_attributes(), if any. This function does
691 * not reflect attributes that come from the labels markup
692 * (see gtk_label_set_markup()). If you want to get the
693 * effective attributes for the label, use
694 * pango_layout_get_attribute (gtk_label_get_layout (label)).
695 * label:
696 * a GtkLabel
697 * Returns:
698 * the attribute list, or NULL if none was set.
700 public PangoAttrList* getAttributes()
702 // PangoAttrList* gtk_label_get_attributes (GtkLabel *label);
703 return gtk_label_get_attributes(gtkLabel);
707 * Returns the justification of the label. See gtk_label_set_justify().
708 * label:
709 * a GtkLabel
710 * Returns:
711 * GtkJustification
713 public GtkJustification getJustify()
715 // GtkJustification gtk_label_get_justify (GtkLabel *label);
716 return gtk_label_get_justify(gtkLabel);
720 * Returns the ellipsizing position of the label. See gtk_label_set_ellipsize().
721 * label:
722 * a GtkLabel
723 * Returns:
724 * PangoEllipsizeMode
725 * Since 2.6
727 public PangoEllipsizeMode getEllipsize()
729 // PangoEllipsizeMode gtk_label_get_ellipsize (GtkLabel *label);
730 return gtk_label_get_ellipsize(gtkLabel);
734 * Retrieves the desired width of label, in characters. See
735 * gtk_label_set_width_chars().
736 * label:
737 * a GtkLabel
738 * Returns:
739 * the width of the label in characters.
740 * Since 2.6
742 public int getWidthChars()
744 // gint gtk_label_get_width_chars (GtkLabel *label);
745 return gtk_label_get_width_chars(gtkLabel);
749 * Retrieves the desired maximum width of label, in characters. See
750 * gtk_label_set_width_chars().
751 * label:
752 * a GtkLabel
753 * Returns:
754 * the maximum width of the label in characters.
755 * Since 2.6
757 public int getMaxWidthChars()
759 // gint gtk_label_get_max_width_chars (GtkLabel *label);
760 return gtk_label_get_max_width_chars(gtkLabel);
764 * Fetches the text from a label widget including any embedded
765 * underlines indicating mnemonics and Pango markup. (See
766 * gtk_label_get_text()).
767 * label:
768 * a GtkLabel
769 * Returns:
770 * the text of the label widget. This string is
771 * owned by the widget and must not be modified or freed.
773 public char[] getLabel()
775 // const gchar* gtk_label_get_label (GtkLabel *label);
776 return Str.toString(gtk_label_get_label(gtkLabel) );
780 * Gets the PangoLayout used to display the label.
781 * The layout is useful to e.g. convert text positions to
782 * pixel positions, in combination with gtk_label_get_layout_offsets().
783 * The returned layout is owned by the label so need not be
784 * freed by the caller.
785 * label:
786 * a GtkLabel
787 * Returns:
788 * the PangoLayout for this label
790 public PangoLayout* getLayout()
792 // PangoLayout* gtk_label_get_layout (GtkLabel *label);
793 return gtk_label_get_layout(gtkLabel);
797 * Returns whether lines in the label are automatically wrapped. See gtk_label_set_line_wrap().
798 * label:
799 * a GtkLabel
800 * Returns:
801 * TRUE if the lines of the label are automatically wrapped.
803 public int getLineWrap()
805 // gboolean gtk_label_get_line_wrap (GtkLabel *label);
806 return gtk_label_get_line_wrap(gtkLabel);
810 * Returns line wrap mode used by the label. See gtk_label_set_line_wrap_mode().
811 * label:
812 * a GtkLabel
813 * Returns:
814 * TRUE if the lines of the label are automatically wrapped.
815 * Since 2.10
817 public PangoWrapMode getLineWrapMode()
819 // PangoWrapMode gtk_label_get_line_wrap_mode (GtkLabel *label);
820 return gtk_label_get_line_wrap_mode(gtkLabel);
824 * Retrieves the target of the mnemonic (keyboard shortcut) of this
825 * label. See gtk_label_set_mnemonic_widget().
826 * label:
827 * a GtkLabel
828 * Returns:
829 * the target of the label's mnemonic, or NULL if none
830 * has been set and the default algorithm will be used.
832 public Widget getMnemonicWidget()
834 // GtkWidget* gtk_label_get_mnemonic_widget (GtkLabel *label);
835 return new Widget( gtk_label_get_mnemonic_widget(gtkLabel) );
839 * Gets the selected range of characters in the label, returning TRUE
840 * if there's a selection.
841 * label:
842 * a GtkLabel
843 * start:
844 * return location for start of selection, as a character offset
845 * end:
846 * return location for end of selection, as a character offset
847 * Returns:
848 * TRUE if selection is non-empty
850 public int getSelectionBounds(int* start, int* end)
852 // gboolean gtk_label_get_selection_bounds (GtkLabel *label, gint *start, gint *end);
853 return gtk_label_get_selection_bounds(gtkLabel, start, end);
857 * Returns whether the label's text is interpreted as marked up with
858 * the Pango text markup
859 * language. See gtk_label_set_use_markup().
860 * label:
861 * a GtkLabel
862 * Returns:
863 * TRUE if the label's text will be parsed for markup.
865 public int getUseMarkup()
867 // gboolean gtk_label_get_use_markup (GtkLabel *label);
868 return gtk_label_get_use_markup(gtkLabel);
872 * Returns whether an embedded underline in the label indicates a
873 * mnemonic. See gtk_label_set_use_underline().
874 * label:
875 * a GtkLabel
876 * Returns:
877 * TRUE whether an embedded underline in the label indicates
878 * the mnemonic accelerator keys.
880 public int getUseUnderline()
882 // gboolean gtk_label_get_use_underline (GtkLabel *label);
883 return gtk_label_get_use_underline(gtkLabel);
887 * Returns whether the label is in single line mode.
888 * label:
889 * a GtkLabel
890 * Returns:
891 * TRUE when the label is in single line mode.
892 * Since 2.6
894 public int getSingleLineMode()
896 // gboolean gtk_label_get_single_line_mode (GtkLabel *label);
897 return gtk_label_get_single_line_mode(gtkLabel);
901 * Gets the angle of rotation for the label. See
902 * gtk_label_set_angle.
903 * label:
904 * a GtkLabel
905 * Returns:
906 * the angle of rotation for the label
907 * Since 2.6
909 public double getAngle()
911 // gdouble gtk_label_get_angle (GtkLabel *label);
912 return gtk_label_get_angle(gtkLabel);
916 * Sets the text of the label. The label is interpreted as
917 * including embedded underlines and/or Pango markup depending
918 * on the values of label->use_underline and label->use_markup.
919 * label:
920 * a GtkLabel
921 * str:
922 * the new text to set for the label
924 public void setLabel(char[] str)
926 // void gtk_label_set_label (GtkLabel *label, const gchar *str);
927 gtk_label_set_label(gtkLabel, Str.toStringz(str));
931 * Sets whether the text of the label contains markup in Pango's text markup
932 * language. See gtk_label_set_markup().
933 * label:
934 * a GtkLabel
935 * setting:
936 * TRUE if the label's text should be parsed for markup.
938 public void setUseMarkup(int setting)
940 // void gtk_label_set_use_markup (GtkLabel *label, gboolean setting);
941 gtk_label_set_use_markup(gtkLabel, setting);
945 * If true, an underline in the text indicates the next character should be
946 * used for the mnemonic accelerator key.
947 * label:
948 * a GtkLabel
949 * setting:
950 * TRUE if underlines in the text indicate mnemonics
952 public void setUseUnderline(int setting)
954 // void gtk_label_set_use_underline (GtkLabel *label, gboolean setting);
955 gtk_label_set_use_underline(gtkLabel, setting);
959 * Sets whether the label is in single line mode.
960 * label:
961 * a GtkLabel
962 * single_line_mode:
963 * TRUE if the label should be in single line mode
964 * Since 2.6
966 public void setSingleLineMode(int singleLineMode)
968 // void gtk_label_set_single_line_mode (GtkLabel *label, gboolean single_line_mode);
969 gtk_label_set_single_line_mode(gtkLabel, singleLineMode);
973 * Sets the angle of rotation for the label. An angle of 90 reads from
974 * from bottom to top, an angle of 270, from top to bottom. The angle
975 * setting for the label is ignored if the label is selectable,
976 * wrapped, or ellipsized.
977 * label:
978 * a GtkLabel
979 * angle:
980 * the angle that the baseline of the label makes with
981 * the horizontal, in degrees, measured counterclockwise
982 * Since 2.6
983 * Property Details
984 * The "angle" property
985 * "angle" gdouble : Read / Write
986 * The angle that the baseline of the label makes with the horizontal,
987 * in degrees, measured counterclockwise. An angle of 90 reads from
988 * from bottom to top, an angle of 270, from top to bottom. Ignored
989 * if the label is selectable, wrapped, or ellipsized.
990 * Allowed values: [0,360]
991 * Default value: 0
992 * Since 2.6
994 public void setAngle(double angle)
996 // void gtk_label_set_angle (GtkLabel *label, gdouble angle);
997 gtk_label_set_angle(gtkLabel, angle);