Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/wid_build/api/respluginfrugalcreatef_t.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/wid_build/api/respluginfrugalcreatef_t.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/wid_build/api/respluginfrugalcreatef_t.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/wid_build/api/respluginfrugalcreatef_t.html on line 8

ResPluginFrugalCreateF_t

A function you must write to create an instance of a frugal resource editor

Synopsis:



typedef ResPluginHandle_t
ResPluginFrugalCreateF_t (
  PhABHandle_t phab ,
  const PhABResExportFrugal_t *exp,
  const ResPluginFormatData_t *format,
  int n_default,
  const void *default_value,
  PtWidget_t *parent,
  int n,
  const void *value )

Description:

This function is exported in the ResPluginFrugalEditor_t structure.

This function is called to create a new instance of the frugal resource editor.

The plugin should create any necessary widgets inside the container parent widget. The plugin must try to create its widget(s) with a transparent background, if possible, and it should anchor it's widgets or attach a resize callback to the parent in order to properly display itself when the width of the parent changes. The parent widget will have a non-transparent background.

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.

Arguments:

phab
A PhABHandle_t provided by PhAB, and which should be used as the phab argument when the plugin calls any of the functions present in the exp table of functions.
exp
A pointer to a PhABResExportFrugal_t defining the functions exported by PhAB for the frugal editor. You can assume that the exp pointer will remain valid during the lifetime of the plugin.
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.
n_default
Default value for the resource, together with the default_value argument.
default_value
Default value for the resource. This pointer is guaranteed to remain valid during the lifetime of the plugin.
parent
The parent container widget for any widgets the resource editor creates.
n
Initial resource data, depending on the data type. See Resource datatypes.
value
Initial resource data, depending on the data type. See Resource datatypes.

Should return:

This function should return a ResPluginHandle_t plugin handle, or NULL on error. If you return a non-NULL value, this value will be passed as the first argument to all your other functions.

Examples:

This example create function for a frugal editor is from the complete plugin example at the end of this chapter.

static ResPluginHandle_t plugin_frugal_create
        ( PhABHandle_t phab , const PhABResExportFrugal_t *exp,
          const ResPluginFormatData_t *format,
          int n_default, const void *default_value,
          PtWidget_t *parent,
          int n, const void *value ) {

  PtArg_t args[2];
  PhRect_t offset = { { -1, -1 }, { -1, -1 } };
  PluginFrugalInstance_t *instance;

  instance = calloc( 1, sizeof( *instance ) );
  if( !instance ) return NULL;

  instance->n_default = n_default;
  instance->default_value = default_value;
  instance->n_master = n;
  instance->value_master = value;

  instance->phab = phab;
  instance->exp = exp;

  PtSetArg( &args[0], Pt_ARG_ANCHOR_OFFSETS, &offset, 0 );
  PtSetArg( &args[1], Pt_ARG_TEXT_STRING, value, 0 );
  instance->frugal = ApCreateWidget( db, "string_frugal", 0, 0, 2, args );
  PtAddCallback( instance->frugal, Pt_CB_TEXT_CHANGED, plugin_frugal_changed, instance );
  return ( ResPluginHandle_t ) instance;
  }

Classification:

QNX Neutrino

See also:

PhABResExportFrugal_t, ResPluginFrugalEditor_t, Resource datatypes.


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/wid_build/api/respluginfrugalcreatef_t.html on line 171

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/wid_build/api/respluginfrugalcreatef_t.html on line 171