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