gtk :: GtkLabel :: defaultinit
# A widget that displays a small to medium amount of text
# See: https://developer.gnome.org/gtk3/3.2/GtkLabel.html
extern class GtkLabel `{GtkLabel *`}
super GtkMisc
# Create a GtkLabel with text
new (text: String) import String.to_cstring `{
return (GtkLabel*)gtk_label_new(String_to_cstring(text));
`}
# Set the text of the label
fun text=(text: String) import String.to_cstring `{
gtk_label_set_text(self, String_to_cstring(text));
`}
# Returns the text of the label
fun text: String import CString.to_s `{
return CString_to_s((char*)gtk_label_get_text(self));
`}
# Sets the angle of rotation for the label.
# An angle of 90 reads from from bottom to top, an angle of 270, from top to bottom.
fun angle=(degre: Float) `{
gtk_label_set_angle(self, degre);
`}
# Returns the angle of rotation for the label.
fun angle: Float `{
return gtk_label_get_angle(self);
`}
# Set simple formatted text content from a `format` string and the `content` which is escaped
#
# ~~~nitish
# GtkLabel lbl = new GtkLabel("Non-formatted text")
# lbl.set_markup("<span style=\"italic\">\%s</span>".to_cstring,
# "Italic content")
# ~~~
fun set_markup(format, content: CString) `{
char *formatted = g_markup_printf_escaped(format, content);
gtk_label_set_markup(self, formatted);
g_free(formatted);
`}
# Set justification of the lines in the label relative to each other
fun justify=(value: GtkJustification) `{ gtk_label_set_justify(self, value); `}
# Get justification of the lines in the label relative to each other
fun justify: GtkJustification `{ return gtk_label_get_justify(self); `}
end
lib/gtk/v3_4/gtk_core.nit:669,1--718,3