Create a CheckListboxItem
Sometimes you need a list where the items are checkable. The ItemListbox introduced in CEGUI 0.5 accepts all sorts of items, as long as they inherit ItemEntry. I'm going to teach you how to create a CheckListboxItem to put in your list.
Getting started!
I'm assuming you are just using a standard imageset, with a standard scheme (currently TaharezLook and WindowsLook are supported).
We are first going to get started by writing the looknfeel entry. This is the most important part of this tutorial, as its basically 70% of what we need to do to achieve our goal. First of all, this entry has a few states:
- Enabled: How the item looks when the item is enabled.
- Disabled: How the item looks when the item is disabled.
- SelectedEnabled: How the item looks when the item is selected and is enabled.
- SelectedDisabled: How the item looks when the item is selected and is disabled.
Writing the requirements
Open the appriopiate looknfeel file (WindowsLook.looknfeel or TaharezLook.looknfeel), and place this at the bottom (inside the Falagard tags though!)
Our start
<WidgetLook name="WindowsLook/CheckListboxItem"> </WidgetLook>
We first need to define a WidgetLook, this is where all the action happens in. It takes one attribute, name. This is simply the name of the widget you are defining. Now we are going to add the states. These states are necessary for the item to respond to certain events. For example, when the item is disabled, the state Disabled is used.
<WidgetLook name="WindowsLook/CheckListboxItem"> <StateImagery name="Enabled"> <Layer> <Section section="label"> <ColourProperty name="TextColour" /> </Section> </Layer> </StateImagery> <StateImagery name="Disabled"> <Layer> <Section section="label"> <ColourProperty name="TextColour" /> </Section> </Layer> </StateImagery> </WidgetLook>