2010-09-17 17:15:21 +02:00
|
|
|
#ifndef _TEXT_HPP_
|
|
|
|
#define _TEXT_HPP_
|
|
|
|
|
|
|
|
#include "libwiigui/gui.h"
|
|
|
|
#include "wstring.hpp"
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
int LineOffset;
|
|
|
|
int CharCount;
|
|
|
|
int width;
|
2010-09-17 17:15:21 +02:00
|
|
|
} TextLine;
|
|
|
|
|
2010-09-24 02:48:03 +02:00
|
|
|
class Text: public GuiText
|
2010-09-17 17:15:21 +02:00
|
|
|
{
|
|
|
|
public:
|
2010-09-24 02:48:03 +02:00
|
|
|
//!Constructor
|
|
|
|
//!\param t Text
|
|
|
|
//!\param s Font size
|
|
|
|
//!\param c Font color
|
2010-09-17 17:15:21 +02:00
|
|
|
Text(const char * t, int s, GXColor c);
|
|
|
|
Text(const wchar_t * t, int s, GXColor c);
|
|
|
|
~Text();
|
2010-09-24 02:48:03 +02:00
|
|
|
//!Sets the text of the GuiText element
|
|
|
|
//!\param t Text
|
|
|
|
void SetText(const char * t);
|
|
|
|
void SetText(const wchar_t * t);
|
|
|
|
//!Set the max texwidth
|
2010-09-17 17:15:21 +02:00
|
|
|
void SetMaxWidth(int width);
|
2010-09-24 02:48:03 +02:00
|
|
|
//!Go to next line
|
|
|
|
void NextLine();
|
|
|
|
//!Go to previous line
|
|
|
|
void PreviousLine();
|
|
|
|
//!Refresh the rows to draw
|
2010-09-17 17:15:21 +02:00
|
|
|
void Refresh();
|
2010-09-24 02:48:03 +02:00
|
|
|
//!Set the text line
|
2010-09-17 17:15:21 +02:00
|
|
|
void SetTextLine(int line);
|
2010-09-24 02:48:03 +02:00
|
|
|
//!Set to the char pos in text
|
2010-09-17 17:15:21 +02:00
|
|
|
void SetTextPos(int pos);
|
2010-09-24 02:48:03 +02:00
|
|
|
//!Refresh the rows to draw
|
2010-09-28 22:55:42 +02:00
|
|
|
int GetCurrPos() { return curLineStart; };
|
2010-09-24 02:48:03 +02:00
|
|
|
//!Get the count of loaded lines
|
2010-09-28 22:55:42 +02:00
|
|
|
int GetLinesCount() { return textDyn.size(); };
|
2010-09-24 02:48:03 +02:00
|
|
|
//!Get the total count of lines
|
2010-09-28 22:55:42 +02:00
|
|
|
int GetTotalLinesCount() { return TextLines.size(); };
|
2010-09-17 17:15:21 +02:00
|
|
|
//!Get the original full Text
|
|
|
|
const wchar_t * GetText();
|
|
|
|
//!Get the original full Text as wString
|
2010-09-28 22:55:42 +02:00
|
|
|
wString * GetwString() { return wText; };
|
2010-09-17 17:15:21 +02:00
|
|
|
//!Get the original Text as a UTF-8 text
|
|
|
|
std::string GetUTF8String() const;
|
|
|
|
//!Get a Textline
|
|
|
|
const wchar_t * GetTextLine(int ind);
|
|
|
|
//!Get the offset in the text of a drawn Line
|
|
|
|
int GetLineOffset(int ind);
|
2010-09-24 02:48:03 +02:00
|
|
|
//!Constantly called to draw the text
|
|
|
|
void Draw();
|
2010-09-17 17:15:21 +02:00
|
|
|
protected:
|
|
|
|
void CalcLineOffsets();
|
|
|
|
void FillRows();
|
|
|
|
|
2010-09-24 02:48:03 +02:00
|
|
|
wString * wText;
|
|
|
|
std::vector<TextLine> TextLines;
|
|
|
|
int curLineStart;
|
|
|
|
int FirstLineOffset;
|
|
|
|
bool filling;
|
2010-09-17 17:15:21 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|