From 2d1f007e7586b7745380060a506ba351a609aa3a Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 3 Jul 2020 18:32:16 +0200 Subject: Allow changing the placeholder text, fix dmenu empty search selection --- src/SearchBar.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/SearchBar.cpp') 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; -- cgit v1.2.3