aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Body.hpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/include/Body.hpp b/include/Body.hpp
index c487ad9..81e3a69 100644
--- a/include/Body.hpp
+++ b/include/Body.hpp
@@ -73,11 +73,12 @@ namespace QuickMedia {
public:
Body(Program *program, sf::Font *font, sf::Font *bold_font);
- // Select previous item, ignoring invisible items
- void select_previous_item();
+ // Select previous item, ignoring invisible items. Returns true if the item was changed. This can be used to check if the top was hit when wrap_around is set to false
+ bool select_previous_item();
- // Select next item, ignoring invisible items
- void select_next_item();
+ // Select next item, ignoring invisible items. Returns true if the item was changed. This can be used to check if the bottom was hit when wrap_around is set to false
+ bool select_next_item();
+ void set_selected_item(int item);
void select_first_item();
void reset_selected();
@@ -99,15 +100,17 @@ namespace QuickMedia {
bool no_items_visible() const;
+ int get_selected_item() const { return selected_item; }
+
sf::Font *font;
sf::Font *bold_font;
sf::Text progress_text;
sf::Text author_text;
sf::Text replies_text;
- int selected_item;
BodyItems items;
std::thread thumbnail_load_thread;
bool draw_thumbnails;
+ bool wrap_around;
private:
struct ThumbnailData {
bool referenced;
@@ -117,5 +120,6 @@ namespace QuickMedia {
std::shared_ptr<sf::Texture> load_thumbnail_from_url(const std::string &url);
std::unordered_map<std::string, ThumbnailData> item_thumbnail_textures;
bool loading_thumbnail;
+ int selected_item;
};
} \ No newline at end of file