aboutsummaryrefslogtreecommitdiff
path: root/src/Entry.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Entry.cpp')
-rw-r--r--src/Entry.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Entry.cpp b/src/Entry.cpp
index f9897ba..c57d6cb 100644
--- a/src/Entry.cpp
+++ b/src/Entry.cpp
@@ -11,6 +11,7 @@ const float background_margin_vertical = 0.0f;
namespace QuickMedia {
Entry::Entry(const std::string &placeholder_text, sf::Font *font, sf::Font *cjk_font) :
on_submit_callback(nullptr),
+ draw_background(true),
text("", font, cjk_font, 16, 0.0f),
width(0.0f),
background(sf::Vector2f(1.0f, 1.0f), 7.0f, 10),
@@ -36,7 +37,8 @@ namespace QuickMedia {
// (and also split text into lines to not draw them at all once they are not inside the scissor box)
void Entry::draw(sf::RenderWindow &window) {
background.setSize(sf::Vector2f(width, get_height()));
- //window.draw(background);
+ if(draw_background)
+ window.draw(background);
if(text.getString().isEmpty() && !text.isEditable()) {
window.draw(placeholder);
//sf::Vector2f placeholder_pos = placeholder.getPosition();
@@ -63,6 +65,10 @@ namespace QuickMedia {
text.moveCaretToEnd();
}
+ void Entry::append_text(std::string str) {
+ text.appendText(std::move(str));
+ }
+
void Entry::set_position(const sf::Vector2f &pos) {
background.setPosition(pos);
text.setPosition(pos + sf::Vector2f(background_margin_horizontal, background_margin_vertical - 3.0f));