BuildableProtocol

public protocol BuildableProtocol

GtkBuildable allows objects to extend and customize their deserialization from GtkBuilder UI descriptions. 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 GtkBuilder. 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 format or run any extra routines at deserialization time.

The BuildableProtocol protocol exposes the methods and properties of an underlying GtkBuildable instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, see Buildable. Alternatively, use BuildableRef as a lighweight, unowned reference if you already have an instance you just want to use.

  • ptr

    Untyped pointer to the underlying GtkBuildable instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • buildable_ptr Default implementation

    Typed pointer to the underlying GtkBuildable instance.

    Default Implementation

    Return the stored, untyped pointer as a typed pointer to the GtkBuildable instance.

    Declaration

    Swift

    var buildable_ptr: UnsafeMutablePointer<GtkBuildable>! { get }
  • Required Initialiser for types conforming to BuildableProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

Buildable Interface: BuildableProtocol extension (methods and fields)

  • Adds a child to buildable. type is an optional string describing how the child should be added.

    Declaration

    Swift

    @inlinable
    func addChild<BuilderT, ObjectT>(builder: BuilderT, child: ObjectT, type: UnsafePointer<gchar>? = nil) where BuilderT : BuilderProtocol, ObjectT : ObjectProtocol
  • Constructs a child of buildable with the name name.

    GtkBuilder calls this function if a “constructor” has been specified in the UI definition.

    Declaration

    Swift

    @inlinable
    func constructChild<BuilderT>(builder: BuilderT, name: UnsafePointer<gchar>!) -> GLibObject.ObjectRef! where BuilderT : BuilderProtocol
  • This is similar to gtk_buildable_parser_finished() but is called once for each custom tag handled by the buildable.

    Declaration

    Swift

    @inlinable
    func customFinished<BuilderT>(builder: BuilderT, child: GLibObject.ObjectRef? = nil, tagname: UnsafePointer<gchar>!, data: gpointer! = nil) where BuilderT : BuilderProtocol
  • This is similar to gtk_buildable_parser_finished() but is called once for each custom tag handled by the buildable.

    Declaration

    Swift

    @inlinable
    func customFinished<BuilderT, ObjectT>(builder: BuilderT, child: ObjectT?, tagname: UnsafePointer<gchar>!, data: gpointer! = nil) where BuilderT : BuilderProtocol, ObjectT : ObjectProtocol
  • This is called at the end of each custom element handled by the buildable.

    Declaration

    Swift

    @inlinable
    func customTagEnd<BuilderT>(builder: BuilderT, child: GLibObject.ObjectRef? = nil, tagname: UnsafePointer<gchar>!, data: UnsafeMutablePointer<gpointer?>? = nil) where BuilderT : BuilderProtocol
  • This is called at the end of each custom element handled by the buildable.

    Declaration

    Swift

    @inlinable
    func customTagEnd<BuilderT, ObjectT>(builder: BuilderT, child: ObjectT?, tagname: UnsafePointer<gchar>!, data: UnsafeMutablePointer<gpointer?>? = nil) where BuilderT : BuilderProtocol, ObjectT : ObjectProtocol
  • This is called for each unknown element under <child>.

    Declaration

    Swift

    @inlinable
    func customTagStart<BuilderT, MarkupParserT>(builder: BuilderT, child: GLibObject.ObjectRef? = nil, tagname: UnsafePointer<gchar>!, parser: MarkupParserT, data: UnsafeMutablePointer<gpointer?>?) -> Bool where BuilderT : BuilderProtocol, MarkupParserT : MarkupParserProtocol
  • This is called for each unknown element under <child>.

    Declaration

    Swift

    @inlinable
    func customTagStart<BuilderT, MarkupParserT, ObjectT>(builder: BuilderT, child: ObjectT?, tagname: UnsafePointer<gchar>!, parser: MarkupParserT, data: UnsafeMutablePointer<gpointer?>?) -> Bool where BuilderT : BuilderProtocol, MarkupParserT : MarkupParserProtocol, ObjectT : ObjectProtocol
  • Get the internal child called childname of the buildable object.

    Declaration

    Swift

    @inlinable
    func getInternalChild<BuilderT>(builder: BuilderT, childname: UnsafePointer<gchar>!) -> GLibObject.ObjectRef! where BuilderT : BuilderProtocol
  • getName() Extension method

    Gets the name of the buildable object.

    GtkBuilder sets the name based on the GtkBuilder UI definition used to construct the buildable.

    Declaration

    Swift

    @inlinable
    func getName() -> String!
  • parserFinished(builder:) Extension method

    Called when the builder finishes the parsing of a GtkBuilder UI definition. Note that this will be called once for each time gtk_builder_add_from_file() or gtk_builder_add_from_string() is called on a builder.

    Declaration

    Swift

    @inlinable
    func parserFinished<BuilderT>(builder: BuilderT) where BuilderT : BuilderProtocol
  • Sets the property name name to value on the buildable object.

    Declaration

    Swift

    @inlinable
    func setBuildableProperty<BuilderT, ValueT>(builder: BuilderT, name: UnsafePointer<gchar>!, value: ValueT) where BuilderT : BuilderProtocol, ValueT : ValueProtocol
  • set(name:) Extension method

    Sets the name of the buildable object.

    Declaration

    Swift

    @inlinable
    func set(name: UnsafePointer<gchar>!)
  • name Extension method

    Gets the name of the buildable object.

    GtkBuilder sets the name based on the GtkBuilder UI definition used to construct the buildable.

    Declaration

    Swift

    @inlinable
    var name: String! { get nonmutating set }