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

Public Member Functions

 TextBox ()
 Default constructor. More...
 
 TextBox (const TextBox &copy)
 Copy constructor. More...
 
virtual ~TextBox ()
 Desturctor. More...
 
TextBoxoperator= (const TextBox &right)
 Overload of assignment operator. More...
 
virtual bool load (unsigned int width, unsigned int height, unsigned int textSize, const std::string &scrollbarPathname="")
 Creates the text box. More...
 
virtual void setSize (float width, float height)
 Changes the size of the text box. More...
 
virtual Vector2u getSize () const
 Returns the size of the text box, unaffected by scaling. More...
 
virtual Vector2f getScaledSize () const
 Returns the size of the text box, after the scaling transformation. More...
 
virtual std::string getLoadedScrollbarPathname () const
 Returns the pathname that was used to load the scrollbar. More...
 
virtual void setText (const sf::String &text)
 Changes the text of the text box. More...
 
virtual void addText (const sf::String &text)
 Appends some text to the text that was already in the text box. More...
 
virtual sf::String getText () const
 Returns the text of the text 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. The minimum text size is 8. More...
 
virtual unsigned int getTextSize () const
 Returns the character size of the text. More...
 
virtual void setMaximumCharacters (unsigned int maxChars=0)
 Changes the maximum character limit. More...
 
virtual unsigned int getMaximumCharacters () const
 Returns the maximum character limit. 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 text box. More...
 
virtual void changeColors (const sf::Color &backgroundColor=sf::Color(50, 50, 50), const sf::Color &textColor=sf::Color(0, 0, 0), const sf::Color &selectedTextColor=sf::Color(255, 255, 255), const sf::Color &selectedTextBackgroundColor=sf::Color(10, 110, 255), const sf::Color &borderColor=sf::Color(0, 0, 0), const sf::Color &selectionPointColor=sf::Color(110, 110, 255))
 Changes the colors from the text box. More...
 
virtual void setBackgroundColor (const sf::Color &backgroundColor)
 Set the background color that will be used inside the text box. More...
 
virtual void setTextColor (const sf::Color &textColor)
 Set the text color that will be used inside the text box. More...
 
virtual void setSelectedTextColor (const sf::Color &selectedTextColor)
 Set the text color of the selected text that will be used inside the text box. More...
 
virtual void setSelectedTextBackgroundColor (const sf::Color &selectedTextBackgroundColor)
 Set the background color of the selected text that will be used inside the text box. More...
 
virtual void setBorderColor (const sf::Color &borderColor)
 Set the border color that will be used inside the text box. More...
 
virtual const sf::Color & getBackgroundColor () const
 Get the background color that is currently being used inside the text box. More...
 
virtual const sf::Color & getTextColor () const
 Get the text color that is currently being used inside the text box. More...
 
virtual const sf::Color & getSelectedTextColor () const
 Get the text color of the selected text that is currently being used inside the text box. More...
 
virtual const sf::Color & getSelectedTextBackgroundColor () const
 Get the background color of the selected text that is currently being used inside the text box. More...
 
virtual const sf::Color & getBorderColor () const
 Get the border color that is currently being used inside the text box. More...
 
virtual void setSelectionPointPosition (unsigned int charactersBeforeSelectionPoint)
 Sets the flickering selection point to after a specific character. More...
 
virtual bool setScrollbar (const std::string &scrollbarPathname)
 Changes the scrollbar of the text box. More...
 
virtual void removeScrollbar ()
 Removes the scrollbar from the text box (if there is one). More...
 
virtual void setSelectionPointWidth (unsigned int width=2)
 This will change the width of the selection point. 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...
 

Public Attributes

sf::Color selectionPointColor
 The color of the flickering selection pointer. More...
 
unsigned int selectionPointWidth
 The width in pixels of the flickering selection pointer. More...
 

Constructor & Destructor Documentation

tgui::TextBox::TextBox ( )

Default constructor.

tgui::TextBox::TextBox ( const TextBox copy)

Copy constructor.

virtual tgui::TextBox::~TextBox ( )
virtual

Desturctor.

Member Function Documentation

virtual void tgui::TextBox::addText ( const sf::String &  text)
virtual

Appends some text to the text that was already in the text box.

virtual void tgui::TextBox::changeColors ( const sf::Color &  backgroundColor = sf::Color(50, 50, 50),
const sf::Color &  textColor = sf::Color(0, 0, 0),
const sf::Color &  selectedTextColor = sf::Color(255, 255, 255),
const sf::Color &  selectedTextBackgroundColor = sf::Color(10, 110, 255),
const sf::Color &  borderColor = sf::Color(0, 0, 0),
const sf::Color &  selectionPointColor = sf::Color(110, 110, 255) 
)
virtual

Changes the colors from the text box.

Parameters
backgroundColorThe color of the background of the text box.
textColorThe color of the text
selectedTextColorThe color of the text when it is selected
selectedTextBackgroundColorThe color of the background of the text that is selected
borderColorThe color of the borders
selectionPointColorThe color of the flickering selection point
virtual const sf::Color& tgui::TextBox::getBackgroundColor ( ) const
virtual

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

virtual const sf::Color& tgui::TextBox::getBorderColor ( ) const
virtual

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

virtual std::string tgui::TextBox::getLoadedScrollbarPathname ( ) const
virtual

Returns the pathname that was used to load the scrollbar.

When no scrollbar was loaded then this function will return an empty string.

virtual unsigned int tgui::TextBox::getMaximumCharacters ( ) const
virtual

Returns the maximum character limit.

This function will return 0 when there is no limit.

virtual Vector2f tgui::TextBox::getScaledSize ( ) const
virtual

Returns the size of the text box, after the scaling transformation.

Implements tgui::OBJECT.

virtual const sf::Color& tgui::TextBox::getSelectedTextBackgroundColor ( ) const
virtual

Get the background color of the selected text that is currently being used inside the text box.

virtual const sf::Color& tgui::TextBox::getSelectedTextColor ( ) const
virtual

Get the text color of the selected text that is currently being used inside the text box.

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

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

Implements tgui::OBJECT.

virtual sf::String tgui::TextBox::getText ( ) const
virtual

Returns the text of the text box.

virtual const sf::Color& tgui::TextBox::getTextColor ( ) const
virtual

Get the text color that is currently being used inside the text box.

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

Returns the font of the text.

virtual unsigned int tgui::TextBox::getTextSize ( ) const
virtual

Returns the character size of the text.

virtual bool tgui::TextBox::load ( unsigned int  width,
unsigned int  height,
unsigned int  textSize,
const std::string &  scrollbarPathname = "" 
)
virtual

Creates the text box.

The text 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 text box (borders included).
heightThe height of the text 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 textbox is full.
Returns
  • true on success
  • false when scrollbar couldn't be loaded (only if scrollbarPathname isn't empty)
TextBox& tgui::TextBox::operator= ( const TextBox right)

Overload of assignment operator.

virtual void tgui::TextBox::removeScrollbar ( )
virtual

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

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

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

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

See Also
changeColors
virtual void tgui::TextBox::setBorderColor ( const sf::Color &  borderColor)
virtual

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

See Also
changeColors
virtual void tgui::TextBox::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 text 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 void tgui::TextBox::setMaximumCharacters ( unsigned int  maxChars = 0)
virtual

Changes the maximum character limit.

Set maxChars to 0 to disable the limit.

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

Changes the scrollbar of the text box.

Only needed when this wasn't done when creating the text box or if the scrollbar should be changed.

virtual void tgui::TextBox::setSelectedTextBackgroundColor ( const sf::Color &  selectedTextBackgroundColor)
virtual

Set the background color of the selected text that will be used inside the text box.

See Also
changeColors
virtual void tgui::TextBox::setSelectedTextColor ( const sf::Color &  selectedTextColor)
virtual

Set the text color of the selected text that will be used inside the text box.

See Also
changeColors
virtual void tgui::TextBox::setSelectionPointPosition ( unsigned int  charactersBeforeSelectionPoint)
virtual

Sets the flickering selection point to after a specific character.

Normally you will not need this function.

virtual void tgui::TextBox::setSelectionPointWidth ( unsigned int  width = 2)
virtual

This will change the width of the selection point.

virtual void tgui::TextBox::setSize ( float  width,
float  height 
)
virtual

Changes the size of the text box.

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

Implements tgui::OBJECT.

virtual void tgui::TextBox::setText ( const sf::String &  text)
virtual

Changes the text of the text box.

virtual void tgui::TextBox::setTextColor ( const sf::Color &  textColor)
virtual

Set the text color that will be used inside the text box.

See Also
changeColors
virtual void tgui::TextBox::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 by changing gloabalFont from the parent.

virtual void tgui::TextBox::setTextSize ( unsigned int  size)
virtual

Changes the character size of the text. The minimum text size is 8.

Member Data Documentation

sf::Color tgui::TextBox::selectionPointColor

The color of the flickering selection pointer.

unsigned int tgui::TextBox::selectionPointWidth

The width in pixels of the flickering selection pointer.


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