diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-07-03 18:32:16 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-03 18:32:16 +0200 |
commit | 2d1f007e7586b7745380060a506ba351a609aa3a (patch) | |
tree | 4cae8892fb7ca5ecebe1696ce64cb12a1e922f8d /src/SearchBar.cpp | |
parent | 18467b4cd333ab0b7aa10b1c1acd83942c583e60 (diff) |
Allow changing the placeholder text, fix dmenu empty search selection
Diffstat (limited to 'src/SearchBar.cpp')
-rw-r--r-- | src/SearchBar.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/SearchBar.cpp b/src/SearchBar.cpp index 9d8a168..5c3c35c 100644 --- a/src/SearchBar.cpp +++ b/src/SearchBar.cpp @@ -11,15 +11,16 @@ const float PADDING_HORIZONTAL = 50.0f; const float padding_vertical = 20.0f; namespace QuickMedia { - SearchBar::SearchBar(sf::Font &font, sf::Texture &plugin_logo) : + SearchBar::SearchBar(sf::Font &font, sf::Texture &plugin_logo, const std::string &placeholder) : onTextUpdateCallback(nullptr), onTextSubmitCallback(nullptr), onTextBeginTypingCallback(nullptr), onAutocompleteRequestCallback(nullptr), text_autosearch_delay(0), autocomplete_search_delay(0), - text("Search...", font, 18), + text(placeholder, font, 18), autocomplete_text("", font, 18), + placeholder_str(placeholder), show_placeholder(true), updated_search(false), updated_autocomplete(false), @@ -116,7 +117,7 @@ namespace QuickMedia { text.setString(str); if(str.getSize() == 0) { show_placeholder = true; - text.setString("Search..."); + text.setString(placeholder_str); text.setFillColor(text_placeholder_color); autocomplete_text.setString(""); } else { @@ -158,7 +159,7 @@ namespace QuickMedia { if(show_placeholder) return; show_placeholder = true; - text.setString("Search..."); + text.setString(placeholder_str); text.setFillColor(text_placeholder_color); autocomplete_text.setString(""); needs_update = true; |