TGUI  v0.5.2
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Public Member Functions | List of all members
tgui::ChatBox Struct Reference
Inheritance diagram for tgui::ChatBox:
tgui::OBJECT tgui::OBJECT_BORDERS

Public Member Functions

 ChatBox ()
 Default constructor. More...
 
 ChatBox (const ChatBox &copy)
 Copy constructor. More...
 
virtual ~ChatBox ()
 Desturctor. More...
 
ChatBoxoperator= (const ChatBox &right)
 Overload of assignment operator. More...
 
virtual bool load (float width, float height, unsigned int textSize, const std::string &scrollbarPathname="")
 Creates the chat box. More...
 
virtual void setSize (float width, float height)
 Changes the size of the chat box. More...
 
virtual Vector2u getSize () const
 Returns the size of the chat box, unaffected by scaling. More...
 
virtual Vector2f getScaledSize () const
 Returns the size of the chat box, after the scaling tranformation. More...
 
virtual std::string getLoadedScrollbarPathname () const
 Returns the pathname that was used to load the scrollbar. More...
 
virtual void addLine (const sf::String &text, const sf::Color &color=sf::Color::Black)
 Add a new line of text to the chat box. More...
 
virtual void setTextFont (const sf::Font &font)
 Changes the font of the text. More...
 
virtual const sf::Font * getTextFont () const
 Returns the font of the text. More...
 
virtual void setTextSize (unsigned int size)
 Changes the character size of the text. More...
 
virtual unsigned int getTextSize () const
 Returns the character size of the text. More...
 
virtual void setBorders (unsigned int leftBorder=0, unsigned int topBorder=0, unsigned int rightBorder=0, unsigned int bottomBorder=0)
 Changes the border width and border height of the chat box. More...
 
virtual void setBackgroundColor (const sf::Color &backgroundColor)
 Set the background color that will be used inside the chat box. More...
 
virtual void setBorderColor (const sf::Color &borderColor)
 Set the border color that will be used inside the chat box. More...
 
virtual const sf::Color & getBackgroundColor () const
 Get the background color that is currently being used inside the chat box. More...
 
virtual const sf::Color & getBorderColor () const
 Get the border color that is currently being used inside the chat box. More...
 
virtual bool setScrollbar (const std::string &scrollbarPathname)
 Changes the scrollbar of the chat box. More...
 
virtual void removeScrollbar ()
 Removes the scrollbar from the chat box (if there is one). More...
 
- Public Member Functions inherited from tgui::OBJECT
 OBJECT ()
 Default constructor. More...
 
 OBJECT (const OBJECT &copy)
 Copy constructor. More...
 
virtual ~OBJECT ()
 Destructor. More...
 
OBJECToperator= (const OBJECT &right)
 Overload of assignment operator. More...
 
virtual void show ()
 Shows the object. More...
 
virtual void hide ()
 Hides the object. More...
 
virtual bool isVisible () const
 Returns true when the object is visible. More...
 
virtual void enable ()
 Enables the object. More...
 
virtual void disable ()
 Disables the object. More...
 
virtual bool isEnabled () const
 Returns true when the object is enabled. More...
 
virtual bool isDisabled () const
 Returns true when the object is disabled. More...
 
virtual bool isLoaded () const
 Returns true when the object is loaded successfully. More...
 
void focus ()
 Focus the object. More...
 
void unfocus ()
 Unfocus the object. More...
 
void focusNextObject ()
 Focuses the next object. More...
 
virtual bool isFocused () const
 Returns true when the object is focused and false otherwise. More...
 
virtual ObjectTypes getObjectType () const
 Returns the type of the object. More...
 
virtual void moveToFront ()
 Places the object before all other objects. More...
 
virtual void moveToBack ()
 Places the object behind all other objects. More...
 
- Public Member Functions inherited from tgui::OBJECT_BORDERS
 OBJECT_BORDERS ()
 Default constructor. More...
 
virtual Vector4u getBorders () const
 Returns the size of the borders as a tgui::Vector4u. More...
 

Constructor & Destructor Documentation

tgui::ChatBox::ChatBox ( )

Default constructor.

tgui::ChatBox::ChatBox ( const ChatBox copy)

Copy constructor.

Parameters
copyInstance to copy
virtual tgui::ChatBox::~ChatBox ( )
virtual

Desturctor.

Member Function Documentation

virtual void tgui::ChatBox::addLine ( const sf::String &  text,
const sf::Color &  color = sf::Color::Black 
)
virtual

Add a new line of text to the chat box.

Parameters
textText that will be added to the chat box
colorColor of the text
virtual const sf::Color& tgui::ChatBox::getBackgroundColor ( ) const
virtual

Get the background color that is currently being used inside the chat box.

Returns
The color of the background of the chat box
virtual const sf::Color& tgui::ChatBox::getBorderColor ( ) const
virtual

Get the border color that is currently being used inside the chat box.

Returns
The color of the borders
virtual std::string tgui::ChatBox::getLoadedScrollbarPathname ( ) const
virtual

Returns the pathname that was used to load the scrollbar.

Returns
Pathname used to load the scrollbar. When no scrollbar was loaded then this function will return an empty string.
virtual Vector2f tgui::ChatBox::getScaledSize ( ) const
virtual

Returns the size of the chat box, after the scaling tranformation.

Returns
Size of the chat box

Implements tgui::OBJECT.

virtual Vector2u tgui::ChatBox::getSize ( ) const
virtual

Returns the size of the chat box, unaffected by scaling.

Returns
Size of the chat box

Implements tgui::OBJECT.

virtual const sf::Font* tgui::ChatBox::getTextFont ( ) const
virtual

Returns the font of the text.

Returns
Pointer to the font that is currently being used
virtual unsigned int tgui::ChatBox::getTextSize ( ) const
virtual

Returns the character size of the text.

Returns
The current text size.
virtual bool tgui::ChatBox::load ( float  width,
float  height,
unsigned int  textSize,
const std::string &  scrollbarPathname = "" 
)
virtual

Creates the chat box.

The chat box may resize a little bit. It might be a little bit bigger or smaller than the size passed to this function.

Parameters
widthThe width of the chat box (borders included).
heightThe height of the chat box (borders included).
textSizeThe size of the text.
scrollbarPathnameThe pathname needed to load the vertical scrollbar. If not provided then there will be no possibility to scroll, thus no text can be added when the box is full.
Returns
  • true on success
  • false when scrollbar couldn't be loaded (only if scrollbarPathname isn't empty)
ChatBox& tgui::ChatBox::operator= ( const ChatBox right)

Overload of assignment operator.

Parameters
rightInstance to assign
Returns
Reference to itself
virtual void tgui::ChatBox::removeScrollbar ( )
virtual

Removes the scrollbar from the chat box (if there is one).

When there are too many lines to fit in the chat box then some lines will be removed.

virtual void tgui::ChatBox::setBackgroundColor ( const sf::Color &  backgroundColor)
virtual

Set the background color that will be used inside the chat box.

Parameters
backgroundColorThe new background color.
virtual void tgui::ChatBox::setBorderColor ( const sf::Color &  borderColor)
virtual

Set the border color that will be used inside the chat box.

Parameters
borderColorThe color of the borders
virtual void tgui::ChatBox::setBorders ( unsigned int  leftBorder = 0,
unsigned int  topBorder = 0,
unsigned int  rightBorder = 0,
unsigned int  bottomBorder = 0 
)
virtual

Changes the border width and border height of the chat box.

Parameters
leftBorderThe width of the left border
topBorderThe height of the top border
rightBorderThe width of the right border
bottomBorderThe height of the bottom border

Implements tgui::OBJECT_BORDERS.

virtual bool tgui::ChatBox::setScrollbar ( const std::string &  scrollbarPathname)
virtual

Changes the scrollbar of the chat box.

Parameters
scrollbarPathnameThe pathname needed to load the scrollbar
Returns
  • true when the scrollbar was successfully loaded
  • false when the loading of the scrollbar failed
virtual void tgui::ChatBox::setSize ( float  width,
float  height 
)
virtual

Changes the size of the chat box.

Parameters
widthThe new width of the chat box
heightThe new height of the chat box

Implements tgui::OBJECT.

virtual void tgui::ChatBox::setTextFont ( const sf::Font &  font)
virtual

Changes the font of the text.

When you don't call this function then the global font will be use. This global font can be changed with the setGlobalFont function from the parent.

Parameters
fontThe new font
virtual void tgui::ChatBox::setTextSize ( unsigned int  size)
virtual

Changes the character size of the text.

Parameters
sizeThe new text size. The minimum text size is 8.

The documentation for this struct was generated from the following file: