diff options
Diffstat (limited to 'src/Entry.cpp')
-rw-r--r-- | src/Entry.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Entry.cpp b/src/Entry.cpp index 977feab..a3c576f 100644 --- a/src/Entry.cpp +++ b/src/Entry.cpp @@ -13,7 +13,7 @@ namespace QuickMedia { on_submit_callback(nullptr), text("", font, cjk_font, 18, 0.0f), width(0.0f), - background(sf::Vector2f(1.0f, 1.0f), 10.0f, 10), + background(sf::Vector2f(1.0f, 1.0f), 7.0f, 10), placeholder(placeholder_text, *font, 18) { text.setEditable(true); @@ -54,6 +54,15 @@ namespace QuickMedia { text.setEditable(editable); } + void Entry::set_text(std::string new_text) { + text.setString(std::move(new_text)); + } + + void Entry::move_caret_to_end() { + text.updateGeometry(); + text.moveCaretToEnd(); + } + void Entry::set_position(const sf::Vector2f &pos) { background.setPosition(pos); text.setPosition(pos + sf::Vector2f(background_margin_horizontal, background_margin_vertical)); |