aboutsummaryrefslogtreecommitdiff
path: root/src/SearchBar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/SearchBar.cpp')
-rw-r--r--src/SearchBar.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/SearchBar.cpp b/src/SearchBar.cpp
index 26b00a4..df7d951 100644
--- a/src/SearchBar.cpp
+++ b/src/SearchBar.cpp
@@ -39,6 +39,7 @@ namespace QuickMedia {
input_masked(input_masked),
typing(false),
backspace_pressed(false),
+ mouse_left_inside(false),
vertical_pos(0.0f)
{
text.setFillColor(text_placeholder_color);
@@ -97,10 +98,24 @@ namespace QuickMedia {
auto clipboard = sf::Clipboard::getString().toUtf8();
append_text(std::string(clipboard.begin(), clipboard.end()));
}
+
if(event.type == sf::Event::TextEntered && event.text.unicode != 8 && event.text.unicode != 127) // 8 = backspace, 127 = del
onTextEntered(event.text.unicode);
else if(event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Backspace)
onTextEntered(8);
+
+ if(is_touch_enabled() && event.type == sf::Event::MouseButtonPressed && event.mouseButton.button == sf::Mouse::Left) {
+ sf::FloatRect box(background.getPosition(), background.getSize());
+ if(box.contains(event.mouseButton.x, event.mouseButton.y))
+ mouse_left_inside = true;
+ else
+ mouse_left_inside = false;
+ } else if(is_touch_enabled() && event.type == sf::Event::MouseButtonReleased && event.mouseButton.button == sf::Mouse::Left) {
+ sf::FloatRect box(background.getPosition(), background.getSize());
+ if(mouse_left_inside && box.contains(event.mouseButton.x, event.mouseButton.y))
+ show_virtual_keyboard();
+ mouse_left_inside = false;
+ }
}
void SearchBar::update() {