cee::vis::OverlayTextBox Class Reference

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

Public Types

enum  TextBoxContentAlignment { LEFT, CENTER, RIGHT }
 Alignment of text content within a text box. More...
 
- Public Types inherited from cee::vis::OverlayItem
enum  LayoutCorner {
  TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT,
  CENTER, TOP_CENTER, BOTTOM_CENTER
}
 Enumerator for the different locations/"corners" of the view. More...
 
enum  LayoutDirection { HORIZONTAL, VERTICAL, ABSOLUTE_POSITION }
 Enumerator for horizontal or vertical orientation of layout items. Describes which direction additional items should be positioned if more than one exists in the same corner. More...
 

Public Member Functions

 OverlayTextBox (Font *font)
 Constructs an overlay text box. More...
 
virtual unsigned int width () const
 Returns the width of the text box in pixels. More...
 
virtual unsigned int height () const
 Returns the height of the text box in pixels. More...
 
void setSize (unsigned int width, unsigned int height)
 Sets the size of the text box, in pixels. More...
 
virtual int priority () const
 Returns the render priority of the item. More...
 
virtual void setPriority (int priority)
 Sets render priority of the item. More...
 
void setSizeToFitText ()
 Sets the size of the text box to fit the current text. More...
 
void setFont (Font *font)
 Sets the font to use in the text box. More...
 
Str text () const
 Returns the text currently displayed in the text box. More...
 
void setText (const Str &text)
 Sets the text to show in the text box. More...
 
Color3f textColor () const
 Returns the color of the text in the text box. More...
 
void setTextColor (const Color3f &color)
 Sets the color of the text in the text box. More...
 
Color3f backgroundColor () const
 Returns the background color of the text box. More...
 
void setBackgroundColor (const Color3f &color)
 Sets the color of the background of the text box. More...
 
float backgroundOpacity () const
 Returns the opacity of the background. 1.0 = opaque, 0.0 = fully transparent. More...
 
void setBackgroundOpacity (float opacity)
 Sets the opacity (transparency) of the background of the text box. 1.0 = opaque, 0.0 = fully transparent. More...
 
Color3f borderColor () const
 Returns the border color of the text box. More...
 
void setBorderColor (const Color3f &color)
 Sets the color of the border of the text box. More...
 
float borderWidth () const
 Returns the width of the border around the text box in pixels. More...
 
void setBorderWidth (float width)
 Sets the width in pixels of the border around the text box. More...
 
bool drawBackground () const
 Returns true if the background is drawn. More...
 
void setDrawBackground (bool drawBackground)
 Specifies if the background should be drawn or not. More...
 
bool drawBorder () const
 Returns true if the border is drawn. More...
 
void setDrawBorder (bool drawBorder)
 Specifies if the border should be drawn or not. More...
 
TextBoxContentAlignment textContentAlignment () const
 Returns alignment of text content in text box. More...
 
void setTextContentAlignment (TextBoxContentAlignment alignment)
 Sets alignment of text content in text box. More...
 
- Public Member Functions inherited from cee::vis::OverlayItem
bool visible () const
 Returns true if the overlay item is set to be visible. More...
 
void setVisible (bool visible)
 Sets if the overlay item should be visible or not. More...
 
int absolutePositionX () const
 Returns the x coordinate of the absolute position to use for the OverlayItem if LayoutDirection is specified as ABSOLUTE_POSITION. More...
 
int absolutePositionY () const
 Returns the y coordinate of the absolute position to use for the OverlayItem if LayoutDirection is specified as ABSOLUTE_POSITION. More...
 
void setAbsolutePosition (int x, int y)
 Sets the absolute position of the bottom left corner of the OverlayItem as an offset from the LayoutCorner of the item. More...
 
- Public Member Functions inherited from cee::RefCountedObject
void addRef () const
 Increments the reference count for this object. More...
 
void release () const
 Decrements the reference count for this object. More...
 
int refCount () const
 Returns the reference count for this object. More...
 
void setRefCountZero () const
 Sets the ref count to zero, but DOES NOT delete the object. More...
 
Inheritance diagram for cee::vis::OverlayTextBox:
cee::vis::OverlayItem cee::RefCountedObject

Detailed Description

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

Member Enumeration Documentation

Alignment of text content within a text box.

Enumerator
LEFT 

Align left.

CENTER 

Align center.

RIGHT 

Align right.

Constructor & Destructor Documentation

cee::vis::OverlayTextBox::OverlayTextBox ( Font font)

Constructs an overlay text box.

Member Function Documentation

cee::Color3f cee::vis::OverlayTextBox::backgroundColor ( ) const

Returns the background color of the text box.

float cee::vis::OverlayTextBox::backgroundOpacity ( ) const

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

cee::Color3f cee::vis::OverlayTextBox::borderColor ( ) const

Returns the border color of the text box.

float cee::vis::OverlayTextBox::borderWidth ( ) const

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

bool cee::vis::OverlayTextBox::drawBackground ( ) const

Returns true if the background is drawn.

bool cee::vis::OverlayTextBox::drawBorder ( ) const

Returns true if the border is drawn.

unsigned int cee::vis::OverlayTextBox::height ( ) const
virtual

Returns the height of the text box in pixels.

Implements cee::vis::OverlayItem.

int cee::vis::OverlayTextBox::priority ( ) const
virtual

Returns the render priority of the item.

Implements cee::vis::OverlayItem.

void cee::vis::OverlayTextBox::setBackgroundColor ( const Color3f color)

Sets the color of the background of the text box.

void cee::vis::OverlayTextBox::setBackgroundOpacity ( float  opacity)

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

void cee::vis::OverlayTextBox::setBorderColor ( const Color3f color)

Sets the color of the border of the text box.

void cee::vis::OverlayTextBox::setBorderWidth ( float  width)

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

void cee::vis::OverlayTextBox::setDrawBackground ( bool  drawBackground)

Specifies if the background should be drawn or not.

void cee::vis::OverlayTextBox::setDrawBorder ( bool  drawBorder)

Specifies if the border should be drawn or not.

void cee::vis::OverlayTextBox::setFont ( Font font)

Sets the font to use in the text box.

void cee::vis::OverlayTextBox::setPriority ( int  priority)
virtual

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.

Implements cee::vis::OverlayItem.

void cee::vis::OverlayTextBox::setSize ( unsigned int  width,
unsigned int  height 
)
virtual

Sets the size of the text box, in pixels.

Implements cee::vis::OverlayItem.

void cee::vis::OverlayTextBox::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 cee::vis::OverlayTextBox::setText ( const Str text)

Sets the text to show in the text box.

void cee::vis::OverlayTextBox::setTextColor ( const Color3f color)

Sets the color of the text in the text box.

void cee::vis::OverlayTextBox::setTextContentAlignment ( TextBoxContentAlignment  alignment)

Sets alignment of text content in text box.

Str cee::vis::OverlayTextBox::text ( ) const

Returns the text currently displayed in the text box.

cee::Color3f cee::vis::OverlayTextBox::textColor ( ) const

Returns the color of the text in the text box.

OverlayTextBox::TextBoxContentAlignment cee::vis::OverlayTextBox::textContentAlignment ( ) const

Returns alignment of text content in text box.

unsigned int cee::vis::OverlayTextBox::width ( ) const
virtual

Returns the width of the text box in pixels.

Implements cee::vis::OverlayItem.