diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-11-10 21:13:02 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-11-10 21:13:02 +0100 |
commit | dd3da1832c0103a2da35df8ac2483461311bdf25 (patch) | |
tree | de66b34fde824a08807f6de5f59779f9ba58b610 /include | |
parent | 9c99020b598c2e70c0d14d5ad4e7c22436af3b42 (diff) |
Scroll body automatically to reveal more items when making the window larger, even after resizing to smaller size before
Diffstat (limited to 'include')
-rw-r--r-- | include/Body.hpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/include/Body.hpp b/include/Body.hpp index 1fa32bb..1952b74 100644 --- a/include/Body.hpp +++ b/include/Body.hpp @@ -136,6 +136,11 @@ namespace QuickMedia { using BodyItems = std::vector<std::shared_ptr<BodyItem>>; using BodyItemRenderCallback = std::function<void(BodyItem *body_item)>; + enum class AttachSide { + TOP, + BOTTOM + }; + class Body { public: Body(Program *program, sf::Texture &loading_icon_texture); @@ -146,10 +151,10 @@ namespace QuickMedia { bool select_next_page(); // Select previous item, ignoring invisible items. Returns true if the item was changed or if the item scrolled. This can be used to check if the top was hit when wrap_around is set to false - bool select_previous_item(); + bool select_previous_item(bool scroll_page_if_large_item = true); // Select next item, ignoring invisible items. Returns true if the item was changed or if the item scrolled. This can be used to check if the bottom was hit when wrap_around is set to false - bool select_next_item(); + bool select_next_item(bool scroll_page_if_large_item = true); void set_selected_item(int item, bool reset_prev_selected_item = true); // Returns -1 if item can't be found @@ -213,6 +218,7 @@ namespace QuickMedia { sf::Color line_separator_color; BodyItemRenderCallback body_item_render_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 update_dirty_state(BodyItem *body_item, float width); @@ -238,5 +244,8 @@ namespace QuickMedia { double elapsed_time_sec = 0.0; bool selected_line_top_visible = true; bool selected_line_bottom_visible = true; + bool items_cut_off = false; + float offset_to_top = 0.0f; + float offset_to_bottom = 0.0f; }; }
\ No newline at end of file |