Index

Package: Label

Description

package Gtk.Label is
should be made selectable. </description>

Binding from C File version 2.8.17

<testgtk>create_label.adb</testgtk>

Screenshot

gtk-label.png

Classes

Gtk_Label_Record

type Gtk_Label_Record is new Misc.Gtk_Misc_Record with private;

Ancestors:

Immediate Children:

Primitive operations:

Get_Attributes
Get_Ellipsize
Get_Layout_Offsets
Get_Line_Wrap
Get_Line_Wrap_Mode
Get_Max_Width_Chars
Get_Mnemonic_Keyval
Get_Mnemonic_Widget
Get_Selectable
Get_Selection_Bounds
Get_Single_Line_Mode
Get_Use_Markup
Get_Use_Underline
Get_Width_Chars
Glib.Object.Deallocate (Inherited)
Glib.Object.Notify (Inherited)
Glib.Object.Ref (Inherited)
Glib.Object.Unref (Inherited)
Gtk.Misc.Get_Alignment (Inherited)
Gtk.Misc.Get_Padding (Inherited)
Gtk.Misc.Set_Alignment (Inherited)
Gtk.Misc.Set_Padding (Inherited)
Gtk.Object.Destroy (Inherited)
Gtk.Object.Flag_Is_Set (Inherited)
Gtk.Object.Flags (Inherited)
Gtk.Object.Get_Type (Inherited)
Gtk.Object.Set_Flags (Inherited)
Gtk.Object.Sink (Inherited)
Gtk.Object.Unset_Flags (Inherited)
Gtk.Widget.Activate (Inherited)
Gtk.Widget.Add_Accelerator (Inherited)
Gtk.Widget.Add_Events (Inherited)
Gtk.Widget.Add_Mnemonic_Label (Inherited)
Gtk.Widget.Can_Activate_Accel (Inherited)
Gtk.Widget.Child_Notify (Inherited)
Gtk.Widget.Class_Path (Inherited)
Gtk.Widget.Class_Path_Reversed (Inherited)
Gtk.Widget.Create_Pango_Context (Inherited)
Gtk.Widget.Create_Pango_Layout (Inherited)
Gtk.Widget.Draw (Inherited)
Gtk.Widget.Ensure_Style (Inherited)
Gtk.Widget.Error_Bell (Inherited)
Gtk.Widget.Freeze_Child_Notify (Inherited)
Gtk.Widget.Get_Allocation_Height (Inherited)
Gtk.Widget.Get_Allocation_Width (Inherited)
Gtk.Widget.Get_Allocation_X (Inherited)
Gtk.Widget.Get_Allocation_Y (Inherited)
Gtk.Widget.Get_Ancestor (Inherited)
Gtk.Widget.Get_Child_Requisition (Inherited)
Gtk.Widget.Get_Child_Visible (Inherited)
Gtk.Widget.Get_Colormap (Inherited)
Gtk.Widget.Get_Composite_Name (Inherited)
Gtk.Widget.Get_Direction (Inherited)
Gtk.Widget.Get_Events (Inherited)
Gtk.Widget.Get_Extension_Events (Inherited)
Gtk.Widget.Get_Has_Tooltip (Inherited)
Gtk.Widget.Get_Name (Inherited)
Gtk.Widget.Get_No_Show_All (Inherited)
Gtk.Widget.Get_Pango_Context (Inherited)
Gtk.Widget.Get_Parent (Inherited)
Gtk.Widget.Get_Parent_Window (Inherited)
Gtk.Widget.Get_Pointer (Inherited)
Gtk.Widget.Get_Root_Window (Inherited)
Gtk.Widget.Get_Size_Request (Inherited)
Gtk.Widget.Get_Snapshot (Inherited)
Gtk.Widget.Get_State (Inherited)
Gtk.Widget.Get_Style (Inherited)
Gtk.Widget.Get_Tooltip_Markup (Inherited)
Gtk.Widget.Get_Tooltip_Text (Inherited)
Gtk.Widget.Get_Tooltip_Window (Inherited)
Gtk.Widget.Get_Toplevel (Inherited)
Gtk.Widget.Get_Visual (Inherited)
Gtk.Widget.Get_Window (Inherited)
Gtk.Widget.Grab_Default (Inherited)
Gtk.Widget.Grab_Focus (Inherited)
Gtk.Widget.Has_Screen (Inherited)
Gtk.Widget.Hide (Inherited)
Gtk.Widget.Hide_All (Inherited)
Gtk.Widget.Input_Shape_Combine_Mask (Inherited)
Gtk.Widget.Intersect (Inherited)
Gtk.Widget.Is_Ancestor (Inherited)
Gtk.Widget.Is_Composited (Inherited)
Gtk.Widget.Is_Focus (Inherited)
Gtk.Widget.Keynav_Failed (Inherited)
Gtk.Widget.List_Mnemonic_Labels (Inherited)
Gtk.Widget.Map (Inherited)
Gtk.Widget.Mnemonic_Activate (Inherited)
Gtk.Widget.Modify_Base (Inherited)
Gtk.Widget.Modify_Bg (Inherited)
Gtk.Widget.Modify_Cursor (Inherited)
Gtk.Widget.Modify_Fg (Inherited)
Gtk.Widget.Modify_Font (Inherited)
Gtk.Widget.Modify_Text (Inherited)
Gtk.Widget.Path (Inherited)
Gtk.Widget.Path_Reversed (Inherited)
Gtk.Widget.Queue_Clear (Inherited)
Gtk.Widget.Queue_Clear_Area (Inherited)
Gtk.Widget.Queue_Draw (Inherited)
Gtk.Widget.Queue_Draw_Area (Inherited)
Gtk.Widget.Queue_Resize (Inherited)
Gtk.Widget.Queue_Resize_No_Redraw (Inherited)
Gtk.Widget.Realize (Inherited)
Gtk.Widget.Region_Intersect (Inherited)
Gtk.Widget.Remove_Accelerator (Inherited)
Gtk.Widget.Remove_Mnemonic_Label (Inherited)
Gtk.Widget.Render_Icon (Inherited)
Gtk.Widget.Reparent (Inherited)
Gtk.Widget.Reset_Rc_Styles (Inherited)
Gtk.Widget.Reset_Shapes (Inherited)
Gtk.Widget.Restore_Default_Style (Inherited)
Gtk.Widget.Send_Expose (Inherited)
Gtk.Widget.Set_Accel_Path (Inherited)
Gtk.Widget.Set_App_Paintable (Inherited)
Gtk.Widget.Set_Child_Visible (Inherited)
Gtk.Widget.Set_Colormap (Inherited)
Gtk.Widget.Set_Composite_Name (Inherited)
Gtk.Widget.Set_Direction (Inherited)
Gtk.Widget.Set_Double_Buffered (Inherited)
Gtk.Widget.Set_Events (Inherited)
Gtk.Widget.Set_Extension_Events (Inherited)
Gtk.Widget.Set_Has_Tooltip (Inherited)
Gtk.Widget.Set_Name (Inherited)
Gtk.Widget.Set_No_Show_All (Inherited)
Gtk.Widget.Set_Parent (Inherited)
Gtk.Widget.Set_Parent_Window (Inherited)
Gtk.Widget.Set_Redraw_On_Allocate (Inherited)
Gtk.Widget.Set_Scroll_Adjustments (Inherited)
Gtk.Widget.Set_Sensitive (Inherited)
Gtk.Widget.Set_Size_Request (Inherited)
Gtk.Widget.Set_State (Inherited)
Gtk.Widget.Set_Style (Inherited)
Gtk.Widget.Set_Tooltip_Markup (Inherited)
Gtk.Widget.Set_Tooltip_Text (Inherited)
Gtk.Widget.Set_Tooltip_Window (Inherited)
Gtk.Widget.Set_UPosition (Inherited)
Gtk.Widget.Set_USize (Inherited)
Gtk.Widget.Set_Window (Inherited)
Gtk.Widget.Shape_Combine_Mask (Inherited)
Gtk.Widget.Show (Inherited)
Gtk.Widget.Show_All (Inherited)
Gtk.Widget.Show_Now (Inherited)
Gtk.Widget.Size_Allocate (Inherited)
Gtk.Widget.Size_Request (Inherited)
Gtk.Widget.Style_Get_Property (Inherited)
Gtk.Widget.Thaw_Child_Notify (Inherited)
Gtk.Widget.Trigger_Tooltip_Query (Inherited)
Gtk.Widget.Unmap (Inherited)
Gtk.Widget.Unrealize (Inherited)
Select_Region
Set_Attributes
Set_Ellipsize
Set_Line_Wrap
Set_Line_Wrap_Mode
Set_Markup_With_Mnemonic
Set_Max_Width_Chars
Set_Mnemonic_Widget
Set_Selectable
Set_Single_Line_Mode
Set_Text_With_Mnemonic
Set_Use_Markup
Set_Use_Underline
Set_Width_Chars

Types

Gtk_Label

type Gtk_Label is access all Gtk_Label_Record'Class;

Constants & Global variables

Label_Property (Glib.Properties.Property_String)

Label_Property            : constant Glib.Properties.Property_String;
Attributes_Property : constant ???

Use_Markup_Property (Glib.Properties.Property_Boolean)

Use_Markup_Property       : constant Glib.Properties.Property_Boolean;
Attributes_Property : constant ???

Use_Underline_Property (Glib.Properties.Property_Boolean)

Use_Underline_Property    : constant Glib.Properties.Property_Boolean;

Wrap_Mode_Property (Glib.Properties.Property_Enum)

Wrap_Mode_Property        : constant Glib.Properties.Property_Enum;

Mnemonic_Keyval_Property (Glib.Properties.Property_Uint_RO)

Mnemonic_Keyval_Property  : constant Glib.Properties.Property_Uint_RO;

Mnemonic_Widget_Property (Glib.Properties.Property_Object)

Mnemonic_Widget_Property  : constant Glib.Properties.Property_Object;

Cursor_Position_Property (Glib.Properties.Property_Int)

Cursor_Position_Property  : constant Glib.Properties.Property_Int;
Ellipsize_Property : constant Glib.Properties.Property_Enum;

Max_Width_Chars_Property (Glib.Properties.Property_Int)

Max_Width_Chars_Property  : constant Glib.Properties.Property_Int;
Ellipsize_Property : constant Glib.Properties.Property_Enum;

Selection_Bound_Property (Glib.Properties.Property_Int)

Selection_Bound_Property  : constant Glib.Properties.Property_Int;

Single_Line_Mode_Property (Glib.Properties.Property_Boolean)

Single_Line_Mode_Property : constant Glib.Properties.Property_Boolean;

Width_Chars_Property (Glib.Properties.Property_Int)

Width_Chars_Property      : constant Glib.Properties.Property_Int;

Signal_Copy_Clipboard (Glib.Signal_Name)

Signal_Copy_Clipboard : constant Glib.Signal_Name := "copy_clipboard";

Signal_Move_Cursor (Glib.Signal_Name)

Signal_Move_Cursor    : constant Glib.Signal_Name := "move_cursor";

Signal_Populate_Popup (Glib.Signal_Name)

Signal_Populate_Popup : constant Glib.Signal_Name := "populate_popup";

Subprograms & Entries

Gtk_New

procedure Gtk_New 
(Label: out Gtk_Label;
Str: UTF8_String := "");

Initialize

procedure Initialize 
(Label: access Gtk_Label_Record'Class;
Str: UTF8_String);
Creates or initializes a new label. Str is the string to be displayed.

Gtk_New_With_Mnemonic

procedure Gtk_New_With_Mnemonic 
(Label: out Gtk_Label;
Str: UTF8_String);

Initialize_With_Mnemonic

procedure Initialize_With_Mnemonic 
(Label: access Gtk_Label_Record'Class;
Str: UTF8_String);
Creates or initializes a new label containing the text in Str. If characters in Str are preceded by an underscore, they are underlined indicating that they represent a keyboard accelerator called a mnemonic. The mnemonic key can be used to activate another widget, chosen automatically or explicitely using Set_Mnemonic_Widget.

Get_Type

function Get_Type return Glib.GType;
Return the internal value associated with a Gtk_Label.

Set_Justify

procedure Set_Justify 
(Label: access Gtk_Label_Record;
Jtype: Enums.Gtk_Justification);

Get_Justify

function Get_Justify 
(Label: access Gtk_Label_Record) return Enums.Gtk_Justification;
Set the justification for the label. The default value is Justify_Center, which means that the text will be centered in the label. Note that this setting has an impact only when the Gtk_Label is larger than the text (its default width is the same as the text) and contains multiple lines. To justify a single line label, you should instead call Set_Alignment and make sure that the label or any surrounding container fills its horizontal allocated space.

Set_Line_Wrap

procedure Set_Line_Wrap 
(Label: access Gtk_Label_Record;
Wrap: Boolean);

Get_Line_Wrap

function  Get_Line_Wrap 
(Label: access Gtk_Label_Record) return Boolean;
Toggle line wrapping within Label. if Wrap is True, then Label will break lines if the text is larger then the widget's size. If Wrap is False, then the text is simply cut off.

Set_Line_Wrap_Mode

procedure Set_Line_Wrap_Mode 
(Label: access Gtk_Label_Record;
Wrap_Mode: Pango.Layout.Pango_Wrap_Mode);

Get_Line_Wrap_Mode

function Get_Line_Wrap_Mode 
(Label: access Gtk_Label_Record) return Pango.Layout.Pango_Wrap_Mode;
If line wrapping is on (see Set_Line_Wrap) this controls how the line wrapping is done. The default is Pango_Wrap_Word which means wrap on word boundaries.

Set_Selectable

procedure Set_Selectable 
(Label: access Gtk_Label_Record;
Selectable: Boolean);

Get_Selectable

function  Get_Selectable 
(Label: access Gtk_Label_Record) return Boolean;
Selectable labels allow the user to select text from the label, for copy-and-paste.

Set_Use_Markup

procedure Set_Use_Markup 
(Label: access Gtk_Label_Record;
Markup: Boolean);

Get_Use_Markup

function Get_Use_Markup 
(Label: access Gtk_Label_Record) return Boolean;
Sets whether the text of the label contains markup in Pango's text markup language. If Markup is True, then Label will be parsed for markup.

Set_Use_Underline

procedure Set_Use_Underline 
(Label: access Gtk_Label_Record;
Underline: Boolean);

Get_Use_Underline

function Get_Use_Underline 
(Label: access Gtk_Label_Record) return Boolean;
Indicates wether an embedded underline in the label indicates the mnemonic accelerator key.

Set_Angle

procedure Set_Angle 
(Label: access Gtk_Label_Record;
Angle: Gdouble);

Get_Angle

function Get_Angle  
(Label: access Gtk_Label_Record) return Gdouble;
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. The angle setting for the label is ignored if the label is selectable, wrapped, or ellipsized.

Set_Ellipsize

procedure Set_Ellipsize 
(Label: access Gtk_Label_Record;
Mode: Pango.Layout.Pango_Ellipsize_Mode);

Get_Ellipsize

function Get_Ellipsize 
(Label: access Gtk_Label_Record) return Pango.Layout.Pango_Ellipsize_Mode;
Sets the mode used to ellipsize (add an ellipsis: "...") to the text if there is not enough space to render the entire string.

Set_Text

procedure Set_Text 
(Label: access Gtk_Label_Record;
Str: UTF8_String);

Get_Text

function  Get_Text 
(Label: access Gtk_Label_Record) return UTF8_String;
Change the text of the label. The new text is visible on the screen at once. Note that the underline pattern is not modified.

Set_Label

procedure Set_Label 
(Label: access Gtk_Label_Record;
Str: String);

Get_Label

function Get_Label  
(Label: access Gtk_Label_Record) return String;
Sets the text of the label. The label is interpreted as including embedded underlines and/or Pango markup depending on the values of label->use_underline and label->use_markup.

Get_Layout

function Get_Layout 
(Label: access Gtk_Label_Record) return Pango.Layout.Pango_Layout;
Gets the layout used to display the label. The layout is useful to e.g. convert text positions to pixel positions, in combination with Get_Layout_Offsets(). The returned layout is owned by the label so need not be freed by the caller.

Get_Layout_Offsets

procedure Get_Layout_Offsets 
(Label: access Gtk_Label_Record;
X, Y: out Gint);
Obtains the coordinates where the label will draw the layout representing the text in the label; useful to convert mouse events into coordinates inside the layout, e.g. to take some action if some part of the label is clicked. Of course you will need to create a Gtk_Event_Box to receive the events, and pack the label inside it, since labels are a #GTK_NO_WINDOW widget. Remember when using the layout functions you need to convert to and from pixels using PANGO_PIXELS() or #PANGO_SCALE.

Set_Max_Width_Chars

procedure Set_Max_Width_Chars 
(Label: access Gtk_Label_Record;
N_Chars: Gint);

Get_Max_Width_Chars

function Get_Max_Width_Chars 
(Label: access Gtk_Label_Record) return Gint;
Sets the desired maximum width in characters of Label

Set_Width_Chars

procedure Set_Width_Chars 
(Label: access Gtk_Label_Record;
N_Chars: Gint);

Get_Width_Chars

function Get_Width_Chars  
(Label: access Gtk_Label_Record) return Gint;
Sets the desired width in characters of Label.

Set_Single_Line_Mode

procedure Set_Single_Line_Mode 
(Label: access Gtk_Label_Record;
Single_Line_Mode: Boolean);

Get_Single_Line_Mode

function Get_Single_Line_Mode 
(Label: access Gtk_Label_Record) return Boolean;
Sets whether the label is in single line mode.

Get_Mnemonic_Keyval

function Get_Mnemonic_Keyval 
(Label: access Gtk_Label_Record) return Gdk.Types.Gdk_Key_Type;
Return the key value of the mnemonic accelerator key indicated by an embedded underline in the label. If there is no mnemonic set up it returns Gdk.Types.Keysyms.GDK_VoidSymbol.

Set_Attributes

procedure Set_Attributes 
(Label: access Gtk_Label_Record;
Attrs: Pango.Attributes.Pango_Attr_List);

Get_Attributes

function Get_Attributes 
(Label: access Gtk_Label_Record) return Pango.Attributes.Pango_Attr_List;
Sets a list of attributes to be applied to the label text. These attributes will be ignored if the use_underline or use_markup properties are set. Get_Attributes does not reflect attributes that come from the label's markup (see Set_Markup). If you want to get the effective attributes for the label, use Pango.Layout.Get_Attribute (Get_Layout (Label)).

Set_Text_With_Mnemonic

procedure Set_Text_With_Mnemonic 
(Label: access Gtk_Label_Record;
Str: UTF8_String);
Change the text and mnemonic key of the label. The new text and mnemonic are visible on the screen at once. The mnemonic key can be used to activate another widget, chosen automatically or explicitely using Set_Mnemonic_Widget.

Set_Markup

procedure Set_Markup 
(Label: access Gtk_Label_Record;
Str: UTF8_String);
Parses Str which is marked up with the Pango text markup language, setting the label's text and attribute list based on the parse results.

Set_Markup_With_Mnemonic

procedure Set_Markup_With_Mnemonic 
(Label: access Gtk_Label_Record;
Str: UTF8_String);
Parse Str which is marked up with the Pango text markup language, setting the label's text and attribute list based on the parse results. If characters in Str are preceded by an underscore, they are underlined indicating that they represent a mnemonic. The mnemonic key can be used to activate another widget, chosen automatically or explicitely using Set_Mnemonic_Widget.

Set_Mnemonic_Widget

procedure Set_Mnemonic_Widget 
(Label: access Gtk_Label_Record;
Widget: access Gtk.Widget.Gtk_Widget_Record'Class);

Get_Mnemonic_Widget

function Get_Mnemonic_Widget 
(Label: access Gtk_Label_Record) return Gtk.Widget.Gtk_Widget;
If the label has been set so that it has an mnemonic key, the label can be associated with a widget that is the target of the mnemonic. When the label is inside a widget (like a Gtk_Button or a Gtk_Notebook tab), it is automatically associated with the correct widget, but sometimes (i.e. when the target is a Gtk_Entry next to the label), you need to set it explicitly using this procedure. The target widget will be accelerated by emitting "mnemonic_activate" on it. The default handler for this signal will activate the widget if there are no mnemonic collisions and toggle focus between the colliding widgets otherwise.

Select_Region

procedure Select_Region 
(Label: access Gtk_Label_Record;
Start_Offset: Integer := -1;
End_Offset: Integer := -1);
Selects a range of characters in the label, if the label is selectable. If Start or End are -1, then the end of the label will be substituted.

Get_Selection_Bounds

procedure Get_Selection_Bounds 
(Label: access Gtk_Label_Record;
First, Last: out Gint;
Has_Selection: out Boolean);
Gets the selected range of characters in the label, returning True if there's a selection.

Set_Pattern

procedure Set_Pattern 
(Label: access Gtk_Label_Record;
Pattern: String);
Change the underlines pattern. Pattern is a simple string made of underscore and space characters, matching the ones in the string. GtkAda will underline every letter that matches an underscore. An empty string disables the underlines. example: If the text is FooBarBaz and the Pattern is "___ ___" then both "Foo" and "Baz" will be underlined, but not "Bar".

Get

function Get 
(Label: access Gtk_Label_Record) return UTF8_String renames Get_Text;
pragma Obsolescent; Same as Get_Text.