Add-On API Introduction
Library: ObjectHandlerLib.so
The base class for an Interface Elements add-on is IEEditableObject.
An IEEditableObject is very generic and should provide these functions and information about the object it represents:
- Flattening/unflattening the object to/from a data buffer of a given size
- Instantiating one or more default objects
- Returning an editor view (IEObjectEditor) which can edit an object instance
- Returning a drag representation (a view or bitmap which can be seen during dragging the object)
- Generating source from the object. This is not applicable to all objects.
- Providing the base classes of the object
- Providing add-on creation information (name, author, copyright, help message)
There is an IEEditableView class which derives from IEEditableObject and which you may use to inherit your own editable view classes.
IEEditableView provides these functions in addition to IEEditableObject:
- Handling a variable of any type associated with a view, archiving and instantiating the variable in the view archive
- Provides virtual functions for updating the view according to the variable, or updating the variable according to the state of the view
- Adjusts the parent view frame (a special editor view container) during editing
- Getting a window-wide unique ID, which is useful for creating BMessages
IEObjectEditor is the actual object editor which derives from BView. You need to derive your own editor from this class to edit an object. Its functionality:
- Receiving notification when the target object changed via a hook function
- Notifying the object roster about the object change
- Providing the possibility to selecting/editing/remove others objects
- Deciding whether to be opened as collapsed view.
A global instance of an object roster (IEObjectRoster) is available all the time by declaring
extern IEObjectRoster *ie_object_roster;
The tasks of the object roster:
- Loading the object editor add-ons
- Providing a list of available object types
- Looking up an add-on by class name
- Opening object editor windows
- Tracking changes in object editors and updating other object editors which edit the same object