ResPluginSetDataF_t

A function you must write to set the resource data in the editor

Synopsis:

typedef void ResPluginSetDataF_t(
  ResPluginHandle_t handle,
  int n,
  const void *value,
  const ResPluginFormatData_t *format )

Description:

This function is exported in the ResPluginCommon_t structure.

This function is called by PhAB to set a data value in the plugin editor, after the plugin instance is created.

The data value is represented by the parameter pair n and value. How these parameters are passed depends on the data type of the resource. See the description of resource data types for a discussion of how these parameters are passed.

For some datatypes, PhAB will guarantee that it is safe for the plugin to look at the content pointed to by value, not only for the duration of this function, but beyond that. That pointer is called PhAB's “master copy” and it is guaranteed to stay a valid pointer until the next call to the function.

If necessary, format information is passed by format when the plugin instance is created. The format data depends on the data type. For example, for the RES_DATATYPE_FLAG datatype, format provides the plugin with the list of possible flag values, the flag manifests, and the associated masks, if any.

In some circumstances, the format data might change for the same plugin instance. In this case PhAB calls the set data function again with a new format structure.

Arguments:

handle
The ResPluginHandle_t handle returned when the instance of the editor is created with a create function, either ResPluginFrugalCreateF_t or ResPluginFullCreateF_t.
n
Resource data, depending on the data type. See Resource datatypes.
value
Resource data, depending on the data type. See Resource datatypes.
format
A pointer to a ResPluginFormatData_t structure that describes format information required by the data type. See Resource datatypes for a description of how this structure applies to each datatype.

Examples:

This sample function is from the complete plugin example at the end of this chapter.

static void plugin_frugal_set_data( ResPluginHandle_t handle, int n, const void *value,
                                    const ResPluginFormatData_t *format )
{
  PluginFrugalInstance_t *instance =
  ( PluginFrugalInstance_t * ) handle;
  instance->n_master = n;
  instance->value_master = value;
  PtSetResource( instance->frugal, Pt_ARG_TEXT_STRING, value, 0 );
}

Classification:

QNX Neutrino

See also:

ResPluginCommon_t, ResPluginFrugalCreateF_t, ResPluginFullCreateF_t, Resource datatypes.