5#ifndef INCLUDE_FIFECHAN_TEXT_HPP_
6#define INCLUDE_FIFECHAN_TEXT_HPP_
11#include "fifechan/platform.hpp"
12#include "fifechan/rectangle.hpp"
27 class FIFEGUI_API Text
37 explicit Text(std::string
const & content);
41 Text(Text
const &) =
default;
42 Text& operator=(Text
const &) =
default;
43 Text(Text&&) =
default;
44 Text& operator=(Text&&) =
default;
52 virtual void setContent(std::string
const & content);
68 virtual void setRow(
unsigned int row, std::string
const & content);
76 virtual void addRow(std::string
const & row);
85 virtual void insertRow(std::string
const & row,
unsigned int position);
93 virtual void eraseRow(
unsigned int row);
102 virtual std::string&
getRow(
unsigned int row);
109 virtual void insert(
int character);
124 virtual void remove(
int numberOfCharacters);
Abstract interface for font rendering.
Represents a rectangular area (X, Y, Width, Height).
unsigned int mCaretColumn
Holds the column the caret is in.
virtual void setCaretColumn(int column)
Sets the column the caret should be in.
virtual unsigned int getNumberOfCharacters() const
Gets the number of characters in the text.
virtual unsigned int getMaximumCaretRow() const
Gets the maximum row the caret can be in.
virtual void setContent(std::string const &content)
Sets the content of the text.
virtual unsigned int getNumberOfRows() const
Gets the number of rows in the text.
virtual int getWidth(int row, Font *font) const
Gets the width in pixels of a row.
virtual std::string & getRow(unsigned int row)
Gets a reference to a row.
virtual void setCaretRow(int row)
Sets the row the caret should be in.
virtual int getCaretPosition() const
Gets the caret position.
virtual void addRow(std::string const &row)
Adds a row to the content.
virtual void setRow(unsigned int row, std::string const &content)
Sets the content of a row.
virtual void remove(int numberOfCharacters)
Removes a given number of characters at starting at the current caret position.
unsigned int mCaretRow
Holds the row the caret is in.
virtual int getCaretColumn() const
Gets the column the caret is currently in.
virtual void insertRow(std::string const &row, unsigned int position)
Inserts a row before the specified row position.
virtual void setCaretPosition(int position)
Sets the caret position.
virtual int getCaretX(Font *font) const
Gets the x coordinate of the caret in pixels given a font.
unsigned int mCaretPosition
Holds the position of the caret.
virtual int getCaretRow() const
Gets the row the caret is currently in.
virtual void eraseRow(unsigned int row)
Erases the given row.
virtual int getCaretY(Font *font) const
Gets the y coordinate of the caret in pixels given a font.
std::vector< std::string > mRows
Holds the text row by row.
virtual std::string getContent() const
Gets the content of the text.
virtual void insert(int character)
Inserts a character at the current caret position.
void calculateCaretPositionFromRowAndColumn()
Calculates the caret position from the caret row and caret column.
virtual Rectangle getDimension(Font *font) const
Gets the dimension in pixels of the text given a font.
virtual Rectangle getCaretDimension(Font *font) const
Gets the caret dimension relative to this text.