<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://cegui.org.uk/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Tss</id>
		<title>CEGUI Wiki - Crazy Eddie's GUI System (Open Source) - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://cegui.org.uk/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Tss"/>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/Special:Contributions/Tss"/>
		<updated>2026-04-09T18:33:41Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.24.1</generator>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=Performing_custom_rendering_at_the_right_time&amp;diff=3674</id>
		<title>Performing custom rendering at the right time</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=Performing_custom_rendering_at_the_right_time&amp;diff=3674"/>
				<updated>2011-02-26T12:11:30Z</updated>
		
		<summary type="html">&lt;p&gt;Tss: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}} [[category: Tutorials]]&lt;br /&gt;
==What is this tutorial?==&lt;br /&gt;
This is an advanced tutorial showing one of the ways in which it is possible to hook into the CEGUI rendering process to draw custom imagery using the underlying rendering API directly.&lt;br /&gt;
&lt;br /&gt;
The actual code that is shown here demonstrates a window that has a link to another window, and that link is indicated graphically by way of a line with two arrows.  This was inspired by [http://www.cegui.org.uk/phpBB2/viewtopic.php?f=10&amp;amp;t=5389 this forum post], but I think that it is important to state that the technique can also be used for totally different purposes too.&lt;br /&gt;
&lt;br /&gt;
The example code is using OpenGL, although similar things are possible with the other APIs too.&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
It is probably worthwhile discussing why some 'advanced technique' is required in order to perform certain types of custom rendering in the first place.&lt;br /&gt;
&lt;br /&gt;
All of the things rendered internally by CEGUI are cached and queued for later drawing.  This means that when a window draws itself, it has not at that stage actually drawn anything, but rather it has queued some instructions for what to draw when the actual rendering is performed later on.&lt;br /&gt;
&lt;br /&gt;
The biggest issue with this arises when you need custom rendering that relates to a given window, as opposed to custom rendering done before or after the CEGUI::System::renderGUI call.  How does one know precisely when to do this custom rendering such that it is layered correctly in regards to the other CEGUI based rendering?  You can't render directly in response to the window events that signal a window's rendering has started or ended, because these events relate to CEGUI based rendering which can be – and is – cached.&lt;br /&gt;
&lt;br /&gt;
What you actually need to do is hook into the part of the process that queues things for rendering, and queue your own custom object to perform whatever rendering you need.  The objects that get queued are based on the CEGUI::GeometryBuffer interface, the key thing to know is that the only function of that interface used during the final rendering process is the GeometryBuffer::draw function.  This means that it's possible to implement a custom GeometryBuffer whose draw function renders directly to the active CEGUI::RenderingSurface (such as the screen / back buffer), rather than drawing some buffered geometry like the regular implementation for the CEGUI::Renderer that you use.&lt;br /&gt;
&lt;br /&gt;
The basic scenario is that we need a subclass of some CEGUI::Window type so we can override the Window::drawSelf function in order to queue our custom GeometryBuffer implementation.  And, of course, a custom GeometryBuffer implementation that will perform whatever rendering we desire.  These will now be discussed.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
===LinkedWindow class===&lt;br /&gt;
For this example, we will develop a LinkedWindow class that is based on the existing FrameWindow type.  The class declaration looks like this:&lt;br /&gt;
&amp;lt;code&amp;gt;class LinkedWindow : public CEGUI::FrameWindow&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
    //! 'Namespace' string used for global events on this class.&lt;br /&gt;
    static const CEGUI::String EventNamespace;&lt;br /&gt;
    //! String holding the type name of this widget.&lt;br /&gt;
    static const CEGUI::String WidgetTypeName;&lt;br /&gt;
&lt;br /&gt;
    //! set window that will be the target of our link line.&lt;br /&gt;
    void setTarget(const CEGUI::Window* target);&lt;br /&gt;
    //! return pointer that is our current link target.&lt;br /&gt;
    const CEGUI::Window* getTarget() const;&lt;br /&gt;
&lt;br /&gt;
    LinkedWindow(const CEGUI::String&amp;amp; type, const CEGUI::String&amp;amp; name);&lt;br /&gt;
    ~LinkedWindow();&lt;br /&gt;
&lt;br /&gt;
protected:&lt;br /&gt;
    // overridden from base class.&lt;br /&gt;
    void drawSelf(const CEGUI::RenderingContext&amp;amp; ctx);&lt;br /&gt;
    bool testClassName_impl(const CEGUI::String&amp;amp; class_name) const;&lt;br /&gt;
&lt;br /&gt;
    //! pointer to a GeometryBuffer that will render our link line.&lt;br /&gt;
    CEGUI::GeometryBuffer* d_linksGeometry;&lt;br /&gt;
    //! pointer to the target window of our link line.  May be zero.&lt;br /&gt;
    const CEGUI::Window* d_target;&lt;br /&gt;
};&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The key thing included here is the drawSelf override, the rest is either boilerplate or related to the specific implementation of this demo.  Perhaps it's worthwhile to point out the pointer to a GeometryBuffer though, since this will actually point to an instance of our custom implementation of GeometryBuffer and is initialised in the LinkedWindow constructor.&lt;br /&gt;
&lt;br /&gt;
====The Window::drawSelf override====&lt;br /&gt;
Since - at least for this demo - we want our custom rendering to appear between windows, we need to ensure that the RenderingSurface we use is not a surface local to the window.  Here we see the code tests to see if the surface we are given in the context is a rendering window, and if it is, we choose to use the owner of that RenderingWindow instead.  This is intended to avoid the AutoRenderingSurface of a FrameWindow, though in the demo we switch this off anyway.  Depending on your own specific circumstances the code below may not be entirely robust (but it will suffice for most normal uses).&lt;br /&gt;
&amp;lt;code&amp;gt;    RenderingSurface* surface;&lt;br /&gt;
&lt;br /&gt;
    if (ctx.surface-&amp;gt;isRenderingWindow())&lt;br /&gt;
        surface = &amp;amp;static_cast&amp;lt;RenderingWindow*&amp;gt;(ctx.surface)-&amp;gt;getOwner();&lt;br /&gt;
    else&lt;br /&gt;
        surface = ctx.surface;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next part is key, and is in fact, single most important line in the tutorial.  This is where we queue our custom GeometryBuffer instance to the surface we chose above.&lt;br /&gt;
&amp;lt;code&amp;gt;    surface-&amp;gt;addGeometryBuffer(ctx.queue, *d_linksGeometry); &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally we call the base class implementation so that the regular FrameWindow rendering is now performed (actually, it's queued - just like our custom GeometryBuffer above!)&lt;br /&gt;
&amp;lt;code&amp;gt;    FrameWindow::drawSelf(ctx);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===LinkGeometryBuffer class===&lt;br /&gt;
The class declaration for LinkGeometryBuffer is as follows:&lt;br /&gt;
&amp;lt;code&amp;gt;class LinkGeometryBuffer : public CEGUI::GeometryBuffer&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
    LinkGeometryBuffer(LinkedWindow* owner);&lt;br /&gt;
&lt;br /&gt;
    // required interface functions for base class.&lt;br /&gt;
    void draw() const;&lt;br /&gt;
    void setTranslation(const CEGUI::Vector3&amp;amp; v) {}&lt;br /&gt;
    void setRotation(const CEGUI::Vector3&amp;amp; r) {}&lt;br /&gt;
    void setPivot(const CEGUI::Vector3&amp;amp; p) {}&lt;br /&gt;
    void setClippingRegion(const CEGUI::Rect&amp;amp; region) {}&lt;br /&gt;
    void appendVertex(const CEGUI::Vertex&amp;amp; vertex) {}&lt;br /&gt;
    void appendGeometry(const CEGUI::Vertex* const vbuff, CEGUI::uint vertex_count) {}&lt;br /&gt;
    void setActiveTexture(CEGUI::Texture* texture) {}&lt;br /&gt;
    void reset() {}&lt;br /&gt;
    CEGUI::Texture* getActiveTexture() const {return 0;}&lt;br /&gt;
    CEGUI::uint getVertexCount() const {return 0;}&lt;br /&gt;
    CEGUI::uint getBatchCount() const {return 0;}&lt;br /&gt;
    void setRenderEffect(CEGUI::RenderEffect* effect) {}&lt;br /&gt;
    CEGUI::RenderEffect* getRenderEffect() {return 0;}&lt;br /&gt;
&lt;br /&gt;
protected:&lt;br /&gt;
    //! helper that uses GL calls to render the link line&lt;br /&gt;
    static void drawLink(const CEGUI::Vector2&amp;amp; source, const CEGUI::Vector2&amp;amp; dest,&lt;br /&gt;
                         float source_size, float dest_size);&lt;br /&gt;
    //! helper that uses GL calls to render an arrow.&lt;br /&gt;
    static void drawArrowRight(float x, float y, float sz);&lt;br /&gt;
&lt;br /&gt;
    //! LinkedWindow that created and owns the GeometryBuffer.&lt;br /&gt;
    LinkedWindow* d_owner;&lt;br /&gt;
};&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see it's pretty much just the required functions as specified by the CEGUI::GeometryBuffer interface, along with a couple of helper functions which are specific to this demo.&lt;br /&gt;
&lt;br /&gt;
====The GeometryBuffer::draw override====&lt;br /&gt;
Below is the code for the custom drawing function.  There is little to discuss, since this is just some very basic code and OpenGL calls.  We basically determine the source and destination locations which will be the end points of the link line, and call a helper function that makes the GL calls to draw.  It's probably worth highlighting the calls that save and restore the GL attributes, we do this because CEGUI will not expect its states to get messed up mid-way through rendering!  We don't save the model-view matrix, since this is reset by each GeometryBuffer anyway.&lt;br /&gt;
&amp;lt;code&amp;gt;    if (!d_owner-&amp;gt;getTarget())&lt;br /&gt;
        return;&lt;br /&gt;
&lt;br /&gt;
    const Rect src_area(d_owner-&amp;gt;getUnclippedOuterRect());&lt;br /&gt;
    const Rect dst_area(d_owner-&amp;gt;getTarget()-&amp;gt;getUnclippedOuterRect());&lt;br /&gt;
&lt;br /&gt;
    const Vector2 source(&lt;br /&gt;
        src_area.d_right,&lt;br /&gt;
        src_area.d_top + ((src_area.d_bottom - src_area.d_top) / 2));&lt;br /&gt;
&lt;br /&gt;
    const Vector2 dest(&lt;br /&gt;
        dst_area.d_left,&lt;br /&gt;
        dst_area.d_top + ((dst_area.d_bottom - dst_area.d_top) / 2));&lt;br /&gt;
&lt;br /&gt;
    glPushClientAttrib(GL_CLIENT_ALL_ATTRIB_BITS);&lt;br /&gt;
    glPushAttrib(GL_ALL_ATTRIB_BITS);&lt;br /&gt;
&lt;br /&gt;
    glMatrixMode(GL_MODELVIEW);&lt;br /&gt;
    glLoadIdentity();&lt;br /&gt;
&lt;br /&gt;
    glBindTexture(GL_TEXTURE_2D, 0);&lt;br /&gt;
    glDisable(GL_SCISSOR_TEST);&lt;br /&gt;
&lt;br /&gt;
    glColor3f(0.1, 1, 0.2);&lt;br /&gt;
    drawLink(source, dest, 15, 9);&lt;br /&gt;
&lt;br /&gt;
    glPopAttrib();&lt;br /&gt;
    glPopClientAttrib();&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And that really is all there is to it!&lt;br /&gt;
&lt;br /&gt;
===Registering the new window type===&lt;br /&gt;
The new window type is registered using the WindowFactoryManager and the templatised WindowFactory, like so:&lt;br /&gt;
&amp;lt;code&amp;gt;WindowFactoryManager::getSingleton().addFactory&amp;lt;TplWindowFactory&amp;lt;LinkedWindow&amp;gt; &amp;gt;();&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For this example, the falagard mapping that makes this usable is specified in code, but it's just as easily added to your XML scheme file:&lt;br /&gt;
&amp;lt;code&amp;gt;WindowFactoryManager::getSingleton().&lt;br /&gt;
    addFalagardWindowMapping(&amp;quot;TaharezLook/LinkedWindow&amp;quot;,&lt;br /&gt;
                             &amp;quot;LinkedWindow&amp;quot;,&lt;br /&gt;
                             &amp;quot;TaharezLook/FrameWindow&amp;quot;,&lt;br /&gt;
                             &amp;quot;Falagard/FrameWindow&amp;quot;);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
Here we have seen how to hook into the CEGUI rendering process by queueing a custom GeometryBuffer implementation along with (or instead of) the regular GeometryBuffer queued by the Window's drawSelf function.  This allows any custom rendering to be performed at the correct time so it appears at the same layered position as a window in the output.&lt;br /&gt;
&lt;br /&gt;
==Example Code==&lt;br /&gt;
===LinkedWindow Class Declaration (LinkedWindow.h)===&lt;br /&gt;
&amp;lt;code&amp;gt;#ifndef _LINKED_WINDOW_H&lt;br /&gt;
#define _LINKED_WINDOW_H&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;elements/CEGUIFrameWindow.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*!&lt;br /&gt;
\brief&lt;br /&gt;
    Custom subclass of FrameWindow.  The main purpose of this is so we can&lt;br /&gt;
    override the Window::drawSelf function in order to add an instance of&lt;br /&gt;
    our custom GeometryBuffer at an appropriate place - which will then&lt;br /&gt;
    render the link lines when it's draw function is called.&lt;br /&gt;
*/&lt;br /&gt;
class LinkedWindow : public CEGUI::FrameWindow&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
    //! 'Namespace' string used for global events on this class.&lt;br /&gt;
	static const CEGUI::String EventNamespace;&lt;br /&gt;
    //! String holding the type name of this widget.&lt;br /&gt;
    static const CEGUI::String WidgetTypeName;&lt;br /&gt;
&lt;br /&gt;
    //! set window that will be the target of our link line.&lt;br /&gt;
    void setTarget(const CEGUI::Window* target);&lt;br /&gt;
    //! return pointer that is our current link target.&lt;br /&gt;
    const CEGUI::Window* getTarget() const;&lt;br /&gt;
&lt;br /&gt;
    LinkedWindow(const CEGUI::String&amp;amp; type, const CEGUI::String&amp;amp; name);&lt;br /&gt;
    ~LinkedWindow();&lt;br /&gt;
&lt;br /&gt;
protected:&lt;br /&gt;
    // overridden from base class.&lt;br /&gt;
    void drawSelf(const CEGUI::RenderingContext&amp;amp; ctx);&lt;br /&gt;
    bool testClassName_impl(const CEGUI::String&amp;amp; class_name) const;&lt;br /&gt;
&lt;br /&gt;
    //! pointer to a GeometryBuffer that will render our link line.&lt;br /&gt;
    CEGUI::GeometryBuffer* d_linksGeometry;&lt;br /&gt;
    //! pointer to the target window of our link line.  May be zero.&lt;br /&gt;
    const CEGUI::Window* d_target;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#endif&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===LinkedWindow Class Implementation (LinkedWindow.cpp)===&lt;br /&gt;
&amp;lt;code&amp;gt;#include &amp;lt;CEGUIRenderingWindow.h&amp;gt;&lt;br /&gt;
#include &amp;lt;CEGUIRenderingContext.h&amp;gt;&lt;br /&gt;
#include &amp;quot;LinkedWindow.h&amp;quot;&lt;br /&gt;
#include &amp;quot;LinkGeometryBuffer.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
using namespace CEGUI;&lt;br /&gt;
&lt;br /&gt;
//----------------------------------------------------------------------------//&lt;br /&gt;
const String LinkedWindow::EventNamespace(&amp;quot;LinkedWindow&amp;quot;);&lt;br /&gt;
const String LinkedWindow::WidgetTypeName(&amp;quot;LinkedWindow&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//----------------------------------------------------------------------------//&lt;br /&gt;
LinkedWindow::LinkedWindow(const CEGUI::String&amp;amp; type, const CEGUI::String&amp;amp; name) :&lt;br /&gt;
    FrameWindow(type, name),&lt;br /&gt;
    d_linksGeometry(new LinkGeometryBuffer(this)),&lt;br /&gt;
    d_target(0)&lt;br /&gt;
{&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//----------------------------------------------------------------------------//&lt;br /&gt;
void LinkedWindow::setTarget(const CEGUI::Window* target)&lt;br /&gt;
{&lt;br /&gt;
    d_target = target;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//----------------------------------------------------------------------------//&lt;br /&gt;
const Window* LinkedWindow::getTarget() const&lt;br /&gt;
{&lt;br /&gt;
    return d_target;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//----------------------------------------------------------------------------//&lt;br /&gt;
LinkedWindow::~LinkedWindow()&lt;br /&gt;
{&lt;br /&gt;
    delete d_linksGeometry;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//----------------------------------------------------------------------------//&lt;br /&gt;
void LinkedWindow::drawSelf(const RenderingContext&amp;amp; ctx)&lt;br /&gt;
{&lt;br /&gt;
    RenderingSurface* surface;&lt;br /&gt;
&lt;br /&gt;
    if (ctx.surface-&amp;gt;isRenderingWindow())&lt;br /&gt;
        surface = &amp;amp;static_cast&amp;lt;RenderingWindow*&amp;gt;(ctx.surface)-&amp;gt;getOwner();&lt;br /&gt;
    else&lt;br /&gt;
        surface = ctx.surface;&lt;br /&gt;
&lt;br /&gt;
    surface-&amp;gt;addGeometryBuffer(ctx.queue, *d_linksGeometry); &lt;br /&gt;
&lt;br /&gt;
    FrameWindow::drawSelf(ctx);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//----------------------------------------------------------------------------//&lt;br /&gt;
bool LinkedWindow::testClassName_impl(const CEGUI::String&amp;amp; class_name) const&lt;br /&gt;
{&lt;br /&gt;
    if (class_name == LinkedWindow::WidgetTypeName)&lt;br /&gt;
        return true;&lt;br /&gt;
&lt;br /&gt;
    return FrameWindow::testClassName_impl(class_name);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//----------------------------------------------------------------------------//&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===LinkGeometryBuffer Class Declaration (LinkGeometryBuffer.h)===&lt;br /&gt;
&amp;lt;code&amp;gt;#ifndef _LINK_GEOMETRY_BUFFER_H&lt;br /&gt;
#define _LINK_GEOMETRY_BUFFER_H&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;CEGUIGeometryBuffer.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class LinkedWindow;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/*!&lt;br /&gt;
/brief&lt;br /&gt;
    Custom GeometryBuffer used for drawing links from a LinkedWindow to its&lt;br /&gt;
    target window.&lt;br /&gt;
&lt;br /&gt;
\note&lt;br /&gt;
    The only part of the regular GeometryBuffer interface we will implement is&lt;br /&gt;
    the GeometryBuffer::draw function, the rest is stubbed out.  Note also that&lt;br /&gt;
    we don't actually 'buffer' anything here, but do direct drawing within the&lt;br /&gt;
    draw function.&lt;br /&gt;
*/&lt;br /&gt;
class LinkGeometryBuffer : public CEGUI::GeometryBuffer&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
    LinkGeometryBuffer(LinkedWindow* owner);&lt;br /&gt;
&lt;br /&gt;
    // required interface functions for base class.&lt;br /&gt;
    void draw() const;&lt;br /&gt;
    void setTranslation(const CEGUI::Vector3&amp;amp; v) {}&lt;br /&gt;
    void setRotation(const CEGUI::Vector3&amp;amp; r) {}&lt;br /&gt;
    void setPivot(const CEGUI::Vector3&amp;amp; p) {}&lt;br /&gt;
    void setClippingRegion(const CEGUI::Rect&amp;amp; region) {}&lt;br /&gt;
    void appendVertex(const CEGUI::Vertex&amp;amp; vertex) {}&lt;br /&gt;
    void appendGeometry(const CEGUI::Vertex* const vbuff, CEGUI::uint vertex_count) {}&lt;br /&gt;
    void setActiveTexture(CEGUI::Texture* texture) {}&lt;br /&gt;
    void reset() {}&lt;br /&gt;
    CEGUI::Texture* getActiveTexture() const {return 0;}&lt;br /&gt;
    CEGUI::uint getVertexCount() const {return 0;}&lt;br /&gt;
    CEGUI::uint getBatchCount() const {return 0;}&lt;br /&gt;
    void setRenderEffect(CEGUI::RenderEffect* effect) {}&lt;br /&gt;
    CEGUI::RenderEffect* getRenderEffect() {return 0;}&lt;br /&gt;
&lt;br /&gt;
protected:&lt;br /&gt;
    //! helper that uses GL calls to render the link line&lt;br /&gt;
    static void drawLink(const CEGUI::Vector2&amp;amp; source, const CEGUI::Vector2&amp;amp; dest,&lt;br /&gt;
                         float source_size, float dest_size);&lt;br /&gt;
    //! helper that uses GL calls to render an arrow.&lt;br /&gt;
    static void drawArrowRight(float x, float y, float sz);&lt;br /&gt;
&lt;br /&gt;
    //! LinkedWindow that created and owns the GeometryBuffer.&lt;br /&gt;
    LinkedWindow* d_owner;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#endif&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===LinkGeometryBuffer Class Implementation (LinkGeometryBuffer.cpp)===&lt;br /&gt;
&amp;lt;code&amp;gt;#include &amp;quot;LinkGeometryBuffer.h&amp;quot;&lt;br /&gt;
#include &amp;quot;LinkedWindow.h&amp;quot;&lt;br /&gt;
#include &amp;lt;GL/gl.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using namespace CEGUI;&lt;br /&gt;
&lt;br /&gt;
//----------------------------------------------------------------------------//&lt;br /&gt;
LinkGeometryBuffer::LinkGeometryBuffer(LinkedWindow* owner) :&lt;br /&gt;
    d_owner(owner)&lt;br /&gt;
{&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//----------------------------------------------------------------------------//&lt;br /&gt;
void LinkGeometryBuffer::draw() const&lt;br /&gt;
{&lt;br /&gt;
    if (!d_owner-&amp;gt;getTarget())&lt;br /&gt;
        return;&lt;br /&gt;
&lt;br /&gt;
    const Rect src_area(d_owner-&amp;gt;getUnclippedOuterRect());&lt;br /&gt;
    const Rect dst_area(d_owner-&amp;gt;getTarget()-&amp;gt;getUnclippedOuterRect());&lt;br /&gt;
&lt;br /&gt;
    const Vector2 source(&lt;br /&gt;
        src_area.d_right,&lt;br /&gt;
        src_area.d_top + ((src_area.d_bottom - src_area.d_top) / 2));&lt;br /&gt;
&lt;br /&gt;
    const Vector2 dest(&lt;br /&gt;
        dst_area.d_left,&lt;br /&gt;
        dst_area.d_top + ((dst_area.d_bottom - dst_area.d_top) / 2));&lt;br /&gt;
&lt;br /&gt;
    glPushClientAttrib(GL_CLIENT_ALL_ATTRIB_BITS);&lt;br /&gt;
    glPushAttrib(GL_ALL_ATTRIB_BITS);&lt;br /&gt;
&lt;br /&gt;
    glMatrixMode(GL_MODELVIEW);&lt;br /&gt;
    glLoadIdentity();&lt;br /&gt;
&lt;br /&gt;
    glBindTexture(GL_TEXTURE_2D, 0);&lt;br /&gt;
    glDisable(GL_SCISSOR_TEST);&lt;br /&gt;
&lt;br /&gt;
    glColor3f(0.1, 1, 0.2);&lt;br /&gt;
    drawLink(source, dest, 15, 9);&lt;br /&gt;
&lt;br /&gt;
    glPopAttrib();&lt;br /&gt;
    glPopClientAttrib();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//----------------------------------------------------------------------------//&lt;br /&gt;
void LinkGeometryBuffer::drawLink(const Vector2&amp;amp; source, const Vector2&amp;amp; dest,&lt;br /&gt;
                                  float source_size, float dest_size)&lt;br /&gt;
{&lt;br /&gt;
    drawArrowRight(source.d_x, source.d_y, source_size);&lt;br /&gt;
&lt;br /&gt;
    glBegin(GL_LINES);&lt;br /&gt;
        glVertex2f(source.d_x + (source_size - 1), source.d_y);&lt;br /&gt;
        glVertex2f(dest.d_x - (dest_size - 1), dest.d_y);&lt;br /&gt;
    glEnd();&lt;br /&gt;
&lt;br /&gt;
    drawArrowRight(dest.d_x - dest_size, dest.d_y, dest_size);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//----------------------------------------------------------------------------//&lt;br /&gt;
void LinkGeometryBuffer::drawArrowRight(float x, float y, float sz)&lt;br /&gt;
{&lt;br /&gt;
    glBegin(GL_TRIANGLES);&lt;br /&gt;
        glVertex2f(x, y - sz / 2);&lt;br /&gt;
        glVertex2f(x, y + sz / 2);&lt;br /&gt;
        glVertex2f(x + sz, y);&lt;br /&gt;
    glEnd();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//----------------------------------------------------------------------------//&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Demo App code using GLUT (main.cpp)===&lt;br /&gt;
&amp;lt;code&amp;gt;#include &amp;lt;GL/glut.h&amp;gt;&lt;br /&gt;
#include &amp;lt;CEGUI.h&amp;gt;&lt;br /&gt;
#include &amp;lt;RendererModules/OpenGL/CEGUIOpenGLRenderer.h&amp;gt;&lt;br /&gt;
#include &amp;quot;LinkedWindow.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
using namespace CEGUI;&lt;br /&gt;
&lt;br /&gt;
//----------------------------------------------------------------------------//&lt;br /&gt;
void drawFunc()&lt;br /&gt;
{&lt;br /&gt;
    glClearColor(0, 0, 0, 1);&lt;br /&gt;
    glClear(GL_COLOR_BUFFER_BIT);&lt;br /&gt;
&lt;br /&gt;
    System::getSingleton().renderGUI();&lt;br /&gt;
&lt;br /&gt;
    glutSwapBuffers();&lt;br /&gt;
    glutPostRedisplay();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//----------------------------------------------------------------------------//&lt;br /&gt;
void moveFunc(int x, int y)&lt;br /&gt;
{&lt;br /&gt;
    System::getSingleton().injectMousePosition(x, y);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//----------------------------------------------------------------------------//&lt;br /&gt;
void mouseButtonFunc(int button, int state, int, int)&lt;br /&gt;
{&lt;br /&gt;
    MouseButton cegui_btn;&lt;br /&gt;
&lt;br /&gt;
    switch (button)&lt;br /&gt;
    {&lt;br /&gt;
    case GLUT_MIDDLE_BUTTON:&lt;br /&gt;
        cegui_btn = MiddleButton;&lt;br /&gt;
        break;&lt;br /&gt;
&lt;br /&gt;
    case GLUT_RIGHT_BUTTON:&lt;br /&gt;
        cegui_btn = RightButton;&lt;br /&gt;
        break;&lt;br /&gt;
&lt;br /&gt;
    default:&lt;br /&gt;
        cegui_btn = LeftButton;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if (state == GLUT_UP)&lt;br /&gt;
        System::getSingleton().injectMouseButtonUp(cegui_btn);&lt;br /&gt;
    else&lt;br /&gt;
        System::getSingleton().injectMouseButtonDown(cegui_btn);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//----------------------------------------------------------------------------//&lt;br /&gt;
void initialiseGLUT(int argc, char* argv[])&lt;br /&gt;
{&lt;br /&gt;
    glutInit(&amp;amp;argc, argv);&lt;br /&gt;
    glutInitWindowSize(800, 600);&lt;br /&gt;
    glutInitDisplayMode(GLUT_DOUBLE );&lt;br /&gt;
    glutCreateWindow(&amp;quot;CEGUI Demo App&amp;quot;);&lt;br /&gt;
    glutDisplayFunc(drawFunc);&lt;br /&gt;
    glutMotionFunc(moveFunc);&lt;br /&gt;
    glutPassiveMotionFunc(moveFunc);&lt;br /&gt;
    glutMouseFunc(mouseButtonFunc);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//----------------------------------------------------------------------------//&lt;br /&gt;
void initialiseCEGUIResources()&lt;br /&gt;
{&lt;br /&gt;
    DefaultResourceProvider* rp = static_cast&amp;lt;DefaultResourceProvider*&amp;gt;(&lt;br /&gt;
        System::getSingleton().getResourceProvider());&lt;br /&gt;
    rp-&amp;gt;setResourceGroupDirectory(&amp;quot;schemes&amp;quot;, &amp;quot;/usr/local/share/CEGUI/schemes&amp;quot;);&lt;br /&gt;
    rp-&amp;gt;setResourceGroupDirectory(&amp;quot;imagesets&amp;quot;, &amp;quot;/usr/local/share/CEGUI/imagesets&amp;quot;);&lt;br /&gt;
    rp-&amp;gt;setResourceGroupDirectory(&amp;quot;fonts&amp;quot;, &amp;quot;/usr/local/share/CEGUI/fonts&amp;quot;);&lt;br /&gt;
    rp-&amp;gt;setResourceGroupDirectory(&amp;quot;looknfeel&amp;quot;, &amp;quot;/usr/local/share/CEGUI/looknfeel&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    Scheme::setDefaultResourceGroup(&amp;quot;schemes&amp;quot;);&lt;br /&gt;
    Imageset::setDefaultResourceGroup(&amp;quot;imagesets&amp;quot;);&lt;br /&gt;
    Font::setDefaultResourceGroup(&amp;quot;fonts&amp;quot;);&lt;br /&gt;
    WidgetLookManager::setDefaultResourceGroup(&amp;quot;looknfeel&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//----------------------------------------------------------------------------//&lt;br /&gt;
void registerCustomWindow()&lt;br /&gt;
{&lt;br /&gt;
    // register the new window type&lt;br /&gt;
    WindowFactoryManager::getSingleton().&lt;br /&gt;
        addFactory&amp;lt;TplWindowFactory&amp;lt;LinkedWindow&amp;gt; &amp;gt;();&lt;br /&gt;
&lt;br /&gt;
    // make a mapping that uses the existing TL/FrameWindow renderer.&lt;br /&gt;
    WindowFactoryManager::getSingleton().&lt;br /&gt;
        addFalagardWindowMapping(&amp;quot;TaharezLook/LinkedWindow&amp;quot;,&lt;br /&gt;
                                 &amp;quot;LinkedWindow&amp;quot;,&lt;br /&gt;
                                 &amp;quot;TaharezLook/FrameWindow&amp;quot;,&lt;br /&gt;
                                 &amp;quot;Falagard/FrameWindow&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//----------------------------------------------------------------------------//&lt;br /&gt;
bool checkBoxHandler(const EventArgs&amp;amp; a)&lt;br /&gt;
{&lt;br /&gt;
    const WindowEventArgs&amp;amp; wa = static_cast&amp;lt;const WindowEventArgs&amp;amp;&amp;gt;(a);&lt;br /&gt;
    Checkbox* cb = static_cast&amp;lt;Checkbox*&amp;gt;(wa.window);&lt;br /&gt;
&lt;br /&gt;
    const String lnkWindowName(cb-&amp;gt;getUserString(&amp;quot;LinkedWindow&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
    if (!lnkWindowName.empty())&lt;br /&gt;
    {&lt;br /&gt;
        Window* lw = WindowManager::getSingleton().getWindow(lnkWindowName);&lt;br /&gt;
        lw-&amp;gt;setVisible(cb-&amp;gt;isSelected());&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//----------------------------------------------------------------------------//&lt;br /&gt;
LinkedWindow* createLinkedWindow(const String&amp;amp; name,&lt;br /&gt;
                                 float x, float y, float w, float h,&lt;br /&gt;
                                 const String&amp;amp; title,&lt;br /&gt;
                                 bool initially_hidden)&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    LinkedWindow* wnd = static_cast&amp;lt;LinkedWindow*&amp;gt;(&lt;br /&gt;
        WindowManager::getSingleton().&lt;br /&gt;
            createWindow(&amp;quot;TaharezLook/LinkedWindow&amp;quot;, name));&lt;br /&gt;
&lt;br /&gt;
    wnd-&amp;gt;setPosition(UVector2(UDim(x, 0), UDim(y, 0)));&lt;br /&gt;
    wnd-&amp;gt;setSize(UVector2(UDim(w, 0), UDim(h, 0)));&lt;br /&gt;
    wnd-&amp;gt;setUsingAutoRenderingSurface(false);&lt;br /&gt;
    wnd-&amp;gt;setText(title);&lt;br /&gt;
    wnd-&amp;gt;setVisible(!initially_hidden);&lt;br /&gt;
&lt;br /&gt;
    return wnd;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//----------------------------------------------------------------------------//&lt;br /&gt;
Checkbox* createCheckbox(float x, float y, const String&amp;amp; label)&lt;br /&gt;
{&lt;br /&gt;
    Checkbox* wnd = static_cast&amp;lt;Checkbox*&amp;gt;(WindowManager::getSingleton().&lt;br /&gt;
        createWindow(&amp;quot;TaharezLook/Checkbox&amp;quot;));&lt;br /&gt;
    wnd-&amp;gt;setPosition(UVector2(UDim(x, 0), UDim(y, 0)));&lt;br /&gt;
    wnd-&amp;gt;setSize(UVector2(UDim(1.0, 0), UDim(0.2, 0)));&lt;br /&gt;
    wnd-&amp;gt;setText(label);&lt;br /&gt;
    wnd-&amp;gt;subscribeEvent(Checkbox::EventCheckStateChanged, checkBoxHandler);&lt;br /&gt;
&lt;br /&gt;
    return wnd;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//----------------------------------------------------------------------------//&lt;br /&gt;
int main(int argc, char* argv[])&lt;br /&gt;
{&lt;br /&gt;
    initialiseGLUT(argc, argv);&lt;br /&gt;
&lt;br /&gt;
    System::setDefaultXMLParserName(&amp;quot;ExpatParser&amp;quot;);&lt;br /&gt;
    OpenGLRenderer::bootstrapSystem();&lt;br /&gt;
    initialiseCEGUIResources();&lt;br /&gt;
&lt;br /&gt;
    SchemeManager::getSingleton().create(&amp;quot;TaharezLook.scheme&amp;quot;);&lt;br /&gt;
    System::getSingleton().setDefaultMouseCursor(&amp;quot;TaharezLook&amp;quot;, &amp;quot;MouseArrow&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    registerCustomWindow();&lt;br /&gt;
&lt;br /&gt;
    WindowManager&amp;amp; winMgr(WindowManager::getSingleton());&lt;br /&gt;
    Window* root = winMgr.createWindow(&amp;quot;DefaultWindow&amp;quot;);&lt;br /&gt;
    System::getSingleton().setGUISheet(root);&lt;br /&gt;
&lt;br /&gt;
    LinkedWindow* main = createLinkedWindow(&amp;quot;main&amp;quot;, 0.4, 0.2, 0.25, 0.25, &amp;quot;Main Window&amp;quot;, false);&lt;br /&gt;
    root-&amp;gt;addChildWindow(main);&lt;br /&gt;
&lt;br /&gt;
    LinkedWindow* src1 = createLinkedWindow(&amp;quot;src1&amp;quot;, 0.1, 0.1, 0.2, 0.15, &amp;quot;Src Wnd 1&amp;quot;, true);&lt;br /&gt;
    root-&amp;gt;addChildWindow(src1);&lt;br /&gt;
&lt;br /&gt;
    LinkedWindow* src2 = createLinkedWindow(&amp;quot;src2&amp;quot;, 0.1, 0.3, 0.2, 0.15, &amp;quot;Src Wnd 2&amp;quot;, true);&lt;br /&gt;
    root-&amp;gt;addChildWindow(src2);&lt;br /&gt;
&lt;br /&gt;
    LinkedWindow* dst1 = createLinkedWindow(&amp;quot;dst1&amp;quot;, 0.7, 0.1, 0.25, 0.25, &amp;quot;Dst Wnd 1&amp;quot;, false);&lt;br /&gt;
    root-&amp;gt;addChildWindow(dst1);&lt;br /&gt;
&lt;br /&gt;
    Window* tg1 = createCheckbox(0, 0, &amp;quot;Link Target 1&amp;quot;);&lt;br /&gt;
    main-&amp;gt;addChildWindow(tg1);&lt;br /&gt;
    src1-&amp;gt;setTarget(tg1);&lt;br /&gt;
    tg1-&amp;gt;setUserString(&amp;quot;LinkedWindow&amp;quot;, &amp;quot;src1&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    Window* tg2 = createCheckbox(0, 0.2, &amp;quot;Link Target 2&amp;quot;);&lt;br /&gt;
    main-&amp;gt;addChildWindow(tg2);&lt;br /&gt;
    tg2-&amp;gt;setUserString(&amp;quot;LinkedWindow&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    Window* tg3 = createCheckbox(0, 0.4, &amp;quot;Link Target 3&amp;quot;);&lt;br /&gt;
    main-&amp;gt;addChildWindow(tg3);&lt;br /&gt;
    src2-&amp;gt;setTarget(tg3);&lt;br /&gt;
    tg3-&amp;gt;setUserString(&amp;quot;LinkedWindow&amp;quot;, &amp;quot;src2&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    Window* button = winMgr.createWindow(&amp;quot;TaharezLook/Button&amp;quot;);&lt;br /&gt;
    button-&amp;gt;setPosition(UVector2(UDim(0.0, 0), UDim(0.3, 0)));&lt;br /&gt;
    button-&amp;gt;setSize(UVector2(UDim(1.0, 0), UDim(0.2, 0)));&lt;br /&gt;
    button-&amp;gt;setText(&amp;quot;Engage!&amp;quot;);&lt;br /&gt;
    button-&amp;gt;setUserString(&amp;quot;LinkedWindow&amp;quot;, &amp;quot;main&amp;quot;);&lt;br /&gt;
    dst1-&amp;gt;addChildWindow(button);&lt;br /&gt;
    main-&amp;gt;setTarget(button);&lt;br /&gt;
&lt;br /&gt;
    glutMainLoop();&lt;br /&gt;
&lt;br /&gt;
    OpenGLRenderer::destroySystem();&lt;br /&gt;
&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//----------------------------------------------------------------------------//&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tss</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=Creating_Skins&amp;diff=3671</id>
		<title>Creating Skins</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=Creating_Skins&amp;diff=3671"/>
				<updated>2011-02-26T12:11:03Z</updated>
		
		<summary type="html">&lt;p&gt;Tss: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[category: Tutorials]]&lt;br /&gt;
&lt;br /&gt;
So far this page contains a few thoughts randomly scattered around as I (centipede) learn how to create skins. It may be worth a reading though.&lt;br /&gt;
&lt;br /&gt;
== What the artist should know about programming CEGUI ==&lt;br /&gt;
If you are more of an artist than a programmer, and you intend to make skins for CEGUI, but have practically no experience with how to program it then all those definition files (imageset, scheme, looknfeel) and other things will be wildly confusing. You need to have a basic idea of how the code works before things will make any sense, but once you do it all seems so naturally logical. The reason this wiki-entry has been written is that the author is right in the transition from foggy confusion to perfect clarity, and he wants to put his experience into writing before he becomes a silent member of the crowd of people who thinks these matters are so obvious that they hardly need to be expounded upon. If you are wise, you will add your thoughts and experience too.&lt;br /&gt;
&lt;br /&gt;
The programmer lives in the C++ world whereas the artist lives in the XML world. They are brought together in the Look-plugins: FalagardLook (and previously TaharezLook and WindowsLook). It works a bit like the Model/View paradigm. The Core library is not at all concerned with how things look. It is only interested in behaviour: What state is the button in right now, and what would happen if the user moved the mouse away while keeping the button pressed etc. The core library relies on the Look-modules to supply the visual aspect. They are the ones that handles all the stuff the artist specify in the XML files.&lt;br /&gt;
&lt;br /&gt;
== Child, NamedArea, states and optional configurations ==&lt;br /&gt;
&lt;br /&gt;
So basically the Core has a set of logical elements/widgets which the Look-plugins turns into a set of physical elements/widgets using the information in the XML files. This is why certain things are mandatory in the looknfeel files.&lt;br /&gt;
&lt;br /&gt;
Some widgets are ''logically'' composed of a few smaller widgets. A FrameWindow consists of a TitleBar and a SystemButton and a ListBox has a vertical and a horizontal Scrollbar. FalagardLook, being totally configurable as it is, can really make no assumptions about how things are arranged by the artist, so it absolutely relies on the '''&amp;lt;Child&amp;gt;''' elements of the '''&amp;lt;WidgetLook&amp;gt;''' to specify where to put those subelements in the physical space of the FrameWindow. Notice how the following code from the Vanilla.looknfeel is really just a specification of an area on the total FrameWindow where the titlebar should be placed:&lt;br /&gt;
        &amp;lt;Child type=&amp;quot;Vanilla/Titlebar&amp;quot; nameSuffix=&amp;quot;__auto_titlebar__&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;Area&amp;gt;&lt;br /&gt;
                &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot; &amp;gt;&amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&amp;lt;/Dim&amp;gt;&lt;br /&gt;
                &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot; &amp;gt;&amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&amp;lt;/Dim&amp;gt;&lt;br /&gt;
                &amp;lt;Dim type=&amp;quot;Width&amp;quot; &amp;gt;&amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; type=&amp;quot;Width&amp;quot; /&amp;gt;&amp;lt;/Dim&amp;gt;&lt;br /&gt;
                &amp;lt;Dim type=&amp;quot;Height&amp;quot; &amp;gt;&amp;lt;FontDim type=&amp;quot;LineSpacing&amp;quot; padding=&amp;quot;14&amp;quot; /&amp;gt;&amp;lt;/Dim&amp;gt;&lt;br /&gt;
            &amp;lt;/Area&amp;gt;&lt;br /&gt;
            &amp;lt;Property name=&amp;quot;AlwaysOnTop&amp;quot; value=&amp;quot;False&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/Child&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some widgets can have a ''logical'' interaction (e.g. writing text in an EditBox) which forces the poor ignorant FalagardLook module to demand of the poor all-knowing artist to specify where to put the text. Putting it at position (0,0) it usually not a very good idea, so the artist must specify a '''&amp;lt;NamedArea&amp;gt;''' that FalagardLook can read and use when rendering text. Here is an example of a specified &amp;quot;client area&amp;quot; of a FrameWindow, which is the area inside the window where subwidgets can be placed (i.e. all the window except titlebar and border):&lt;br /&gt;
        &amp;lt;NamedArea name=&amp;quot;ClientWithTitleWithFrame&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;Area&amp;gt;&lt;br /&gt;
                &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot;&amp;gt;&amp;lt;AbsoluteDim value=&amp;quot;7&amp;quot; /&amp;gt;&amp;lt;/Dim&amp;gt;&lt;br /&gt;
                &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot;&amp;gt;&amp;lt;WidgetDim widget=&amp;quot;__auto_titlebar__&amp;quot; dimension=&amp;quot;BottomEdge&amp;quot; /&amp;gt;&amp;lt;/Dim&amp;gt;&lt;br /&gt;
                &amp;lt;Dim type=&amp;quot;RightEdge&amp;quot;&amp;gt;&amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;-7&amp;quot; type=&amp;quot;RightEdge&amp;quot; /&amp;gt;&amp;lt;/Dim&amp;gt;&lt;br /&gt;
                &amp;lt;Dim type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;-7&amp;quot; type=&amp;quot;BottomEdge&amp;quot; /&amp;gt;&amp;lt;/Dim&amp;gt;&lt;br /&gt;
            &amp;lt;/Area&amp;gt;&lt;br /&gt;
        &amp;lt;/NamedArea&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
One thing worth noting above is that a FrameWindow must have not just one client area specified but four! This is because the programmer that uses CEGUI can request four different kinds of subwindows: With/without a titlebar and with/without a border. The artists must be prepared for this and perhaps even go to the extreme of painting four kinds of windows. Falagard can't possibly deduce where the client area is placed in the four situations, so it will have to know from the XML files.&lt;br /&gt;
&lt;br /&gt;
== So, how DO I make a skin? ==&lt;br /&gt;
&lt;br /&gt;
Here are some quick ideas on how to get around the job without spending too many hours. There is nothing wrong with reusing things. You can always add more detail later on, but for a start it would be fairly nice to have something that just resembles a GUI rather fast. Remember that in Falagard you can layer things which makes it particularly easy to reuse pixels.&lt;br /&gt;
&lt;br /&gt;
'''Things you will need for a minimal gui'''&lt;br /&gt;
&lt;br /&gt;
'''Assembling the stuff'''&lt;br /&gt;
&lt;br /&gt;
''FrameWindow''&lt;br /&gt;
Remember that the titlebar and the rest are drawn separately (i.e. the titlebar is a Child of the FrameWindow and as such is a separate Falagard element).&lt;br /&gt;
You will most likely have a few rows of &amp;quot;glue pixels&amp;quot; between the titlebar and the bottom of the FrameWindow. [Should they be put in the titlebar or the rest? Don't know yet]&lt;/div&gt;</summary>
		<author><name>Tss</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=The_Beginners_Guide_to_Falagard_skinning_-_Part_I&amp;diff=3670</id>
		<title>The Beginners Guide to Falagard skinning - Part I</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=The_Beginners_Guide_to_Falagard_skinning_-_Part_I&amp;diff=3670"/>
				<updated>2011-02-26T12:10:56Z</updated>
		
		<summary type="html">&lt;p&gt;Tss: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[category: Tutorials]]&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
The Falagard system in CEGUI 0.4 and up is a powerful tool.&lt;br /&gt;
By using it you can make your GUI elements look like you want and not how some coder thought looked cool.&lt;br /&gt;
Use Falagard to your advantage and you can do alot of nice things from XML that you might think needed real code.&lt;br /&gt;
&lt;br /&gt;
Falagard allows you not only to define how the rendering of a window proceeds, you can create new representational features as well by creating new properties for the window and using them in your imagery configurations.&lt;br /&gt;
&lt;br /&gt;
Before I go too far glorifying Falagard, we'll just jump right into it :-)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
Falagard is a part of the CEGUI core and is implemented in C++. It is completely possible to write a skin in C++, but it's is not very practical. You have to recompile every time you change something. Fortunately CEGUI supports creating a Falagard skin from a custom XML format.&lt;br /&gt;
&lt;br /&gt;
This Falagard XML format is what we're going to be looking at throughout this tutorial. As I think learning by doing is the way to go, we'll try to produce something useful with this tutorial - a fully working look'n'feel for a regular button.&lt;br /&gt;
&lt;br /&gt;
The beginning:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;Falagard&amp;gt;&lt;br /&gt;
     &amp;lt;WidgetLook name=&amp;quot;MyButton&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;/WidgetLook&amp;gt;&lt;br /&gt;
 &amp;lt;/Falagard&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the truely minimal XML that defines a widget look. A widget look contains all the information needed to render a specific type of window, a widget look is also what we would define as a look'n'feel.&lt;br /&gt;
The first line tells the parser that this is really a XML document. This must always be the first line of a Falagard XML skin.&lt;br /&gt;
The second line opens the ''Falagard'' tag. This is always the first thing we do after the ''&amp;lt;?xml ... ?&amp;gt;'' tag.&lt;br /&gt;
I hope you're somewhat familiar with XML or at least HTML as this tutorial might be a little difficult to understand if you're not. Now you're warned.&lt;br /&gt;
The third line opens a ''WidgetLook'' tag. This is where we cram all the details about our look'n'feel.&lt;br /&gt;
The fourth line closes the ''WidgetLook'' tag. We must always remember to close our tags.&lt;br /&gt;
The fifth line closes the ''Falagard'' tag. Again - always remember to close your tags.&lt;br /&gt;
&lt;br /&gt;
While this simple XML snippet is good for showing you how to start out, it is completely useless as it does nothing.&lt;br /&gt;
&lt;br /&gt;
To make our look'n'feel interesting we need to tell it what to do. So let's have a look at the Falagard data structure:&lt;br /&gt;
&lt;br /&gt;
* WidgetLook&lt;br /&gt;
** Property definitions&lt;br /&gt;
** Properties&lt;br /&gt;
** Named areas&lt;br /&gt;
** Child components&lt;br /&gt;
** Imagery sections&lt;br /&gt;
** State imagery&lt;br /&gt;
&lt;br /&gt;
This might be overwhelming. It might not. Either way it's the how it is. Falagard is a complex system...&lt;br /&gt;
But it's really not that hard once you get down the basics.&lt;br /&gt;
&lt;br /&gt;
The look'n'feel we are going to produce is for a ''Falagard/Button'' type window. This window type is simple, and we don't have to know about all of the parts of a look'n'feel. We only need to know what we'll be using. Furthermore we'll keep it very simple which leaves us at a point where we can make something work with very little.&lt;br /&gt;
&lt;br /&gt;
I'm still going to give a short description of each item in the list though:&lt;br /&gt;
&lt;br /&gt;
* WidgetLook - This is where we add all the other components for our look'n'feel. Consider it '''the''' look'n'feel.&lt;br /&gt;
&lt;br /&gt;
* Property definitions - A property definition is the creation of a new property in the window that gets the look'n'feel assigned.&lt;br /&gt;
&lt;br /&gt;
* Properties - A property in CEGUI is a window variable that we can access from anywhere. Even outside C++ (think XML window layouts). We often assign default values to properties from a look'n'feel.&lt;br /&gt;
&lt;br /&gt;
* Named areas - A named area defines a rectangle, inside the window we are skinning, with a distinct name. Often used to define where to draw some specific piece of imagery that needs special handling by CEGUI as thus cannot be completely defined in the look'n'feel.&lt;br /&gt;
&lt;br /&gt;
* Child components - Some window types need child windows. This could be scrollbar, a titlebar etc. We specify what type of window this child will be customize it for the situation from the look'n'feel.&lt;br /&gt;
&lt;br /&gt;
* Imagery sections - An imagery section is a collection of imagery components tagged with a name. We use imagery sections to split the renderable parts of our look'n'feel into sections which can be drawn independently. Like for example having the frame in one section and the background in another.&lt;br /&gt;
&lt;br /&gt;
* State imagery - Tells CEGUI what to draw when. In a state imagery we draw all the different imagery sections we need for a specific window &amp;quot;situation&amp;quot;. For our button we will have: Normal, Hover, Pushed, Disabled.&lt;br /&gt;
&lt;br /&gt;
Ok. I hope this clarifies it a bit. We'll go into more detil about the different parts as we need them.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
Every time you write a look'n'feel you need to make find out what the requirements are for the type of window you want to skin. To get this information you either look at the header files in the Falagard module source directory, or you reference the manual. This is available both online, here on the wiki, and in the documentation directory in the SDK as a PDF.&lt;br /&gt;
&lt;br /&gt;
The online version is available on the page [[&amp;quot;Falagard&amp;quot; Skinning System Documentation]]. For the list of these requirements I'm talking about the [[Falagard System base widgets reference]] is what you're looking for.&lt;br /&gt;
If we look in there we'll see that ''Falagard/Button'' only require 1 ''StateImagery'' definition to be present. ''Normal''.&lt;br /&gt;
&lt;br /&gt;
It allows up to four ''StateImagery'' definitions to cover all its possible states: ''Normal'', ''Hover'', ''Pushed'' and ''Disabled''.&lt;br /&gt;
&lt;br /&gt;
We'll start out the easy way and just make the ''Normal'' state ;-) So now our XML looks like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;Falagard&amp;gt;&lt;br /&gt;
     &amp;lt;WidgetLook name=&amp;quot;MyButton&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;b&amp;gt;&amp;lt;StateImagery name=&amp;quot;Normal&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;/StateImagery&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
     &amp;lt;/WidgetLook&amp;gt;&lt;br /&gt;
 &amp;lt;/Falagard&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you compare to the last XML piece, the only difference is the addition of a ''StateImagery'' tag with its name attribute set to &amp;quot;Normal&amp;quot;. This makes sure that we live up to the requirement of a &amp;quot;Normal&amp;quot; state definition.&lt;br /&gt;
As I said earlier the ''WidgetLook'' is '''the''' look'n'feel so it is - of course - inside it we add the ''StateImagery'' tag.&lt;br /&gt;
&lt;br /&gt;
This still extremely simple look'n'feel is actually a fully valid look'n'feel. It implements what is required by the manual. Though as you might have guessed it still does nothing.&lt;br /&gt;
To get it to render anything we have to define the imagery sections mentioned earlier.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Imagery ==&lt;br /&gt;
For our look'n'feel we'll just want a single image to be stretched over the entire window area. That is each corner from the image mapped to each corner of the window.&lt;br /&gt;
&lt;br /&gt;
To acheive this the first thing we need to do is to add a ''ImagerySection'' to our look'n'feel.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;Falagard&amp;gt;&lt;br /&gt;
     &amp;lt;WidgetLook name=&amp;quot;MyButton&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;b&amp;gt;&amp;lt;ImagerySection name=&amp;quot;bg&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;/ImagerySection&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
         &amp;lt;StateImagery name=&amp;quot;Normal&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;b&amp;gt;&amp;lt;Layer&amp;gt;&lt;br /&gt;
                &amp;lt;Section section=&amp;quot;bg&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;/Layer&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
         &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;/WidgetLook&amp;gt;&lt;br /&gt;
 &amp;lt;/Falagard&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have added the imagery section, and named it &amp;quot;bg&amp;quot;. This name is just something we choose.&lt;br /&gt;
&lt;br /&gt;
Inside the state imagery for the &amp;quot;Normal&amp;quot; state a layer has been added.&lt;br /&gt;
The ''Layer'' tag allow you to control the z-ordering of layers inside in a ''StateImagery'', but we only need one layer for this look'n'feel so let's not worry too much about that.&lt;br /&gt;
&lt;br /&gt;
In the layer a ''Section'' has been added. This tag tells the layer its in that we want the ''ImagerySection'' named &amp;quot;bg&amp;quot; to be rendered as part of this layer.&lt;br /&gt;
&lt;br /&gt;
This is nice. The look'n'feel is all ready and hooked up to render the imagery section &amp;quot;bg&amp;quot; as the imagery for the &amp;quot;Normal&amp;quot; state. But our imagery section is still empty, and this means our look'n'feel really is no better than the previous. It still does nothing (at least visually).&lt;br /&gt;
&lt;br /&gt;
Now that we're over the really basic and boring stuff, let's make it draw that image...&lt;br /&gt;
&lt;br /&gt;
To draw a single image we use the tag ''ImageryComponent''. This tag requires us to define the area in which we want the image to be drawn, as well as the image to draw.&lt;br /&gt;
&lt;br /&gt;
The area is the most complex part of practically all look'n'feels. It is designed to be flexible and uses an extended version of the unified coordinate system of CEGUI 0.4 and up.&lt;br /&gt;
Besides the regular two numbers containing the relative and absolute component of the coordinate or size Falagard also allows us to use the dimensions of images, windows, text and even properties.&lt;br /&gt;
We can also perform arithmetic operations on these dimensions to a certain extent.&lt;br /&gt;
&lt;br /&gt;
Any area needs to define 4 dimensions to fully describe the area. There is some flexibility in how you define the dimensions though.&lt;br /&gt;
Probably the most common is to use one of &amp;quot;LeftEdge&amp;quot;, &amp;quot;TopEdge&amp;quot;, &amp;quot;RightEdge&amp;quot; or &amp;quot;BottomEdge&amp;quot;. These map to edges of the window that recieves the look'n'feel, but you can specify &amp;quot;Width&amp;quot; and &amp;quot;Height&amp;quot; instead of &amp;quot;RightEdge&amp;quot; and &amp;quot;BottomEdge&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The look'n'feel we're creating only needs a simple area that covers the entire widget. We'll take the XML required for that in two steps.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Area&amp;gt;&lt;br /&gt;
     &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;/Dim&amp;gt;&lt;br /&gt;
     &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;/Dim&amp;gt;&lt;br /&gt;
     &amp;lt;Dim type=&amp;quot;RightEdge&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;/Dim&amp;gt;&lt;br /&gt;
     &amp;lt;Dim type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;/Dim&amp;gt;&lt;br /&gt;
 &amp;lt;/Area&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The area itself is created with the ''Area'' tag. Inside it we have the 4 dimensions. We must explicitly state the type of dimension for each one. The order is important:&lt;br /&gt;
&lt;br /&gt;
* LeftEdge&lt;br /&gt;
* TopEdge&lt;br /&gt;
* RightEdge / Width&lt;br /&gt;
* BottomEdge / Height&lt;br /&gt;
&lt;br /&gt;
You don't have to use '''both''' width and height. For example using &amp;quot;RightEdge&amp;quot; and &amp;quot;Height&amp;quot; is fine.&lt;br /&gt;
&lt;br /&gt;
This tells the area how to interpret the dimensions that we are now going to add:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Area&amp;gt;&lt;br /&gt;
     &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot;&amp;gt;&lt;br /&gt;
         '''&amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;'''&lt;br /&gt;
     &amp;lt;/Dim&amp;gt;&lt;br /&gt;
     &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot;&amp;gt;&lt;br /&gt;
         '''&amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;'''&lt;br /&gt;
     &amp;lt;/Dim&amp;gt;&lt;br /&gt;
     &amp;lt;Dim type=&amp;quot;RightEdge&amp;quot;&amp;gt;&lt;br /&gt;
         '''&amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;RightEdge&amp;quot; /&amp;gt;'''&lt;br /&gt;
     &amp;lt;/Dim&amp;gt;&lt;br /&gt;
     &amp;lt;Dim type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&lt;br /&gt;
         '''&amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;BottomEdge&amp;quot; /&amp;gt;'''&lt;br /&gt;
     &amp;lt;/Dim&amp;gt;&lt;br /&gt;
 &amp;lt;/Area&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inside each ''Dim'' tag we have added a dimension. Let's take them one at a time.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt; - This tell it to put our &amp;quot;LeftEdge&amp;quot; ''Dim'' at pixel position 0. All dimensions are always relative to window that has the look'n'feel, so 0 will in this case be the left edge of our widget as we planned.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt; - Just the same as before. But this time we're in a &amp;quot;TopEdge&amp;quot; ''Dim'' so it will result in the top edge of our window.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;RightEdge&amp;quot; /&amp;gt; - A unified dimension. This one has a scale (relative) component of exactly one. And a offset (absolute) value of zero. As type we've set &amp;quot;RightEdge&amp;quot;. This is what the scale component get multiplied by to get some thing useful (pixel values). One times RightEdge will equal RightEdge, which is exactly the window dimension we want.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;BottomEdge&amp;quot; /&amp;gt; - Same as before but the bottom edge of our window as the dimension.&lt;br /&gt;
&lt;br /&gt;
Now the area to span our entire is worked out, let's add that ''ImageryComponent'' and give it its area.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;Falagard&amp;gt;&lt;br /&gt;
     &amp;lt;WidgetLook name=&amp;quot;MyButton&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;ImagerySection name=&amp;quot;bg&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;b&amp;gt;&amp;lt;ImageryComponent&amp;gt;&lt;br /&gt;
                &amp;lt;Area&amp;gt;&lt;br /&gt;
                    &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
                    &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                    &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
                    &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                    &amp;lt;Dim type=&amp;quot;RightEdge&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;RightEdge&amp;quot; /&amp;gt;&lt;br /&gt;
                    &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                    &amp;lt;Dim type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;BottomEdge&amp;quot; /&amp;gt;&lt;br /&gt;
                    &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                &amp;lt;/Area&amp;gt;&lt;br /&gt;
            &amp;lt;/ImageryComponent&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
         &amp;lt;/ImagerySection&amp;gt;&lt;br /&gt;
         &amp;lt;StateImagery name=&amp;quot;Normal&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;Layer&amp;gt;&lt;br /&gt;
                &amp;lt;Section section=&amp;quot;bg&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;/Layer&amp;gt;&lt;br /&gt;
         &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;/WidgetLook&amp;gt;&lt;br /&gt;
 &amp;lt;/Falagard&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the area is in place.&lt;br /&gt;
The ''ImageryComponent'' tag has been added to our ''ImagerySection'' and inside it we have out the area we just created.&lt;br /&gt;
All thats missing now is the image!&lt;br /&gt;
&lt;br /&gt;
We'll assume we have a imageset loaded called &amp;quot;MyImages&amp;quot;. And inside this imageset we have the image &amp;quot;ButtonBG&amp;quot; defined.&lt;br /&gt;
This is the image we'll use for our button.&lt;br /&gt;
&lt;br /&gt;
The XML looks like this&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Image imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;ButtonBG&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Simple eh?&lt;br /&gt;
&lt;br /&gt;
We also wanted the image to be stretched across the whole area of the ''ImageryComponent''. The default formatting in top/left alignment. Not good enough...&lt;br /&gt;
&lt;br /&gt;
We add the formatting tags&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;VertFormat type=&amp;quot;Stretched&amp;quot; /&amp;gt;&lt;br /&gt;
 &amp;lt;HorzFormat type=&amp;quot;Stretched&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Vertical format must come first. Both sets stretching as the formatting. Which is what we need.&lt;br /&gt;
That's all we wanted in the look'n'feel so let's have a look at the XML for this extremely simple button skin.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;Falagard&amp;gt;&lt;br /&gt;
     &amp;lt;WidgetLook name=&amp;quot;MyButton&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;ImagerySection name=&amp;quot;bg&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;ImageryComponent&amp;gt;&lt;br /&gt;
                &amp;lt;Area&amp;gt;&lt;br /&gt;
                    &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
                    &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                    &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
                    &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                    &amp;lt;Dim type=&amp;quot;RightEdge&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;RightEdge&amp;quot; /&amp;gt;&lt;br /&gt;
                    &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                    &amp;lt;Dim type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;BottomEdge&amp;quot; /&amp;gt;&lt;br /&gt;
                    &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                &amp;lt;/Area&amp;gt;&lt;br /&gt;
                &amp;lt;b&amp;gt;&amp;lt;Image imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;ButtonBG&amp;quot; /&amp;gt;&lt;br /&gt;
                &amp;lt;VertFormat type=&amp;quot;Stretched&amp;quot; /&amp;gt;&lt;br /&gt;
                &amp;lt;HorzFormat type=&amp;quot;Stretched&amp;quot; /&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
            &amp;lt;/ImageryComponent&amp;gt;&lt;br /&gt;
         &amp;lt;/ImagerySection&amp;gt;&lt;br /&gt;
         &amp;lt;StateImagery name=&amp;quot;Normal&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;Layer&amp;gt;&lt;br /&gt;
                &amp;lt;Section section=&amp;quot;bg&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;/Layer&amp;gt;&lt;br /&gt;
         &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;/WidgetLook&amp;gt;&lt;br /&gt;
 &amp;lt;/Falagard&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three new tags just got added after the area in the ''ImageryComponent'', and we're done :)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Label ==&lt;br /&gt;
You might have noticed that I have'nt talked about the label until now.&lt;br /&gt;
We'll need to take a look at it now or we won't get any text on our button.&lt;br /&gt;
With Falagard you have full control of how the text is rendered.&lt;br /&gt;
&lt;br /&gt;
For our look'n'feel we want the text to be centered both vertically and horizontally in the widget. We also want the text to wrap (word wrap) if it's too long to render as one line without being clipped.&lt;br /&gt;
&lt;br /&gt;
We'll make a new ''ImagerySection'' for our label. This gives us a nice seperation of parts to render. &amp;quot;bg&amp;quot; being the background, and a new section called &amp;quot;label&amp;quot; to represent the - You guessed it - label.&lt;br /&gt;
Inside this new ''ImagerySection'' we add a ''TextComponent'' which we'll set up to render the text like we want.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;ImagerySection name=&amp;quot;label&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;TextComponent&amp;gt;&lt;br /&gt;
     &amp;lt;/TextComponent&amp;gt;&lt;br /&gt;
 &amp;lt;/ImagerySection&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Like a ''ImageryComponent'' a ''TextComponent'' must have an area. For our button we'll allow text to span the entire window. This means that we can reuse the ''Area'' from before.&lt;br /&gt;
&lt;br /&gt;
A ''TextComponent'' by default renders the text of the window that has the look'n'feel assigned.&lt;br /&gt;
This is exactly what we want for our button.&lt;br /&gt;
&lt;br /&gt;
The formatting we wanted is easily made by using the same tag we used before (to format the background image) but with another type. The formattings supported are different for ''TextComponent'' and ''ImageryComponent''.&lt;br /&gt;
&lt;br /&gt;
Let's look at the XML for this new ''ImagerySection'' &amp;quot;label&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;ImagerySection name=&amp;quot;label&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;TextComponent&amp;gt;&lt;br /&gt;
         &amp;lt;b&amp;gt;&amp;lt;Area&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;RightEdge&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;RightEdge&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;BottomEdge&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
         &amp;lt;/Area&amp;gt;&lt;br /&gt;
         &amp;lt;VertFormat type=&amp;quot;CentreAligned&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;HorzFormat type=&amp;quot;WordWrapCentreAligned&amp;quot; /&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
     &amp;lt;/TextComponent&amp;gt;&lt;br /&gt;
 &amp;lt;/ImagerySection&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We added the same area as in the &amp;quot;bg&amp;quot; ''ImagerySection'', and added the formattings we wanted. Take a look at [[Falagard System XML Enumerations reference]] for the complete listing of supported formattings (and lots of other stuff).&lt;br /&gt;
&lt;br /&gt;
This ''ImagerySection'' is done. It will render the label with the correct formatting using a white colour. By not specifying a colour we always choose white, which is useful as we can modulate it into any colour we choose later on. Which we of course will :-)&lt;br /&gt;
&lt;br /&gt;
To actually use this new &amp;quot;label&amp;quot; section we must add it to our state imagery like we did with the &amp;quot;bg&amp;quot; section earlier. So here's what the XML looks like so far:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;Falagard&amp;gt;&lt;br /&gt;
     &amp;lt;WidgetLook name=&amp;quot;MyButton&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;b&amp;gt;&amp;lt;ImagerySection name=&amp;quot;label&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;TextComponent&amp;gt;&lt;br /&gt;
                &amp;lt;Area&amp;gt;&lt;br /&gt;
                     &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot;&amp;gt;&lt;br /&gt;
                         &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
                     &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                     &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot;&amp;gt;&lt;br /&gt;
                         &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
                     &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                     &amp;lt;Dim type=&amp;quot;RightEdge&amp;quot;&amp;gt;&lt;br /&gt;
                         &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;RightEdge&amp;quot; /&amp;gt;&lt;br /&gt;
                     &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                     &amp;lt;Dim type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&lt;br /&gt;
                         &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;BottomEdge&amp;quot; /&amp;gt;&lt;br /&gt;
                     &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                 &amp;lt;/Area&amp;gt;&lt;br /&gt;
                 &amp;lt;VertFormat type=&amp;quot;CentreAligned&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;HorzFormat type=&amp;quot;WordWrapCentreAligned&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/TextComponent&amp;gt;&lt;br /&gt;
         &amp;lt;/ImagerySection&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
         &amp;lt;ImagerySection name=&amp;quot;bg&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;ImageryComponent&amp;gt;&lt;br /&gt;
                &amp;lt;Area&amp;gt;&lt;br /&gt;
                    &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
                    &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                    &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
                    &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                    &amp;lt;Dim type=&amp;quot;RightEdge&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;RightEdge&amp;quot; /&amp;gt;&lt;br /&gt;
                    &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                    &amp;lt;Dim type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;BottomEdge&amp;quot; /&amp;gt;&lt;br /&gt;
                    &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                &amp;lt;/Area&amp;gt;&lt;br /&gt;
                &amp;lt;Image imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;ButtonBG&amp;quot; /&amp;gt;&lt;br /&gt;
                &amp;lt;VertFormat type=&amp;quot;Stretched&amp;quot; /&amp;gt;&lt;br /&gt;
                &amp;lt;HorzFormat type=&amp;quot;Stretched&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;/ImageryComponent&amp;gt;&lt;br /&gt;
         &amp;lt;/ImagerySection&amp;gt;&lt;br /&gt;
         &amp;lt;StateImagery name=&amp;quot;Normal&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;Layer&amp;gt;&lt;br /&gt;
                &amp;lt;Section section=&amp;quot;bg&amp;quot; /&amp;gt;&lt;br /&gt;
                '''&amp;lt;Section section=&amp;quot;label&amp;quot; /&amp;gt;'''&lt;br /&gt;
            &amp;lt;/Layer&amp;gt;&lt;br /&gt;
         &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;/WidgetLook&amp;gt;&lt;br /&gt;
 &amp;lt;/Falagard&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This look'n'feel adds the fully working label (still white) to our button skin. This is starting to become a useful look'n'feel, so let's give it the final touch by adding handling of the three other states ''Hover'', ''Pushed'' and ''Disabled'' that we left out before.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Colours ==&lt;br /&gt;
We want to use different text colours for each of these states. We also want to able to customize those colours on a per widget basis.&lt;br /&gt;
This is made possible by the property definition.&lt;br /&gt;
&lt;br /&gt;
A ''PropertyDefinition'' creates a new property in the window that gets the look'n'feel assigned. The property we create is a simple string value, but '''we''' choose what it's used for. '''Not''' CEGUI.&lt;br /&gt;
&lt;br /&gt;
In total we have 4 states for our button counting the new ones, so we'll add 4 new properties to store the text colour for each state. The XML is like so:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;PropertyDefinition name=&amp;quot;NormalTextColour&amp;quot; initialValue=&amp;quot;FFFFFFFF&amp;quot; redrawOnWrite=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
 &amp;lt;PropertyDefinition name=&amp;quot;HoverTextColour&amp;quot; initialValue=&amp;quot;FFFF0000&amp;quot; redrawOnWrite=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
 &amp;lt;PropertyDefinition name=&amp;quot;PushedTextColour&amp;quot; initialValue=&amp;quot;FF00FF00&amp;quot; redrawOnWrite=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
 &amp;lt;PropertyDefinition name=&amp;quot;DisabledTextColour&amp;quot; initialValue=&amp;quot;7F888888&amp;quot; redrawOnWrite=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*''name'' is the name the new property will be available under.&lt;br /&gt;
*''initialValue'' is the default value for the property.&lt;br /&gt;
*''redrawOnWrite'' when set to true the window will be redrawn when the value of the property changes.&lt;br /&gt;
&lt;br /&gt;
These properties will be available from both C++ code and in XML window layouts. So choosing a good name is a good idea.&lt;br /&gt;
You can create properties that you don't use for anything inside the look'n'feel. These will still become available which can be a good way of creating new variables for windows that you might need in your application.&lt;br /&gt;
&lt;br /&gt;
The default values represent colours in the format CEGUI would expect a colour for a built-in property.&lt;br /&gt;
Colours for CEGUI are always written in hexadecimal.&lt;br /&gt;
&lt;br /&gt;
The format is: &amp;quot;AARRGGBB&amp;quot; where:&lt;br /&gt;
* AA = Alpha&lt;br /&gt;
* RR = Red&lt;br /&gt;
* GG = Green&lt;br /&gt;
* BB = Blue&lt;br /&gt;
&lt;br /&gt;
This gives our properties the values of&lt;br /&gt;
* white for ''Normal''&lt;br /&gt;
* red for ''Hover''&lt;br /&gt;
* green for ''Pushed''&lt;br /&gt;
* 50% tranparent grey for ''Disabled''&lt;br /&gt;
&lt;br /&gt;
Setting a new value for any of these properties will make sure the button is re-rendered to show the new colour.&lt;br /&gt;
&lt;br /&gt;
The only places in the look'n'feel that know which state we are in are the ''StateImagery'' tags. The ''Section'' tags inside these allow for colours to be specified. The XML for the label in the ''Normal'' state looks like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Section name=&amp;quot;label&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;ColourProperty name=&amp;quot;NormalTextColour&amp;quot; /&amp;gt;&lt;br /&gt;
 &amp;lt;/Section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ''ColourProperty'' tag inside our ''Section'' ensures that all imagery in the imagery section &amp;quot;label&amp;quot; has its colour modulated by the value of the property &amp;quot;NormalTextColour&amp;quot;. The imagery section &amp;quot;label&amp;quot; render only white text, so by doing this we ensure that the colour rendered is exactly that of the value of the property &amp;quot;NormalTextColour&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
We now know what to do so lets look at the XML so far for this look'n'feel:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;Falagard&amp;gt;&lt;br /&gt;
     &amp;lt;WidgetLook name=&amp;quot;MyButton&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;b&amp;gt;&amp;lt;PropertyDefinition name=&amp;quot;NormalTextColour&amp;quot; initialValue=&amp;quot;FFFFFFFF&amp;quot; redrawOnWrite=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;PropertyDefinition name=&amp;quot;HoverTextColour&amp;quot; initialValue=&amp;quot;FFFF0000&amp;quot; redrawOnWrite=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;PropertyDefinition name=&amp;quot;PushedTextColour&amp;quot; initialValue=&amp;quot;FF00FF00&amp;quot; redrawOnWrite=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;PropertyDefinition name=&amp;quot;DisabledTextColour&amp;quot; initialValue=&amp;quot;7F888888&amp;quot; redrawOnWrite=&amp;quot;true&amp;quot; /&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
         &amp;lt;ImagerySection name=&amp;quot;label&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;TextComponent&amp;gt;&lt;br /&gt;
                &amp;lt;Area&amp;gt;&lt;br /&gt;
                     &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot;&amp;gt;&lt;br /&gt;
                         &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
                     &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                     &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot;&amp;gt;&lt;br /&gt;
                         &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
                     &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                     &amp;lt;Dim type=&amp;quot;RightEdge&amp;quot;&amp;gt;&lt;br /&gt;
                         &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;RightEdge&amp;quot; /&amp;gt;&lt;br /&gt;
                     &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                     &amp;lt;Dim type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&lt;br /&gt;
                         &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;BottomEdge&amp;quot; /&amp;gt;&lt;br /&gt;
                     &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                 &amp;lt;/Area&amp;gt;&lt;br /&gt;
                 &amp;lt;VertFormat type=&amp;quot;CentreAligned&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;HorzFormat type=&amp;quot;WordWrapCentreAligned&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/TextComponent&amp;gt;&lt;br /&gt;
         &amp;lt;/ImagerySection&amp;gt;&lt;br /&gt;
         &amp;lt;ImagerySection name=&amp;quot;bg&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;ImageryComponent&amp;gt;&lt;br /&gt;
                &amp;lt;Area&amp;gt;&lt;br /&gt;
                    &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
                    &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                    &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
                    &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                    &amp;lt;Dim type=&amp;quot;RightEdge&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;RightEdge&amp;quot; /&amp;gt;&lt;br /&gt;
                    &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                    &amp;lt;Dim type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;BottomEdge&amp;quot; /&amp;gt;&lt;br /&gt;
                    &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                &amp;lt;/Area&amp;gt;&lt;br /&gt;
                &amp;lt;Image imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;ButtonBG&amp;quot; /&amp;gt;&lt;br /&gt;
                &amp;lt;VertFormat type=&amp;quot;Stretched&amp;quot; /&amp;gt;&lt;br /&gt;
                &amp;lt;HorzFormat type=&amp;quot;Stretched&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;/ImageryComponent&amp;gt;&lt;br /&gt;
         &amp;lt;/ImagerySection&amp;gt;&lt;br /&gt;
         &amp;lt;StateImagery name=&amp;quot;Normal&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;Layer&amp;gt;&lt;br /&gt;
                &amp;lt;Section section=&amp;quot;bg&amp;quot; /&amp;gt;&lt;br /&gt;
                &amp;lt;b&amp;gt;&amp;lt;Section section=&amp;quot;label&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;ColourProperty name=&amp;quot;NormalTextColour&amp;quot; /&amp;gt;&lt;br /&gt;
                &amp;lt;/Section&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
            &amp;lt;/Layer&amp;gt;&lt;br /&gt;
         &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
         &amp;lt;b&amp;gt;&amp;lt;StateImagery name=&amp;quot;Hover&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;Layer&amp;gt;&lt;br /&gt;
                &amp;lt;Section section=&amp;quot;bg&amp;quot; /&amp;gt;&lt;br /&gt;
                &amp;lt;Section section=&amp;quot;label&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;ColourProperty name=&amp;quot;HoverTextColour&amp;quot; /&amp;gt;&lt;br /&gt;
                &amp;lt;/Section&amp;gt;&lt;br /&gt;
            &amp;lt;/Layer&amp;gt;&lt;br /&gt;
         &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
         &amp;lt;StateImagery name=&amp;quot;Pushed&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;Layer&amp;gt;&lt;br /&gt;
                &amp;lt;Section section=&amp;quot;bg&amp;quot; /&amp;gt;&lt;br /&gt;
                &amp;lt;Section section=&amp;quot;label&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;ColourProperty name=&amp;quot;PushedTextColour&amp;quot; /&amp;gt;&lt;br /&gt;
                &amp;lt;/Section&amp;gt;&lt;br /&gt;
            &amp;lt;/Layer&amp;gt;&lt;br /&gt;
         &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
         &amp;lt;StateImagery name=&amp;quot;Disabled&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;Layer&amp;gt;&lt;br /&gt;
                &amp;lt;Section section=&amp;quot;bg&amp;quot; /&amp;gt;&lt;br /&gt;
                &amp;lt;Section section=&amp;quot;label&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;ColourProperty name=&amp;quot;DisabledTextColour&amp;quot; /&amp;gt;&lt;br /&gt;
                &amp;lt;/Section&amp;gt;&lt;br /&gt;
            &amp;lt;/Layer&amp;gt;&lt;br /&gt;
         &amp;lt;/StateImagery&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
     &amp;lt;/WidgetLook&amp;gt;&lt;br /&gt;
 &amp;lt;/Falagard&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Not too hard was it? The look'n'feel reached a whole new level with these changes, as state is reflected in the text colour.&lt;br /&gt;
&lt;br /&gt;
To sum up what we've made:&lt;br /&gt;
* A look'n'feel for the ''Falagard/Button'' window type.&lt;br /&gt;
* Static background image.&lt;br /&gt;
* Formatted label.&lt;br /&gt;
* Label colour dependent on current state.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
That will be enough for this time. It's getting early ;-)&lt;br /&gt;
&lt;br /&gt;
I hope this tutorial is useful and that it will help expose Falagard more broadly.&lt;br /&gt;
&lt;br /&gt;
Please give feedback in the discussion page so I can improve the tutorial where needed.&lt;br /&gt;
&lt;br /&gt;
--[[User:lindquist|lindquist]] 06:10, 6 Dec 2005 (CET)&lt;/div&gt;</summary>
		<author><name>Tss</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=The_Beginners_Guide_to_Falagard_skinning_-_Part_II&amp;diff=3669</id>
		<title>The Beginners Guide to Falagard skinning - Part II</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=The_Beginners_Guide_to_Falagard_skinning_-_Part_II&amp;diff=3669"/>
				<updated>2011-02-26T12:10:49Z</updated>
		
		<summary type="html">&lt;p&gt;Tss: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[category: Tutorials]]&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Last time we looked at the essential basics to get something running with Falagard. This is great, but a simplistic look'n'feel for a button is a bit boring. So lets step forward and learn something new.&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will create a look'n'feel for the ''Editbox'' window type. This widget is interactive and uses new parts of the Falagard system, making it an excellent target for another tutorial.&lt;br /&gt;
&lt;br /&gt;
So let's get started...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
We'll start out by looking at the requirements for the ''Editbox'' window type. Like always, the information we're looking for can be found in the [[Falagard System base widgets reference]].&lt;br /&gt;
&lt;br /&gt;
In there we'll see that the ''Editbox'' is a bit more complex than the ''Button''. But fear not - we'll get through every part of it ;-)&lt;br /&gt;
&lt;br /&gt;
Let's start out with the ''StateImagery'' needed for this widget:&lt;br /&gt;
* Enabled&lt;br /&gt;
* Disabled&lt;br /&gt;
* ReadOnly&lt;br /&gt;
* ActiveSelection&lt;br /&gt;
* InactiveSelection&lt;br /&gt;
&lt;br /&gt;
Unlike the ''Button'' we don't have any optional states. ''Enabled'' and ''Disabled'' should speak for themselves. ''ReadOnly'' is used when the ''Editbox'' is in read-only mode (easy huh?).&lt;br /&gt;
&lt;br /&gt;
The ''ActiveSelection'' state is somewhat special. It should define what imagery to render for the selection graphics itself when the window is in an activated state (has focus).&lt;br /&gt;
''InactiveSelection'' is the same, except it is used when the window is '''not''' active (does'nt have focus).&lt;br /&gt;
&lt;br /&gt;
Besides the ''StateImagery'' needed, a ''Editbox'' also requires a ''NamedArea'' called '''TextArea''' and a ''ImagerySection'' named '''Carat''' (yes, car'''a'''t).&lt;br /&gt;
We'll have a much closer look at these later on.&lt;br /&gt;
&lt;br /&gt;
The initial XML (with the parts we know about) looks like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt; &lt;br /&gt;
 &amp;lt;Falagard&amp;gt;&lt;br /&gt;
 	&amp;lt;ImagerySection name=&amp;quot;Carat&amp;quot;&amp;gt;&lt;br /&gt;
 	&amp;lt;/ImagerySection&amp;gt;&lt;br /&gt;
 	&amp;lt;StateImagery name=&amp;quot;Enabled&amp;quot;&amp;gt;&lt;br /&gt;
 	&amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
 	&amp;lt;StateImagery name=&amp;quot;Disabled&amp;quot;&amp;gt;&lt;br /&gt;
 	&amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
 	&amp;lt;StateImagery name=&amp;quot;ReadOnly&amp;quot;&amp;gt;&lt;br /&gt;
 	&amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
 	&amp;lt;StateImagery name=&amp;quot;ActiveSelection&amp;quot;&amp;gt;&lt;br /&gt;
 	&amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
 	&amp;lt;StateImagery name=&amp;quot;InactiveSelection&amp;quot;&amp;gt;&lt;br /&gt;
 	&amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
 &amp;lt;/Falagard&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We'll fill it out as we go...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Imagery ==&lt;br /&gt;
This look'n'feel will use a frame consisting of 8 different images from our favorite imageset ''MyImages''. Furthermore we'll have a single image stretched to fill the hole in this frame. The images will have names that are easy to interpret:&lt;br /&gt;
{| cellpadding=&amp;quot;15&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Frame setup&lt;br /&gt;
| TL || align=&amp;quot;center&amp;quot; | T || TR&lt;br /&gt;
|-&lt;br /&gt;
| align=&amp;quot;center&amp;quot; | L || Bg|| align=&amp;quot;center&amp;quot; |R&lt;br /&gt;
|-&lt;br /&gt;
| BL || align=&amp;quot;center&amp;quot; | B || BR&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each prefixed with '''Editbox'''. Forming imagenames like '''EditboxTL''' etc.&lt;br /&gt;
&lt;br /&gt;
The ''FrameComponent'' tag may only occur inside an ''ImagerySection''. Just like the ''ImageryComponent'' and ''TextComponent'' that we used in part I.&lt;br /&gt;
&lt;br /&gt;
Using the ''FrameComponent'' is very much like using the ''ImageryComponent'' all the tags allowed are the same, but a ''FrameComponent'' allows up to nine images to be specified. It's purpose is to make making frames easy :-)&lt;br /&gt;
A ''FrameComponent'' is special in the way it handles formatting compared to ''ImageryComponent'' though. Any formatting options are only applied to the background image - if it's specified. Yes. We don't have to set all nine of them. We can just choose the image &amp;quot;positions&amp;quot; we need. In our case we'll use all of them tough...&lt;br /&gt;
&lt;br /&gt;
Let's look at the XML for this ''FrameComponent'':&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;FrameComponent&amp;gt;&lt;br /&gt;
        &amp;lt;Area&amp;gt;&lt;br /&gt;
            &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;/Dim&amp;gt;&lt;br /&gt;
            &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;/Dim&amp;gt;&lt;br /&gt;
            &amp;lt;Dim type=&amp;quot;RightEdge&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;RightEdge&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;/Dim&amp;gt;&lt;br /&gt;
            &amp;lt;Dim type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;BottomEdge&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;/Dim&amp;gt;&lt;br /&gt;
        &amp;lt;/Area&amp;gt;&lt;br /&gt;
        &amp;lt;Image type=&amp;quot;TopLeftCorner&amp;quot;     imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxTL&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Image type=&amp;quot;TopEdge&amp;quot;           imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxT&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Image type=&amp;quot;TopRightCorner&amp;quot;    imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxTR&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Image type=&amp;quot;RightEdge&amp;quot;         imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxR&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Image type=&amp;quot;BottomRightCorner&amp;quot; imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxBR&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Image type=&amp;quot;BottomEdge&amp;quot;        imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxB&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Image type=&amp;quot;BottomLeftCorner&amp;quot;  imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxBL&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Image type=&amp;quot;LeftEdge&amp;quot;          imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxL&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Image type=&amp;quot;Background&amp;quot;        imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxBg&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;VertFormat type=&amp;quot;Stretched&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;HorzFormat type=&amp;quot;Stretched&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/FrameComponent&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should recognise the area. It's the full area of the window, exactly like the areas we used in part I.&lt;br /&gt;
Reason: We want the frame and background to cover the entire window. Simple :-)&lt;br /&gt;
&lt;br /&gt;
Nine images are specifed. The order does not matter.&lt;br /&gt;
But note that compared to the ''ImageryComponent'' used last time, we must specify a type attribute for the images.&lt;br /&gt;
This is so Falagard knows where to place this image in the frame.&lt;br /&gt;
These are of course listed in the [[Falagard System XML Enumerations reference]].&lt;br /&gt;
&lt;br /&gt;
The format both horizontally and vertically is ''Stretched''. This ensures that the background image is stretched to fill as much as possible of the &amp;quot;hole&amp;quot; created by the border images (TL,T,TR etc.).&lt;br /&gt;
&lt;br /&gt;
We'll use this frame for all the 3 states (''Enabled'', ''Disabled'', ''ReadOnly''), but we want the colours to be a little different in each state. In part I we created a new property to hold the colour of the Text. To show a different approach, we'll &amp;quot;hard-code&amp;quot; the frame colours into this look'n'feel.&lt;br /&gt;
&lt;br /&gt;
CEGUI supports using a colour rectangle to modulate the colours of anything it renders. This makes it possible to &amp;quot;apply&amp;quot; nice colour gradients to our frame imagery.&lt;br /&gt;
&lt;br /&gt;
The ''Normal'' state will use the colours, unmodified from the image file.&lt;br /&gt;
&lt;br /&gt;
The ''Disabled'' state will use gray to darken the frame imagery &lt;br /&gt;
&lt;br /&gt;
In the ''ReadOnly'' state we'll create a gradient that is white in the top-left corner, and slightly grayish for the three other corners. When applied to the imagery this will result in the top-left corner using exactly the same colours as in the image file, and the three other corners being slightly darkened.&lt;br /&gt;
&lt;br /&gt;
To use this frame component we must - like stated earlier - fit it in a ''ImagerySection''. We'll call this new imagery section &amp;quot;frame&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This is all the we need to write up the xml for this frame, and use it in our states, so now the XML looks like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt; &lt;br /&gt;
 &amp;lt;Falagard&amp;gt;&lt;br /&gt;
     &amp;lt;b&amp;gt;&amp;lt;ImagerySection name=&amp;quot;frame&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;FrameComponent&amp;gt;&lt;br /&gt;
             &amp;lt;Area&amp;gt;&lt;br /&gt;
                 &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                 &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                 &amp;lt;Dim type=&amp;quot;RightEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;RightEdge&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                 &amp;lt;Dim type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;BottomEdge&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;/Area&amp;gt;&lt;br /&gt;
             &amp;lt;Image type=&amp;quot;TopLeftCorner&amp;quot;     imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxTL&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;Image type=&amp;quot;TopEdge&amp;quot;           imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxT&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;Image type=&amp;quot;TopRightCorner&amp;quot;    imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxTR&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;Image type=&amp;quot;RightEdge&amp;quot;         imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxR&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;Image type=&amp;quot;BottomRightCorner&amp;quot; imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxBR&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;Image type=&amp;quot;BottomEdge&amp;quot;        imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxB&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;Image type=&amp;quot;BottomLeftCorner&amp;quot;  imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxBL&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;Image type=&amp;quot;LeftEdge&amp;quot;          imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxL&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;Image type=&amp;quot;Background&amp;quot;        imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxBg&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;VertFormat type=&amp;quot;Stretched&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;HorzFormat type=&amp;quot;Stretched&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;/FrameComponent&amp;gt;&lt;br /&gt;
     &amp;lt;/ImagerySection&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
     &amp;lt;ImagerySection name=&amp;quot;Carat&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;/ImagerySection&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;Enabled&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;b&amp;gt;&amp;lt;Layer&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;frame&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;/Layer&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;Disabled&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;b&amp;gt;&amp;lt;Layer&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;frame&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;Colours topLeft=&amp;quot;FF7F7F7F&amp;quot; topRight=&amp;quot;FF7F7F7F&amp;quot; bottomLeft=&amp;quot;FF7F7F7F&amp;quot; bottomRight=&amp;quot;FF7F7F7F&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Section&amp;gt;&lt;br /&gt;
         &amp;lt;/Layer&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;ReadOnly&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;b&amp;gt;&amp;lt;Layer&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;frame&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;Colours topLeft=&amp;quot;FFFFFFFF&amp;quot; topRight=&amp;quot;FFDFDFDF&amp;quot; bottomLeft=&amp;quot;FFDFDFDF&amp;quot; bottomRight=&amp;quot;FFDFDFDF&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Section&amp;gt;&lt;br /&gt;
         &amp;lt;/Layer&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;ActiveSelection&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;InactiveSelection&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
 &amp;lt;/Falagard&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The frame component has been added, and the ''Enabled'', ''Disabled'' and ''ReadOnly'' states have been set up to use them. The only new thing is really the ''Colours'' tag inside the ''Section'' tags for &amp;quot;frame&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
It behaves just like the ''ColourProperty'' tag we used in part I, except you can specify a colour to use for each corner.&lt;br /&gt;
It's attributes&lt;br /&gt;
* topLeft&lt;br /&gt;
* topRight&lt;br /&gt;
* bottomLeft&lt;br /&gt;
* bottomRight&lt;br /&gt;
Each specify a single colour of the same format we used for ''ColourProperty'' (AARRGGBB in hex).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Text ==&lt;br /&gt;
Remeber something about a ''NamedArea''? Either way we're going to look at it now. The ''Editbox'' widget requires us to define a named area so it knows where to render, the text we type in, the caret (the marker that shows us where the characters we type will be inserted) and our selection.&lt;br /&gt;
&lt;br /&gt;
In this look'n'feel, we want the text to be rendered inside our frame. That is we dont want the text to cover the frame imagery itself, only the background of it. Falagard provides a ''ImageDim'' tag that we can use to extract the width and height from the images we used for the frame. Falagard also provides a ''DimOperator'' tag that we can use to do a little math on our dimensions. These features will be the core of our ''NamedArea'' which will be named '''TextArea''' (Stated in the requirements... Remember?)&lt;br /&gt;
&lt;br /&gt;
The only thing we must (and may) specify in a ''NamedArea'' is a ''Area''.&lt;br /&gt;
&lt;br /&gt;
If we take a look back at the ''Area'' tag, we know that it must specify four dimensions. ''LeftEdge'', ''TopEdge'', ''RightEdge'' and ''BottomEdge''. You might remember that we can specify ''Width'' instead of ''RightEdge'', and ''Height'' instead of ''BottomEdge''. But we're not going to do that. Just so you know (and don't forget) ;-)&lt;br /&gt;
&lt;br /&gt;
We start out with a &amp;quot;empty&amp;quot; XML and fill it out as we go. For now it looks like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;NamedArea name=&amp;quot;TextArea&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Area&amp;gt;&lt;br /&gt;
         &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;/Dim&amp;gt;&lt;br /&gt;
         &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;/Dim&amp;gt;&lt;br /&gt;
         &amp;lt;Dim type=&amp;quot;RightEdge&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;/Dim&amp;gt;&lt;br /&gt;
         &amp;lt;Dim type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;/Dim&amp;gt;&lt;br /&gt;
     &amp;lt;/Area&amp;gt;&lt;br /&gt;
 &amp;lt;/NamedArea&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We start out with the left edge. In the frame we used the image named '''EditboxL''' for the left edge. And as the area we want to define is to lie inside the frame, we'll use the width of this specific image as the left edge of our area.&lt;br /&gt;
The XML for this ''ImageDim'' is like so:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;ImageDim imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxL&amp;quot; dimension=&amp;quot;Width&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The top edge is very similar except we'll use the height of the image named '''EditboxT''' instead.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;ImageDim imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxT&amp;quot; dimension=&amp;quot;Height&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The right edge is a bit more tricky. To start out we'll use a ''UnifiedDim'' that gives us the right edge of our widget.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;RightEdge&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;/Unified&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We use a seperate tag to close it, as by itself this ''UnifiedDim'' is not good enough. We still need the take the frame into accout. The image dimension we're after is the width of the image '''EditboxR'''. We must subtract this width from the right edge to ensure that the frame imagery is not overwritten by a long text string in the ''Editbox''.&lt;br /&gt;
&lt;br /&gt;
The ''DimOperator'' can do this for us with XML like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;RightEdge&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;b&amp;gt;&amp;lt;DimOperator op=&amp;quot;Subtract&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;ImageDim imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxR&amp;quot; dimension=&amp;quot;Width&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;/DimOperator&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
 &amp;lt;/Unified&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ''DimOperator'' tag requires us to specify the attribute ''op'' with the name of the operation we want to perform as the value. The operations supported by Falagard are:&lt;br /&gt;
* Add&lt;br /&gt;
* Subtract&lt;br /&gt;
* Multiply&lt;br /&gt;
* Divide&lt;br /&gt;
We used ''Subtract'' to &amp;quot;move back&amp;quot; a little from our right edge to make sure we leave the frame imagery for the right edge alone.&lt;br /&gt;
&lt;br /&gt;
The bottom edge of the area is very similar to the right. There are two differences. First we want the ''UnifiedDim'' to take the bottom edge of our window and not the right edge. Second we want to subtract the height of the image named '''EditboxB''' instead too.&lt;br /&gt;
&lt;br /&gt;
This gives us this XML:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;DimOperator op=&amp;quot;Subtract&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;ImageDim imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxB&amp;quot; dimension=&amp;quot;Height&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;/DimOperator&amp;gt;&lt;br /&gt;
 &amp;lt;/Unified&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If we put these four dimensions into our ''NamedArea'' it looks like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;NamedArea name=&amp;quot;TextArea&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Area&amp;gt;&lt;br /&gt;
         &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot;&amp;gt;&lt;br /&gt;
             &amp;lt;b&amp;gt;&amp;lt;ImageDim imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxL&amp;quot; dimension=&amp;quot;Width&amp;quot; /&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
         &amp;lt;/Dim&amp;gt;&lt;br /&gt;
         &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot;&amp;gt;&lt;br /&gt;
             &amp;lt;b&amp;gt;&amp;lt;ImageDim imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxT&amp;quot; dimension=&amp;quot;Height&amp;quot; /&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
         &amp;lt;/Dim&amp;gt;&lt;br /&gt;
         &amp;lt;Dim type=&amp;quot;RightEdge&amp;quot;&amp;gt;&lt;br /&gt;
             &amp;lt;b&amp;gt;&amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;RightEdge&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;DimOperator op=&amp;quot;Subtract&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;ImageDim imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxR&amp;quot; dimension=&amp;quot;Width&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/DimOperator&amp;gt;&lt;br /&gt;
             &amp;lt;/Unified&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
         &amp;lt;/Dim&amp;gt;&lt;br /&gt;
         &amp;lt;Dim type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&lt;br /&gt;
             &amp;lt;b&amp;gt;&amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;DimOperator op=&amp;quot;Subtract&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;ImageDim imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxB&amp;quot; dimension=&amp;quot;Height&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/DimOperator&amp;gt;&lt;br /&gt;
             &amp;lt;/Unified&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
         &amp;lt;/Dim&amp;gt;&lt;br /&gt;
     &amp;lt;/Area&amp;gt;&lt;br /&gt;
 &amp;lt;/NamedArea&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the complete ''NamedArea'' for our ''Editbox'' look'n'feel. If we fit it inside our full look'n'feel it will look like the XML below. Notice that the ''NamedArea'' is specifed before the ''ImagerySection''. This is required by Falagard.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt; &lt;br /&gt;
 &amp;lt;Falagard&amp;gt;&lt;br /&gt;
     &amp;lt;b&amp;gt;&amp;lt;NamedArea name=&amp;quot;TextArea&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;Area&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;ImageDim imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxL&amp;quot; dimension=&amp;quot;Width&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;ImageDim imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxT&amp;quot; dimension=&amp;quot;Height&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;RightEdge&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;RightEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;DimOperator op=&amp;quot;Subtract&amp;quot;&amp;gt;&lt;br /&gt;
                         &amp;lt;ImageDim imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxR&amp;quot; dimension=&amp;quot;Width&amp;quot; /&amp;gt;&lt;br /&gt;
                     &amp;lt;/DimOperator&amp;gt;&lt;br /&gt;
                 &amp;lt;/Unified&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;DimOperator op=&amp;quot;Subtract&amp;quot;&amp;gt;&lt;br /&gt;
                         &amp;lt;ImageDim imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxB&amp;quot; dimension=&amp;quot;Height&amp;quot; /&amp;gt;&lt;br /&gt;
                     &amp;lt;/DimOperator&amp;gt;&lt;br /&gt;
                 &amp;lt;/Unified&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
         &amp;lt;/Area&amp;gt;&lt;br /&gt;
     &amp;lt;/NamedArea&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
     &amp;lt;ImagerySection name=&amp;quot;frame&amp;quot;&amp;gt;&lt;br /&gt;
         ...&lt;br /&gt;
         ... saving space ...&lt;br /&gt;
         ...&lt;br /&gt;
     &amp;lt;/ImagerySection&amp;gt;&lt;br /&gt;
     &amp;lt;ImagerySection name=&amp;quot;Carat&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;/ImagerySection&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;Enabled&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;Layer&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;frame&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;/Layer&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;Disabled&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;Layer&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;frame&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;Colours topLeft=&amp;quot;FF7F7F7F&amp;quot; topRight=&amp;quot;FF7F7F7F&amp;quot; bottomLeft=&amp;quot;FF7F7F7F&amp;quot; bottomRight=&amp;quot;FF7F7F7F&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Section&amp;gt;&lt;br /&gt;
         &amp;lt;/Layer&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;ReadOnly&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;Layer&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;frame&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;Colours topLeft=&amp;quot;FFFFFFFF&amp;quot; topRight=&amp;quot;FFDFDFDF&amp;quot; bottomLeft=&amp;quot;FFDFDFDF&amp;quot; bottomRight=&amp;quot;FFDFDFDF&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Section&amp;gt;&lt;br /&gt;
         &amp;lt;/Layer&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;ActiveSelection&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;InactiveSelection&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
 &amp;lt;/Falagard&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We don't reference '''TextArea''' anywhere. Just specifying it is all that is required according to the [[Falagard System base widgets reference]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Caret ==&lt;br /&gt;
The ''Editbox'' has a caret. This is a marker that shows us where we are typing and allows us to tell if we are inserting in the middle of the text or at the end etc. The text is split around it by CEGUI so we don't draw over the text rendering the point we're editing unreadable. All this is currently handled internally and all you need to do is create a ''ImagerySection'' name '''Carat'''.&lt;br /&gt;
&lt;br /&gt;
note by Pompei2: You're reading right, the ''ImagerySection'' is named '''Carat''' although the right word is a caret.&lt;br /&gt;
&lt;br /&gt;
When CEGUI needs render the caret (and the text) it will fetch this ''ImagerySection'' and render it at the appropriate position in the text.&lt;br /&gt;
We do not need to make a ''TextComponent'' in a ''Editbox'' to get the text to render. Because of the pecularities of the caret (and selection which we will handle later) it's all done automatically, by using the ''NamedArea'' '''TextArea''' we just specified along with the real pixel area of the window, to confine rendering to right rectangle on the screen.&lt;br /&gt;
&lt;br /&gt;
Enough details. We just want to render a single image named '''EditboxCaret''' stretched vertically inside the '''TextArea'''.&lt;br /&gt;
&lt;br /&gt;
Creating the ''ImagerySection'' is very much like creating the background for the ''Button'' in part I, the only real difference being the ''Area'' used. We'll look at the XML for this area, it's all made up by stuff we've already seen.&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;Area&amp;gt;&lt;br /&gt;
        &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/Dim&amp;gt;&lt;br /&gt;
        &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/Dim&amp;gt;&lt;br /&gt;
        &amp;lt;Dim type=&amp;quot;Width&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;ImageDim imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxCaret&amp;quot; dimension=&amp;quot;Width&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/Dim&amp;gt;&lt;br /&gt;
        &amp;lt;Dim type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;BottomEdge&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/Dim&amp;gt;&lt;br /&gt;
    &amp;lt;/Area&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first and second (left/top edges) ''Dim''s have the familiar ''AbsoluteDim'' with a value of zero. Nothing new here.&lt;br /&gt;
&lt;br /&gt;
The third ''Dim'' on the other hand is new. It's now specified as &amp;quot;Width&amp;quot; and not &amp;quot;RightEdge&amp;quot; like we have done so far. Inside we have a ''ImageDim'' for the width of the caret image we're using. If we had used the regular ''UnifiedDim'', the caret itself would have the width our textarea (because the caret resides in the text area) and would have been very ugly...&lt;br /&gt;
&lt;br /&gt;
The fourth dimension is the familiar ''UnifiedDim'' we have used in all the earlier areas.&lt;br /&gt;
&lt;br /&gt;
We know from part I how to make a ''ImagerySection'' with a ''ImageryComponent''. This is all we need to render this single-image caret. The XML for our look'n'feel is nearing completion.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt; &lt;br /&gt;
 &amp;lt;Falagard&amp;gt;&lt;br /&gt;
     &amp;lt;NamedArea name=&amp;quot;TextArea&amp;quot;&amp;gt;&lt;br /&gt;
         ...&lt;br /&gt;
         ... saving space ...&lt;br /&gt;
         ...&lt;br /&gt;
     &amp;lt;/NamedArea&amp;gt;&lt;br /&gt;
     &amp;lt;ImagerySection name=&amp;quot;frame&amp;quot;&amp;gt;&lt;br /&gt;
         ...&lt;br /&gt;
         ... saving space ...&lt;br /&gt;
         ...&lt;br /&gt;
     &amp;lt;/ImagerySection&amp;gt;&lt;br /&gt;
     &amp;lt;ImagerySection name=&amp;quot;Carat&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;b&amp;gt;&amp;lt;ImageryComponent&amp;gt;&lt;br /&gt;
             &amp;lt;Area&amp;gt;&lt;br /&gt;
                 &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                 &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                 &amp;lt;Dim type=&amp;quot;Width&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;ImageDim imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxCaret&amp;quot; dimension=&amp;quot;Width&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                 &amp;lt;Dim type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;BottomEdge&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;/Area&amp;gt;&lt;br /&gt;
             &amp;lt;Image imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxCaret&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;VertFormat type=&amp;quot;Stretched&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;/ImageryComponent&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
     &amp;lt;/ImagerySection&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;Enabled&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;Layer&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;frame&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;/Layer&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;Disabled&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;Layer&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;frame&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;Colours topLeft=&amp;quot;FF7F7F7F&amp;quot; topRight=&amp;quot;FF7F7F7F&amp;quot; bottomLeft=&amp;quot;FF7F7F7F&amp;quot; bottomRight=&amp;quot;FF7F7F7F&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Section&amp;gt;&lt;br /&gt;
         &amp;lt;/Layer&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;ReadOnly&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;Layer&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;frame&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;Colours topLeft=&amp;quot;FFFFFFFF&amp;quot; topRight=&amp;quot;FFDFDFDF&amp;quot; bottomLeft=&amp;quot;FFDFDFDF&amp;quot; bottomRight=&amp;quot;FFDFDFDF&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Section&amp;gt;&lt;br /&gt;
         &amp;lt;/Layer&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;ActiveSelection&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;InactiveSelection&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
 &amp;lt;/Falagard&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We only specify the vertical formatting for the new ''ImageryComponent'' because we are specifying the area to exactly match the width of the image, and thus any formatting would have no effect. ''LeftAligned'' (the default) is just fine.&lt;br /&gt;
&lt;br /&gt;
Now we just need to do something in the ''ActiveSelection'' and ''InactiveSelection'' states...&lt;br /&gt;
&lt;br /&gt;
== Selection ==&lt;br /&gt;
When the user has selected text in the ''Editbox'', either with the mouse or the keyboard, CEGUI render the selection using the two additional states '''ActiveSelection''' and '''InactiveSelection'''.&lt;br /&gt;
&lt;br /&gt;
The the window is active (has focus) it will use the state '''ActiveSelection''', if if does not have focus (inactive) yet still has a selection '''InactiveSelection''' will be used.&lt;br /&gt;
&lt;br /&gt;
For the selection in this look'n'feel, we'll use a single image stretched over the selection area. This image will contain plain white in the image file so we can apply any colour(s) we choose to the selection imagery.&lt;br /&gt;
Let's call it '''White'''.&lt;br /&gt;
&lt;br /&gt;
For '''ActiveSelection''' we'll use a classic blue colour, for inactive the same, except we'll make it 50% transparent.&lt;br /&gt;
We can avoid a colour tag in the '''ActiveSelection''' state if we specify the colours to use directly in the ''ImageryComponent''. We'll do that to show how it works.&lt;br /&gt;
&lt;br /&gt;
We'll create a new ''ImagerySection'' for this &amp;quot;selection brush&amp;quot; named '''selection'''. XML follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;ImagerySection name=&amp;quot;selection&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;ImageryComponent&amp;gt;&lt;br /&gt;
         &amp;lt;Area&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;RightEdge&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;RightEdge&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;BottomEdge&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
         &amp;lt;/Area&amp;gt;&lt;br /&gt;
         &amp;lt;Image imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;White&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;Colours topLeft=&amp;quot;FF26458A&amp;quot; topRight=&amp;quot;FF26458A&amp;quot; bottomLeft=&amp;quot;FF26458A&amp;quot; bottomRight=&amp;quot;FF26458A&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;VertFormat type=&amp;quot;Stretched&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;HorzFormat type=&amp;quot;Stretched&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;/ImageryComponent&amp;gt;&lt;br /&gt;
 &amp;lt;/ImagerySection&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We use a default area that you should recognise by now. CEGUI will automatically use the right size for the selection.&lt;br /&gt;
The image we use is the one called '''White''' from our favorite imageset '''MyImages'''. Like always ;-)&lt;br /&gt;
A colour tag has been added as well to make our selection some kind of blue...&lt;br /&gt;
The vertical and horizontal formatting is ''Stretched'' which is generally what you would want to do in a situation like this.&lt;br /&gt;
&lt;br /&gt;
We'll &amp;quot;call&amp;quot; this ''ImagerySection'' from the '''ActiveSelection''' and '''InactiveSelection''' states. In the '''InactiveSelection''' state we'll further modulate the colours used by passing a 50% transparent white. This will have the effect of using the same colour as in the active state, but make that colour 50% transparent. We could have just specified the full colour to use in each state and remove the ''Colours'' tag from the ''ImageryComponent'', but I wanted to show that multiple modulations are possible with Falagard.&lt;br /&gt;
&lt;br /&gt;
The states are the last thing missing from the look'n'feel, so let's take a look at the final XML (yay :-P ).&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt; &lt;br /&gt;
 &amp;lt;Falagard&amp;gt;&lt;br /&gt;
     &amp;lt;NamedArea name=&amp;quot;TextArea&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;Area&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;ImageDim imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxL&amp;quot; dimension=&amp;quot;Width&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;ImageDim imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxT&amp;quot; dimension=&amp;quot;Height&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;RightEdge&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;RightEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;DimOperator op=&amp;quot;Subtract&amp;quot;&amp;gt;&lt;br /&gt;
                         &amp;lt;ImageDim imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxR&amp;quot; dimension=&amp;quot;Width&amp;quot; /&amp;gt;&lt;br /&gt;
                     &amp;lt;/DimOperator&amp;gt;&lt;br /&gt;
                 &amp;lt;/Unified&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;DimOperator op=&amp;quot;Subtract&amp;quot;&amp;gt;&lt;br /&gt;
                         &amp;lt;ImageDim imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxB&amp;quot; dimension=&amp;quot;Height&amp;quot; /&amp;gt;&lt;br /&gt;
                     &amp;lt;/DimOperator&amp;gt;&lt;br /&gt;
                 &amp;lt;/Unified&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
         &amp;lt;/Area&amp;gt;&lt;br /&gt;
     &amp;lt;/NamedArea&amp;gt;&lt;br /&gt;
     &amp;lt;ImagerySection name=&amp;quot;frame&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;FrameComponent&amp;gt;&lt;br /&gt;
             &amp;lt;Area&amp;gt;&lt;br /&gt;
                 &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                 &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                 &amp;lt;Dim type=&amp;quot;RightEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;RightEdge&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                 &amp;lt;Dim type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;BottomEdge&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;/Area&amp;gt;&lt;br /&gt;
             &amp;lt;Image type=&amp;quot;TopLeftCorner&amp;quot;     imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxTL&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;Image type=&amp;quot;TopEdge&amp;quot;           imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxT&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;Image type=&amp;quot;TopRightCorner&amp;quot;    imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxTR&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;Image type=&amp;quot;RightEdge&amp;quot;         imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxR&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;Image type=&amp;quot;BottomRightCorner&amp;quot; imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxBR&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;Image type=&amp;quot;BottomEdge&amp;quot;        imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxB&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;Image type=&amp;quot;BottomLeftCorner&amp;quot;  imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxBL&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;Image type=&amp;quot;LeftEdge&amp;quot;          imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxL&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;Image type=&amp;quot;Background&amp;quot;        imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxBg&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;VertFormat type=&amp;quot;Stretched&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;HorzFormat type=&amp;quot;Stretched&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;/FrameComponent&amp;gt;&lt;br /&gt;
     &amp;lt;/ImagerySection&amp;gt;&lt;br /&gt;
     &amp;lt;ImagerySection name=&amp;quot;Carat&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;ImageryComponent&amp;gt;&lt;br /&gt;
             &amp;lt;Area&amp;gt;&lt;br /&gt;
                 &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                 &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                 &amp;lt;Dim type=&amp;quot;Width&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;ImageDim imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxCaret&amp;quot; dimension=&amp;quot;Width&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                 &amp;lt;Dim type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;BottomEdge&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;/Area&amp;gt;&lt;br /&gt;
             &amp;lt;Image imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;EditboxCaret&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;VertFormat type=&amp;quot;Stretched&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;/ImageryComponent&amp;gt;&lt;br /&gt;
     &amp;lt;/ImagerySection&amp;gt;&lt;br /&gt;
     &amp;lt;b&amp;gt;&amp;lt;ImagerySection name=&amp;quot;selection&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;ImageryComponent&amp;gt;&lt;br /&gt;
             &amp;lt;Area&amp;gt;&lt;br /&gt;
                 &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                 &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                 &amp;lt;Dim type=&amp;quot;RightEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;RightEdge&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                 &amp;lt;Dim type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;0&amp;quot; type=&amp;quot;BottomEdge&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;/Area&amp;gt;&lt;br /&gt;
             &amp;lt;Image imageset=&amp;quot;MyImages&amp;quot; image=&amp;quot;White&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;Colours topLeft=&amp;quot;FF26458A&amp;quot; topRight=&amp;quot;FF26458A&amp;quot; bottomLeft=&amp;quot;FF26458A&amp;quot; bottomRight=&amp;quot;FF26458A&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;VertFormat type=&amp;quot;Stretched&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;HorzFormat type=&amp;quot;Stretched&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;/ImageryComponent&amp;gt;&lt;br /&gt;
     &amp;lt;/ImagerySection&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;Enabled&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;Layer&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;frame&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;/Layer&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;Disabled&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;Layer&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;frame&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;Colours topLeft=&amp;quot;FF7F7F7F&amp;quot; topRight=&amp;quot;FF7F7F7F&amp;quot; bottomLeft=&amp;quot;FF7F7F7F&amp;quot; bottomRight=&amp;quot;FF7F7F7F&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Section&amp;gt;&lt;br /&gt;
         &amp;lt;/Layer&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;ReadOnly&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;Layer&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;frame&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;Colours topLeft=&amp;quot;FFFFFFFF&amp;quot; topRight=&amp;quot;FFDFDFDF&amp;quot; bottomLeft=&amp;quot;FFDFDFDF&amp;quot; bottomRight=&amp;quot;FFDFDFDF&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Section&amp;gt;&lt;br /&gt;
         &amp;lt;/Layer&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;ActiveSelection&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;b&amp;gt;&amp;lt;Layer&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;selection&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;/Layer&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;InactiveSelection&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;b&amp;gt;&amp;lt;Layer&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;selection&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;Colours topLeft=&amp;quot;7FFFFFFF&amp;quot; topRight=&amp;quot;7FFFFFFF&amp;quot; bottomLeft=&amp;quot;7FFFFFFF&amp;quot; bottomRight=&amp;quot;7FFFFFFF&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Section&amp;gt;&lt;br /&gt;
         &amp;lt;/Layer&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
 &amp;lt;/Falagard&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's it folks. The look'n'feel is done. Hopefully you're starting to play around with the XML and making the look'n'feel suit you (or your artist ;-) ).&lt;br /&gt;
Again, feel free to add comments in the discussion page.&lt;br /&gt;
&lt;br /&gt;
Stay tuned for part III...&lt;br /&gt;
&lt;br /&gt;
--[[User:lindquist|lindquist]] 00:41, 14 Dec 2005 (CET)&lt;/div&gt;</summary>
		<author><name>Tss</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=Overview_of_GUI_files&amp;diff=3668</id>
		<title>Overview of GUI files</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=Overview_of_GUI_files&amp;diff=3668"/>
				<updated>2011-02-26T12:10:39Z</updated>
		
		<summary type="html">&lt;p&gt;Tss: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[category: Tutorials]]&lt;br /&gt;
&lt;br /&gt;
There are a lot of files that go into creating a GUI with CEGUI.  Here is an overview (thanks to lindquist for the original version).  An expanded version of this brief overview would be quite useful.&lt;br /&gt;
&lt;br /&gt;
==Overview of CEGUI resource files==&lt;br /&gt;
==='''.imageset Files'''===&lt;br /&gt;
An imageset is an xml file describing a set of images contained in an image file.&lt;br /&gt;
When an imageset is loaded, images from that file become available to the application via the [http://www.cegui.org.uk/api_reference/classCEGUI_1_1ImagesetManager.html ImagesetManager].&lt;br /&gt;
&lt;br /&gt;
Editor: [http://www.cegui.org.uk/phpBB2/viewtopic.php?t=1346 CEImagesetEditor in the works by Martignasse.]&lt;br /&gt;
&lt;br /&gt;
==='''[[Scheme files|.scheme Files]]'''===&lt;br /&gt;
A scheme file is an xml file describing the binding of widgets defined in a looknfeel file and the base Falagard widget set. Once loaded the components in the scheme file are available via the [http://www.cegui.org.uk/api_reference/classCEGUI_1_1WindowManager.html WindowManager].  A detailed description of [[Scheme files]] is also available.&lt;br /&gt;
&lt;br /&gt;
Editor: none&lt;br /&gt;
&lt;br /&gt;
==='''.looknfeel Files'''===&lt;br /&gt;
These are also xml files, which define the visual aspect of widgets declared in the scheme file.&lt;br /&gt;
&lt;br /&gt;
Editor: none&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''.layout Files'''===&lt;br /&gt;
A layout file is also in xml format.  It describes a set of widgets to create and their positions, sizes, and other attributes.  Basically this describes the final on-screen layout of your GUI, hence the name.&lt;br /&gt;
&lt;br /&gt;
Editor: [[The_&amp;quot;official&amp;quot;_layout_editor]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''.font Files'''===&lt;br /&gt;
These simple xml files give the location of a font file (like a TrueType .ttf file) and define a few extra properties about how CEGUI should use that font.&lt;br /&gt;
&lt;br /&gt;
Editor:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==About [[%22Falagard%22_Skinning_System_Documentation | Falagard]]==&lt;br /&gt;
Falagard is the part of the API that makes it possible to create a completly new set of widgets (at the visual level) from xml files.&lt;br /&gt;
&lt;br /&gt;
You can, with a looknfeel, describe a widget and make it appear as you want (by using images defined in some imageset) and finally bind it to one of the widgets from a Falagard Base widget set in a scheme file.&lt;br /&gt;
&lt;br /&gt;
Link: [[%22Falagard%22_Skinning_System_Documentation | Falagard documentation]]&lt;br /&gt;
&lt;br /&gt;
==Related Documents==&lt;br /&gt;
* [[XML File formats]] - Detailed documentation of the various XML file formats.&lt;/div&gt;</summary>
		<author><name>Tss</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=Create_ImageButtons&amp;diff=3667</id>
		<title>Create ImageButtons</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=Create_ImageButtons&amp;diff=3667"/>
				<updated>2011-02-26T12:10:14Z</updated>
		
		<summary type="html">&lt;p&gt;Tss: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[category: Tutorials]]&lt;br /&gt;
&lt;br /&gt;
If you write a GUI for a game, at some time comes the point where you want to create the most exciting kind of buttons: ImageButtons ! But care, I'm not talking about a default button frame, that has a picture instead of a text, I'm talking about ''completely'' self-drawn buttons. I've found two ways to accomplish that task, both are nice.&lt;br /&gt;
&lt;br /&gt;
== Preparations ==&lt;br /&gt;
There are a few tasks we have to accomplish before being able to create an ImageButton.&lt;br /&gt;
&lt;br /&gt;
=== Draw it ! ===&lt;br /&gt;
The most important thing is, of course, draw the pictures. If you don't want to accomplish this, ask your graphics artist :)&lt;br /&gt;
You have to draw 4 pictures/button, wich represents the four states:&lt;br /&gt;
#Normal: That is how the button looks like most of the time.&lt;br /&gt;
#Hover: This is how the button should look when the mouse comes over it.&lt;br /&gt;
#Pushed: When the user clicks the mouse button (and holds it down a bit) over the button, it looks like this.&lt;br /&gt;
#Disabled: You can imagine what this is.&lt;br /&gt;
&lt;br /&gt;
This is the file we'll use for this HOWTO and as you see, i didn't ask my graphics artist to do one :p&lt;br /&gt;
You can find all other files (source code, data files) there too.&lt;br /&gt;
[[http://pompei2.cesar4.be/cegui/imgButton/]]&lt;br /&gt;
Edit: shit the link is currently dead ... I hope I find the files so I can upload them again, but atm everything that is written here must be enough. On questions/problems just ask in the forum.&lt;br /&gt;
&lt;br /&gt;
=== The Imageset ===&lt;br /&gt;
When I talk about an Imageset, I mean two files: The picture file (.tga, .png, or whatever) and the description (.imageset) file. The picture file can contain a lot of images, but its size has to be a power of two. The description file is an xml file wich gives a name to a (rectangular) location in the picture. So you can call the location (150,150,32,32) &amp;quot;UnitIcon&amp;quot; for example.&lt;br /&gt;
&lt;br /&gt;
'''An example for a .imageset file:'''&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;Imageset Name=&amp;quot;THEButton&amp;quot; Imagefile=&amp;quot;THEButton.png&amp;quot; &amp;gt;&lt;br /&gt;
 	&amp;lt;Image Name=&amp;quot;btnNormal&amp;quot; XPos=&amp;quot;0&amp;quot; YPos=&amp;quot;0&amp;quot;  Width=&amp;quot;64&amp;quot; Height=&amp;quot;20&amp;quot; /&amp;gt;&lt;br /&gt;
 	&amp;lt;Image Name=&amp;quot;btnHover&amp;quot;  XPos=&amp;quot;0&amp;quot; YPos=&amp;quot;20&amp;quot; Width=&amp;quot;64&amp;quot; Height=&amp;quot;20&amp;quot; /&amp;gt;&lt;br /&gt;
 	&amp;lt;Image Name=&amp;quot;btnPushed&amp;quot; XPos=&amp;quot;0&amp;quot; YPos=&amp;quot;40&amp;quot; Width=&amp;quot;64&amp;quot; Height=&amp;quot;20&amp;quot; /&amp;gt;&lt;br /&gt;
 	&amp;lt;Image Name=&amp;quot;btnDisabl&amp;quot; XPos=&amp;quot;0&amp;quot; YPos=&amp;quot;60&amp;quot; Width=&amp;quot;64&amp;quot; Height=&amp;quot;20&amp;quot; /&amp;gt;&lt;br /&gt;
 &amp;lt;/Imageset&amp;gt;&lt;br /&gt;
We will use this imageset in our examples. It defines four named images: btnNormal, btnHover, btnPushed and btnDisabl (saved in the file &amp;quot;THEButton.png&amp;quot;). The whole imageset is called &amp;quot;THEButton&amp;quot; and saved in a file named &amp;quot;THEButton.imageset&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How to use this imageset now ? This is very simple, you just have to do this in your initialisation code:&lt;br /&gt;
 // Load the THEButton Imageset that has the pictures for our button.&lt;br /&gt;
 CEGUI::ImagesetManager::getSingleton().createImageset( &amp;quot;THEButton.imageset&amp;quot; ); &lt;br /&gt;
That's all ! Of course, you should do this in a try/catch block.&lt;br /&gt;
&lt;br /&gt;
If, for some wicked reason, you want to do something in code with this imageset, you can either save the pointer that the function above returns, or you just get that pointer if you know the name of the imageset (what you usually do), using this function:&lt;br /&gt;
 CEGUI::Imageset *m_pImageSet = CEGUI::ImagesetManager::getSingleton().getImageset( &amp;quot;THEButton&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
Enough about imagesets.&lt;br /&gt;
&lt;br /&gt;
== The programmer's job ==&lt;br /&gt;
Now we can create the button itself (in two different ways):&lt;br /&gt;
&lt;br /&gt;
=== The first way: mainly in code ===&lt;br /&gt;
One way is to create the button in code, you usually do this if you only know wich button to display at runtime. Maybe a strategy game is the best to illustrate this. Imagine you have the buttonspanel, a place on screen with an array of buttons. The buttons that are present there depend on something (like wich unit is currently selected or so). The first thing you have to do, is not in code. Create one layout file for every button. The file should look somewhat like this:&lt;br /&gt;
&lt;br /&gt;
'''Content of button1.layout version 0.1'''&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUILayout&amp;gt;&lt;br /&gt;
 &amp;lt;Window Type=&amp;quot;TaharezLook/ImageButton&amp;quot; Name=&amp;quot;btnNewGame&amp;quot;&amp;gt;&lt;br /&gt;
 	&amp;lt;Property Name=&amp;quot;UnifiedPosition&amp;quot; Value=&amp;quot;{{0,0},{0,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
 	&amp;lt;Property Name=&amp;quot;UnifiedSize&amp;quot; Value=&amp;quot;{{0,64},{0,20}}&amp;quot; /&amp;gt;&lt;br /&gt;
 	&amp;lt;nowiki&amp;gt;&amp;lt;!-- Here we choose what images to take. set:THEButton means they are stored --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- in the imageset named THEButton and image:btnNormal specifies wich image it is. --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 	&amp;lt;Property Name=&amp;quot;NormalImage&amp;quot;     Value=&amp;quot;set:THEButton image:btnNormal&amp;quot; /&amp;gt;&lt;br /&gt;
 	&amp;lt;Property Name=&amp;quot;HoverImage&amp;quot;      Value=&amp;quot;set:THEButton image:btnHover&amp;quot;  /&amp;gt;&lt;br /&gt;
 	&amp;lt;Property Name=&amp;quot;PushedImage&amp;quot;     Value=&amp;quot;set:THEButton image:btnPushed&amp;quot; /&amp;gt;&lt;br /&gt;
 	&amp;lt;Property Name=&amp;quot;DisabledImage&amp;quot;   Value=&amp;quot;set:THEButton image:btnDisabl&amp;quot; /&amp;gt;&lt;br /&gt;
 	&amp;lt;nowiki&amp;gt;&amp;lt;!-- Now the button would be ready, but without caption ... So we add a caption. --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &amp;lt;/Window&amp;gt;&lt;br /&gt;
 &amp;lt;/GUILayout&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have an imagebutton but you want it to have a caption, you could write this kind of layout file:&lt;br /&gt;
&lt;br /&gt;
'''Content of button1.layout version 0.2'''&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;GUILayout&amp;gt;&lt;br /&gt;
 &amp;lt;Window Type=&amp;quot;TaharezLook/ImageButton&amp;quot; Name=&amp;quot;btnNewGame&amp;quot;&amp;gt;&lt;br /&gt;
 	&amp;lt;Property Name=&amp;quot;UnifiedPosition&amp;quot; Value=&amp;quot;{{0,0},{0,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
 	&amp;lt;Property Name=&amp;quot;UnifiedSize&amp;quot; Value=&amp;quot;{{0,64},{0,20}}&amp;quot; /&amp;gt;&lt;br /&gt;
 	&amp;lt;nowiki&amp;gt;&amp;lt;!-- Here we choose what images to take. set:THEButton means they are stored --&amp;gt;&lt;br /&gt;
	&amp;lt;!-- in the imageset named THEButton and image:btnNormal specifies wich image it is. --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 	&amp;lt;Property Name=&amp;quot;NormalImage&amp;quot;     Value=&amp;quot;set:THEButton image:btnNormal&amp;quot; /&amp;gt;&lt;br /&gt;
 	&amp;lt;Property Name=&amp;quot;HoverImage&amp;quot;      Value=&amp;quot;set:THEButton image:btnHover&amp;quot;  /&amp;gt;&lt;br /&gt;
 	&amp;lt;Property Name=&amp;quot;PushedImage&amp;quot;     Value=&amp;quot;set:THEButton image:btnPushed&amp;quot; /&amp;gt;&lt;br /&gt;
 	&amp;lt;Property Name=&amp;quot;DisabledImage&amp;quot;   Value=&amp;quot;set:THEButton image:btnDisabl&amp;quot; /&amp;gt;&lt;br /&gt;
 	&amp;lt;nowiki&amp;gt;&amp;lt;!-- Now the button would be ready, but without caption ... So we add a caption. --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 	&amp;lt;Window Type=&amp;quot;TaharezLook/StaticText&amp;quot; Name=&amp;quot;btnNewGame_text__&amp;quot;&amp;gt;&lt;br /&gt;
 		&amp;lt;nowiki&amp;gt;&amp;lt;!-- We make the text take all the space of the button to center the text. --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- You should adapt these values to your pictures, just play a bit with em ;) --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 		&amp;lt;Property Name=&amp;quot;UnifiedPosition&amp;quot;   Value=&amp;quot;{{0,0},{0,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
 		&amp;lt;Property Name=&amp;quot;UnifiedSize&amp;quot;       Value=&amp;quot;{{1,0},{1,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
 		&amp;lt;nowiki&amp;gt;&amp;lt;!-- Disable the frame and background, so we got only the text and not a StaticText widget. --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 		&amp;lt;Property Name=&amp;quot;FrameEnabled&amp;quot;      Value=&amp;quot;False&amp;quot; /&amp;gt;&lt;br /&gt;
 		&amp;lt;Property Name=&amp;quot;BackgroundEnabled&amp;quot; Value=&amp;quot;False&amp;quot; /&amp;gt;&lt;br /&gt;
 		&amp;lt;nowiki&amp;gt;&amp;lt;!-- Here we center the text into the button --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 		&amp;lt;Property Name=&amp;quot;HorzFormatting&amp;quot;    Value=&amp;quot;WordWrapCentred&amp;quot; /&amp;gt;&lt;br /&gt;
 		&amp;lt;Property Name=&amp;quot;VertFormatting&amp;quot;    Value=&amp;quot;Middle&amp;quot; /&amp;gt;&lt;br /&gt;
 		&amp;lt;nowiki&amp;gt;&amp;lt;!-- We MUST disable the text so that it is the button that gets our mouse events, --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- and not the static text ! If you forget that line, the buttons graphics will correspond, --&amp;gt;&lt;br /&gt;
		&amp;lt;!-- but the clicks on the button won't work ! because they are &amp;quot;eaten&amp;quot; by the staticText. --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 		&amp;lt;Property Name=&amp;quot;Disabled&amp;quot;          Value=&amp;quot;True&amp;quot; /&amp;gt;&lt;br /&gt;
 		&amp;lt;nowiki&amp;gt;&amp;lt;!-- finally, this is the caption we want the button to have. --&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 		&amp;lt;Property Name=&amp;quot;Text&amp;quot;&amp;gt;New game&amp;lt;/Property&amp;gt;&lt;br /&gt;
 	&amp;lt;/Window&amp;gt;&lt;br /&gt;
 &amp;lt;/Window&amp;gt;&lt;br /&gt;
 &amp;lt;/GUILayout&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This adds a child window of type StaticText, with no border and background, that takes all the place in the button, so we can center it. If your caption has to be not centered, play with the values.&lt;br /&gt;
&lt;br /&gt;
A problem that comes up now, is that if the user clicks on the button, the click will be absorbed by the StaticText, and won't reach the button. That's bad. I searched around and found the following two propertys:&lt;br /&gt;
 &amp;lt;Property Name=&amp;quot;MousePassThroughEnabled&amp;quot;  Value=&amp;quot;True&amp;quot; /&amp;gt;&lt;br /&gt;
 &amp;lt;Property Name=&amp;quot;DistributeCapturedInputs&amp;quot; Value=&amp;quot;True&amp;quot; /&amp;gt;&lt;br /&gt;
But both didn't seem to work as expected, I asked the forums and lindquist told me that &amp;quot;If all you want is a simple label added to the ImageButton then adding a TextComponent in the looknfeel is a much cleaner solution.&amp;quot;. He is probably right, but I didn't struggle with looknfeels yet. If you achieved this, you can tell me or add a chapter to this wiki :)&lt;br /&gt;
&lt;br /&gt;
The solution he suggested (and the only one wich worked, if i remember correctly, is disabling the staticText (like in the complete code written above)&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Property Name=&amp;quot;Disabled&amp;quot; Value=&amp;quot;True&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now all you need to do to load and show the button are the following four lines of code.&lt;br /&gt;
&lt;br /&gt;
 	CEGUI::Window *w = CEGUI::WindowManager::getSingleton().loadWindowLayout( &amp;quot;button1.layout&amp;quot; );&lt;br /&gt;
 	rootWin-&amp;gt;addChildWindow( w );&lt;br /&gt;
 	w-&amp;gt;setPosition( CEGUI::UVector2( CEGUI::UDim(0.5f,-32.0f), CEGUI::UDim(0.5f,-10.0f) ) );&lt;br /&gt;
 	w-&amp;gt;setVisible( true );&lt;br /&gt;
Supposing rootWin is your current root window, or any other window you want to put the button in.&lt;br /&gt;
We set the position to be the center (0.5f) minus the half the height/width of the button, so the button is really centered.&lt;br /&gt;
Of course, you can do everything else you want before (and while) showing the button.&lt;br /&gt;
&lt;br /&gt;
That's it ! now you can work with the button however you want :)&lt;br /&gt;
&lt;br /&gt;
=== The second way: Let the power of layout guide you ===&lt;br /&gt;
I suppose you read the first way, because they are very similar and I won't rewrite the whole code here. The main difference is that if you like layouts, you'll already have declared all your windows in layout files. The the &amp;quot;'''Content of button1.layout version 0.2'''&amp;quot; won't be alone in a layout file of its own, but it will be in your already existing layout files.&lt;br /&gt;
You still have to load the Imageset. I Provided a sample, named imgButtonSample.layout&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
That's it ! If you got suggestions, corrections or whatever feedback, just tell me.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[User:Pompei2|Pompei2]] 11:18, 11 January 2007 (PST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[User:fezztah|fezztah]] &lt;br /&gt;
To properly centre the label on an image button vertically as well as horizontally I had to change the line: &amp;lt;Property Name=&amp;quot;VertFormatting&amp;quot;    Value=&amp;quot;Middle&amp;quot; /&amp;gt; such that Value=&amp;quot;VertCentred&amp;quot; instead. I'm not sure if the original is a mistake so I won't alter it in case it has some other purpose.&lt;/div&gt;</summary>
		<author><name>Tss</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=Create_a_CheckListboxItem&amp;diff=3666</id>
		<title>Create a CheckListboxItem</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=Create_a_CheckListboxItem&amp;diff=3666"/>
				<updated>2011-02-26T12:10:06Z</updated>
		
		<summary type="html">&lt;p&gt;Tss: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[category: Tutorials]]&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==Getting started!==&lt;br /&gt;
I'm assuming you are just using a standard imageset, with a standard scheme (currently TaharezLook and WindowsLook are supported).&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
#Enabled: How the item looks when the item is enabled.&lt;br /&gt;
#Disabled: How the item looks when the item is disabled.&lt;br /&gt;
#SelectedEnabled: How the item looks when the item is selected and is enabled.&lt;br /&gt;
#SelectedDisabled: How the item looks when the item is selected and is disabled.&lt;br /&gt;
&lt;br /&gt;
==Writing the requirements==&lt;br /&gt;
&lt;br /&gt;
Open the appriopiate looknfeel file (WindowsLook.looknfeel or TaharezLook.looknfeel), and place this at the bottom (inside the Falagard tags though!)&lt;br /&gt;
&lt;br /&gt;
''' Our start '''&lt;br /&gt;
 &amp;lt;WidgetLook name=&amp;quot;WindowsLook/CheckListboxItem&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;/WidgetLook&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;WidgetLook name=&amp;quot;WindowsLook/CheckListboxItem&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;Enabled&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;Layer&amp;gt;&lt;br /&gt;
               &amp;lt;Section section=&amp;quot;label&amp;quot;&amp;gt;&lt;br /&gt;
                   &amp;lt;ColourProperty name=&amp;quot;TextColour&amp;quot; /&amp;gt;&lt;br /&gt;
               &amp;lt;/Section&amp;gt;&lt;br /&gt;
          &amp;lt;/Layer&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;Disabled&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;Layer&amp;gt;&lt;br /&gt;
               &amp;lt;Section section=&amp;quot;label&amp;quot;&amp;gt;&lt;br /&gt;
                   &amp;lt;ColourProperty name=&amp;quot;TextColour&amp;quot; /&amp;gt;&lt;br /&gt;
               &amp;lt;/Section&amp;gt;&lt;br /&gt;
          &amp;lt;/Layer&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
 &amp;lt;/WidgetLook&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We define a state via StateImagery. It requires the attribute name which specifies what state its in. Don't worry about Layer for now. Section is always used. This part takes care of actually changing the look. It requires a attribute section, this is actually WHAT to change, in this case the label. TextColour is a simple colour (black), we will define it below. Now as you can see the Enabled state just sets the text colour to black, thats all it does. Same goes for Disabled (remember this is an item, items are not commonly disabled).&lt;br /&gt;
&lt;br /&gt;
Now we are going to take a look at the other two states.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;WidgetLook name=&amp;quot;WindowsLook/CheckListboxItem&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;Enabled&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;Layer&amp;gt;&lt;br /&gt;
               &amp;lt;Section section=&amp;quot;label&amp;quot;&amp;gt;&lt;br /&gt;
                   &amp;lt;ColourProperty name=&amp;quot;TextColour&amp;quot; /&amp;gt;&lt;br /&gt;
               &amp;lt;/Section&amp;gt;&lt;br /&gt;
          &amp;lt;/Layer&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;Disabled&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;Layer&amp;gt;&lt;br /&gt;
               &amp;lt;Section section=&amp;quot;label&amp;quot;&amp;gt;&lt;br /&gt;
                   &amp;lt;ColourProperty name=&amp;quot;TextColour&amp;quot; /&amp;gt;&lt;br /&gt;
               &amp;lt;/Section&amp;gt;&lt;br /&gt;
          &amp;lt;/Layer&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;SelectedEnabled&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;Layer&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;selection&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;label&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;ColourProperty name=&amp;quot;SelectedTextColour&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Section&amp;gt;&lt;br /&gt;
         &amp;lt;/Layer&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;SelectedDisabled&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;Layer&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;selection&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;label&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;ColourProperty name=&amp;quot;SelectedTextColour&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Section&amp;gt;&lt;br /&gt;
         &amp;lt;/Layer&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
 &amp;lt;/WidgetLook&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These states pretty much speak for themselves altough there are more sections listed. Section not only defines what to change, also defines what needs to be shown. In the Enabled state we dont want it to look like its selected, so there is no selection section. Note that the order of which you put the Sections are also the Z order. In this case we are putting the selection image first, and then text. If we would do it the other way around, we wouldn't see the text.&lt;br /&gt;
&lt;br /&gt;
Now we are going to add the definitions of some colors and property's.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;WidgetLook name=&amp;quot;WindowsLook/CheckListboxItem&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;PropertyDefinition name=&amp;quot;TextColour&amp;quot; initialValue=&amp;quot;FF000000&amp;quot; redrawOnWrite=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;PropertyDefinition name=&amp;quot;SelectedTextColour&amp;quot; initialValue=&amp;quot;FFFFFFFF&amp;quot; redrawOnWrite=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;PropertyDefinition name=&amp;quot;SelectionBrush&amp;quot; initialValue=&amp;quot;set:WindowsLook image:Background&amp;quot; redrawOnWrite=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;PropertyDefinition name=&amp;quot;SelectionColour&amp;quot; initialValue=&amp;quot;FF3030FF&amp;quot; redrawOnWrite=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;Property name=&amp;quot;Selectable&amp;quot; value=&amp;quot;True&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;Enabled&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;Layer&amp;gt;&lt;br /&gt;
               &amp;lt;Section section=&amp;quot;label&amp;quot;&amp;gt;&lt;br /&gt;
                   &amp;lt;ColourProperty name=&amp;quot;TextColour&amp;quot; /&amp;gt;&lt;br /&gt;
               &amp;lt;/Section&amp;gt;&lt;br /&gt;
          &amp;lt;/Layer&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;Disabled&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;Layer&amp;gt;&lt;br /&gt;
               &amp;lt;Section section=&amp;quot;label&amp;quot;&amp;gt;&lt;br /&gt;
                   &amp;lt;ColourProperty name=&amp;quot;TextColour&amp;quot; /&amp;gt;&lt;br /&gt;
               &amp;lt;/Section&amp;gt;&lt;br /&gt;
          &amp;lt;/Layer&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;SelectedEnabled&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;Layer&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;selection&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;label&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;ColourProperty name=&amp;quot;SelectedTextColour&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Section&amp;gt;&lt;br /&gt;
         &amp;lt;/Layer&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;SelectedDisabled&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;Layer&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;selection&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;label&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;ColourProperty name=&amp;quot;SelectedTextColour&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Section&amp;gt;&lt;br /&gt;
         &amp;lt;/Layer&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
 &amp;lt;/WidgetLook&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Our first PropertyDefinition just defines a text for a colour used in the StateImagery sections. Same goes for the other PropertyDefinitions except the SelectionBrush. Instead of defining a color, it defines a image. In this case it uses the WindowsLook Background image defined in the imageset. Then we got a Property, which simply implies some sort of setting. In this case, we make it a item by adding the Property 'Selectable' and setting it to true as we want it to act like an item.&lt;br /&gt;
&lt;br /&gt;
==Writing the functional parts==&lt;br /&gt;
&lt;br /&gt;
We now need to add the parts where the background, text and the selection gets drawn. This seems hard, but isn't actually. We are going to start off with a NamedArea. This is required for a listbox item as the listbox needs to know how big the item is to fit it into the list. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;WidgetLook name=&amp;quot;WindowsLook/CheckListboxItem&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;PropertyDefinition name=&amp;quot;TextColour&amp;quot; initialValue=&amp;quot;FF000000&amp;quot; redrawOnWrite=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;PropertyDefinition name=&amp;quot;SelectedTextColour&amp;quot; initialValue=&amp;quot;FFFFFFFF&amp;quot; redrawOnWrite=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;PropertyDefinition name=&amp;quot;SelectionBrush&amp;quot; initialValue=&amp;quot;set:WindowsLook image:Background&amp;quot; redrawOnWrite=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;PropertyDefinition name=&amp;quot;SelectionColour&amp;quot; initialValue=&amp;quot;FF3030FF&amp;quot; redrawOnWrite=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;Property name=&amp;quot;Selectable&amp;quot; value=&amp;quot;True&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;b&amp;gt;&amp;lt;NamedArea name=&amp;quot;ContentSize&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;Area&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot; &amp;gt;&lt;br /&gt;
                 &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot; &amp;gt;&lt;br /&gt;
                 &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;Width&amp;quot; &amp;gt;&lt;br /&gt;
                 &amp;lt;FontDim type=&amp;quot;HorzExtent&amp;quot; padding=&amp;quot;6&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;Height&amp;quot; &amp;gt;&lt;br /&gt;
                 &amp;lt;FontDim type=&amp;quot;LineSpacing&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
         &amp;lt;/Area&amp;gt;&lt;br /&gt;
     &amp;lt;/NamedArea&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;Enabled&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;Layer&amp;gt;&lt;br /&gt;
               &amp;lt;Section section=&amp;quot;label&amp;quot;&amp;gt;&lt;br /&gt;
                   &amp;lt;ColourProperty name=&amp;quot;TextColour&amp;quot; /&amp;gt;&lt;br /&gt;
               &amp;lt;/Section&amp;gt;&lt;br /&gt;
          &amp;lt;/Layer&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;Disabled&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;Layer&amp;gt;&lt;br /&gt;
               &amp;lt;Section section=&amp;quot;label&amp;quot;&amp;gt;&lt;br /&gt;
                   &amp;lt;ColourProperty name=&amp;quot;TextColour&amp;quot; /&amp;gt;&lt;br /&gt;
               &amp;lt;/Section&amp;gt;&lt;br /&gt;
          &amp;lt;/Layer&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;SelectedEnabled&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;Layer&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;selection&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;label&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;ColourProperty name=&amp;quot;SelectedTextColour&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Section&amp;gt;&lt;br /&gt;
         &amp;lt;/Layer&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;SelectedDisabled&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;Layer&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;selection&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;label&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;ColourProperty name=&amp;quot;SelectedTextColour&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Section&amp;gt;&lt;br /&gt;
         &amp;lt;/Layer&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
 &amp;lt;/WidgetLook&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I am assuming you know what the basics like the Area, Dim and such. Though FontDim is used to change the size of the item depending on a label. The part we just added now defines the size of the item.&lt;br /&gt;
Instead of adding the whole code here again, I'm only showing the additions from now on.&lt;br /&gt;
&lt;br /&gt;
Ok! Now we are going to add the actual Checkbox. This is crucial for our goal, as it allows the item to be checked upon click. We dont have to write the states and all that for the Checkbox, we just use Child! Just place this under our NamedArea and above the first StateImagery.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Child type =&amp;quot;WindowsLook/Checkbox&amp;quot; nameSuffix=&amp;quot;__auto__checkbox&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;Area&amp;gt;&lt;br /&gt;
         &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot;&amp;gt;&lt;br /&gt;
             &amp;lt;UnifiedDim scale=&amp;quot;0&amp;quot; type=&amp;quot;LeftEdge&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;AbsoluteDim value=&amp;quot;3&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;/Dim&amp;gt;&lt;br /&gt;
         &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot;&amp;gt;&lt;br /&gt;
             &amp;lt;UnifiedDim scale=&amp;quot;0&amp;quot; type=&amp;quot;TopEdge&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;/Dim&amp;gt;&lt;br /&gt;
         &amp;lt;Dim type=&amp;quot;Width&amp;quot;&amp;gt;&lt;br /&gt;
             &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; type=&amp;quot;Width&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;/Dim&amp;gt;&lt;br /&gt;
         &amp;lt;Dim type=&amp;quot;Height&amp;quot;&amp;gt;&lt;br /&gt;
             &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; type=&amp;quot;Height&amp;quot;/&amp;gt;&lt;br /&gt;
         &amp;lt;/Dim&amp;gt;&lt;br /&gt;
     &amp;lt;/Area&amp;gt;&lt;br /&gt;
 &amp;lt;/Child&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This adds a WindowsLook/Checkbox to our item. The suffix is necessary to make the name unique. the rest is pretty straight forward - it adds the checkbox on the left side of the item, starting from 3 pixels to make it look smooth.&lt;br /&gt;
&lt;br /&gt;
Now we need a label, this part is simple and I will not spend as much time on clarifying it, it basically explains itself.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;ImagerySection name=&amp;quot;label&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;TextComponent&amp;gt;&lt;br /&gt;
         &amp;lt;Area&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;AbsoluteDim value=&amp;quot;18&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;RightEdge&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;-3&amp;quot; type=&amp;quot;RightEdge&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; type=&amp;quot;BottomEdge&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
         &amp;lt;/Area&amp;gt;&lt;br /&gt;
     &amp;lt;/TextComponent&amp;gt;&lt;br /&gt;
 &amp;lt;/ImagerySection&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The TextComponent simply states this this can contain text. The Dim's are just positioning. Note the LeftEdge, the label starts at 18 pixels from the left. This is because the first ~15 pixels are occupied by the checkbox.&lt;br /&gt;
&lt;br /&gt;
Now something important! The selection image.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;ImagerySection name=&amp;quot;selection&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;ImageryComponent&amp;gt;&lt;br /&gt;
         &amp;lt;Area&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;RightEdge&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; type=&amp;quot;RightEdge&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; type=&amp;quot;BottomEdge&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
         &amp;lt;/Area&amp;gt;&lt;br /&gt;
         &amp;lt;ImageProperty name=&amp;quot;SelectionBrush&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;ColourProperty name=&amp;quot;SelectionColour&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;VertFormat type=&amp;quot;Stretched&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;HorzFormat type=&amp;quot;Stretched&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;/ImageryComponent&amp;gt;&lt;br /&gt;
 &amp;lt;/ImagerySection&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that we give it the name selection, as used in the StateImagery. The Area part is just positioning and fitting again. The Dim's used there simply make sure the whole item is filled. ImageProperty defines the image to use. We have defined SelectionBrush at the top of our WidgetLook. It simply fills the Area with that image now. ColourProperty colors the image, we have also defined SelectionColour at the top of the WidgetLook. VertFormat and HorzFormat are stretched, if its not stretched, it will only draw one pixel of the image, making it near invisible. Stretching it just makes sure the whole area is covered.&lt;br /&gt;
&lt;br /&gt;
That was it! We wrote our looknfeel entry!!&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;WidgetLook name=&amp;quot;WindowsLook/CheckListboxItem&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;PropertyDefinition name=&amp;quot;TextColour&amp;quot; initialValue=&amp;quot;FF000000&amp;quot; redrawOnWrite=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;PropertyDefinition name=&amp;quot;SelectedTextColour&amp;quot; initialValue=&amp;quot;FFFFFFFF&amp;quot; redrawOnWrite=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;PropertyDefinition name=&amp;quot;SelectionBrush&amp;quot; initialValue=&amp;quot;set:WindowsLook image:Background&amp;quot; redrawOnWrite=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;PropertyDefinition name=&amp;quot;SelectionColour&amp;quot; initialValue=&amp;quot;FF3030FF&amp;quot; redrawOnWrite=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;Property name=&amp;quot;Selectable&amp;quot; value=&amp;quot;True&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;NamedArea name=&amp;quot;ContentSize&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;Area&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot; &amp;gt;&lt;br /&gt;
                 &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot; &amp;gt;&lt;br /&gt;
                 &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;Width&amp;quot; &amp;gt;&lt;br /&gt;
                 &amp;lt;FontDim type=&amp;quot;HorzExtent&amp;quot; padding=&amp;quot;6&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;Height&amp;quot; &amp;gt;&lt;br /&gt;
                 &amp;lt;FontDim type=&amp;quot;LineSpacing&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
         &amp;lt;/Area&amp;gt;&lt;br /&gt;
     &amp;lt;/NamedArea&amp;gt;&lt;br /&gt;
     &amp;lt;Child type =&amp;quot;WindowsLook/Checkbox&amp;quot; nameSuffix=&amp;quot;__auto__checkbox&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;Area&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;UnifiedDim scale=&amp;quot;0&amp;quot; type=&amp;quot;LeftEdge&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;AbsoluteDim value=&amp;quot;3&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;UnifiedDim scale=&amp;quot;0&amp;quot; type=&amp;quot;TopEdge&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;Width&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; type=&amp;quot;Width&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;Dim type=&amp;quot;Height&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; type=&amp;quot;Height&amp;quot;/&amp;gt;&lt;br /&gt;
             &amp;lt;/Dim&amp;gt;&lt;br /&gt;
         &amp;lt;/Area&amp;gt;&lt;br /&gt;
     &amp;lt;/Child&amp;gt;&lt;br /&gt;
     &amp;lt;ImagerySection name=&amp;quot;label&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;TextComponent&amp;gt;&lt;br /&gt;
             &amp;lt;Area&amp;gt;&lt;br /&gt;
                 &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                 &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;AbsoluteDim value=&amp;quot;18&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                 &amp;lt;Dim type=&amp;quot;RightEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; offset=&amp;quot;-3&amp;quot; type=&amp;quot;RightEdge&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                 &amp;lt;Dim type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; type=&amp;quot;BottomEdge&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;/Area&amp;gt;&lt;br /&gt;
         &amp;lt;/TextComponent&amp;gt;&lt;br /&gt;
     &amp;lt;/ImagerySection&amp;gt;&lt;br /&gt;
     &amp;lt;ImagerySection name=&amp;quot;selection&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;ImageryComponent&amp;gt;&lt;br /&gt;
             &amp;lt;Area&amp;gt;&lt;br /&gt;
                 &amp;lt;Dim type=&amp;quot;TopEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                 &amp;lt;Dim type=&amp;quot;LeftEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;AbsoluteDim value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                 &amp;lt;Dim type=&amp;quot;RightEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; type=&amp;quot;RightEdge&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/Dim&amp;gt;&lt;br /&gt;
                 &amp;lt;Dim type=&amp;quot;BottomEdge&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;UnifiedDim scale=&amp;quot;1&amp;quot; type=&amp;quot;BottomEdge&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/Dim&amp;gt;&lt;br /&gt;
             &amp;lt;/Area&amp;gt;&lt;br /&gt;
             &amp;lt;ImageProperty name=&amp;quot;SelectionBrush&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;ColourProperty name=&amp;quot;SelectionColour&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;VertFormat type=&amp;quot;Stretched&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;HorzFormat type=&amp;quot;Stretched&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;/ImageryComponent&amp;gt;&lt;br /&gt;
     &amp;lt;/ImagerySection&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;Enabled&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;Layer&amp;gt;&lt;br /&gt;
               &amp;lt;Section section=&amp;quot;label&amp;quot;&amp;gt;&lt;br /&gt;
                   &amp;lt;ColourProperty name=&amp;quot;TextColour&amp;quot; /&amp;gt;&lt;br /&gt;
               &amp;lt;/Section&amp;gt;&lt;br /&gt;
          &amp;lt;/Layer&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;Disabled&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;Layer&amp;gt;&lt;br /&gt;
               &amp;lt;Section section=&amp;quot;label&amp;quot;&amp;gt;&lt;br /&gt;
                   &amp;lt;ColourProperty name=&amp;quot;TextColour&amp;quot; /&amp;gt;&lt;br /&gt;
               &amp;lt;/Section&amp;gt;&lt;br /&gt;
          &amp;lt;/Layer&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;SelectedEnabled&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;Layer&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;selection&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;label&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;ColourProperty name=&amp;quot;SelectedTextColour&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Section&amp;gt;&lt;br /&gt;
         &amp;lt;/Layer&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
     &amp;lt;StateImagery name=&amp;quot;SelectedDisabled&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;Layer&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;selection&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;Section section=&amp;quot;label&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;ColourProperty name=&amp;quot;SelectedTextColour&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/Section&amp;gt;&lt;br /&gt;
         &amp;lt;/Layer&amp;gt;&lt;br /&gt;
     &amp;lt;/StateImagery&amp;gt;&lt;br /&gt;
 &amp;lt;/WidgetLook&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pfew am I glad thats done. &lt;br /&gt;
&lt;br /&gt;
==Coding our item==&lt;br /&gt;
&lt;br /&gt;
We have come to the part where we actually try out our new item. We need to do a few things to call this one finished. First, we need to create the CheckListboxItem class. Then we are going to add the window factory to the system. Last but not least is adding the Falagard mapping. We'll start with the CheckListboxItem class.&lt;br /&gt;
&lt;br /&gt;
====CheckListItem.h====&lt;br /&gt;
 #ifndef _CHECKLISTITEM_&lt;br /&gt;
 #define _CHECKLISTITEM_&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;CEGUI.h&amp;gt;&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 namespace CEGUI&lt;br /&gt;
 {&lt;br /&gt;
     class CheckListboxItem : public ItemEntry&lt;br /&gt;
     {&lt;br /&gt;
     protected:&lt;br /&gt;
     public:&lt;br /&gt;
         CheckListboxItem(const String &amp;amp;type, const String &amp;amp;name);&lt;br /&gt;
         virtual ~CheckListboxItem();&lt;br /&gt;
         static const String WidgetTypeName;&lt;br /&gt;
    };&lt;br /&gt;
    CEGUI_DECLARE_WINDOW_FACTORY(CheckListboxItem)&lt;br /&gt;
 }&lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
As you can see, this class inherits ItemEntry. This is necessary as its THE thing that makes this item working properly. Pay special attention to &amp;lt;b&amp;gt;CEGUI_DECLARE_WINDOW_FACTORY(CheckListboxItem)&amp;lt;/b&amp;gt;. This tells CEGUI that we are declarating the window.&lt;br /&gt;
&lt;br /&gt;
====CheckListItem.cpp====&lt;br /&gt;
 #include &amp;quot;CheckListItem.h&amp;quot;&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 namespace CEGUI&lt;br /&gt;
 {&lt;br /&gt;
     CEGUI_DEFINE_WINDOW_FACTORY(CheckListboxItem)&lt;br /&gt;
     const String CheckListboxItem::WidgetTypeName(&amp;quot;CEGUI/CheckListboxItem&amp;quot;);&lt;br /&gt;
     CheckListboxItem::CheckListboxItem(const String &amp;amp;type, const String &amp;amp;name) :&lt;br /&gt;
             ItemEntry(type, name)&lt;br /&gt;
     {&lt;br /&gt;
     }&lt;br /&gt;
     CheckListboxItem::~CheckListboxItem()&lt;br /&gt;
     {&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;CEGUI_DEFINE_WINDOW_FACTORY(CheckListboxItem)&amp;lt;/b&amp;gt; is quite important here. It tells CEGUI where we are placing the code that comes with the window. As you can see this class is quite empty, you are, of course, free to add anything you like to this class - these are just the mere basics.&lt;br /&gt;
&lt;br /&gt;
Now, there is one more important thing to do. Register this window properly in CEGUI.&lt;br /&gt;
&lt;br /&gt;
 namespace CEGUI&lt;br /&gt;
 {&lt;br /&gt;
 void bindCEGUI()&lt;br /&gt;
 {&lt;br /&gt;
     CEGUI::WindowFactoryManager&amp;amp; wfMgr = CEGUI::WindowFactoryManager::getSingleton();&lt;br /&gt;
     wfMgr.addFactory(&amp;amp;CEGUI_WINDOW_FACTORY(CheckListboxItem));&lt;br /&gt;
     wfMgr.addFalagardWindowMapping(&amp;quot;WindowsLook/CheckListboxItem&amp;quot;, &amp;quot;CEGUI/ItemEntry&amp;quot;, &amp;quot;WindowsLook/CheckListboxItem&amp;quot;, &amp;quot;Falagard/ItemEntry&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
addFalagardWindowMappings parameters are as follows: Name, Type, LooknFeel, WindowRenderer. Just put this code somewhere in your main file or on another place that you are sure is executed before using our new item. Also note, in order to use &amp;lt;b&amp;gt;CEGUI_WINDOW_FACTORY()&amp;lt;/b&amp;gt; you need to be in the CEGUI namespace.&lt;br /&gt;
&lt;br /&gt;
'''Example'''&lt;br /&gt;
&lt;br /&gt;
====main.cpp====&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
 #include &amp;quot;SDLLoader.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;CheckListItem.h&amp;quot;&lt;br /&gt;
 void doStuff();&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 namespace CEGUI&lt;br /&gt;
 {&lt;br /&gt;
 void bindCEGUI()&lt;br /&gt;
 {&lt;br /&gt;
     CEGUI::WindowFactoryManager&amp;amp; wfMgr = CEGUI::WindowFactoryManager::getSingleton();&lt;br /&gt;
     wfMgr.addFactory(&amp;amp;CEGUI_WINDOW_FACTORY(CheckListboxItem));&lt;br /&gt;
     wfMgr.addFalagardWindowMapping(&amp;quot;WindowsLook/CheckListboxItem&amp;quot;, &amp;quot;CEGUI/ItemEntry&amp;quot;, &amp;quot;WindowsLook/CheckListboxItem&amp;quot;, &amp;quot;Falagard/ItemEntry&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 int main (int argc, char **argv) &lt;br /&gt;
 {&lt;br /&gt;
     SDLLoader sdl;&lt;br /&gt;
     sdl.init();&lt;br /&gt;
     CEGUI::bindCEGUI();&lt;br /&gt;
     doStuff();&lt;br /&gt;
     sdl.main_loop();&lt;br /&gt;
     return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &amp;lt;br&amp;gt;&lt;br /&gt;
 void doStuff()&lt;br /&gt;
 {&lt;br /&gt;
     CEGUI::System * m_System = CEGUI::System::getSingletonPtr();&lt;br /&gt;
     CEGUI::Logger::getSingletonPtr()-&amp;gt;setLoggingLevel(CEGUI::Insane);&lt;br /&gt;
     CEGUI::WindowManager * m_WndMgr = CEGUI::WindowManager::getSingletonPtr();&lt;br /&gt;
     CEGUI::Window * m_Root = m_System-&amp;gt;getGUISheet();&lt;br /&gt;
     &amp;lt;br&amp;gt;&lt;br /&gt;
     CEGUI::ItemListbox * lb = (CEGUI::ItemListbox*)m_WndMgr-&amp;gt;createWindow(&amp;quot;WindowsLook/ItemListbox&amp;quot;, &amp;quot;Lol&amp;quot;);&lt;br /&gt;
     lb-&amp;gt;setSize(CEGUI::UVector2(CEGUI::UDim(0.3f, 0.0f), CEGUI::UDim(0.3f, 0.0f)));&lt;br /&gt;
     lb-&amp;gt;setPosition(CEGUI::UVector2(CEGUI::UDim(0.1f, 0.0f), CEGUI::UDim(0.1f, 0.0f)));&lt;br /&gt;
     m_Root-&amp;gt;addChildWindow(lb);&lt;br /&gt;
     &amp;lt;br&amp;gt;&lt;br /&gt;
     CEGUI::CheckListboxItem * check = (CEGUI::CheckListboxItem*)m_WndMgr-&amp;gt;createWindow(&amp;quot;WindowsLook/CheckListboxItem&amp;quot;, &amp;quot;Test&amp;quot;);&lt;br /&gt;
     check-&amp;gt;setText(&amp;quot;Test&amp;quot;);&lt;br /&gt;
     lb-&amp;gt;addChildWindow(check);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
As you can see in the main function, the function that registers the window is called before actually creating it. Dont pay any attention to the sdl initiation - it's just my personal test environment.&lt;br /&gt;
&lt;br /&gt;
Congratulations! You have just created a CheckListboxItem. This was a very good practice because you also learned the technique required to write a completely new widget.&lt;br /&gt;
&lt;br /&gt;
Please contact me if you have any question, comments, feedback - anything, email me at [mailto:levia@openfrag.org levia at openfrag dot com].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[User:Levia|Levia]] 21:10, 5 April 2007 (GMT+1)&lt;/div&gt;</summary>
		<author><name>Tss</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=Identifying_Multiple_Event_Sources_From_A_Single_Callback&amp;diff=3665</id>
		<title>Identifying Multiple Event Sources From A Single Callback</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=Identifying_Multiple_Event_Sources_From_A_Single_Callback&amp;diff=3665"/>
				<updated>2011-02-26T12:09:48Z</updated>
		
		<summary type="html">&lt;p&gt;Tss: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[category: Tutorials]]&lt;br /&gt;
&lt;br /&gt;
Sometimes you would like to identify the sender of an event from within your callback function.  For example, you would like to execute some common code for your buttons, like triggering a sound to be played on CEGUI::PushButton::EventClicked.  Here is an example [http://www.cegui.org.uk/api_reference/classCEGUI_1_1PushButton.html CEGUI::PushButton] we would like to wire up:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
CEGUI::PushButton* pushButton = &lt;br /&gt;
  static_cast&amp;lt;CEGUI::PushButton*&amp;gt;&lt;br /&gt;
    (CEGUI::WindowManager::getSingleton().createWindow(&amp;quot;WindowsLook/Button&amp;quot;, &amp;quot;TheButton&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
pushButton-&amp;gt;subscribeEvent(CEGUI::PushButton::EventClicked,&lt;br /&gt;
                           CEGUI::Event::Subscriber(&amp;amp;MainMenu::OnButtonClick, this));&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To do this, simply cast the [http://www.cegui.org.uk/api_reference/classCEGUI_1_1EventArgs.html CEGUI::EventArgs] in your callback to a [http://www.cegui.org.uk/api_reference/classCEGUI_1_1WindowEventArgs.html CEGUI::WindowEventArgs]. The CEGUI::WindowEventArgs object contains a pointer to the [http://www.cegui.org.uk/api_reference/classCEGUI_1_1Window.html CEGUI::Window] that sent the event.  Now its as easy as calling CEGUI::Window::getName().  Obviously, you can do much more now that you have a pointer to the window who fired the event, but this is just an example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
bool MainMenu::OnButtonClick(const CEGUI::EventArgs&amp;amp; e)&lt;br /&gt;
{&lt;br /&gt;
  const CEGUI::MouseEventArgs&amp;amp; we = &lt;br /&gt;
    static_cast&amp;lt;const CEGUI::MouseEventArgs&amp;amp;&amp;gt;(e);&lt;br /&gt;
&lt;br /&gt;
  CEGUI::String senderID = we.window-&amp;gt;getName();&lt;br /&gt;
&lt;br /&gt;
  if (senderID == &amp;quot;TheButton&amp;quot;)&lt;br /&gt;
  {&lt;br /&gt;
    // code for dealing with a &amp;quot;TheButton&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  return true;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tss</name></author>	</entry>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=Cool_window_effects&amp;diff=3664</id>
		<title>Cool window effects</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=Cool_window_effects&amp;diff=3664"/>
				<updated>2011-02-26T12:09:30Z</updated>
		
		<summary type="html">&lt;p&gt;Tss: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[category: Tutorials]]&lt;br /&gt;
&lt;br /&gt;
= Inactive windows become transparent =&lt;br /&gt;
'''WARNING ! As for now (02.07.2007), this code does make all your tooltips transparent, I'm working on a solution.'''&lt;br /&gt;
&lt;br /&gt;
'''Problem solved (02.07.2007). If you used the old code, please replace by the new.'''&lt;br /&gt;
&lt;br /&gt;
Please discuss this snippet within the [[http://www.cegui.org.uk/phpBB2/viewtopic.php?p=11786 cool window effects - Inactive windows become trans.]] thread. &lt;br /&gt;
&lt;br /&gt;
Do you know about the [http://vizzzion.org/images/blog/composite.png cool effects that the composite extension can create] on linux ? There are many. I wanted to implement one into my game: make the [http://img337.imageshack.us/img337/9398/windowtransparencyue1.png inactive windows become transparent] and only the active one be 100% opaque. (see the links in this sentence for screenshots.) This effect can be interesting if you want your users to concentrate 100% on the active window and the inactive ones aren't important at this moment. But what if the user has to see two windows or more at the same time (and with full opacity) ? We'll see how to handle this.&lt;br /&gt;
&lt;br /&gt;
== The theory ==&lt;br /&gt;
There is more then one way to achieve this, but I'll only present the one I chose. CEGUI has something that is called global events. These are events that are fired independently on the widget they apply to. I'll try with an example: sometimes you need to know when a button is clicked, no matter what button it is, you want to know it for EVERY button. This is what global events are for.&lt;br /&gt;
&lt;br /&gt;
We'll subscribe to two global events: &amp;quot;a window gets activated&amp;quot; and &amp;quot;a window gets closed&amp;quot;. When a window gets activated, we add it to a stack which we use to keep track of the windows and the order they where activated. We also make the last active window become transparent. When a window gets closed, we remove it from the stack and activate the one that is on the top of the stack now. (that is the window that was active just before the one we just closed.)&lt;br /&gt;
&lt;br /&gt;
We keep the root window away from it, that means we never make the root window transparent, because this would make the tooltips become transparent. You need to have an empty root window that is a container for your other windows.&lt;br /&gt;
&lt;br /&gt;
== The praxis (code) ==&lt;br /&gt;
Now let's go ! First, we need to register callback functions to the two global events:&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;&lt;br /&gt;
CEGUI::GlobalEventSet::getSingleton( ).subscribeEvent( CEGUI::Window::EventNamespace + &amp;quot;/&amp;quot; + CEGUI::Window::EventActivated,&lt;br /&gt;
                                                       CEGUI::Event::Subscriber(&amp;amp;onWindowActivated) );&lt;br /&gt;
CEGUI::GlobalEventSet::getSingleton( ).subscribeEvent( CEGUI::Window::EventNamespace + &amp;quot;/&amp;quot; + CEGUI::Window::EventDestructionStarted,&lt;br /&gt;
                                                       CEGUI::Event::Subscriber(&amp;amp;onWindowClosed) );&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also need a stack to keep track of the windows. I chose to use the std::list type instead of the std::stack, because we need to be able to either delete all references of one element or to search the stack. So here it is:&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;std::list&amp;lt;CEGUI::Window *&amp;gt; pWinHistory;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also, don't forget to put your root window just before setting it as the root window:&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;pWinHistory.push_back(pMyRootWindow);&lt;br /&gt;
CEGUI::System::getSingleton().setGUISheet(pMyRootWindow);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One thing you need to know about the root window is that you need an empty root window, containing one or more child windows that contain all GUI items. Your root window will never become transparent, thus you need an empty &amp;quot;container&amp;quot; root window.&lt;br /&gt;
&lt;br /&gt;
And now we implement our two callback functions. I excessively commented the functions.&lt;br /&gt;
&lt;br /&gt;
onWindowActivated:&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;/// Called everytime a window gets activated.&lt;br /&gt;
/** This function is called by CEGUI every time that a window gets the focus.&lt;br /&gt;
 *&lt;br /&gt;
 *  Currently, we use this function to keep track of the order that windows where&lt;br /&gt;
 *  active, so when closing a window we can activate the last one, as this isn't&lt;br /&gt;
 *  done automatically by CEGUI.&lt;br /&gt;
 *&lt;br /&gt;
 * \param e The event arguments.&lt;br /&gt;
 *&lt;br /&gt;
 * \return Always true.&lt;br /&gt;
 *&lt;br /&gt;
 * \author Pompei2&lt;br /&gt;
 */&lt;br /&gt;
bool onWindowActivated( const CEGUI::EventArgs &amp;amp;ea )&lt;br /&gt;
{&lt;br /&gt;
	try {&lt;br /&gt;
		const CEGUI::WindowEventArgs&amp;amp; we = static_cast&amp;lt;const CEGUI::WindowEventArgs&amp;amp;&amp;gt;(ea);&lt;br /&gt;
		CEGUI::Window *pLastWin = pWinHistory.back( );&lt;br /&gt;
&lt;br /&gt;
		// We only work with FrameWindows.&lt;br /&gt;
		if( !we.window-&amp;gt;testClassName( CEGUI::FrameWindow::EventNamespace ) )&lt;br /&gt;
			return true;&lt;br /&gt;
&lt;br /&gt;
		// If it is the same window as before, ignore it.&lt;br /&gt;
		if( pLastWin == we.window )&lt;br /&gt;
			return true;&lt;br /&gt;
&lt;br /&gt;
		if( pLastWin != CEGUI::System::getSingleton().getGUISheet() ) {&lt;br /&gt;
			// If every time a window gets activated we make the last active window become&lt;br /&gt;
			// transparent, this will result in all inactive windows being transparent.&lt;br /&gt;
			pLastWin-&amp;gt;setProperty( &amp;quot;Alpha&amp;quot;, &amp;quot;0.25&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
			// But we never make the root window transparent, as this would make all tooltips&lt;br /&gt;
			// become transparent, and we don't want this !&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// We need the active window to not inherit the transparence of its parents.&lt;br /&gt;
		we.window-&amp;gt;setProperty( &amp;quot;InheritsAlpha&amp;quot;, &amp;quot;false&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
		// Finally, we add the new window to the stack.&lt;br /&gt;
&lt;br /&gt;
		// One could also check if it's already present in the stack and if yes, just put it on the top.&lt;br /&gt;
		// You would have to do this if you want to set the transparency depending on the window's position&lt;br /&gt;
		// in the stack (see &amp;quot;Extending the effect&amp;quot;).&lt;br /&gt;
		pWinHistory.push_back( we.window );&lt;br /&gt;
 	} catch( CEGUI::Exception&amp;amp; e ) {&lt;br /&gt;
		fprintf( stderr, &amp;quot;CEGUI error: %s\n&amp;quot;, e.getMessage( ).c_str( ) );&lt;br /&gt;
		return true;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	return true;&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And onWindowClosed:&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;cpp/&amp;gt;/// Called everytime a window gets closed.&lt;br /&gt;
/** This function is called by CEGUI just before a window gets closed.&lt;br /&gt;
 *&lt;br /&gt;
 *  Currently, we use this function to activate the previous window&lt;br /&gt;
 *  when closing this one, as it's not done automatically by CEGUI.&lt;br /&gt;
 *&lt;br /&gt;
 * \param e The event arguments.&lt;br /&gt;
 *&lt;br /&gt;
 * \return Always true.&lt;br /&gt;
 *&lt;br /&gt;
 * \author Pompei2&lt;br /&gt;
 */&lt;br /&gt;
bool onWindowClosed( const CEGUI::EventArgs &amp;amp;ea )&lt;br /&gt;
{&lt;br /&gt;
	try {&lt;br /&gt;
		const CEGUI::WindowEventArgs&amp;amp; we = static_cast&amp;lt;const CEGUI::WindowEventArgs&amp;amp;&amp;gt;(ea);&lt;br /&gt;
		CEGUI::Window *pLastWin = NULL;&lt;br /&gt;
&lt;br /&gt;
		// We only work with FrameWindows.&lt;br /&gt;
		if( !we.window-&amp;gt;testClassName( CEGUI::FrameWindow::EventNamespace ) )&lt;br /&gt;
			return true;&lt;br /&gt;
&lt;br /&gt;
		// Delete the current window from the stack.&lt;br /&gt;
		// CARE: std::list::remove removes ALL occurences of we.window from the stack !&lt;br /&gt;
		// This is VERY important to know, as if you activate window A, then window B and then A again,&lt;br /&gt;
		// the stack will contain A twice: {A,B,A}.&lt;br /&gt;
		pWinHistory.remove( we.window );&lt;br /&gt;
&lt;br /&gt;
		// Now we get the window that was active before the current one:&lt;br /&gt;
		pLastWin = m_pWinHistory.back( );&lt;br /&gt;
&lt;br /&gt;
		// re-activate it (like windos, linux, .. all do).&lt;br /&gt;
		pLastWin-&amp;gt;activate( );&lt;br /&gt;
&lt;br /&gt;
		// And set it to be opaque again.&lt;br /&gt;
		// You could either do this here or you do this in the onWindowActivate function, the result is the same,&lt;br /&gt;
		// as the call to CEGUI::Window::activate above results in onWindowActivate to be called.&lt;br /&gt;
		pLastWin-&amp;gt;setProperty( &amp;quot;Alpha&amp;quot;, &amp;quot;1.0&amp;quot; );&lt;br /&gt;
	} catch( CEGUI::Exception&amp;amp; e ) {&lt;br /&gt;
		fprintf( stderr, &amp;quot;CEGUI error: %s\n&amp;quot;, e.getMessage( ).c_str( ) );&lt;br /&gt;
		return true;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	return true;&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's all.&lt;br /&gt;
&lt;br /&gt;
One important thing you might not know yet, is that CEGUI DOESN'T activate a window that gets shown. you have to manually activate a window when you create it (and want it to be active, of course).&lt;br /&gt;
&lt;br /&gt;
== Extending the effect ==&lt;br /&gt;
* You could also automatically activate a window as soon as it's shown. for this you could subscribe to the &amp;quot;a window gets shown&amp;quot; global event and then just call ea.window-&amp;gt;activate( );&lt;br /&gt;
Edit: Hmm I tried this one but wasn't able to get it to work. If someone has success, please tell us how you did it in the forums.&lt;br /&gt;
&lt;br /&gt;
* You could try to make the window's transparency degree dependent on its position in the stack. That means the most recent windows get less transparent while the &amp;quot;oldest&amp;quot; windows get very transparent. To do this, just loop trough the stack - that would be a list - and set every window's transparency accordingly. Do this when a window gets active AND when a window gets closed. You would also need to never have the same window twice in the stack, as it would screw your results up.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[User:Pompei2|Pompei2]] 06:00, 6 May 2007 (PDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
----&lt;br /&gt;
you can add more cool effects here.&lt;/div&gt;</summary>
		<author><name>Tss</name></author>	</entry>

	</feed>