Defines | |
#define | mt_RsrcFree(app) mt_rsrc_free(app->aes_global) |
Release from memory resource file loaded by mt_RsrcLoad(). | |
#define | RsrcFree() mt_rsrc_free(gl_appvar->aes_global) |
See mt_RsrcFree(). | |
Functions | |
int | mt_RsrcLoad (APPvar *app, const char *name) |
Load a resource file in memory. | |
void | mt_RsrcXtype (APPvar *app, int mode, OBJECT **rs_trindex, int num_tree) |
Install/remove WinDom extended objects. | |
void | mt_RsrcFixCicon (APPvar *app, OBJECT *object, int num_obs, int num_cib, INT16 palette[][4], void *fix) |
Fix color icons to the current screen resolution. | |
void | mt_RsrcFreeCicon (APPvar *app, void *fix) |
Release from memory fixed color icons. | |
int | mt_RsrcUserDraw (APPvar *app, int mode, WINDOW *win, int __index, func_userdraw draw, void *data) |
associate a drawing function to an objet formular | |
void * | mt_RsrcXload (APPvar *app, const char *name) |
load multiple extended GEM resource file. | |
void | mt_RsrcXfree (APPvar *app, void *rsc) |
Release memory allocated by mt_RsrcXload(). | |
int | mt_RsrcGaddr (APPvar *app, void *rsc, int type, int __index, void *addr) |
retrieve an address object from a loaded resource file. | |
rscHDR * | mt_RsrcGhdr (APPvar *app, void *rsc) |
return the header of the RSC |
#define mt_RsrcFree | ( | app | ) | mt_rsrc_free(app->aes_global) |
Release from memory resource file loaded by mt_RsrcLoad().
#define RsrcFree | ( | ) | mt_rsrc_free(gl_appvar->aes_global) |
See mt_RsrcFree().
void mt_RsrcFixCicon | ( | APPvar * | app, | |
OBJECT * | object, | |||
int | num_obs, | |||
int | num_cib, | |||
INT16 | palette[][4], | |||
void * | _fix | |||
) |
Fix color icons to the current screen resolution.
app | application descriptor, | |
object | pointer to an objects tree, | |
num_obs | number of objects in object, | |
num_cib | number of color icons in object, | |
palette | color palette, | |
_fix | pointer to a structure containing the fixed icons. |
void mt_RsrcFreeCicon | ( | APPvar * | app, | |
void * | _fix | |||
) |
Release from memory fixed color icons.
app | application descriptor, | |
_fix | pointer filled in by mt_RsrcFixCicon(). |
int mt_RsrcGaddr | ( | APPvar * | app, | |
void * | _rsc, | |||
int | type, | |||
int | index, | |||
void * | addr | |||
) |
retrieve an address object from a loaded resource file.
app | application descriptor, | |
_rsc | resource descriptor or NULL | |
type | type of object to retrieval. Possible values are:
| |
index | object index to retrieval, | |
addr | address of object, |
return the header of the RSC
app | application descriptor, | |
rsc | pointer to a resource descriptor, |
typedef struct { long nobs; // number of OBJECT items long ntree; // number of tree OBJECT long nted; // number of TEDINFO items long ncib; // number of CICON items long nib; long nbb; long nfstr; // number of string items long nfimg; // number of IMAGE items OBJECT *object; // address of OBJECTS TEDINFO *tedinfo; // address of TEDINFO ICONBLK *iconblk; // address of ICONBLK BITBLK *bitblk; // address of BITBLK CICON *cicon; // address of CICON CICONBLK *ciconblk; // table of CICONBLK char **frstr; BITBLK **frimg; OBJECT **trindex; // address of tree OBJECTS } rscHDR; *
int mt_RsrcLoad | ( | APPvar * | app, | |
const char * | name | |||
) |
Load a resource file in memory.
app | application descriptor, | |
name | GEM resource file name to load. |
Trick : mt_RsrcLoad() use PATH environment variable to locate resource file.
int mt_RsrcUserDraw | ( | APPvar * | app, | |
int | mode, | |||
WINDOW * | win, | |||
int | index, | |||
func_userdraw | draw, | |||
void * | data | |||
) |
associate a drawing function to an objet formular
app | application descriptor, | |
mode | OC_FORM or OC_TOOLBAR, | |
win | window descriptor, | |
index | object index, | |
draw | address of drawing function, | |
data | address of an user data, |
Refer to the documentation of the func_userdraw type for a description of the userdef callback function interface.
void mt_RsrcXfree | ( | APPvar * | app, | |
void * | rsc | |||
) |
Release memory allocated by mt_RsrcXload().
app | application descriptor, | |
rsc | pointer to resource structure (provided by mt_RsrcXload()), |
void* mt_RsrcXload | ( | APPvar * | app, | |
const char * | name | |||
) |
load multiple extended GEM resource file.
app | application descriptor, | |
name | GEM resource file name to load. |
mt_RsrcXload() use the PATH environment variable to locate the resource file (in this case, the filename should not be a pathname). The function returns a pointer which identify the resource or a NULL value if an error occurs. The pointer must be kept in memory because it is used by mt_RsrcGaddr() to get an object address in resource and it is used by mt_RsrcXfree() to release resource memory. Icons colors are automatically fixed by mt_RsrcXload() using mt_RsrcFixCicon() and transformed into a XCICON extended type. Due to this, color icons are displaying on any TOS version. To access to ICONBLK structure of a XCICON object, use the macro GET_XCICON().
Example
{ void *rsc1, *rsc2; OBJECT *tree; // Loads resources rsc1 = RsrcXload( "myrsc1.rsc"); rsc2 = RsrcXload( "myrsc2.rsc"); // Get an object RsrcGaddr( rsc1, R_TREE, FORM1, &tree); ... RsrcXfree( rsc2); RsrcXfree( rsc1); }
void mt_RsrcXtype | ( | APPvar * | app, | |
int | mode, | |||
OBJECT ** | trindex, | |||
int | num_tree | |||
) |
Install/remove WinDom extended objects.
app | application descriptor, | |
mode | possible values are :
| |
trindex | address of object tree array or NULL, | |
num_tree | number of object tree in trindex. |
An WinDom extended object is an object having a special value in ob_type field of the OBJECT structure. The low byte of ob_type is used by AES to identify the type of object (button, box, text, ...). The high byte is not read by AES. WinDom uses it to specify new objects. mt_RsrcXtype() transform theses objects into a G_USERDEF objects or insersly can restore objects previously transformed.
The mode parameter describes the action to perform. Mode RSRC_XTYPE installs extended type for objects having an extended type. There is a second mode, RSRC_X3D, which installs new object types with a 3D look for all objects. The goal of this mode is to allow your dialog boxes to have the same aspect with MagiC, Naes, TOS or any other GEM system. Addressed objects are buttons and boxes (!U)without extended types(!u). And off course, these two modes can be cumulated (mode RSRC_XALL).
To fix the objects in the internal resource, the trindex parameter must set to NULL and the trindex parameter is not used. To fix an external resource, the trindex parameter should be filled with the address of object trees in the resource. This address is supplied with the RSH file created by your resource editor. The RSH file must be include in your source code with an #include
directive. The num_tree value is also supplied with the RSH file.
When the application finishes, extended objects should be freed by a call to RsrcXtype() with mode 0.