From d123c41cd3ad4f0d55ae134be69e7ffd144dbb74 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 18 May 2021 22:05:19 +0200 Subject: Add mention autocomplete --- include/Body.hpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'include/Body.hpp') 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 on_top_reached = nullptr; std::function 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 -- cgit v1.2.3