Index

Package: Builder

Description

package Gtk.Builder is

Gtk.Builder - Build an interface from an XML UI definition as produced by the Glade-3 GUI builder.

Note that GtkAda provides a higher-level API for using the GUI builder, in Gtkada.Builder.

A Gtk_Builder is an auxiliary object that reads textual descriptions of a user interface and instantiates the described objects. To pass a description to a Gtk_Builder, call Add_From_File or Add_From_String.

These subprograms can be called multiple times; the builder merges the content of all descriptions.

A Gtk_Builder holds a reference to all objects that it has constructed and drops these references when it is finalized. This finalization can cause the destruction of non-widget objects or widgets which are not contained in a toplevel window. For toplevel windows constructed by a builder, it is the responsibility of the user to call Gtk.Widget.Destroy to get rid of them and all the widgets they contain.

The subprograms Get_Object and Get_Widget can be used to access the widgets in the interface by the names assigned to them inside the UI description.

Toplevel windows returned by this subprogram will stay around until the user explicitly destroys them with Gtk.Widget.Destroy.

Other widgets will either be part of a larger hierarchy constructed by the builder (in which case you should not have to worry about their lifecycle), or without a parent, in which case they have to be added to some container to make use of them. Non-widget objects need to be reffed with Glib.Object.Ref to keep them beyond the lifespan of the builder.

The subprogram Connect_Signals_Full can be used to connect handlers to the named signals in the description.

Binding from C File version 2.16.6

Classes

Gtk_Builder_Record

type Gtk_Builder_Record is new Glib.Object.GObject_Record with private;

Ancestors:

Immediate Children:

Primitive operations:

Add_From_File
Add_From_String
Connect_Signals_Full
Glib.Object.Deallocate (Inherited)
Glib.Object.Get_Type (Inherited)
Glib.Object.Notify (Inherited)
Glib.Object.Ref (Inherited)
Glib.Object.Ref_Sink (Inherited)
Glib.Object.Unref (Inherited)

Types

Gtk_Builder

type Gtk_Builder is access all Gtk_Builder_Record'Class;

Gtk_Builder_Connect_Func

type Gtk_Builder_Connect_Func is access procedure
     (Builder        : System.Address;
      Object         : System.Address;
      Signal_Name    : Interfaces.C.Strings.chars_ptr;
      Handler_Name   : Interfaces.C.Strings.chars_ptr;
      Connect_Object : System.Address;
      Flags          : Glib.G_Connect_Flags;
      User_Data      : System.Address);

Constants & Global variables

Translation_Domain_Property (Glib.Properties.Property_String)

Translation_Domain_Property : constant Glib.Properties.Property_String;

Subprograms & Entries

Get_Type

function Get_Type return GType;

Gtk_New

procedure Gtk_New 
(Builder: out Gtk_Builder);

Initialize

procedure Initialize 
(Builder: access Gtk_Builder_Record'Class);
Creates a new Gtk_Builder object.

Error_Quark

function Error_Quark return GQuark;

Add_From_File

function Add_From_File 
(Builder: access Gtk_Builder_Record;
Filename: String) return Glib.Error.GError;
Parses a file containing a Gtk_Builder UI definition and merges it with the current contents of builder. Returns: A GError if an error occured, otherwise null.

Add_From_String

function Add_From_String 
(Builder: access Gtk_Builder_Record;
Buffer: String;
Length: Gsize) return Glib.Error.GError;
Parses a string containing a Gtk_Builder UI definition and merges it with the current contents of Builder. Returns: A GError if an error occured, otherwise null.

Get_Object

function Get_Object 
(Builder: access Gtk_Builder_Record;
Object_Name: String) return Glib.Object.GObject;
Gets the object named Object_Name. Note that this function does not increment the reference count of the returned object. Returns null if it could not be found in the object tree. See also Get_Widget below.

Get_Widget

function Get_Widget 
(Builder: access Gtk_Builder_Record;
Name: String) return Gtk.Widget.Gtk_Widget;
Utility function to retrieve a widget created by Builder. Returns null if no widget was found with the given name.

Connect_Signals_Full

procedure Connect_Signals_Full 
(Builder: access Gtk_Builder_Record;
Signal_Function: Gtk_Builder_Connect_Func;
User_Data: System.Address);
This function can be thought of the interpreted language binding version of Connect_Signals, except that it does not require GModule to function correctly.