aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-05-18 22:05:19 +0200
committerdec05eba <dec05eba@protonmail.com>2021-05-18 22:08:41 +0200
commitd123c41cd3ad4f0d55ae134be69e7ffd144dbb74 (patch)
treef46a8e6daea5b757f4b66363c64aea6269dd83a9 /include
parentf6a39afa8bfd869ba661799897ac37e7d1ff7c34 (diff)
Add mention autocomplete
Diffstat (limited to 'include')
-rw-r--r--include/Body.hpp8
-rw-r--r--include/Entry.hpp3
-rw-r--r--include/Text.hpp3
3 files changed, 13 insertions, 1 deletions
diff --git a/include/Body.hpp b/include/Body.hpp
index 84d0f14..9798992 100644
--- a/include/Body.hpp
+++ b/include/Body.hpp
@@ -232,7 +232,6 @@ namespace QuickMedia {
// TODO: Highlight the part of the text that matches the search.
void filter_search_fuzzy(const std::string &text);
- void filter_search_fuzzy_item(const std::string &text, BodyItem *body_item);
bool no_items_visible() const;
@@ -246,6 +245,9 @@ namespace QuickMedia {
bool is_body_full_with_items() const { return items_cut_off; }
int get_num_visible_items() const { return num_visible_items; };
+ // Call this once after adding new items
+ void items_set_dirty();
+
sf::Text progress_text;
sf::Text replies_text;
sf::Text embedded_item_load_text;
@@ -265,6 +267,7 @@ namespace QuickMedia {
std::function<void()> on_top_reached = nullptr;
std::function<void()> on_bottom_reached = nullptr;
private:
+ void filter_search_fuzzy_item(const std::string &text, BodyItem *body_item);
void draw_item(sf::RenderWindow &window, BodyItem *item, const sf::Vector2f &pos, const sf::Vector2f &size, const float item_height, const int item_index, const Json::Value &content_progress, bool include_embedded_item = true, bool merge_with_previous = false);
void update_dirty_state(BodyItem *body_item, float width);
void clear_body_item_cache(BodyItem *body_item);
@@ -325,5 +328,8 @@ namespace QuickMedia {
bool render_selected_item_bg = true;
float item_background_target_pos_y = 0.0f;
float item_background_target_height = 0.0f;
+ // TODO: Instead of using this, add functions for modifying |items| and apply the filter on those new items
+ bool items_dirty = false;
+ std::string current_filter;
};
} \ No newline at end of file
diff --git a/include/Entry.hpp b/include/Entry.hpp
index 581dc14..22680b5 100644
--- a/include/Entry.hpp
+++ b/include/Entry.hpp
@@ -30,6 +30,9 @@ namespace QuickMedia {
void move_caret_to_end();
void append_text(std::string str);
+ void replace(size_t start_index, size_t length, const sf::String &insert_str);
+ int get_caret_index() const;
+
bool is_editable() const;
float get_height();
const sf::String& get_text() const;
diff --git a/include/Text.hpp b/include/Text.hpp
index 989edbb..5749072 100644
--- a/include/Text.hpp
+++ b/include/Text.hpp
@@ -82,6 +82,9 @@ namespace QuickMedia
void setCharacterSize(unsigned int characterSize);
unsigned int getCharacterSize() const;
+ void replace(size_t start_index, size_t length, const sf::String &insert_str);
+ int getCaretIndex() const;
+
void setFillColor(sf::Color color);
void setLineSpacing(float lineSpacing);