Gadgets > Rogue Wave Views Gadgets > Gadget Items > Using Gadget Items > Dynamic Types
 
Dynamic Types
Gadget items are dynamically typed and can therefore be subclassed, saved, and read easily.
The following code lets you access class information:
IlvClassInfo* classInfo = item->getClassInfo();
To check the type of an item, use:
if (item->isSubtypeOf(IlvTreeGadgetItem::ClassInfo())) {
// The item is an IlvTreeGadgetItem.
}
Using Palettes with Gadget Items
Several palettes are used to draw a gadget item:
*The palette returned by getOpaquePalette is used when the item is opaque.
*The palette returned by getSelectionPalette is used to draw the background of a selected gadget item.
*The palette returned by getSelectionTextPalette is used to draw the text of a selected gadget item.
*The palette returned by getHighlightTextPalette is used to draw the text of a highlighted gadget item.
*The palette returned by getInsensitivePalette is used to draw nonsensitive gadget items.
*The palette returned by getNormalTextPalette is used to draw the text of a gadget item that is not selected.
By default, a gadget item uses the palettes of its holder. You can, however, modify the palettes associated with a gadget item, thus making it possible to have gadget items with different palettes inside the same gadget.
To change the palettes assigned to a given gadget item, use the following member functions:
*setNormalTextPalette
*setSelectionTextPalette
*setHighlightTextPalette
*setOpaquePalette
Drawing a Gadget Item
To draw a gadget item, the virtual member function draw is called. You can override it in a subclass to customize the way a gadget item is drawn.

Version 6.0
Copyright © 2015, Rogue Wave Software, Inc. All Rights Reserved.