The purpose of the MCoeControlContext interface is to allow sharing
of graphics settings between controls. The class is defined, in coeccntx.
h, as:
class MCoeControlContext
{
public:
IMPORT_C virtual void ActivateContext(CWindowGc& aGc,
RDrawableWindow& aWindow) const;
IMPORT_C virtual void ResetContext(CWindowGc& aGc) const;
IMPORT_C virtual void PrepareContext(CWindowGc& aGc) const;
};
Unlike most interface classes, MCoeControlContext supplies
default implementations of its member functions. ActivateContext()
calls the passed graphics context’s Activate() for the specified
window, and then calls PrepareContext(). ResetContext()
calls the passed graphics context’s Reset() function, again followed
by a call to PrepareContext(). The default implementation of
PrepareContext() is empty.
You set a control’s context by setting its iContext member, by
using either of CCoeControl’s SetControlContext() or Copy-
ControlContextFrom() functions, to contain a pointer to a class
that implements the MCoeControlContext interface. Once that is
done, the control framework ensures that ActivateContext() and
ResetContext() are called before and after all drawing code.