cee::vis::OverlayTextBox

class OverlayTextBox : public OverlayItem

A view overlay item capable of showing a text with optional border and background.

The overlay item can be added to a view using the View::overlay() and Overlay::addItem(). The view manages the layout of the overlay items, so only a desired size can be given in this class. The position is specified when the overlay item is added to the view.

An overlay item can be shown in multiple views at the same time.

See also

OverlayItem, Overlay, View

Public Types

enum TextBoxContentAlignment

Alignment of text content within a text box.

Values:

enumerator LEFT

Align left.

enumerator CENTER

Align center.

enumerator RIGHT

Align right.

Public Functions

OverlayTextBox(Font *font)

Constructs an overlay text box.

virtual unsigned int width() const

Returns the width of the text box in pixels.

virtual unsigned int height() const

Returns the height of the text box in pixels.

virtual void setSize(unsigned int width, unsigned int height)

Sets the size of the text box, in pixels.

virtual int priority() const

Returns the render priority of the item.

virtual void setPriority(int priority)

Sets render priority of the item.

The render priority determines the order in which item get rendered. Items with lower priorities get rendered first. The default priority is 12.

void setSizeToFitText()

Sets the size of the text box to fit the current text.

The method will also add a bit of space for the border or background if enabled.

void setFont(Font *font)

Sets the font to use in the text box.

Str text() const

Returns the text currently displayed in the text box.

void setText(const Str &text)

Sets the text to show in the text box.

Color3f textColor() const

Returns the color of the text in the text box.

void setTextColor(const Color3f &color)

Sets the color of the text in the text box.

Color3f backgroundColor() const

Returns the background color of the text box.

void setBackgroundColor(const Color3f &color)

Sets the color of the background of the text box.

float backgroundOpacity() const

Returns the opacity of the background. 1.0 = opaque, 0.0 = fully transparent.

void setBackgroundOpacity(float opacity)

Sets the opacity (transparency) of the background of the text box. 1.0 = opaque, 0.0 = fully transparent.

Color3f borderColor() const

Returns the border color of the text box.

void setBorderColor(const Color3f &color)

Sets the color of the border of the text box.

float borderWidth() const

Returns the width of the border around the text box in pixels.

void setBorderWidth(float width)

Sets the width in pixels of the border around the text box.

bool drawBackground() const

Returns true if the background is drawn.

void setDrawBackground(bool drawBackground)

Specifies if the background should be drawn or not.

bool drawBorder() const

Returns true if the border is drawn.

void setDrawBorder(bool drawBorder)

Specifies if the border should be drawn or not.

TextBoxContentAlignment textContentAlignment() const

Returns alignment of text content in text box.

void setTextContentAlignment(TextBoxContentAlignment alignment)

Sets alignment of text content in text box.