aboutsummaryrefslogtreecommitdiff
path: root/src/BodyItem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/BodyItem.cpp')
-rw-r--r--src/BodyItem.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/BodyItem.cpp b/src/BodyItem.cpp
index 0c6e1ce..431616d 100644
--- a/src/BodyItem.cpp
+++ b/src/BodyItem.cpp
@@ -3,10 +3,6 @@
#include "../include/Config.hpp"
namespace QuickMedia {
- static float floor(float v) {
- return (int)v;
- }
-
// static
std::shared_ptr<BodyItem> BodyItem::create(std::string title, bool selectable) {
return std::shared_ptr<BodyItem>(new BodyItem(std::move(title), selectable));
@@ -18,6 +14,7 @@ namespace QuickMedia {
dirty_description(false),
dirty_author(false),
dirty_timestamp(false),
+ dirty_reactions(false),
thumbnail_is_local(false),
userdata(nullptr),
timestamp(0),
@@ -38,6 +35,7 @@ namespace QuickMedia {
dirty_description = !other.description.empty();
dirty_author = !other.author.empty();
dirty_timestamp = other.timestamp != 0;
+ dirty_reactions = !other.reactions.empty();
thumbnail_is_local = other.thumbnail_is_local;
title_text.reset();
description_text.reset();
@@ -79,11 +77,18 @@ namespace QuickMedia {
return *this;
}
- void BodyItem::add_reaction(std::string text, void *userdata) {
+ void BodyItem::add_reaction(std::string text, void *userdata, mgl::Color text_color) {
Reaction reaction;
- reaction.text = std::make_unique<Text>(std::move(text), false, floor(get_config().body.reaction_font_size * get_config().scale * get_config().font_scale), 0.0f);
+ reaction.text_str = std::move(text);
+ reaction.text = nullptr;
reaction.userdata = userdata;
+ reaction.text_color = text_color;
reactions.push_back(std::move(reaction));
+ dirty_reactions = true;
+ }
+
+ void BodyItem::add_reaction(std::string text, void *userdata) {
+ add_reaction(std::move(text), userdata, get_theme().text_color);
}
void BodyItem::draw_list(Body *body, mgl::Window &render_target) {