void StyledTextBox::SetCursorPosition(size_t position) { if (position < 0 || position > GetText().Length()) { return; } int remainingText = GetTextAreaWidth() - FindCursorPointFromIndex(); if (position == GetText().Length()) { pimpl->textOffset = std::min(0, pimpl->textOffset + remainingText); } pimpl->cursorPosition = position; // recalculate text offset int cursorOffset = FindCursorPointFromIndex(); int textAreaWidth = GetTextAreaWidth(); if (cursorOffset < 0 || cursorOffset > textAreaWidth) { if (cursorOffset > textAreaWidth) cursorOffset -= textAreaWidth; pimpl->textOffset -= cursorOffset; } }
void cSkinSTTNGDisplayMenu::SetText(const char *Text, bool FixedFont) { textScroller.Set(osd, x3, y3, GetTextAreaWidth(), y4 - y3, Text, GetTextAreaFont(FixedFont), Theme.Color(clrMenuText), Theme.Color(clrBackground)); SetScrollbar(); }
void cSkinClassicDisplayMenu::SetText(const char *Text, bool FixedFont) { textScroller.Set(osd, x1, y2, GetTextAreaWidth(), y3 - y2, Text, GetTextAreaFont(FixedFont), Theme.Color(clrMenuText), Theme.Color(clrBackground)); SetTextScrollbar(); }