26 #ifndef TGUI_TEXT_BOX_HPP 27 #define TGUI_TEXT_BOX_HPP 30 #include <TGUI/Widget.hpp> 97 bool load(
const std::string& configFileFilename,
const std::string& sectionName =
"TextBox");
107 const std::string& getLoadedConfigFile()
const;
119 virtual void setSize(
float width,
float height);
130 virtual sf::Vector2f getSize()
const;
141 virtual sf::Vector2f getFullSize()
const;
150 void setText(
const sf::String& text);
159 void addText(
const sf::String& text);
168 sf::String getText()
const;
180 void setTextFont(
const sf::Font& font);
189 const sf::Font* getTextFont()
const;
199 void setTextSize(
unsigned int size);
208 unsigned int getTextSize()
const;
220 void setMaximumCharacters(
unsigned int maxChars = 0);
232 unsigned int getMaximumCharacters()
const;
244 virtual void setBorders(
unsigned int leftBorder = 0,
245 unsigned int topBorder = 0,
246 unsigned int rightBorder = 0,
247 unsigned int bottomBorder = 0);
261 void changeColors(
const sf::Color& backgroundColor = sf::Color( 50, 50, 50),
262 const sf::Color& textColor = sf::Color( 0, 0, 0),
263 const sf::Color& selectedTextColor = sf::Color(255, 255, 255),
264 const sf::Color& selectedTextBackgroundColor = sf::Color( 10, 110, 255),
265 const sf::Color& borderColor = sf::Color( 0, 0, 0),
266 const sf::Color& selectionPointColor = sf::Color(110, 110, 255));
275 void setBackgroundColor(
const sf::Color& backgroundColor);
284 void setTextColor(
const sf::Color& textColor);
293 void setSelectedTextColor(
const sf::Color& selectedTextColor);
302 void setSelectedTextBackgroundColor(
const sf::Color& selectedTextBackgroundColor);
311 void setBorderColor(
const sf::Color& borderColor);
320 void setSelectionPointColor(
const sf::Color& selectionPointColor);
329 const sf::Color& getBackgroundColor()
const;
338 const sf::Color& getTextColor()
const;
347 const sf::Color& getSelectedTextColor()
const;
356 const sf::Color& getSelectedTextBackgroundColor()
const;
365 const sf::Color& getBorderColor()
const;
374 const sf::Color& getSelectionPointColor()
const;
388 void setSelectionPointPosition(
unsigned int charactersBeforeSelectionPoint);
402 bool setScrollbar(
const std::string& scrollbarConfigFileFilename);
411 void removeScrollbar();
420 void setSelectionPointWidth(
unsigned int width = 2);
429 unsigned int getSelectionPointWidth()
const;
441 void setReadOnly(
bool readOnly =
true);
454 virtual void setTransparency(
unsigned char transparency);
460 virtual bool mouseOnWidget(
float x,
float y);
465 virtual void leftMousePressed(
float x,
float y);
470 virtual void leftMouseReleased(
float x,
float y);
475 virtual void mouseMoved(
float x,
float y);
480 virtual void keyPressed(
const sf::Event::KeyEvent& event);
485 virtual void textEntered(sf::Uint32 Key);
490 virtual void mouseWheelMoved(
int delta,
int x,
int y);
495 virtual void mouseNotOnWidget();
500 virtual void mouseNoLongerDown();
505 virtual void widgetUnfocused();
513 virtual bool setProperty(std::string property,
const std::string& value);
520 virtual bool getProperty(std::string property, std::string& value)
const;
528 virtual std::list< std::pair<std::string, std::string> > getPropertyList()
const;
539 unsigned int findSelectionPointPosition(
float posX,
float posY);
546 void selectText(
float posX,
float posY);
553 void deleteSelectedCharacters();
560 void updateDisplayedText();
567 void updateSelectionTexts(
float maxLineWidth);
573 virtual void initialize(
Container *
const container);
579 virtual void update();
585 virtual void draw(sf::RenderTarget& target, sf::RenderStates states)
const;
596 TextChanged = WidgetCallbacksCount * 1,
597 AllTextBoxCallbacks = WidgetCallbacksCount * 2 - 1,
598 TextBoxCallbacksCount = WidgetCallbacksCount * 2
605 std::string m_LoadedConfigFile;
612 sf::String m_DisplayedText;
613 unsigned int m_TextSize;
614 unsigned int m_LineHeight;
615 unsigned int m_Lines;
618 unsigned int m_MaxChars;
621 unsigned int m_TopLine;
622 unsigned int m_VisibleLines;
625 unsigned int m_SelChars;
626 unsigned int m_SelStart;
627 unsigned int m_SelEnd;
630 sf::Vector2u m_SelectionPointPosition;
631 bool m_SelectionPointVisible;
634 sf::Color m_SelectionPointColor;
637 unsigned int m_SelectionPointWidth;
640 bool m_SelectionTextsNeedUpdate;
643 sf::Color m_BackgroundColor;
644 sf::Color m_SelectedTextBgrColor;
645 sf::Color m_BorderColor;
648 sf::Text m_TextBeforeSelection;
649 sf::Text m_TextSelection1;
650 sf::Text m_TextSelection2;
651 sf::Text m_TextAfterSelection1;
652 sf::Text m_TextAfterSelection2;
654 std::vector<float> m_MultilineSelectionRectWidth;
660 bool m_PossibleDoubleClick;
672 #endif // TGUI_TEXT_BOX_HPP Namespace that contains all TGUI functions and classes.
Definition: AnimatedPicture.hpp:33
Definition: TextBox.hpp:40
Parent class for widgets that store multiple widgets.
Definition: Container.hpp:43
TextBoxCallbacks
Defines specific triggers to TextBox.
Definition: TextBox.hpp:594