From 4b24638802385816fb5f90c95f175b30ae2398a8 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 4 Aug 2019 02:28:33 +0200 Subject: Add youtube video playing, page navigation --- include/SearchBar.hpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 include/SearchBar.hpp (limited to 'include/SearchBar.hpp') diff --git a/include/SearchBar.hpp b/include/SearchBar.hpp new file mode 100644 index 0000000..c9f75f0 --- /dev/null +++ b/include/SearchBar.hpp @@ -0,0 +1,33 @@ +#pragma once + +#include +#include +#include +#include +#include + +namespace QuickMedia { + using TextUpdateCallback = std::function; + using TextSubmitCallback = std::function; + + class SearchBar { + public: + SearchBar(sf::Font &font); + void draw(sf::RenderWindow &window); + void update(); + void onWindowResize(const sf::Vector2f &window_size); + void onTextEntered(sf::Uint32 codepoint); + void clear(); + + float getBottom() const; + + TextUpdateCallback onTextUpdateCallback; + TextSubmitCallback onTextSubmitCallback; + private: + sf::Text text; + sf::RectangleShape background; + bool show_placeholder; + bool updated_search; + sf::Clock time_since_search_update; + }; +} \ No newline at end of file -- cgit v1.2.3