previous Bonobo - Interfaces next


Bonobo's interfaces are very much 'inspired' by the OLE2 interfaces.

Bonobo interfaces are based on the GNOME::Unknown interface.

The Unknown interface provides:

The interface contains three methods:
    module GNOME {
          interface Unknown {
              void void ref ();
              void void unref ();
              Object query_interface (in string repoid);
          };
      };


To get an interface from an object reference, one would use the queryInterface (QI) method in Interface Definition Language (IDL):

The queryInterface method
module Bonobo {
        interface Unknown {
                ...
                Unknown queryInterface (Unknown obj, in string repoid);
        };
};


Clients of the query_interface method use it to discover dynamically if a component supports a given interface.

For example, a help browser can load an HTML renderer component and ask this component which sort of features are supported by it:
stop_animations (BrowserHTML html)
{
      BrowserControl control
 
      control = html->query_interface ("IDL:Browser/Control:1.0");
      if (control)
              control->stop_animations ();
}

The return value of the query_interface invocation contains a reference to a CORBA object that is derived from the GNOME::Unknown interface or CORBA_OBJECT_NIL if the interface is not supported by the object. And this interface would have been already ref()ed before it was returned. It is up to the caller to call unref() when they are done using the interface.