APIViewEventHandlerProc

User supplied callback function for handling changes of Project Navigator items.

    typedef GSErrCode  APIViewEventHandlerProc (
        const API_NotifyViewEventType*     viewEvent
    );

 

Parameters

viewEvent
[in] This structure identifies the Project Navigator item and the event the add-on is called for.

 

Return Values

NoError
The function has completed with success.

For other common API errors see the API Errors document.

 

Remarks

This is the function which will be called when your add-on requested notifications on Project Navigator item changes with ACAPI_Notify_CatchViewEvent.

 

Example


static GSErrCode __ACENV_CALL  ViewNotificationHandlerProc (const API_NotifyViewEventType* viewEvent) {
    char        msgStr[256];
    char        eventStr[64];

    switch (viewEvent->notifID) {
        case APINotifyView_Inserted:    CHCopyC ("inserted", eventStr);           break;
        case APINotifyView_Modified:    CHCopyC ("modified", eventStr);           break;
        case APINotifyView_Deleted:     CHCopyC ("deleted", eventStr);            break;
        case APINotifyView_Opened:      CHCopyC ("opened", eventStr);             break;
        case APINotifyView_Begin:       return NoError;
        case APINotifyView_End:         return NoError;
        default:                        CHCopyC ("- unknown event -", eventStr);  break;
    }

    API_NavigatorItem item;
    BNZeroMemory (&item, sizeof (API_NavigatorItem));
    GSErrCode err = ACAPI_Navigator (APINavigator_GetNavigatorItemID, const_cast<char*>(viewEvent->itemGuid), &item);

    if (err == NoError) {
        sprintf (msgStr, "API Notification: navigator item \"%s%s%s\" has been %s",
        item.uiId, ((strlen (item.uiId) > 0 && strlen (item.uName) > 0) ? " " : ""), GS::UniString (item.uName).ToCStr (). Get (), eventStr);
    } else {
        sprintf (msgStr, "API Notification: navigator item \"%s\" has been %s", viewEvent->itemGuid, eventStr);
    }

    ACAPI_WriteReport (msgStr, false);

    return NoError;
}

 

Requirements

Version: API 10 or later
Header: APIdefs_Callback.h

 

See Also

API_NotifyViewEventType
ACAPI_Notify_CatchViewEvent
API Functions