From 2872eb224e9f3ec6947542f2d7ac0ad288574cf1 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Tue, 17 May 2011 15:48:23 +0200 Subject: Added a console-like window which doesn't do anything interesting yet. --- widgets/FormattedListboxTextItem.h | 54 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 widgets/FormattedListboxTextItem.h (limited to 'widgets/FormattedListboxTextItem.h') diff --git a/widgets/FormattedListboxTextItem.h b/widgets/FormattedListboxTextItem.h new file mode 100644 index 0000000..efe5ff2 --- /dev/null +++ b/widgets/FormattedListboxTextItem.h @@ -0,0 +1,54 @@ +#ifndef FORMATTEDLISTBOXTEXTITEM_H +#define FORMATTEDLISTBOXTEXTITEM_H + +// TODO: Remove temporary workaround for CEGUI + GCC 4.6 +#include + +#include "CEGUI.h" + +namespace CEGUI +{ +//! A ListboxItem based class that can do horizontal text formatiing. +class FormattedListboxTextItem : public ListboxTextItem +{ +public: + //! Constructor + FormattedListboxTextItem(const String& text, + const HorizontalTextFormatting format = HTF_LEFT_ALIGNED, + const uint item_id = 0, + void* const item_data = 0, + const bool disabled = false, + const bool auto_delete = true); + + //! Destructor. + ~FormattedListboxTextItem(); + + //! Return the current formatting set. + HorizontalTextFormatting getFormatting() const; + /*! + Set the formatting. You should call Listbox::handleUpdatedItemData + after setting the formatting in order to update the listbox. We do not + do it automatically since you may wish to batch changes to multiple + items and multiple calls to handleUpdatedItemData is wasteful. + */ + void setFormatting(const HorizontalTextFormatting fmt); + + // overriden functions. + Size getPixelSize(void) const; + void draw(GeometryBuffer& buffer, const Rect& targetRect, + float alpha, const Rect* clipper) const; + +protected: + //! Helper to create a FormattedRenderedString of an appropriate type. + void setupStringFormatter() const; + //! Current formatting set + HorizontalTextFormatting d_formatting; + //! Class that renders RenderedString with some formatting. + mutable FormattedRenderedString* d_formattedRenderedString; + //! Tracks target area for rendering so we can reformat when needed + mutable Size d_formattingAreaSize; +}; + +} + +#endif -- cgit v1.2.3