IlvObjectLFHandler

Once a gadget has retrieved its look-and-feel handler, it must ask its specific object look-and-feel handler. This object look-and-feel handler is implemented by means of the IlvObjectLFHandler class. Each component that needs to be look-and-feel dependant must create a subclass of the IlvObjectLFHandler class.

Getting a Pointer to an IlvObjectLFHandler Object

The IlvLookFeelHandler class handles a hash table of IlvObjectLFHandler. Each instance of the IlvObjectLFHandler class can be retrieved using its class information. For example, the following code retrieves the object look-and-feel handler of the IlvButton class:

IlvLookFeelHandler lfh = display->getLookFeelHandler();

IlvButtonLFHandler* buttonLF = (IlvButtonLFHandler*)

lfh->getObjectLFHandler(IlvButton::ClassInfo());

Note

The value returned by getObjectLFHandler is cast into an IlvButtonLFHandler pointer, which is the base class for button object look-and-feel handlers.

After retrieving a pointer to its specific object look-and-feel handler, the button can draw itself using the following code:

void

IlvButton::draw(IlvPort* dst,

const IlvTransformer* t,

const IlvRegion* clip) const

{

IlvButtonLFHandler* lfhandler = (IlvButtonLFHandler*)

getObjectLFHandler(IlvButton::ClassInfo());

lfhandler->draw(this, dst, t, clip);

}