Exemplo n.º 1
0
    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;
        }
    }
Exemplo n.º 2
0
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();
}
Exemplo n.º 3
0
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();
}