/*! @header QuesaCustomElements.h
Declares the Quesa custom elements inherited from QD3D.
*/
/* NAME:
QuesaCustomElements.h
DESCRIPTION:
Quesa public header.
COPYRIGHT:
Copyright (c) 1999-2004, Quesa Developers. All rights reserved.
For the current release of Quesa, please see:
* * The before and after rendering callbacks should be attached to the view * object. They are called not only for retained objects that you explicitly submit * for rendering, but also for each object in the hierarchy of a group that * you submit. * * @constant kQ3CallbackElementTypeBeforeRender * The callback will be called just before each retained object * is passed to the renderer. If the callback returns * kQ3Failure, then the object will not be passed to the renderer. * @constant kQ3CallbackElementTypeAfterRender * The callback will be called just after each retained object * is passed to the renderer. The callback's status result * is ignored. * @constant kQ3CallbackElementTypeBeforePick * The callback will be called just before each retained object * is submitted for picking. If the callback returns * kQ3Failure, then the object will not be submitted. * @constant kQ3CallbackElementTypeAfterPick * The callback will be called just after each retained object * is submitted for picking. The callback's status result * is ignored. */ typedef enum { kQ3CallbackElementTypeBeforeRender = Q3_OBJECT_TYPE(0xF0, 'b', 'r', 'e'), kQ3CallbackElementTypeAfterRender = Q3_OBJECT_TYPE(0xF0, 'a', 'r', 'e'), kQ3CallbackElementTypeBeforePick = Q3_OBJECT_TYPE(0xF0, 'b', 'p', 'k'), kQ3CallbackElementTypeAfterPick = Q3_OBJECT_TYPE(0xF0, 'a', 'p', 'k') } TQ3EventCallbackElementTypes; #endif //============================================================================= // Types //----------------------------------------------------------------------------- /*! * @struct * TCEUrlData * @discussion * Describes the data for a URL. * @field url C string containing the full (scheme + path) URL. * @field description Human readable description of the URL. * @field options Options for the URL. */ typedef struct TCEUrlData { char *url; char *description; TCEUrlOptions options; } TCEUrlData; #if QUESA_ALLOW_QD3D_EXTENSIONS /*! * @typedef * TQ3ObjectEventCallback * @discussion * Applications can obtain callbacks as objects are processed * by Quesa. Callbacks are installed as custom elements. In some cases, * it may be necessary to attach the element to each object of interest, * while in other cases the element may be attached to another object * such as a view. See the discussions of element types such as * kQ3ElementTypeBeforeRender for details about specific callbacks. * * Callbacks should return kQ3Success to continue processing the * object, or kQ3Failure to cancel the operation (if possible). * Some events, e.g., those which indicate the completion of an * event, can not be cancelled and the result will be ignored. * * Event callbacks are only available for retained mode objects. * * This functionality is not available in QD3D. * * @param theObject The object being processed. * @param theEventType The event occurring to the object. * @param theHost The object to which the callback element is attached. * @result Whether to continue with the event. */ typedef Q3_CALLBACK_API_C(TQ3Status, TQ3ObjectEventCallback)( TQ3Object theObject, TQ3ElementType theEventType, TQ3Object theHost ); #endif //============================================================================= // Function prototypes //----------------------------------------------------------------------------- /*! * @function * CENameElement_SetData * @discussion * Set the name element for an object. * * The name parameter should point to a C string, and will be copied * by CENameElement_SetData. * * @param object The object to assign the name to. * @param name The C string to associate with the object. * @result Success or failure of the operation. */ Q3_EXTERN_API_C ( TQ3Status ) CENameElement_SetData ( TQ3Object object, const char *name ); /*! * @function * CENameElement_GetData * @discussion * Get the name element for an object. * * The name parameter will receive a C string, or NULL if no name has * been associated with the object. If a non-NULL pointer is returned, * it must be disposed of with CENameElement_EmptyData. * * @param object The object to query. * @param name Receives the name associated with the object. * @result Success or failure of the operation. */ Q3_EXTERN_API_C ( TQ3Status ) CENameElement_GetData ( TQ3Object object, char **name ); /*! * @function * CENameElement_PeekData * @discussion * Get the name element for an object. * * The name parameter will receive a C string, or NULL if no name has * been associated with the object. If a non-NULL pointer is returned, * it should be considered read-only and temporary. Unlike * CENameElement_GetData, this function returns the actual string within * the element, not a copy. * * @availability This function is not available in QD3D. * @param object The object to query. * @param name Receives the name associated with the object. * @result Success or failure of the operation. */ #if QUESA_ALLOW_QD3D_EXTENSIONS Q3_EXTERN_API_C ( TQ3Status ) CENameElement_PeekData ( TQ3Object object, const char **name ); #endif // QUESA_ALLOW_QD3D_EXTENSIONS /*! * @function * CENameElement_EmptyData * @discussion * Release the data returned by CENameElement_GetData. * * @param name A pointer previously returned by CENameElement_GetData. * @result Success or failure of the operation. */ Q3_EXTERN_API_C ( TQ3Status ) CENameElement_EmptyData ( char **name ); /*! * @function * CEUrlElement_SetData * @discussion * Set the URL element for an object. * * The URL element data will be copied by CEUrlElement_SetData. * * @param object The object to assign the URL element to. * @param urlData The URL data to associate with the object. * @result Success or failure of the operation. */ Q3_EXTERN_API_C ( TQ3Status ) CEUrlElement_SetData ( TQ3Object object, TCEUrlData *urlData ); /*! * @function * CEUrlElement_GetData * @discussion * Get the URL element for an object. * * The urlData parameter will receive a pointer to the URL data, or NULL * if no URL element has been associated with the object. If a non-NULL * pointer is returned, it must be disposed of with CEUrlElement_EmptyData. * * @param object The object to retrieve the URL element from. * @param urlData Receives the URL data. * @result Success or failure of the operation. */ Q3_EXTERN_API_C ( TQ3Status ) CEUrlElement_GetData ( TQ3Object object, TCEUrlData **urlData ); /*! * @function * CEUrlElement_EmptyData * @discussion * Release the data returned by CEUrlElement_GetData. * * @param urlData A pointer previously returned by CEUrlElement_GetData. * @result Success or failure of the operation. */ Q3_EXTERN_API_C ( TQ3Status ) CEUrlElement_EmptyData ( TCEUrlData **urlData ); #if QUESA_SUPPORT_QUICKTIME /*! * @function * CEWireElement_SetData * @discussion * Set the QuickTime wired element for an object. * * @param object The object to assign the element to. * @param wireData The QuickTime wired element to associate with the object. * @result Success or failure of the operation. */ Q3_EXTERN_API_C ( TQ3Status ) CEWireElement_SetData ( TQ3Object object, QTAtomContainer wireData ); /*! * @function * CEWireElement_GetData * @discussion * Get the QuickTime wired element for an object. * * The wireData parameter will receive a QTAtomContainer, or NULL if no * wired element has been associated with the object. If a non-NULL pointer * is returned, it must be disposed of with CEWireElement_EmptyData. * * @param object The object to query. * @param wireData Receives the QuickTime wired element associated with the object. * @result Success or failure of the operation. */ Q3_EXTERN_API_C ( TQ3Status ) CEWireElement_GetData ( TQ3Object object, QTAtomContainer *wireData ); /*! * @function * CEWireElement_EmptyData * @discussion * Release the data returned by CEWireElement_GetData. * * @param wireData A pointer previously returned by CEWireElement_GetData. * @result Success or failure of the operation. */ Q3_EXTERN_API_C ( TQ3Status ) CEWireElement_EmptyData ( QTAtomContainer *wireData ); #endif // QUESA_SUPPORT_QUICKTIME //============================================================================= // C++ postamble //----------------------------------------------------------------------------- #ifdef __cplusplus } #endif #endif* TQ3ObjectEventCallback callback = MyCallback; * Q3Object_AddElement( theView, * kQ3CallbackElementTypeBeforeRender, * &callback ); *