222 if (
styles.empty() ==
true)
return nullptr;
225 if (textStyleIdx == -1) {
227 for (
auto l = 0; l <
styles.size(); l++) {
228 auto textStyle = &
styles[l];
230 textStyleIdx = l - 1;
236 auto _textStyle = textStyleIdx <
styles.size()?&
styles[textStyleIdx]:
nullptr;
237 if (_textStyle !=
nullptr &&
lineCharIdxs[lineCharIdx] >= _textStyle->startIdx) {
241 _textStyle = textStyleIdx <
styles.size()?&
styles[textStyleIdx]:
nullptr;
242 if (_textStyle !=
nullptr &&
lineCharIdxs[lineCharIdx] >= _textStyle->startIdx) {
245 textStyle = _textStyle;
251 textStyle = _textStyle;
308 const string& backgroundImage,
371 auto previousNewLineIndex = index;
372 while (previousNewLineIndex >= 0 &&
text.
getCharAt(previousNewLineIndex) !=
'\n') previousNewLineIndex--;
373 previousNewLineIndex = Math::max(previousNewLineIndex, 0);
374 return previousNewLineIndex;
383 auto previousNewLineIndex = index;
384 while (previousNewLineIndex >= 0 &&
text.
getUTF8CharAt(previousNewLineIndex) !=
'\n') previousNewLineIndex--;
385 previousNewLineIndex = Math::max(previousNewLineIndex, 0);
386 return previousNewLineIndex;
395 auto nextNewLineIndex = index;
397 while (nextNewLineIndex < textSize &&
text.
getCharAt(nextNewLineIndex) !=
'\n') nextNewLineIndex++;
398 nextNewLineIndex = Math::min(nextNewLineIndex,
text.
size() - 1);
399 return nextNewLineIndex;
408 auto nextNewLineIndex = index;
410 while (nextNewLineIndex < textLength &&
text.
getUTF8CharAt(nextNewLineIndex) !=
'\n') nextNewLineIndex++;
411 nextNewLineIndex = Math::min(nextNewLineIndex,
text.
size() - 1);
412 return nextNewLineIndex;
422 auto previousDelimiterIndex = index;
423 while (previousDelimiterIndex >= 0 && delimiters.find(
text.
getCharAt(previousDelimiterIndex)) == string::npos) previousDelimiterIndex--;
424 previousDelimiterIndex = Math::max(previousDelimiterIndex, 0);
425 return previousDelimiterIndex;
435 auto previousDelimiterIndex = index;
436 while (previousDelimiterIndex >= 0 && delimiters.find(
text.
getUTF8CharAt(previousDelimiterIndex)) == string::npos) previousDelimiterIndex--;
437 previousDelimiterIndex = Math::max(previousDelimiterIndex, 0);
438 return previousDelimiterIndex;
448 auto nextDelimiterIndex = index;
450 while (nextDelimiterIndex < textSize && delimiters.find(
text.
getUTF8CharAt(nextDelimiterIndex)) == string::npos) nextDelimiterIndex++;
451 nextDelimiterIndex = Math::min(nextDelimiterIndex,
text.
size() - 1);
452 return nextDelimiterIndex;
462 auto nextDelimiterIndex = index;
464 while (nextDelimiterIndex < textLength && delimiters.find(
text.
getUTF8CharAt(nextDelimiterIndex)) == string::npos) nextDelimiterIndex++;
465 nextDelimiterIndex = Math::min(nextDelimiterIndex,
text.
size() - 1);
466 return nextDelimiterIndex;
498 void insertText(int32_t idx,
const string& s);
556 void setTextStyle(
int startIdx,
int endIdx,
const string&
font,
int size,
const string& url =
string());
584 const string& url =
string(),
587 float horizontalScale = 1.0f,
588 float verticalScale = 1.0f,
608 const string& url =
string(),
611 float horizontalScale = 1.0f,
612 float verticalScale = 1.0f,
static STATIC_DLL_IMPEXT GUIColor GUICOLOR_EFFECT_COLOR_ADD
static STATIC_DLL_IMPEXT GUIColor GUICOLOR_EFFECT_COLOR_MUL
GUI element node conditions.
GUI node requested constraints requested constraints type enum.
GUIColor backgroundImageEffectColorMul
GUINode_Scale9Grid backgroundImageScale9Grid
GUIColor backgroundImageEffectColorAdd
GUIParentNode * parentNode
GUIScreenNode * screenNode
GUINode_RequestedConstraints requestedConstraints
GUINode_Alignments alignments
GUI parent node base class thats supporting child nodes.
GUI screen node that represents a screen that can be rendered via GUI system.
GUI styled text node controller.
vector< Line > lineConstraints
void unsetTextStyleUtf8(int startIdx, int endIdx)
Unset text style using Utf8 indices.
int selectionIndexMousePositionX
void setImage(int idx, const string &image, const string &url=string(), int width=-1, int height=-1, float horizontalScale=1.0f, float verticalScale=1.0f, const GUIColor &effectColorMul=GUIColor::GUICOLOR_EFFECT_COLOR_MUL, const GUIColor &effectColorAdd=GUIColor::GUICOLOR_EFFECT_COLOR_ADD)
Set image.
vector< TextStyle > styles
int getNextDelimiter(int index, const string &delimiters)
Get next delimiter.
const string getNodeType() override
void dispose() override
Dispose node.
int getContentWidth() override
void setTextStyleUtf8(int startIdx, int endIdx, const GUIColor &color, const string &font=string(), int size=-1, const string &url=string())
Set text style using Utf8 indices.
void insertText(int32_t idx, int c)
Insert character c at idx.
void unsetTextStyle(int startIdx, int endIdx)
Unset text style.
vector< int > lineCharIdxs
int getPreviousNewLineUtf8(int index)
Get previous new line using Utf8 indices.
void setIndexMousePosition(int x, int y)
Set index mouse position.
int getContentHeight() override
void setSelectionIndexMousePosition(int x, int y)
Set selection index mouse position.
void setText(const MutableString &text)
Set text.
GUIStyledTextNode(GUIScreenNode *screenNode, GUIParentNode *parentNode, const string &id, GUINode_Flow *flow, const GUINode_Alignments &alignments, const GUINode_RequestedConstraints &requestedConstraints, const GUIColor &backgroundColor, const string &backgroundImage, const GUINode_Scale9Grid &backgroundImageScale9Grid, const GUIColor &backgroundImageEffectColorMul, const GUIColor &backgroundImageEffectColorAdd, const GUINode_Border &border, const GUINode_Padding &padding, const GUINodeConditions &showOn, const GUINodeConditions &hideOn, const string &tooltip, bool editable, bool preformatted, const string &font, int size, const string &color, const MutableString &text)
Constructor.
int getPreviousDelimiter(int index, const string &delimiters)
Get previous delimiter.
int getNextNewLine(int index)
Get next newline using.
static constexpr int MOUSEPOSITION_NONE
void setTextStyleUtf8(int startIdx, int endIdx, const string &font, int size, const string &url=string())
Set text style using Utf8 indices.
int doPageDown()
Do page down.
int getNextNewLineUtf8(int index)
Get next newline using Utf8 indices.
void unsetStyles()
Unset/dispose styles.
void setEditMode(bool editMode)
GUIColor selectionBackgroundColor
int doPageUp()
Do page up.
void setImageUtf8(int idx, const string &image, const string &url=string(), int width=-1, int height=-1, float horizontalScale=1.0f, float verticalScale=1.0f, const GUIColor &effectColorMul=GUIColor::GUICOLOR_EFFECT_COLOR_MUL, const GUIColor &effectColorAdd=GUIColor::GUICOLOR_EFFECT_COLOR_ADD)
Set image using Utf8 index.
int getPreviousNewLine(int index)
Get previous new line.
void setTextStyle(int startIdx, int endIdx, const GUIColor &color, const string &font=string(), int size=-1, const string &url=string())
Set text style.
void removeText(int32_t idx, int32_t count)
Remove characters at idx with given length.
void scrollToSelectionIndex()
Set scroll to selection index.
void computeContentAlignment() override
Do content alignment.
void unsetIndexMousePosition()
Unset index mouse position.
void render(GUIRenderer *guiRenderer) override
Render.
bool parentOffsetsChanged
vector< URLArea > urlAreas
void unsetSelectionIndexMousePosition()
Unset selection index mouse position.
bool isContentNode() override
const vector< URLArea > & getURLAreas()
int getPreviousDelimiterUtf8(int index, const string &delimiters)
Get previous delimiter using Utf8 indices.
int selectionIndexMousePositionY
TextStyle * getTextStyle(const vector< int > &lineCharIdxs, int lineCharIdx, int &textStyleIdx)
Get text style for.
void scrollToIndex()
Set scroll to index.
void computeContentAlignmentInternal()
Compute content alignment internal.
vector< int > lineCharBinaryIdxs
int getNextDelimiterUtf8(int index, const string &delimiters)
Get next delimiter using Utf8 indices.
const MutableString & getText() const
void determineNextLineConstraints(UTF8CharacterIterator &u8It, int charEndIdx, int textStyleIdx)
Determine next line constraints.
Mutable utf8 aware string class.
char getCharAt(int32_t idx) const
Get char at given binary index.
int getUtf8BinaryIndex(int idx) const
int getUTF8CharAt(int32_t idx) const
UTF8 string character iterator.
std::exception Exception
Exception base class.
GUI node requested constraints entity.
GUI node scale 9 grid entity.
Line(int binaryIdx, int charIdx, float width, float height, float lineHeight, float baseLine, bool spaceWrap)
URLArea(int left, int top, int width, int height, const string &url)
#define FORBID_CLASS_COPY(CLASS)