1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gtk.Label;
26 
27 private import glib.ConstructionException;
28 private import glib.Str;
29 private import gobject.ObjectG;
30 private import gobject.Signals;
31 private import gtk.Menu;
32 private import gtk.Misc;
33 private import gtk.Widget;
34 public  import gtkc.gdktypes;
35 private import gtkc.gtk;
36 public  import gtkc.gtktypes;
37 private import pango.PgAttributeList;
38 private import pango.PgLayout;
39 
40 
41 /**
42  * The #GtkLabel widget displays a small amount of text. As the name
43  * implies, most labels are used to label another widget such as a
44  * #GtkButton, a #GtkMenuItem, or a #GtkComboBox.
45  * 
46  * # GtkLabel as GtkBuildable
47  * 
48  * The GtkLabel implementation of the GtkBuildable interface supports a
49  * custom <attributes> element, which supports any number of <attribute>
50  * elements. The <attribute> element has attributes named “name“, “value“,
51  * “start“ and “end“ and allows you to specify #PangoAttribute values for
52  * this label.
53  * 
54  * An example of a UI definition fragment specifying Pango attributes:
55  * |[
56  * <object class="GtkLabel">
57  * <attributes>
58  * <attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
59  * <attribute name="background" value="red" start="5" end="10"/>"
60  * </attributes>
61  * </object>
62  * ]|
63  * 
64  * The start and end attributes specify the range of characters to which the
65  * Pango attribute applies. If start and end are not specified, the attribute is
66  * applied to the whole text. Note that specifying ranges does not make much
67  * sense with translatable attributes. Use markup embedded in the translatable
68  * content instead.
69  * 
70  * # Mnemonics
71  * 
72  * Labels may contain “mnemonics”. Mnemonics are
73  * underlined characters in the label, used for keyboard navigation.
74  * Mnemonics are created by providing a string with an underscore before
75  * the mnemonic character, such as `"_File"`, to the
76  * functions gtk_label_new_with_mnemonic() or
77  * gtk_label_set_text_with_mnemonic().
78  * 
79  * Mnemonics automatically activate any activatable widget the label is
80  * inside, such as a #GtkButton; if the label is not inside the
81  * mnemonic’s target widget, you have to tell the label about the target
82  * using gtk_label_set_mnemonic_widget(). Here’s a simple example where
83  * the label is inside a button:
84  * 
85  * |[<!-- language="C" -->
86  * // Pressing Alt+H will activate this button
87  * button = gtk_button_new ();
88  * label = gtk_label_new_with_mnemonic ("_Hello");
89  * gtk_container_add (GTK_CONTAINER (button), label);
90  * ]|
91  * 
92  * There’s a convenience function to create buttons with a mnemonic label
93  * already inside:
94  * 
95  * |[<!-- language="C" -->
96  * // Pressing Alt+H will activate this button
97  * button = gtk_button_new_with_mnemonic ("_Hello");
98  * ]|
99  * 
100  * To create a mnemonic for a widget alongside the label, such as a
101  * #GtkEntry, you have to point the label at the entry with
102  * gtk_label_set_mnemonic_widget():
103  * 
104  * |[<!-- language="C" -->
105  * // Pressing Alt+H will focus the entry
106  * entry = gtk_entry_new ();
107  * label = gtk_label_new_with_mnemonic ("_Hello");
108  * gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
109  * ]|
110  * 
111  * # Markup (styled text)
112  * 
113  * To make it easy to format text in a label (changing colors,
114  * fonts, etc.), label text can be provided in a simple
115  * [markup format][PangoMarkupFormat].
116  * 
117  * Here’s how to create a label with a small font:
118  * |[<!-- language="C" -->
119  * label = gtk_label_new (NULL);
120  * gtk_label_set_markup (GTK_LABEL (label), "<small>Small text</small>");
121  * ]|
122  * 
123  * (See [complete documentation][PangoMarkupFormat] of available
124  * tags in the Pango manual.)
125  * 
126  * The markup passed to gtk_label_set_markup() must be valid; for example,
127  * literal <, > and & characters must be escaped as &lt;, &gt;, and &amp;.
128  * If you pass text obtained from the user, file, or a network to
129  * gtk_label_set_markup(), you’ll want to escape it with
130  * g_markup_escape_text() or g_markup_printf_escaped().
131  * 
132  * Markup strings are just a convenient way to set the #PangoAttrList on
133  * a label; gtk_label_set_attributes() may be a simpler way to set
134  * attributes in some cases. Be careful though; #PangoAttrList tends to
135  * cause internationalization problems, unless you’re applying attributes
136  * to the entire string (i.e. unless you set the range of each attribute
137  * to [0, %G_MAXINT)). The reason is that specifying the start_index and
138  * end_index for a #PangoAttribute requires knowledge of the exact string
139  * being displayed, so translations will cause problems.
140  * 
141  * # Selectable labels
142  * 
143  * Labels can be made selectable with gtk_label_set_selectable().
144  * Selectable labels allow the user to copy the label contents to
145  * the clipboard. Only labels that contain useful-to-copy information
146  * — such as error messages — should be made selectable.
147  * 
148  * # Text layout # {#label-text-layout}
149  * 
150  * A label can contain any number of paragraphs, but will have
151  * performance problems if it contains more than a small number.
152  * Paragraphs are separated by newlines or other paragraph separators
153  * understood by Pango.
154  * 
155  * Labels can automatically wrap text if you call
156  * gtk_label_set_line_wrap().
157  * 
158  * gtk_label_set_justify() sets how the lines in a label align
159  * with one another. If you want to set how the label as a whole
160  * aligns in its available space, see the #GtkWidget::halign and
161  * #GtkWidget:valign properties.
162  * 
163  * The #GtkLabel:width-chars and #GtkLabel:max-width-chars properties
164  * can be used to control the size allocation of ellipsized or wrapped
165  * labels. For ellipsizing labels, if either is specified (and less
166  * than the actual text size), it is used as the minimum width, and the actual
167  * text size is used as the natural width of the label. For wrapping labels,
168  * width-chars is used as the minimum width, if specified, and max-width-chars
169  * is used as the natural width. Even if max-width-chars specified, wrapping
170  * labels will be rewrapped to use all of the available width.
171  * 
172  * Note that the interpretation of #GtkLabel:width-chars and
173  * #GtkLabel:max-width-chars has changed a bit with the introduction of
174  * [width-for-height geometry management.][geometry-management]
175  * 
176  * # Links
177  * 
178  * Since 2.18, GTK+ supports markup for clickable hyperlinks in addition
179  * to regular Pango markup. The markup for links is borrowed from HTML,
180  * using the `<a>` with “href“ and “title“ attributes. GTK+ renders links
181  * similar to the way they appear in web browsers, with colored, underlined
182  * text. The “title“ attribute is displayed as a tooltip on the link.
183  * 
184  * An example looks like this:
185  * 
186  * |[<!-- language="C" -->
187  * const gchar *text =
188  * "Go to the"
189  * "<a href=\"http://www.gtk.org title="&lt;i&gt;Our&lt;/i&gt; website\">"
190  * "GTK+ website</a> for more...";
191  * gtk_label_set_markup (label, text);
192  * ]|
193  * 
194  * It is possible to implement custom handling for links and their tooltips with
195  * the #GtkLabel::activate-link signal and the gtk_label_get_current_uri() function.
196  */
197 public class Label : Misc
198 {
199 	/** the main Gtk struct */
200 	protected GtkLabel* gtkLabel;
201 
202 	/** Get the main Gtk struct */
203 	public GtkLabel* getLabelStruct()
204 	{
205 		return gtkLabel;
206 	}
207 
208 	/** the main Gtk struct as a void* */
209 	protected override void* getStruct()
210 	{
211 		return cast(void*)gtkLabel;
212 	}
213 
214 	protected override void setStruct(GObject* obj)
215 	{
216 		gtkLabel = cast(GtkLabel*)obj;
217 		super.setStruct(obj);
218 	}
219 
220 	/**
221 	 * Sets our main struct and passes it to the parent class.
222 	 */
223 	public this (GtkLabel* gtkLabel, bool ownedRef = false)
224 	{
225 		this.gtkLabel = gtkLabel;
226 		super(cast(GtkMisc*)gtkLabel, ownedRef);
227 	}
228 
229 	/**
230 	 * Creates a new GtkLabel, containing the text in str.
231 	 * If characters in str are preceded by an underscore, they are
232 	 * underlined. If you need a literal underscore character in a label, use
233 	 * '__' (two underscores). The first underlined character represents a
234 	 * keyboard accelerator called a mnemonic. The mnemonic key can be used
235 	 * to activate another widget, chosen automatically, or explicitly using
236 	 * setMnemonicWidget().
237 	 *
238 	 * If setMnemonicWidget() is not called, then the first activatable ancestor of the Label
239 	 * will be chosen as the mnemonic widget. For instance, if the
240 	 * label is inside a button or menu item, the button or menu item will
241 	 * automatically become the mnemonic widget and be activated by
242 	 * the mnemonic.
243 	 * Params:
244 	 *  str = The text of the label, with an underscore in front of the
245 	 *  mnemonic character
246 	 *  mnemonic = when false uses the literal text passed in without mnemonic
247 	 * Throws: ConstructionException GTK+ fails to create the object.
248 	 */
249 	public this (string str, bool mnemonic=true)
250 	{
251 		GtkLabel* p;
252 		
253 		if ( mnemonic )
254 		{
255 			// GtkWidget* gtk_label_new_with_mnemonic (const gchar *str);
256 			p = cast(GtkLabel*)gtk_label_new_with_mnemonic(Str.toStringz(str));
257 		}
258 		else
259 		{
260 			// GtkWidget* gtk_label_new (const gchar *str);
261 			p = cast(GtkLabel*)gtk_label_new(Str.toStringz(str));
262 		}
263 		
264 		if(p is null)
265 		{
266 			throw new ConstructionException("null returned by gtk_label_new");
267 		}
268 		
269 		this(p);
270 	}
271 
272 	/**
273 	 */
274 
275 	/** */
276 	public static GType getType()
277 	{
278 		return gtk_label_get_type();
279 	}
280 
281 	/**
282 	 * Gets the angle of rotation for the label. See
283 	 * gtk_label_set_angle().
284 	 *
285 	 * Return: the angle of rotation for the label
286 	 *
287 	 * Since: 2.6
288 	 */
289 	public double getAngle()
290 	{
291 		return gtk_label_get_angle(gtkLabel);
292 	}
293 
294 	/**
295 	 * Gets the attribute list that was set on the label using
296 	 * gtk_label_set_attributes(), if any. This function does
297 	 * not reflect attributes that come from the labels markup
298 	 * (see gtk_label_set_markup()). If you want to get the
299 	 * effective attributes for the label, use
300 	 * pango_layout_get_attribute (gtk_label_get_layout (label)).
301 	 *
302 	 * Return: the attribute list, or %NULL
303 	 *     if none was set.
304 	 */
305 	public PgAttributeList getAttributes()
306 	{
307 		auto p = gtk_label_get_attributes(gtkLabel);
308 		
309 		if(p is null)
310 		{
311 			return null;
312 		}
313 		
314 		return ObjectG.getDObject!(PgAttributeList)(cast(PangoAttrList*) p);
315 	}
316 
317 	/**
318 	 * Returns the URI for the currently active link in the label.
319 	 * The active link is the one under the mouse pointer or, in a
320 	 * selectable label, the link in which the text cursor is currently
321 	 * positioned.
322 	 *
323 	 * This function is intended for use in a #GtkLabel::activate-link handler
324 	 * or for use in a #GtkWidget::query-tooltip handler.
325 	 *
326 	 * Return: the currently active URI. The string is owned by GTK+ and must
327 	 *     not be freed or modified.
328 	 *
329 	 * Since: 2.18
330 	 */
331 	public string getCurrentUri()
332 	{
333 		return Str.toString(gtk_label_get_current_uri(gtkLabel));
334 	}
335 
336 	/**
337 	 * Returns the ellipsizing position of the label. See gtk_label_set_ellipsize().
338 	 *
339 	 * Return: #PangoEllipsizeMode
340 	 *
341 	 * Since: 2.6
342 	 */
343 	public PangoEllipsizeMode getEllipsize()
344 	{
345 		return gtk_label_get_ellipsize(gtkLabel);
346 	}
347 
348 	/**
349 	 * Returns the justification of the label. See gtk_label_set_justify().
350 	 *
351 	 * Return: #GtkJustification
352 	 */
353 	public GtkJustification getJustify()
354 	{
355 		return gtk_label_get_justify(gtkLabel);
356 	}
357 
358 	/**
359 	 * Fetches the text from a label widget including any embedded
360 	 * underlines indicating mnemonics and Pango markup. (See
361 	 * gtk_label_get_text()).
362 	 *
363 	 * Return: the text of the label widget. This string is
364 	 *     owned by the widget and must not be modified or freed.
365 	 */
366 	public string getLabel()
367 	{
368 		return Str.toString(gtk_label_get_label(gtkLabel));
369 	}
370 
371 	/**
372 	 * Gets the #PangoLayout used to display the label.
373 	 * The layout is useful to e.g. convert text positions to
374 	 * pixel positions, in combination with gtk_label_get_layout_offsets().
375 	 * The returned layout is owned by the @label so need not be
376 	 * freed by the caller. The @label is free to recreate its layout at
377 	 * any time, so it should be considered read-only.
378 	 *
379 	 * Return: the #PangoLayout for this label
380 	 */
381 	public PgLayout getLayout()
382 	{
383 		auto p = gtk_label_get_layout(gtkLabel);
384 		
385 		if(p is null)
386 		{
387 			return null;
388 		}
389 		
390 		return ObjectG.getDObject!(PgLayout)(cast(PangoLayout*) p);
391 	}
392 
393 	/**
394 	 * Obtains the coordinates where the label will draw the #PangoLayout
395 	 * representing the text in the label; useful to convert mouse events
396 	 * into coordinates inside the #PangoLayout, e.g. to take some action
397 	 * if some part of the label is clicked. Of course you will need to
398 	 * create a #GtkEventBox to receive the events, and pack the label
399 	 * inside it, since labels are windowless (they return %FALSE from
400 	 * gtk_widget_get_has_window()). Remember
401 	 * when using the #PangoLayout functions you need to convert to
402 	 * and from pixels using PANGO_PIXELS() or #PANGO_SCALE.
403 	 *
404 	 * Params:
405 	 *     x = location to store X offset of layout, or %NULL
406 	 *     y = location to store Y offset of layout, or %NULL
407 	 */
408 	public void getLayoutOffsets(out int x, out int y)
409 	{
410 		gtk_label_get_layout_offsets(gtkLabel, &x, &y);
411 	}
412 
413 	/**
414 	 * Returns whether lines in the label are automatically wrapped.
415 	 * See gtk_label_set_line_wrap().
416 	 *
417 	 * Return: %TRUE if the lines of the label are automatically wrapped.
418 	 */
419 	public bool getLineWrap()
420 	{
421 		return gtk_label_get_line_wrap(gtkLabel) != 0;
422 	}
423 
424 	/**
425 	 * Returns line wrap mode used by the label. See gtk_label_set_line_wrap_mode().
426 	 *
427 	 * Return: %TRUE if the lines of the label are automatically wrapped.
428 	 *
429 	 * Since: 2.10
430 	 */
431 	public PangoWrapMode getLineWrapMode()
432 	{
433 		return gtk_label_get_line_wrap_mode(gtkLabel);
434 	}
435 
436 	/**
437 	 * Gets the number of lines to which an ellipsized, wrapping
438 	 * label should be limited. See gtk_label_set_lines().
439 	 *
440 	 * Return: The number of lines
441 	 *
442 	 * Since: 3.10
443 	 */
444 	public int getLines()
445 	{
446 		return gtk_label_get_lines(gtkLabel);
447 	}
448 
449 	/**
450 	 * Retrieves the desired maximum width of @label, in characters. See
451 	 * gtk_label_set_width_chars().
452 	 *
453 	 * Return: the maximum width of the label in characters.
454 	 *
455 	 * Since: 2.6
456 	 */
457 	public int getMaxWidthChars()
458 	{
459 		return gtk_label_get_max_width_chars(gtkLabel);
460 	}
461 
462 	/**
463 	 * If the label has been set so that it has an mnemonic key this function
464 	 * returns the keyval used for the mnemonic accelerator. If there is no
465 	 * mnemonic set up it returns #GDK_KEY_VoidSymbol.
466 	 *
467 	 * Return: GDK keyval usable for accelerators, or #GDK_KEY_VoidSymbol
468 	 */
469 	public uint getMnemonicKeyval()
470 	{
471 		return gtk_label_get_mnemonic_keyval(gtkLabel);
472 	}
473 
474 	/**
475 	 * Retrieves the target of the mnemonic (keyboard shortcut) of this
476 	 * label. See gtk_label_set_mnemonic_widget().
477 	 *
478 	 * Return: the target of the label’s mnemonic,
479 	 *     or %NULL if none has been set and the default algorithm will be used.
480 	 */
481 	public Widget getMnemonicWidget()
482 	{
483 		auto p = gtk_label_get_mnemonic_widget(gtkLabel);
484 		
485 		if(p is null)
486 		{
487 			return null;
488 		}
489 		
490 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
491 	}
492 
493 	/**
494 	 * Gets the value set by gtk_label_set_selectable().
495 	 *
496 	 * Return: %TRUE if the user can copy text from the label
497 	 */
498 	public bool getSelectable()
499 	{
500 		return gtk_label_get_selectable(gtkLabel) != 0;
501 	}
502 
503 	/**
504 	 * Gets the selected range of characters in the label, returning %TRUE
505 	 * if there’s a selection.
506 	 *
507 	 * Params:
508 	 *     start = return location for start of selection, as a character offset
509 	 *     end = return location for end of selection, as a character offset
510 	 *
511 	 * Return: %TRUE if selection is non-empty
512 	 */
513 	public bool getSelectionBounds(out int start, out int end)
514 	{
515 		return gtk_label_get_selection_bounds(gtkLabel, &start, &end) != 0;
516 	}
517 
518 	/**
519 	 * Returns whether the label is in single line mode.
520 	 *
521 	 * Return: %TRUE when the label is in single line mode.
522 	 *
523 	 * Since: 2.6
524 	 */
525 	public bool getSingleLineMode()
526 	{
527 		return gtk_label_get_single_line_mode(gtkLabel) != 0;
528 	}
529 
530 	/**
531 	 * Fetches the text from a label widget, as displayed on the
532 	 * screen. This does not include any embedded underlines
533 	 * indicating mnemonics or Pango markup. (See gtk_label_get_label())
534 	 *
535 	 * Return: the text in the label widget. This is the internal
536 	 *     string used by the label, and must not be modified.
537 	 */
538 	public string getText()
539 	{
540 		return Str.toString(gtk_label_get_text(gtkLabel));
541 	}
542 
543 	/**
544 	 * Returns whether the label is currently keeping track
545 	 * of clicked links.
546 	 *
547 	 * Return: %TRUE if clicked links are remembered
548 	 *
549 	 * Since: 2.18
550 	 */
551 	public bool getTrackVisitedLinks()
552 	{
553 		return gtk_label_get_track_visited_links(gtkLabel) != 0;
554 	}
555 
556 	/**
557 	 * Returns whether the label’s text is interpreted as marked up with
558 	 * the [Pango text markup language][PangoMarkupFormat].
559 	 * See gtk_label_set_use_markup ().
560 	 *
561 	 * Return: %TRUE if the label’s text will be parsed for markup.
562 	 */
563 	public bool getUseMarkup()
564 	{
565 		return gtk_label_get_use_markup(gtkLabel) != 0;
566 	}
567 
568 	/**
569 	 * Returns whether an embedded underline in the label indicates a
570 	 * mnemonic. See gtk_label_set_use_underline().
571 	 *
572 	 * Return: %TRUE whether an embedded underline in the label indicates
573 	 *     the mnemonic accelerator keys.
574 	 */
575 	public bool getUseUnderline()
576 	{
577 		return gtk_label_get_use_underline(gtkLabel) != 0;
578 	}
579 
580 	/**
581 	 * Retrieves the desired width of @label, in characters. See
582 	 * gtk_label_set_width_chars().
583 	 *
584 	 * Return: the width of the label in characters.
585 	 *
586 	 * Since: 2.6
587 	 */
588 	public int getWidthChars()
589 	{
590 		return gtk_label_get_width_chars(gtkLabel);
591 	}
592 
593 	/**
594 	 * Gets the #GtkLabel:xalign property for @label.
595 	 *
596 	 * Return: the xalign property
597 	 *
598 	 * Since: 3.16
599 	 */
600 	public float getXalign()
601 	{
602 		return gtk_label_get_xalign(gtkLabel);
603 	}
604 
605 	/**
606 	 * Gets the #GtkLabel:yalign property for @label.
607 	 *
608 	 * Return: the yalign property
609 	 *
610 	 * Since: 3.16
611 	 */
612 	public float getYalign()
613 	{
614 		return gtk_label_get_yalign(gtkLabel);
615 	}
616 
617 	/**
618 	 * Selects a range of characters in the label, if the label is selectable.
619 	 * See gtk_label_set_selectable(). If the label is not selectable,
620 	 * this function has no effect. If @start_offset or
621 	 * @end_offset are -1, then the end of the label will be substituted.
622 	 *
623 	 * Params:
624 	 *     startOffset = start offset (in characters not bytes)
625 	 *     endOffset = end offset (in characters not bytes)
626 	 */
627 	public void selectRegion(int startOffset, int endOffset)
628 	{
629 		gtk_label_select_region(gtkLabel, startOffset, endOffset);
630 	}
631 
632 	/**
633 	 * Sets the angle of rotation for the label. An angle of 90 reads from
634 	 * from bottom to top, an angle of 270, from top to bottom. The angle
635 	 * setting for the label is ignored if the label is selectable,
636 	 * wrapped, or ellipsized.
637 	 *
638 	 * Params:
639 	 *     angle = the angle that the baseline of the label makes with
640 	 *         the horizontal, in degrees, measured counterclockwise
641 	 *
642 	 * Since: 2.6
643 	 */
644 	public void setAngle(double angle)
645 	{
646 		gtk_label_set_angle(gtkLabel, angle);
647 	}
648 
649 	/**
650 	 * Sets a #PangoAttrList; the attributes in the list are applied to the
651 	 * label text.
652 	 *
653 	 * The attributes set with this function will be applied
654 	 * and merged with any other attributes previously effected by way
655 	 * of the #GtkLabel:use-underline or #GtkLabel:use-markup properties.
656 	 * While it is not recommended to mix markup strings with manually set
657 	 * attributes, if you must; know that the attributes will be applied
658 	 * to the label after the markup string is parsed.
659 	 *
660 	 * Params:
661 	 *     attrs = a #PangoAttrList, or %NULL
662 	 */
663 	public void setAttributes(PgAttributeList attrs)
664 	{
665 		gtk_label_set_attributes(gtkLabel, (attrs is null) ? null : attrs.getPgAttributeListStruct());
666 	}
667 
668 	/**
669 	 * Sets the mode used to ellipsize (add an ellipsis: "...") to the text
670 	 * if there is not enough space to render the entire string.
671 	 *
672 	 * Params:
673 	 *     mode = a #PangoEllipsizeMode
674 	 *
675 	 * Since: 2.6
676 	 */
677 	public void setEllipsize(PangoEllipsizeMode mode)
678 	{
679 		gtk_label_set_ellipsize(gtkLabel, mode);
680 	}
681 
682 	/**
683 	 * Sets the alignment of the lines in the text of the label relative to
684 	 * each other. %GTK_JUSTIFY_LEFT is the default value when the widget is
685 	 * first created with gtk_label_new(). If you instead want to set the
686 	 * alignment of the label as a whole, use gtk_widget_set_halign() instead.
687 	 * gtk_label_set_justify() has no effect on labels containing only a
688 	 * single line.
689 	 *
690 	 * Params:
691 	 *     jtype = a #GtkJustification
692 	 */
693 	public void setJustify(GtkJustification jtype)
694 	{
695 		gtk_label_set_justify(gtkLabel, jtype);
696 	}
697 
698 	/**
699 	 * Sets the text of the label. The label is interpreted as
700 	 * including embedded underlines and/or Pango markup depending
701 	 * on the values of the #GtkLabel:use-underline and
702 	 * #GtkLabel:use-markup properties.
703 	 *
704 	 * Params:
705 	 *     str = the new text to set for the label
706 	 */
707 	public void setLabel(string str)
708 	{
709 		gtk_label_set_label(gtkLabel, Str.toStringz(str));
710 	}
711 
712 	/**
713 	 * Toggles line wrapping within the #GtkLabel widget. %TRUE makes it break
714 	 * lines if text exceeds the widget’s size. %FALSE lets the text get cut off
715 	 * by the edge of the widget if it exceeds the widget size.
716 	 *
717 	 * Note that setting line wrapping to %TRUE does not make the label
718 	 * wrap at its parent container’s width, because GTK+ widgets
719 	 * conceptually can’t make their requisition depend on the parent
720 	 * container’s size. For a label that wraps at a specific position,
721 	 * set the label’s width using gtk_widget_set_size_request().
722 	 *
723 	 * Params:
724 	 *     wrap = the setting
725 	 */
726 	public void setLineWrap(bool wrap)
727 	{
728 		gtk_label_set_line_wrap(gtkLabel, wrap);
729 	}
730 
731 	/**
732 	 * If line wrapping is on (see gtk_label_set_line_wrap()) this controls how
733 	 * the line wrapping is done. The default is %PANGO_WRAP_WORD which means
734 	 * wrap on word boundaries.
735 	 *
736 	 * Params:
737 	 *     wrapMode = the line wrapping mode
738 	 *
739 	 * Since: 2.10
740 	 */
741 	public void setLineWrapMode(PangoWrapMode wrapMode)
742 	{
743 		gtk_label_set_line_wrap_mode(gtkLabel, wrapMode);
744 	}
745 
746 	/**
747 	 * Sets the number of lines to which an ellipsized, wrapping label
748 	 * should be limited. This has no effect if the label is not wrapping
749 	 * or ellipsized. Set this to -1 if you don’t want to limit the
750 	 * number of lines.
751 	 *
752 	 * Params:
753 	 *     lines = the desired number of lines, or -1
754 	 *
755 	 * Since: 3.10
756 	 */
757 	public void setLines(int lines)
758 	{
759 		gtk_label_set_lines(gtkLabel, lines);
760 	}
761 
762 	/**
763 	 * Parses @str which is marked up with the
764 	 * [Pango text markup language][PangoMarkupFormat], setting the
765 	 * label’s text and attribute list based on the parse results.
766 	 *
767 	 * If the @str is external data, you may need to escape it with
768 	 * g_markup_escape_text() or g_markup_printf_escaped():
769 	 *
770 	 * |[<!-- language="C" -->
771 	 * const char *format = "<span style=\"italic\">\%s</span>";
772 	 * char *markup;
773 	 *
774 	 * markup = g_markup_printf_escaped (format, str);
775 	 * gtk_label_set_markup (GTK_LABEL (label), markup);
776 	 * g_free (markup);
777 	 * ]|
778 	 *
779 	 * This function will set the #GtkLabel:use-markup property to %TRUE as
780 	 * a side effect.
781 	 *
782 	 * If you set the label contents using the #GtkLabel:label property you
783 	 * should also ensure that you set the #GtkLabel:use-markup property
784 	 * accordingly.
785 	 *
786 	 * See also: gtk_label_set_text()
787 	 *
788 	 * Params:
789 	 *     str = a markup string (see [Pango markup format][PangoMarkupFormat])
790 	 */
791 	public void setMarkup(string str)
792 	{
793 		gtk_label_set_markup(gtkLabel, Str.toStringz(str));
794 	}
795 
796 	/**
797 	 * Parses @str which is marked up with the
798 	 * [Pango text markup language][PangoMarkupFormat],
799 	 * setting the label’s text and attribute list based on the parse results.
800 	 * If characters in @str are preceded by an underscore, they are underlined
801 	 * indicating that they represent a keyboard accelerator called a mnemonic.
802 	 *
803 	 * The mnemonic key can be used to activate another widget, chosen
804 	 * automatically, or explicitly using gtk_label_set_mnemonic_widget().
805 	 *
806 	 * Params:
807 	 *     str = a markup string (see
808 	 *         [Pango markup format][PangoMarkupFormat])
809 	 */
810 	public void setMarkupWithMnemonic(string str)
811 	{
812 		gtk_label_set_markup_with_mnemonic(gtkLabel, Str.toStringz(str));
813 	}
814 
815 	/**
816 	 * Sets the desired maximum width in characters of @label to @n_chars.
817 	 *
818 	 * Params:
819 	 *     nChars = the new desired maximum width, in characters.
820 	 *
821 	 * Since: 2.6
822 	 */
823 	public void setMaxWidthChars(int nChars)
824 	{
825 		gtk_label_set_max_width_chars(gtkLabel, nChars);
826 	}
827 
828 	/**
829 	 * If the label has been set so that it has an mnemonic key (using
830 	 * i.e. gtk_label_set_markup_with_mnemonic(),
831 	 * gtk_label_set_text_with_mnemonic(), gtk_label_new_with_mnemonic()
832 	 * or the “use_underline” property) the label can be associated with a
833 	 * widget that is the target of the mnemonic. When the label is inside
834 	 * a widget (like a #GtkButton or a #GtkNotebook tab) it is
835 	 * automatically associated with the correct widget, but sometimes
836 	 * (i.e. when the target is a #GtkEntry next to the label) you need to
837 	 * set it explicitly using this function.
838 	 *
839 	 * The target widget will be accelerated by emitting the
840 	 * GtkWidget::mnemonic-activate signal on it. The default handler for
841 	 * this signal will activate the widget if there are no mnemonic collisions
842 	 * and toggle focus between the colliding widgets otherwise.
843 	 *
844 	 * Params:
845 	 *     widget = the target #GtkWidget
846 	 */
847 	public void setMnemonicWidget(Widget widget)
848 	{
849 		gtk_label_set_mnemonic_widget(gtkLabel, (widget is null) ? null : widget.getWidgetStruct());
850 	}
851 
852 	/**
853 	 * The pattern of underlines you want under the existing text within the
854 	 * #GtkLabel widget.  For example if the current text of the label says
855 	 * “FooBarBaz” passing a pattern of “___   ___” will underline
856 	 * “Foo” and “Baz” but not “Bar”.
857 	 *
858 	 * Params:
859 	 *     pattern = The pattern as described above.
860 	 */
861 	public void setPattern(string pattern)
862 	{
863 		gtk_label_set_pattern(gtkLabel, Str.toStringz(pattern));
864 	}
865 
866 	/**
867 	 * Selectable labels allow the user to select text from the label, for
868 	 * copy-and-paste.
869 	 *
870 	 * Params:
871 	 *     setting = %TRUE to allow selecting text in the label
872 	 */
873 	public void setSelectable(bool setting)
874 	{
875 		gtk_label_set_selectable(gtkLabel, setting);
876 	}
877 
878 	/**
879 	 * Sets whether the label is in single line mode.
880 	 *
881 	 * Params:
882 	 *     singleLineMode = %TRUE if the label should be in single line mode
883 	 *
884 	 * Since: 2.6
885 	 */
886 	public void setSingleLineMode(bool singleLineMode)
887 	{
888 		gtk_label_set_single_line_mode(gtkLabel, singleLineMode);
889 	}
890 
891 	/**
892 	 * Sets the text within the #GtkLabel widget. It overwrites any text that
893 	 * was there before.
894 	 *
895 	 * This function will clear any previously set mnemonic accelerators, and
896 	 * set the #GtkLabel:use-underline property to %FALSE as a side effect.
897 	 *
898 	 * This function will set the #GtkLabel:use-markup property to %FALSE
899 	 * as a side effect.
900 	 *
901 	 * See also: gtk_label_set_markup()
902 	 *
903 	 * Params:
904 	 *     str = The text you want to set
905 	 */
906 	public void setText(string str)
907 	{
908 		gtk_label_set_text(gtkLabel, Str.toStringz(str));
909 	}
910 
911 	/**
912 	 * Sets the label’s text from the string @str.
913 	 * If characters in @str are preceded by an underscore, they are underlined
914 	 * indicating that they represent a keyboard accelerator called a mnemonic.
915 	 * The mnemonic key can be used to activate another widget, chosen
916 	 * automatically, or explicitly using gtk_label_set_mnemonic_widget().
917 	 *
918 	 * Params:
919 	 *     str = a string
920 	 */
921 	public void setTextWithMnemonic(string str)
922 	{
923 		gtk_label_set_text_with_mnemonic(gtkLabel, Str.toStringz(str));
924 	}
925 
926 	/**
927 	 * Sets whether the label should keep track of clicked
928 	 * links (and use a different color for them).
929 	 *
930 	 * Params:
931 	 *     trackLinks = %TRUE to track visited links
932 	 *
933 	 * Since: 2.18
934 	 */
935 	public void setTrackVisitedLinks(bool trackLinks)
936 	{
937 		gtk_label_set_track_visited_links(gtkLabel, trackLinks);
938 	}
939 
940 	/**
941 	 * Sets whether the text of the label contains markup in
942 	 * [Pango’s text markup language][PangoMarkupFormat].
943 	 * See gtk_label_set_markup().
944 	 *
945 	 * Params:
946 	 *     setting = %TRUE if the label’s text should be parsed for markup.
947 	 */
948 	public void setUseMarkup(bool setting)
949 	{
950 		gtk_label_set_use_markup(gtkLabel, setting);
951 	}
952 
953 	/**
954 	 * If true, an underline in the text indicates the next character should be
955 	 * used for the mnemonic accelerator key.
956 	 *
957 	 * Params:
958 	 *     setting = %TRUE if underlines in the text indicate mnemonics
959 	 */
960 	public void setUseUnderline(bool setting)
961 	{
962 		gtk_label_set_use_underline(gtkLabel, setting);
963 	}
964 
965 	/**
966 	 * Sets the desired width in characters of @label to @n_chars.
967 	 *
968 	 * Params:
969 	 *     nChars = the new desired width, in characters.
970 	 *
971 	 * Since: 2.6
972 	 */
973 	public void setWidthChars(int nChars)
974 	{
975 		gtk_label_set_width_chars(gtkLabel, nChars);
976 	}
977 
978 	/**
979 	 * Sets the #GtkLabel:xalign property for @label.
980 	 *
981 	 * Params:
982 	 *     xalign = the new xalign value, between 0 and 1
983 	 *
984 	 * Since: 3.16
985 	 */
986 	public void setXalign(float xalign)
987 	{
988 		gtk_label_set_xalign(gtkLabel, xalign);
989 	}
990 
991 	/**
992 	 * Sets the #GtkLabel:yalign property for @label.
993 	 *
994 	 * Params:
995 	 *     yalign = the new yalign value, between 0 and 1
996 	 *
997 	 * Since: 3.16
998 	 */
999 	public void setYalign(float yalign)
1000 	{
1001 		gtk_label_set_yalign(gtkLabel, yalign);
1002 	}
1003 
1004 	int[string] connectedSignals;
1005 
1006 	void delegate(Label)[] onActivateCurrentLinkListeners;
1007 	/**
1008 	 * A [keybinding signal][GtkBindingSignal]
1009 	 * which gets emitted when the user activates a link in the label.
1010 	 *
1011 	 * Applications may also emit the signal with g_signal_emit_by_name()
1012 	 * if they need to control activation of URIs programmatically.
1013 	 *
1014 	 * The default bindings for this signal are all forms of the Enter key.
1015 	 *
1016 	 * Since: 2.18
1017 	 */
1018 	void addOnActivateCurrentLink(void delegate(Label) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1019 	{
1020 		if ( "activate-current-link" !in connectedSignals )
1021 		{
1022 			Signals.connectData(
1023 				this,
1024 				"activate-current-link",
1025 				cast(GCallback)&callBackActivateCurrentLink,
1026 				cast(void*)this,
1027 				null,
1028 				connectFlags);
1029 			connectedSignals["activate-current-link"] = 1;
1030 		}
1031 		onActivateCurrentLinkListeners ~= dlg;
1032 	}
1033 	extern(C) static void callBackActivateCurrentLink(GtkLabel* labelStruct, Label _label)
1034 	{
1035 		foreach ( void delegate(Label) dlg; _label.onActivateCurrentLinkListeners )
1036 		{
1037 			dlg(_label);
1038 		}
1039 	}
1040 
1041 	bool delegate(string, Label)[] onActivateLinkListeners;
1042 	/**
1043 	 * The signal which gets emitted to activate a URI.
1044 	 * Applications may connect to it to override the default behaviour,
1045 	 * which is to call gtk_show_uri().
1046 	 *
1047 	 * Params:
1048 	 *     uri = the URI that is activated
1049 	 *
1050 	 * Return: %TRUE if the link has been activated
1051 	 *
1052 	 * Since: 2.18
1053 	 */
1054 	void addOnActivateLink(bool delegate(string, Label) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1055 	{
1056 		if ( "activate-link" !in connectedSignals )
1057 		{
1058 			Signals.connectData(
1059 				this,
1060 				"activate-link",
1061 				cast(GCallback)&callBackActivateLink,
1062 				cast(void*)this,
1063 				null,
1064 				connectFlags);
1065 			connectedSignals["activate-link"] = 1;
1066 		}
1067 		onActivateLinkListeners ~= dlg;
1068 	}
1069 	extern(C) static int callBackActivateLink(GtkLabel* labelStruct, char* uri, Label _label)
1070 	{
1071 		foreach ( bool delegate(string, Label) dlg; _label.onActivateLinkListeners )
1072 		{
1073 			if ( dlg(Str.toString(uri), _label) )
1074 			{
1075 				return 1;
1076 			}
1077 		}
1078 		
1079 		return 0;
1080 	}
1081 
1082 	void delegate(Label)[] onCopyClipboardListeners;
1083 	/**
1084 	 * The ::copy-clipboard signal is a
1085 	 * [keybinding signal][GtkBindingSignal]
1086 	 * which gets emitted to copy the selection to the clipboard.
1087 	 *
1088 	 * The default binding for this signal is Ctrl-c.
1089 	 */
1090 	void addOnCopyClipboard(void delegate(Label) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1091 	{
1092 		if ( "copy-clipboard" !in connectedSignals )
1093 		{
1094 			Signals.connectData(
1095 				this,
1096 				"copy-clipboard",
1097 				cast(GCallback)&callBackCopyClipboard,
1098 				cast(void*)this,
1099 				null,
1100 				connectFlags);
1101 			connectedSignals["copy-clipboard"] = 1;
1102 		}
1103 		onCopyClipboardListeners ~= dlg;
1104 	}
1105 	extern(C) static void callBackCopyClipboard(GtkLabel* labelStruct, Label _label)
1106 	{
1107 		foreach ( void delegate(Label) dlg; _label.onCopyClipboardListeners )
1108 		{
1109 			dlg(_label);
1110 		}
1111 	}
1112 
1113 	void delegate(GtkMovementStep, int, bool, Label)[] onMoveCursorListeners;
1114 	/**
1115 	 * The ::move-cursor signal is a
1116 	 * [keybinding signal][GtkBindingSignal]
1117 	 * which gets emitted when the user initiates a cursor movement.
1118 	 * If the cursor is not visible in @entry, this signal causes
1119 	 * the viewport to be moved instead.
1120 	 *
1121 	 * Applications should not connect to it, but may emit it with
1122 	 * g_signal_emit_by_name() if they need to control the cursor
1123 	 * programmatically.
1124 	 *
1125 	 * The default bindings for this signal come in two variants,
1126 	 * the variant with the Shift modifier extends the selection,
1127 	 * the variant without the Shift modifer does not.
1128 	 * There are too many key combinations to list them all here.
1129 	 * - Arrow keys move by individual characters/lines
1130 	 * - Ctrl-arrow key combinations move by words/paragraphs
1131 	 * - Home/End keys move to the ends of the buffer
1132 	 *
1133 	 * Params:
1134 	 *     step = the granularity of the move, as a #GtkMovementStep
1135 	 *     count = the number of @step units to move
1136 	 *     extendSelection = %TRUE if the move should extend the selection
1137 	 */
1138 	void addOnMoveCursor(void delegate(GtkMovementStep, int, bool, Label) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1139 	{
1140 		if ( "move-cursor" !in connectedSignals )
1141 		{
1142 			Signals.connectData(
1143 				this,
1144 				"move-cursor",
1145 				cast(GCallback)&callBackMoveCursor,
1146 				cast(void*)this,
1147 				null,
1148 				connectFlags);
1149 			connectedSignals["move-cursor"] = 1;
1150 		}
1151 		onMoveCursorListeners ~= dlg;
1152 	}
1153 	extern(C) static void callBackMoveCursor(GtkLabel* labelStruct, GtkMovementStep step, int count, bool extendSelection, Label _label)
1154 	{
1155 		foreach ( void delegate(GtkMovementStep, int, bool, Label) dlg; _label.onMoveCursorListeners )
1156 		{
1157 			dlg(step, count, extendSelection, _label);
1158 		}
1159 	}
1160 
1161 	void delegate(Menu, Label)[] onPopulatePopupListeners;
1162 	/**
1163 	 * The ::populate-popup signal gets emitted before showing the
1164 	 * context menu of the label. Note that only selectable labels
1165 	 * have context menus.
1166 	 *
1167 	 * If you need to add items to the context menu, connect
1168 	 * to this signal and append your menuitems to the @menu.
1169 	 *
1170 	 * Params:
1171 	 *     menu = the menu that is being populated
1172 	 */
1173 	void addOnPopulatePopup(void delegate(Menu, Label) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1174 	{
1175 		if ( "populate-popup" !in connectedSignals )
1176 		{
1177 			Signals.connectData(
1178 				this,
1179 				"populate-popup",
1180 				cast(GCallback)&callBackPopulatePopup,
1181 				cast(void*)this,
1182 				null,
1183 				connectFlags);
1184 			connectedSignals["populate-popup"] = 1;
1185 		}
1186 		onPopulatePopupListeners ~= dlg;
1187 	}
1188 	extern(C) static void callBackPopulatePopup(GtkLabel* labelStruct, GtkMenu* menu, Label _label)
1189 	{
1190 		foreach ( void delegate(Menu, Label) dlg; _label.onPopulatePopupListeners )
1191 		{
1192 			dlg(ObjectG.getDObject!(Menu)(menu), _label);
1193 		}
1194 	}
1195 }