|
||
Resource files contain data separate from executable code. Their main uses are for defining user interfaces components and for storing localisable data.
The application framework defined by the Uikon Core expects features of the app UI, such as menus, to be supplied in a resource file. The framework reads these resources itself. Other user interface components, such as dialogs, can also be easily created from resources, without the application needing to use this API itself.
The UI Control framework's control environment (class
CCoeEnv
) maintains a list of the resource files used by
the application. It provides utility functions to read resources from this
list.
The API has two key concepts: resource file reader, and resource component reader.
Resource files contain data in numbered resources. The resource file reader allows such files to be opened and closed, and individual resources within them, as identified by symbolic identifiers, to be read into binary descriptors. Data items are then extracted from these descriptors using the resource component reader.
The resource file reader is provided by
RResourceFile
.
A resources is defined in terms of a struct. Struct members can be simple, such as integers and strings, or complex, such as other structs, or arrays of structs. The resource component reader is used to read these struct members from a binary descriptor holding the resource into C++ variables. The application must ensure that it puts the struct members into variables of the appropriate types.
The resource component reader is provided by
TResourceReader
.