aboutsummaryrefslogtreecommitdiff
path: root/include/Body.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-03-24 08:42:40 +0100
committerdec05eba <dec05eba@protonmail.com>2021-03-24 08:42:40 +0100
commit84d4d43d2f79da48c3494e11c8b29790fb6eae12 (patch)
treed530ff3bff5737cf224de069d9fe10fa649c454a /include/Body.hpp
parent1bd8a4008499c78e4ee6ed40fd01657506b24983 (diff)
Matrix: merge body items if same author
Diffstat (limited to 'include/Body.hpp')
-rw-r--r--include/Body.hpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/Body.hpp b/include/Body.hpp
index 53622e8..738c41b 100644
--- a/include/Body.hpp
+++ b/include/Body.hpp
@@ -160,6 +160,8 @@ namespace QuickMedia {
using BodyItems = std::vector<std::shared_ptr<BodyItem>>;
using BodyItemRenderCallback = std::function<void(BodyItem *body_item)>;
+ // Return true to merge
+ using BodyItemMergeHandler = std::function<bool(BodyItem *prev_item, BodyItem *this_item)>;
enum class AttachSide {
TOP,
@@ -216,7 +218,7 @@ namespace QuickMedia {
// because of Text::setMaxWidth
void draw_item(sf::RenderWindow &window, BodyItem *item, sf::Vector2f pos, sf::Vector2f size, bool include_embedded_item = true, bool is_embedded = false);
- float get_item_height(BodyItem *item, float width, bool load_texture = true, bool include_embedded_item = true);
+ float get_item_height(BodyItem *item, float width, bool load_texture = true, bool include_embedded_item = true, bool merge_with_previous = false);
float get_spacing_y() const;
static bool string_find_case_insensitive(const std::string &str, const std::string &substr);
@@ -249,14 +251,17 @@ namespace QuickMedia {
sf::Vector2i thumbnail_max_size;
sf::Color line_separator_color;
BodyItemRenderCallback body_item_render_callback;
+ BodyItemMergeHandler body_item_merge_handler;
std::function<void(BodyItem*)> body_item_select_callback;
sf::Shader *thumbnail_mask_shader;
AttachSide attach_side = AttachSide::TOP;
private:
- 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);
+ 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);
sf::Vector2i get_item_thumbnail_size(BodyItem *item) const;
+ BodyItem* get_previous_visible_item(int start_index);
+ BodyItem* get_next_visible_item(int start_index);
private:
Program *program;
std::unordered_map<std::string, std::shared_ptr<ThumbnailData>> item_thumbnail_textures;