Module: Gtk::Buildable

Defined in:
(unknown)

Overview

GtkBuildable allows objects to extend and customize their deserialization from ui files.

The interface includes methods for setting names and properties of objects, parsing custom tags and constructing child objects.

The GtkBuildable interface is implemented by all widgets and many of the non-widget objects that are provided by GTK. The main user of this interface is [classGtk.Builder]. There should be very little need for applications to call any of these functions directly.

An object only needs to implement this interface if it needs to extend the GtkBuilder XML format or run any extra routines at deserialization time.

Instance Method Summary collapse

Instance Method Details

#add_child(buildable, builder, child, type) ⇒ nil

Parameters:

  • buildable (Gtk::Buildable)

    a GtkBuildable

  • builder (Gtk::Builder)

    a GtkBuilder

  • child (GObject::Object)

    child to add

  • type (String)

    kind of child or nil

Returns:

  • (nil)

#buildable_idString

Gets the ID of the buildable object.

GtkBuilder sets the name based on the ID attribute of the <object> tag used to construct the buildable.

Returns:

  • (String)

    the ID of the buildable object

#construct_child(buildable, builder, name) ⇒ GObject::Object

Parameters:

Returns:

  • (GObject::Object)

#custom_finished(buildable, builder, child, tagname, data) ⇒ nil

Parameters:

  • buildable (Gtk::Buildable)

    a GtkBuildable

  • builder (Gtk::Builder)

    a GtkBuilder

  • child (GObject::Object)

    child object or nil for non-child tags

  • tagname (String)

    the name of the tag

  • data (GObject)

    user data created in custom_tag_start

Returns:

  • (nil)

#custom_tag_end(buildable, builder, child, tagname, data) ⇒ nil

Parameters:

  • buildable (Gtk::Buildable)

    A GtkBuildable

  • builder (Gtk::Builder)

    GtkBuilder used to construct this object

  • child (GObject::Object)

    child object or nil for non-child tags

  • tagname (String)

    name of tag

  • data (GObject)

    user data that will be passed in to parser functions

Returns:

  • (nil)

#custom_tag_start(buildable, builder, child, tagname, parser, data) ⇒ Boolean

Returns true if an object has a custom implementation, false if it doesn't.

Parameters:

  • buildable (Gtk::Buildable)

    a GtkBuildable

  • builder (Gtk::Builder)

    a GtkBuilder used to construct this object

  • child (GObject::Object)

    child object or nil for non-child tags

  • tagname (String)

    name of tag

  • parser (Gtk::BuildableParser)

    a GtkBuildableParser to fill in

  • data (GObject)

    return location for user data that will be passed in to parser functions

Returns:

  • (Boolean)

    true if an object has a custom implementation, false if it doesn't.

#get_id(buildable) ⇒ String

Parameters:

Returns:

  • (String)

#get_internal_child(buildable, builder, childname) ⇒ GObject::Object

Returns the internal child of the buildable object.

Parameters:

Returns:

  • (GObject::Object)

    the internal child of the buildable object

#idString

The getter corresponding to set_id. Implement this if you implement set_id.

Returns:

  • (String)

#id=(id) ⇒ nil

Stores the id attribute given in the GtkBuilder UI definition. GtkWidget stores the name as object data. Implement this method if your object has some notion of “ID” and it makes sense to map the XML id attribute to it.

Parameters:

  • id (String)

Returns:

  • (nil)

#parser_finished(buildable, builder) ⇒ nil

Parameters:

Returns:

  • (nil)

#set_buildable_property(buildable, builder, name, value) ⇒ nil

Parameters:

Returns:

  • (nil)

#set_id(buildable, id) ⇒ nil

Parameters:

Returns:

  • (nil)