Glib.Values

Entities

Simple Types

Array Types

Record Types

Subprograms

Description

<doc_ignore>Do not create automatic documentation for this package

C_GValues

type C_GValues is new System.Address;

An array of GValues

Free

procedure Free (Params : in out GParameter_Array)

Free the memory used by Params

Parameters
Params

Free

procedure Free (Val : in out GValues)

Deallocate the memory associated with the given Values array.

Parameters
Val

G_New

procedure G_New
   (Object  : not null access Glib.Object.GObject_Record'Class;
    Typ     : GType;
    Params  : GParameter_Array)

Allocate a new object and set properties.

Parameters
Object
Typ
Params

Get_Address

function  Get_Address (Value : GValue) return System.Address
Parameters
Value
Return Value

Get_Boolean

function  Get_Boolean (Value : GValue) return Boolean

Set_Boolean must only be called when Init has already been used. Otherwise use Init_Set_Boolean.

Parameters
Value
Return Value

Get_Boxed

function  Get_Boxed (Value : GValue) return System.Address

This is similar to Set_Address and Get_Address, except that the boxed type might have been associated with some specific initialization and finalization functions through Glib.Boxed_Type_Register_Static For instance: declare Typ : Glib.GType; Value : GValue; function To_Ref_Counted_Value is new Ada.Unchecked_Conversion (System.Address, My_Ref_Counted_Type); begin Typ := Boxed_Typed_Register_Static ("FOO", Copy'Access, Free'Access); Init (Value, Typ); Set_Boxed (Value, my_ref_counted_value.all'address);

Val := To_Ref_Counted_Value (Get_Boxed (Value));
Unset (Value);

end;

See also Glib.Generic_Properties.Generic_Internal_Boxed_Property.

Parameters
Value
Return Value

Get_Char

function  Get_Char (Value : GValue) return Gchar
Parameters
Value
Return Value

Get_Chars

function  Get_Chars (Value : GValue) return Gtkada.Types.Chars_Ptr
Parameters
Value
Return Value

Get_Double

function  Get_Double (Value : GValue) return Gdouble
Parameters
Value
Return Value

Get_Enum

function Get_Enum (Value : GValue) return Glib.Gint

These are used to manipulate the standard GtkAda enumeration types. For types that you have redefined yourself, you have access to more suitable functions directly in the package Generic_Enumeration_Property.

Parameters
Value
Return Value

Get_Flags

function Get_Flags (Value : GValue) return Glib.Guint

??? Should really manipulate Glib.Properties.Creation.Flags_Int_Value

Parameters
Value
Return Value

Get_Float

function  Get_Float (Value : GValue) return Gfloat
Parameters
Value
Return Value

Get_Int

function  Get_Int (Value : GValue) return Gint

Set_Int must only be called when Init has already been used. Otherwise use Init_Set_Int.

Parameters
Value
Return Value

Get_Long

function  Get_Long (Value : GValue) return Glong
Parameters
Value
Return Value

Get_Object

function Get_Object (Value : GValue) return Glib.Object.GObject

These are used to manipulate GObject instances.

Parameters
Value
Return Value

Get_Proxy

function  Get_Proxy (Value : GValue) return C_Proxy
Parameters
Value
Return Value

Get_String

function  Get_String (Value : GValue) return String
Parameters
Value
Return Value

Get_String

function  Get_String (Value : GValue; Length : Gint) return String
Parameters
Value
Length
Return Value

Get_Uchar

function  Get_Uchar (Value : GValue) return Guchar
Parameters
Value
Return Value

Get_Uint

function  Get_Uint (Value : GValue) return Guint
Parameters
Value
Return Value

Get_Ulong

function  Get_Ulong (Value : GValue) return Gulong
Parameters
Value
Return Value

GParameter

type GParameter is record
   Name  : Gtkada.Types.Chars_Ptr;
   Value : GValue;
end record;
Record fields
Name
Value

GParameter_Array

type GParameter_Array is array (Natural range <>) of GParameter;

GValue

type GValue is private;

A generic value that can hold any of the types as provided in the Set and Get functions below.

GValue_Array

type GValue_Array is array (Gint range <>) of GValue;

GValues

type GValues is private;

This type represents a table of values. Each argument of the table can be of any type. The index of the first element is always 1.

Init

procedure Init (Value : in out GValue; G_Type : Glib.GType)

Set the type of Value to G_Type. This limits the operations you can then apply to Value. For instance, Value must have been initialized with a GType_Int before you can use Set_Int (see below). Note that for enumeration types, you shouldn't use GType_Enum, but rather the exact GType corresponding to the enumeration. If you need to store a reference-counted type in a GValue, it is recommanded that you use a type derived from Boxed (see Set_Boxed below)

Parameters
Value
G_Type

Init_Set_Boolean

procedure Init_Set_Boolean (Value : in out GValue; V : Boolean)

Set_Boolean must only be called when Init has already been used. Otherwise use Init_Set_Boolean.

Parameters
Value
V

Init_Set_Int

procedure Init_Set_Int (Value : in out GValue; V : Gint)

Set_Int must only be called when Init has already been used. Otherwise use Init_Set_Int.

Parameters
Value
V

Init_Set_String

procedure Init_Set_String (Value : in out GValue; V : String)
Parameters
Value
V

Init_Set_Uint

procedure Init_Set_Uint (Value : in out GValue; V : Guint)
Parameters
Value
V

Make_Values

function Make_Values (Nb : Guint) return GValues

Create a new GValues structure from scratch. This procedure causes the allocation of an underlying C array, and this memory should be deallocated after use using procedure Free (see below).

Parameters
Nb
Return Value

Make_Values

function Make_Values (Nb : Guint; Val : C_GValues) return GValues

Build a GValues structure from the given C array. Nb should be the number of elements in the Values array.

Parameters
Nb
Val
Return Value

Nth

function Nth (Val : GValues; Num : Guint) return GValue

Return the Num-th element from Values. In general, the returned value does not need to be unset, since it is still handled by C (in particular when processing the parameters for a callback).

Parameters
Val
Num
Return Value

Set_Address

procedure Set_Address (Value : in out GValue; V_Address : System.Address)
Parameters
Value
V_Address

Set_Boolean

procedure Set_Boolean (Value : in out GValue; V_Boolean : Boolean)

Set_Boolean must only be called when Init has already been used. Otherwise use Init_Set_Boolean.

Parameters
Value
V_Boolean

Set_Boxed

procedure Set_Boxed (Value : in out GValue; V_Address : System.Address)

This is similar to Set_Address and Get_Address, except that the boxed type might have been associated with some specific initialization and finalization functions through Glib.Boxed_Type_Register_Static For instance: declare Typ : Glib.GType; Value : GValue; function To_Ref_Counted_Value is new Ada.Unchecked_Conversion (System.Address, My_Ref_Counted_Type); begin Typ := Boxed_Typed_Register_Static ("FOO", Copy'Access, Free'Access); Init (Value, Typ); Set_Boxed (Value, my_ref_counted_value.all'address);

Val := To_Ref_Counted_Value (Get_Boxed (Value));
Unset (Value);

end;

See also Glib.Generic_Properties.Generic_Internal_Boxed_Property.

Parameters
Value
V_Address

Set_Char

procedure Set_Char (Value : in out GValue; V_Char : Gchar)
Parameters
Value
V_Char

Set_Double

procedure Set_Double (Value : in out GValue; V_Double : Gdouble)
Parameters
Value
V_Double

Set_Enum

procedure Set_Enum (Value : in out GValue; V_Enum : Gint)

These are used to manipulate the standard GtkAda enumeration types. For types that you have redefined yourself, you have access to more suitable functions directly in the package Generic_Enumeration_Property.

Parameters
Value
V_Enum

Set_Flags

procedure Set_Flags (Value : in out GValue; V_Enum : Guint)

??? Should really manipulate Glib.Properties.Creation.Flags_Int_Value

Parameters
Value
V_Enum

Set_Float

procedure Set_Float (Value : in out GValue; V_Float : Gfloat)
Parameters
Value
V_Float

Set_Int

procedure Set_Int (Value : in out GValue; V_Int : Gint)

Set_Int must only be called when Init has already been used. Otherwise use Init_Set_Int.

Parameters
Value
V_Int

Set_Long

procedure Set_Long (Value : in out GValue; V_Long : Glong)
Parameters
Value
V_Long

Set_Object

procedure Set_Object
   (Value : in out GValue; To : access Glib.Object.GObject_Record'Class)

These are used to manipulate GObject instances.

Parameters
Value
To

Set_Proxy

procedure Set_Proxy (Value : in out GValue; V_Proxy : C_Proxy)
Parameters
Value
V_Proxy

Set_String

procedure Set_String (Value : in out GValue; V_String : String)
Parameters
Value
V_String

Set_Uchar

procedure Set_Uchar (Value : in out GValue; V_Uchar : Guchar)
Parameters
Value
V_Uchar

Set_Uint

procedure Set_Uint (Value : in out GValue; V_Uint : Guint)
Parameters
Value
V_Uint

Set_Ulong

procedure Set_Ulong (Value : in out GValue; V_Ulong : Gulong)
Parameters
Value
V_Ulong

Type_Of

function Type_Of (Value : GValue) return Glib.GType

Return the type of data that Value contains. It returns GType_Invalid if Value was not initialized

Parameters
Value
Return Value

Unsafe_Enum_Nth

generic
   type T is (<>);
function Unsafe_Enum_Nth
  (Values : C_GValues; Num : Guint) return T

Used for enumeration types

Generic formal parameters
T
Parameters
Values
Num
Return Value

Unsafe_Nth

procedure Unsafe_Nth (Values : C_GValues; Num : Guint; V : in out GValue)

This returns the Num-th element, starting at 0. This procedure does not check that Values contains at least Num elements, so is potentially dangerous. In general, the returned value does not need to be unset, since it is still handled by C (in particular when processing the parameters for a callback).

Parameters
Values
Num
V

Unsafe_Proxy_Nth

generic
   type T is private;
function Unsafe_Proxy_Nth (Values : C_GValues; Num : Guint) return T

Extract a point from Values (at index Num, 0-based), and convert it to T. This is unsafe because no check is made that Num is a valid index, and no check is made that casting to T makes sense.

Generic formal parameters
T
Parameters
Values
Num
Return Value

Unset

procedure Unset (Value : in out GValue)

Frees the memory allocate for Value (like strings contents) in the call to Init. You only need to call this function in cases where you have called Init yourself.

Parameters
Value