Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::G::TypeInstance Class Reference

Abstract base class for GTK+ interfaces and objects. More...

`#include <inti/glib/type.h>`

Inheritance diagram for Inti::G::TypeInstance:

List of all members.

## Public Member Functions

Accessors

- GTypeInstance * g_type_instance () const
    Get a pointer to the GTypeInstance structure.
- template<typename T> T * get_class () const
    Get a pointer to the class structure for the instance, cast to a pointer of type T.
- bool is_a (GType type) const
    Is the instance of the specified type.
- GType type () const
    Get the type ID for the instance.
- String type_name () const
    Get the type name for the instance.
- bool is_a_type (GType ancestor_type) const
    Is the instance is a descendant of the specified ancestor_type.

Methods

- void add_interface (GType interface_type, GInterfaceInitFunc interface_init)
    Adds the static interface_type to this TypeInstance.

## Static Public Member Functions

- void add_interface (GType instance_type, GType interface_type, GInterfaceInitFunc interface_init)
    Adds the static interface_type to the instantiable instance_type.
- GType register_type (GType parent_type, GClassInitFunc class_init)
    Registers a new static Inti type derived from parent_type.
- template<typename T> T * class_peek_parent (void *g_class)
    Get a pointer to the parent class for g_class; T is the parent class.

## Protected Member Functions

- TypeInstance ()
    Constructor.
- virtual ~TypeInstance ()=0
    Destructor.

## Protected Attributes

- GTypeInstance * instance
    A Pointer to the wrapped GTypeInstance structure.

## Detailed Description

Abstract base class for GTK+ interfaces and objects.

TypeInstance encapsulates GTypeInstance, the base structure for GObjects. It exists only to serve as a common base class for concrete objects and the abstract interfaces they inherit. Gtk::Entry is a good example. It inherits from Gtk::Widget, Gtk::Editable and Gtk::CellEditable. Gtk::Widget is the concrete object and Gtk::Editable and Gtk::CellEditable are its abstract interfaces.

## Member Function Documentation

void Inti::G::TypeInstance::add_interface | ( | GType | instance_type,
|  | GType | interface_type,
|  | GInterfaceInitFunc | interface_init
| ) | `[static]`

Adds the static interface_type to the instantiable instance_type.

Parameters:

  instance_type | GType value of an instantiable type.
  interface_type | GType value of the interface type to add.
  interface_init | The location of the function that initializes interface_type.

void Inti::G::TypeInstance::add_interface | ( | GType | interface_type,
|  | GInterfaceInitFunc | interface_init
| ) |

Adds the static interface_type to this TypeInstance.

Parameters:

  interface_type | GType value of the interface type to add.
  interface_init | The location of the function that initializes interface_type.

template<typename T>
T* Inti::G::TypeInstance::class_peek_parent | ( | void * | g_class | ) | `[inline, static]`

Get a pointer to the parent class for g_class; T is the parent class.

Parameters:

  g_class | The GTK+ class structure to retrieve the parent class for.

Returns:
  The parent GTypeClass structure cast to a structure of type T.

This is a convenience method, often needed in class initializers. It essentially takes the immediate parent type of the class passed in, and returns the class structure thereof. Since derived classes hold a reference count on their parent classes as long as they are instantiated, the returned class will always exist.

template<typename T>
T* Inti::G::TypeInstance::get_class | ( |  | ) | const`[inline]`

Get a pointer to the class structure for the instance, cast to a pointer of type T.

Returns:
  The class structure for the instance or null if the class does not currently exist.

bool Inti::G::TypeInstance::is_a | ( | GType | type | ) | const

Is the instance of the specified type.

Parameters:

  type | The type ID of the interface or object.

Returns:
  true if the instance of the specified type.

bool Inti::G::TypeInstance::is_a_type | ( | GType | ancestor_type | ) | const

Is the instance is a descendant of the specified ancestor_type.

Parameters:

  ancestor_type | The type ID of the ancestor to check.

Returns:
  true if the instance is a descendant of the specified ancestor_type.

GType Inti::G::TypeInstance::register_type | ( | GType | parent_type,
|  | GClassInitFunc | class_init
| ) | `[static]`

Registers a new static Inti type derived from parent_type.

Parameters:

  parent_type | The type which this type will be derived from.
  class_init | The location of the class initialization function.

Returns:
  The new type identifier.

The documentation for this class was generated from the following file:

- type.h

Main Page - Footer