aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Body.hpp5
-rw-r--r--include/QuickMedia.hpp1
-rw-r--r--include/SearchBar.hpp13
3 files changed, 13 insertions, 6 deletions
diff --git a/include/Body.hpp b/include/Body.hpp
index 39ad19d..b50b695 100644
--- a/include/Body.hpp
+++ b/include/Body.hpp
@@ -218,7 +218,7 @@ namespace QuickMedia {
void clamp_selection();
// Returns true if the event was handled
- bool on_event(const sf::RenderWindow &window, const sf::Event &event);
+ bool on_event(const sf::RenderWindow &window, const sf::Event &event, bool keyboard_navigation = true);
void draw(sf::RenderWindow &window, sf::Vector2f pos, sf::Vector2f size);
void draw(sf::RenderWindow &window, sf::Vector2f pos, sf::Vector2f size, const Json::Value &content_progress);
// |size| is the clip size, another outside this will be cut off.
@@ -262,6 +262,9 @@ namespace QuickMedia {
sf::Shader *thumbnail_mask_shader;
AttachSide attach_side = AttachSide::TOP;
bool title_mark_urls = false;
+
+ std::function<void()> on_top_reached = nullptr;
+ std::function<void()> on_bottom_reached = nullptr;
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, bool merge_with_previous = false);
void update_dirty_state(BodyItem *body_item, float width);
diff --git a/include/QuickMedia.hpp b/include/QuickMedia.hpp
index 5d5f613..30836aa 100644
--- a/include/QuickMedia.hpp
+++ b/include/QuickMedia.hpp
@@ -66,6 +66,7 @@ namespace QuickMedia {
FetchType fetch_type;
bool typing = false;
bool fetching_next_page_running = false;
+ bool fetching_next_page_failed = false;
int fetched_page = 0;
sf::Text search_result_text;
AsyncTask<FetchResult> fetch_future;
diff --git a/include/SearchBar.hpp b/include/SearchBar.hpp
index 06c4c98..cad897f 100644
--- a/include/SearchBar.hpp
+++ b/include/SearchBar.hpp
@@ -23,7 +23,7 @@ namespace QuickMedia {
class SearchBar {
public:
SearchBar(sf::Texture *plugin_logo, sf::Shader *rounded_rectangle_shader, const std::string &placeholder, bool input_masked = false);
- void draw(sf::RenderWindow &window, bool draw_shadow = true);
+ void draw(sf::RenderWindow &window, sf::Vector2f size, bool draw_background);
void on_event(sf::Event &event);
void update();
void onWindowResize(const sf::Vector2f &window_size);
@@ -32,7 +32,7 @@ namespace QuickMedia {
bool is_cursor_at_start_of_line() const;
void set_to_autocomplete();
void set_autocomplete_text(const std::string &text);
- void set_vertical_position(float vertical_pos);
+ void set_position(sf::Vector2f pos);
float getBottom() const;
float getBottomWithoutShadow() const;
@@ -46,6 +46,10 @@ namespace QuickMedia {
int text_autosearch_delay;
int autocomplete_search_delay;
bool caret_visible;
+
+ float padding_top = 0.0f;
+ float padding_bottom = 0.0f;
+ float padding_x = 10.0f;
private:
void onTextEntered(sf::Uint32 codepoint);
void clear_autocomplete_if_text_not_substring();
@@ -54,7 +58,6 @@ namespace QuickMedia {
sf::Text text;
sf::Text autocomplete_text;
RoundedRectangle background;
- sf::RectangleShape background_shadow;
sf::RectangleShape shade;
sf::RectangleShape caret;
sf::Sprite plugin_logo_sprite;
@@ -68,8 +71,8 @@ namespace QuickMedia {
bool typing;
bool backspace_pressed;
bool mouse_left_inside;
- float vertical_pos;
+ sf::Vector2f pos;
sf::Clock time_since_search_update;
- sf::Vector2u prev_window_size;
+ sf::Vector2f prev_size;
};
} \ No newline at end of file