package Implements_Buildable is new Glib.Types.Implements (Gtk.Buildable.Gtk_Buildable, Gtk_Label_Record, Gtk_Label);
type Gtk_Label_Record is new Gtk_Misc_Record with null record;
type Gtk_Label is access all Gtk_Label_Record'Class;
Angle_Property : constant Glib.Properties.Property_Double;
Cursor_Position_Property : constant Glib.Properties.Property_Int;
Justify_Property : constant Gtk.Enums.Property_Gtk_Justification;
Label_Property : constant Glib.Properties.Property_String;
Max_Width_Chars_Property : constant Glib.Properties.Property_Int;
Mnemonic_Keyval_Property : constant Glib.Properties.Property_Uint;
Mnemonic_Widget_Property : constant Glib.Properties.Property_Object;
Pattern_Property : constant Glib.Properties.Property_String;
Selectable_Property : constant Glib.Properties.Property_Boolean;
Selection_Bound_Property : constant Glib.Properties.Property_Int;
Single_Line_Mode_Property : constant Glib.Properties.Property_Boolean;
Track_Visited_Links_Property : constant Glib.Properties.Property_Boolean;
Use_Markup_Property : constant Glib.Properties.Property_Boolean;
Use_Underline_Property : constant Glib.Properties.Property_Boolean;
Width_Chars_Property : constant Glib.Properties.Property_Int;
Wrap_Property : constant Glib.Properties.Property_Boolean;
Signal_Activate_Current_Link : constant Glib.Signal_Name := "activate-current-link";
Signal_Activate_Link : constant Glib.Signal_Name := "activate-link";
Signal_Copy_Clipboard : constant Glib.Signal_Name := "copy-clipboard";
Signal_Move_Cursor : constant Glib.Signal_Name := "move-cursor";
Signal_Populate_Popup : constant Glib.Signal_Name := "populate-popup";
procedure Gtk_New
( | Label | : out Gtk_Label; |
Str | : UTF8_String := ""); |
procedure Initialize
( | Label | : access Gtk_Label_Record'Class; |
Str | : UTF8_String := ""); |
procedure Gtk_New_With_Mnemonic
( | Label | : out Gtk_Label; |
Str | : UTF8_String); |
procedure Initialize_With_Mnemonic
( | Label | : access Gtk_Label_Record'Class; |
Str | : UTF8_String); |
function Get_Type return Glib.GType;
function Get_Angle
( | Label | : access Gtk_Label_Record) return Gdouble; |
procedure Set_Angle
( | Label | : access Gtk_Label_Record; |
Angle | : Gdouble); |
function Get_Attributes
( | Label | : access Gtk_Label_Record) return Pango.Attributes.Pango_Attr_List; |
procedure Set_Attributes
( | Label | : access Gtk_Label_Record; |
Attrs | : out Pango.Attributes.Pango_Attr_List); |
function Get_Current_Uri
( | Label | : access Gtk_Label_Record) return UTF8_String; |
function Get_Ellipsize
( | Label | : access Gtk_Label_Record) return Pango.Layout.Pango_Ellipsize_Mode; |
procedure Set_Ellipsize
( | Label | : access Gtk_Label_Record; |
Mode | : Pango.Layout.Pango_Ellipsize_Mode); |
function Get_Justify
( | Label | : access Gtk_Label_Record) return Gtk.Enums.Gtk_Justification; |
procedure Set_Justify
( | Label | : access Gtk_Label_Record; |
Jtype | : Gtk.Enums.Gtk_Justification); |
function Get_Label
( | Label | : access Gtk_Label_Record) return UTF8_String; |
procedure Set_Label
( | Label | : access Gtk_Label_Record; |
Str | : UTF8_String); |
function Get_Layout
( | Label | : access Gtk_Label_Record) return Pango.Layout.Pango_Layout; |
procedure Get_Layout_Offsets
( | Label | : access Gtk_Label_Record; |
X | : out Gint; | |
Y | : out Gint); |
function Get_Line_Wrap
( | Label | : access Gtk_Label_Record) return Boolean; |
procedure Set_Line_Wrap
( | Label | : access Gtk_Label_Record; |
Wrap | : Boolean); |
function Get_Line_Wrap_Mode
( | Label | : access Gtk_Label_Record) return Pango.Layout.Pango_Wrap_Mode; |
procedure Set_Line_Wrap_Mode
( | Label | : access Gtk_Label_Record; |
Wrap_Mode | : Pango.Layout.Pango_Wrap_Mode); |
function Get_Max_Width_Chars
( | Label | : access Gtk_Label_Record) return Gint; |
procedure Set_Max_Width_Chars
( | Label | : access Gtk_Label_Record; |
N_Chars | : Gint); |
function Get_Mnemonic_Keyval
( | Label | : access Gtk_Label_Record) return Guint; |
function Get_Mnemonic_Widget
( | Label | : access Gtk_Label_Record) return Gtk.Widget.Gtk_Widget; |
procedure Set_Mnemonic_Widget
( | Label | : access Gtk_Label_Record; |
Widget | : access Gtk.Widget.Gtk_Widget_Record'Class); |
function Get_Selectable
( | Label | : access Gtk_Label_Record) return Boolean; |
procedure Set_Selectable
( | Label | : access Gtk_Label_Record; |
Setting | : Boolean); |
procedure Get_Selection_Bounds
( | Label | : access Gtk_Label_Record; |
Start | : out Gint; | |
The_End | : out Gint; | |
Has_Selection | : out Boolean); |
function Get_Single_Line_Mode
( | Label | : access Gtk_Label_Record) return Boolean; |
procedure Set_Single_Line_Mode
( | Label | : access Gtk_Label_Record; |
Single_Line_Mode | : Boolean); |
function Get_Text
( | Label | : access Gtk_Label_Record) return UTF8_String; |
procedure Set_Text
( | Label | : access Gtk_Label_Record; |
Str | : UTF8_String); |
function Get_Track_Visited_Links
( | Label | : access Gtk_Label_Record) return Boolean; |
procedure Set_Track_Visited_Links
( | Label | : access Gtk_Label_Record; |
Track_Links | : Boolean); |
function Get_Use_Markup
( | Label | : access Gtk_Label_Record) return Boolean; |
procedure Set_Use_Markup
( | Label | : access Gtk_Label_Record; |
Setting | : Boolean); |
function Get_Use_Underline
( | Label | : access Gtk_Label_Record) return Boolean; |
procedure Set_Use_Underline
( | Label | : access Gtk_Label_Record; |
Setting | : Boolean); |
function Get_Width_Chars
( | Label | : access Gtk_Label_Record) return Gint; |
procedure Set_Width_Chars
( | Label | : access Gtk_Label_Record; |
N_Chars | : Gint); |
function Parse_Uline
( | Label | : access Gtk_Label_Record; |
String | : UTF8_String) return Guint; |
procedure Select_Region
( | Label | : access Gtk_Label_Record; |
Start_Offset | : Gint := -1; | |
End_Offset | : Gint := -1); |
procedure Set_Markup
( | Label | : access Gtk_Label_Record; |
Str | : UTF8_String); |
procedure Set_Markup_With_Mnemonic
( | Label | : access Gtk_Label_Record; |
Str | : UTF8_String); |
procedure Set_Pattern
( | Label | : access Gtk_Label_Record; |
Pattern | : UTF8_String); |
procedure Set_Text_With_Mnemonic
( | Label | : access Gtk_Label_Record; |
Str | : UTF8_String); |
function "+"
( | Widget | : access Gtk_Label_Record'Class) return Gtk.Buildable.Gtk_Buildable renames Implements_Buildable.To_Interface; |
function "-"
( | Interf | : Gtk.Buildable.Gtk_Buildable) return Gtk_Label renames Implements_Buildable.To_Object; |
A Gtk_Label is a light widget associated with some text you want to display on the screen. You can change the text dynamically if needed.
The text can be on multiple lines if you separate each line with the ASCII.LF character. However, this is not the recommended way to display long texts (see the Gtk_Text widget instead). == Mnemonics == Labels may contain mnemonics. Mnemonics are underlined characters in the label, used for keyboard navigation. Mnemonics are created by providing string with an underscore before the mnemonic character, such as "_File", to the functions gtk_new_with_mnemonic or set_text_with_mnemonic().
Mnemonics automatically activate any activatable widget the label is inside, such as a Gtk_Button; if the label is not inside the mnemonic's target widget, you have to tell the label about the target using set_mnemonic_widget(). For instance: declare Button : Gtk_Button; Label : Gtk_Label; begin Gtk_New (Button); Gtk_New_With_Mnemonic (Label, "_File"); Add (Button, Label); end; However, there exists a convenience function in Gtk.Button to create such a button already. == Markup == To make it easy to format text in a label (changing colors, fonts, etc.), label text can be provided in a simple markup format. Here's how to create a label with a small font: Gtk_New (Label, "<small>hello</small>"); The markup must be valid, and <>& characters must be escaped with < > and & Markup strings are just a convenient way to set the Pango_Attr_List on label; Set_Attributes() may be a simpler way to set attributes in some cases. Be careful though; Pango_Attr_List tends to cause internationalization problems, unless you're applying attributes to the entire string (i.e. unless you set the range of each attribute to [0, G_MAXINT)). The reason is that specifying the start_index and end_index for a Pango_Attribute requires knowledge of the exact string being displayed, so translations will cause problems. == Selectable labels == Labels can be made selectable with Set_Selectable. Selectable labels allow the user to copy the label contents to the clipboard. Only should be made selectable.