aboutsummaryrefslogtreecommitdiff
path: root/include/Entry.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/Entry.hpp')
-rw-r--r--include/Entry.hpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/include/Entry.hpp b/include/Entry.hpp
new file mode 100644
index 0000000..6f96e58
--- /dev/null
+++ b/include/Entry.hpp
@@ -0,0 +1,37 @@
+#pragma once
+
+#include "Text.hpp"
+#include "../external/RoundedRectangleShape.hpp"
+#include <SFML/Graphics/Text.hpp>
+#include <functional>
+
+namespace sf {
+ class Font;
+ class Event;
+ class RenderWindow;
+}
+
+namespace QuickMedia {
+ // Return true to clear the text
+ using OnEntrySubmit = std::function<bool(const sf::String& text)>;
+
+ class Entry {
+ public:
+ Entry(const std::string &placeholder_text, sf::Font *font, sf::Font *cjk_font);
+ void process_event(sf::Event &event);
+ void draw(sf::RenderWindow &window);
+
+ void set_editable(bool editable);
+ void set_position(const sf::Vector2f &pos);
+ void set_max_width(float width);
+
+ float get_height();
+
+ OnEntrySubmit on_submit_callback;
+ private:
+ Text text;
+ float width;
+ sf::RoundedRectangleShape background;
+ sf::Text placeholder;
+ };
+} \ No newline at end of file