aboutsummaryrefslogtreecommitdiff
path: root/include/Body.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/Body.hpp')
-rw-r--r--include/Body.hpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/include/Body.hpp b/include/Body.hpp
index 65645e9..91913b5 100644
--- a/include/Body.hpp
+++ b/include/Body.hpp
@@ -17,6 +17,7 @@ namespace Json {
}
namespace QuickMedia {
+ class ThumbnailData;
using BodyItemRenderCallback = std::function<void(std::shared_ptr<BodyItem> &body_item)>;
// Return true to merge
using BodyItemMergeHandler = std::function<bool(BodyItem *prev_item, BodyItem *this_item)>;
@@ -154,9 +155,10 @@ namespace QuickMedia {
void filter_search_fuzzy_item(const std::string &text, BodyItem *body_item);
void handle_item_render(const sf::Vector2f pos, const float item_width, const float item_height, int item_index);
// Returns the the body total drawn height
- float draw_list_view(sf::RenderWindow &window, sf::Vector2f pos, sf::Vector2f size, const int prev_num_visible_items, const Json::Value &content_progress);
+ float draw_list_view(sf::RenderWindow &window, sf::Vector2f pos, sf::Vector2f size, const Json::Value &content_progress);
void draw_card_view(sf::RenderWindow &window, sf::Vector2f pos, sf::Vector2f size, sf::Vector2u window_size, float scissor_y);
void draw_item(sf::RenderWindow &window, std::shared_ptr<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 draw_card_item(sf::RenderWindow &window, std::shared_ptr<BodyItem> &item, const sf::Vector2f &pos, const sf::Vector2f &pos_offset, const sf::Vector2f &body_size, const sf::Vector2f &window_size, float item_height, float scissor_y, int item_index, ThumbnailData *item_thumbnail);
void update_dirty_state(BodyItem *body_item, float width);
void clear_body_item_cache(BodyItem *body_item);
sf::Vector2i get_item_thumbnail_size(BodyItem *item) const;
@@ -183,11 +185,25 @@ namespace QuickMedia {
BOTTOM
};
+ struct RenderItem {
+ std::shared_ptr<BodyItem> body_item;
+ sf::Vector2f pos;
+ sf::Vector2f pos_offset;
+ sf::Vector2f size;
+ float item_height;
+ int item_index;
+ bool merge_with_previous;
+ std::shared_ptr<ThumbnailData> item_thumbnail;
+ };
+
// TODO: Prevent items from being removed when render is in progress. That would invalidate references and cause a crash
BodyItems items;
BodyTheme body_theme;
+ // Items that are rendered in the current frame
+ std::vector<RenderItem> render_items;
+
int selected_item;
int prev_selected_item;
double page_scroll = 0.0;