Developer

API Reference

ITRIGMLELEMENT_AttachObject()

deprecated
Items marked as deprecated have been replaced by a more powerful, alternative feature. Deprecated interfaces include a reference to the replacement interface, which should be used for all new application development. Deprecated features are still supported for backward compatibility, but should be avoided when developing new applications.
Brew Release
Brew MP 1.0.2
See Also
ITRIGMLELEMENT_GetAttachedObject()
Description
Attaches a BREW COM object to the element. The object must implement at least IQueryInterface.
The Trigml extension that implements an element will typically attach an object to the element in its ITRIGMLEXTENSION_ElementCreated() notification. The object can then be retrieved and manipulated in subsequent ITRIGMLEXTENSION_*() notifications by calling ITRIGMLELEMENT_GetAttachedObject().
The element will AddRef the object. It will be Released either when a new object is attached or when the element itself is destroyed. At most one object can be attached to each Trigml element.
Parameters
  • po
    []:
    The element to which to attach the object.
  • obj
    []:
    The object to attach. Supply NULL to Release a previously-attached object without attaching a new one.
Interface
ITRIGMLELEMENT
Prototype
   void ITRIGMLELEMENT_AttachObject(ITrigmlElement* po, IQueryInterface* obj);
Return
   None.
Side Effect
None
Comment
It is not necessary for the object to have an associated class declared in a MIF file and creatable by ISHELL_CreateInstance(). All that is required is a valid COM interface pointer.
There are two important special cases for attached objects.
1. If you declare an element as having type 'visible' in the extension's XML metadata (normally you do this by adding it to the 'visibleContainer' or 'visibleLeaf' element classes), and the object you attach implements IWidget, then your element will then inherit all default layout and widget tree behavior from the core Trigml extension.
2. If you declare an element as having type 'listener' in the extension's XML metadata (normally you do this by adding it to the 'listeners' or 'modifiers' element classes), then the object you attach should implement ITrigmlListenerAction. Your element will then inherit the when, while, until and consume attributes that are common to Trigml listeners and modifiers. Your extension will be notified when your listener is activated or deactivated via calls to ITRIGMLLISTENERACTION_Activate().
  • Follow