A function exported by PhAB to get the resource structure for another datatype
void get_res ( ResDatatype_t type char *abstract_name_editor ResPluginFrugalEditor_t **pfrugal_editor, ResPluginFullEditor_t **pfull_editor )
This function is exported from PhAB in the PhABResExportCommon_t structure.
This convenience function can be called from either the frugal or full editor to obtain the handle for the editor of another resource type. This allows one plugin to call another currently loaded resource editor plugin as a sub-editor. For example, a pixmap full editor needs to be able to edit the color of a pixel. To do this, you can use get_res() in the pixmap editor to create an instance of the full color editor.
Here is a partial example of calling the color editor from a different editor plugin.
/* taken from the pixmap editor plugin */ /* here "instance" is an instance to the full resource pixmap editor */ /* get the predefined resource editor for "color" */ instance->exp->common.get_res( RES_DATATYPE_COLOR, NULL, NULL, &instance->def_res_full_color ); /* did we obtain a valid pointer to the full resource editor for "color" ? */ if( instance->def_res_full_color ) { /* use the exported convenience functions that were passed for the pixmap plugin editor */ instance->color_editor_exp = *instance->exp; /* defined our own apply and closing functions */ instance->color_editor_exp.common.apply = color_res_apply; instance->color_editor_exp.closing = color_res_closing; instance->color_editor_handle = instance->def_res_full_color->create( (PhABHandle_t) instance, &instance->color_editor_exp, NULL, color, NULL, NULL, "the color editor", color, NULL ); } static int color_res_apply( PhABHandle_t phab, int color, void *value ) { PluginFullInstance_t *instance = (PluginFullInstance_t *) phab; /* here "instance" is an instance to the full resource pixmap editor */ ....... return 1; } static int color_res_closing( PhABHandle_t phab ) { PluginFullInstance_t *instance = (PluginFullInstance_t *) phab; /* here "instance" is an instance to the full resource pixmap editor */ instance->color_editor_handle = NULL; return 1; }
Photon
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
create_window(), destroy(), get_area(), PhABResExportCommon_t, set_state(), to_front().