The control environment packages the interface to the window server and provides an environment for creating controls. It is implemented in a single class, CCoeEnv
, which encapsulates active objects and an active scheduler for receiving events from the window server. Each application has exactly one CCoeEnv
object.
CCoeEnv
also provides a number of utilities which are useful to most applications. These utilities include:
creating a graphics context, the system graphics context. This is the standard graphics context which is normally used for drawing controls, and which can be accessed using CCoeControl::SystemGc()
.
access to the window server session
utilities for using fonts
utilities for reading resource values from resource files
CCoeEnv
maintains a list of the resource files used by the application. Files may be added to the list using AddResourceFileL()
, and removed using DeleteResourceFile()
.
The utility functions provided by the control framework read resources and resource data from the resource files in its list.
A resource file consists of a list of resources, each identified by a resource ID. In turn, each resource consists of a list of resource values in the form of binary data. The order and lengths of the values are defined, for each resource type, in an enumeration (generally stored in a file with an .rh
extension).
To read data from a resource file requires two stages:
read a resource from the resource file into a buffer
read resource values from the resource, by using a resource reader
CCoeEnv
provides utility functions to perform the first of these stages and functions to create resource readers.
It should be noted that stage two can be omitted if the resource contains only one value, or if it is read into a formatted buffer: in both these cases the resource data can be read straight from the buffer.