blob: efe5ff2ab56fbb0ca3e53f879f655861ff9b7a5f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#ifndef FORMATTEDLISTBOXTEXTITEM_H
#define FORMATTEDLISTBOXTEXTITEM_H
// TODO: Remove temporary workaround for CEGUI + GCC 4.6
#include <cstddef>
#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
|