diff options
Diffstat (limited to 'include/Tabs.hpp')
-rw-r--r-- | include/Tabs.hpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/include/Tabs.hpp b/include/Tabs.hpp index ec5ab96..f7c3054 100644 --- a/include/Tabs.hpp +++ b/include/Tabs.hpp @@ -13,6 +13,8 @@ namespace sf { } namespace QuickMedia { + class Body; + class Tabs { public: Tabs(sf::Shader *rounded_rectangle_shader, sf::Color shade_color = sf::Color(33, 37, 44)); @@ -21,7 +23,7 @@ namespace QuickMedia { static float get_shade_height(); // Returns the id (index) of the tab. The ids start from 0 - int add_tab(const std::string &title); + int add_tab(const std::string &title, Body *body); void on_event(sf::Event &event); void draw(sf::RenderWindow &window, sf::Vector2f pos, float width); @@ -32,10 +34,15 @@ namespace QuickMedia { std::function<void(int)> on_change_tab = nullptr; private: + void move_selected_tab(int new_tab); float tab_index_to_x_offset(int index); private: - std::vector<sf::Text> tab_texts; - std::vector<std::string> tab_labels_utf8; + struct Tab { + sf::Text text; + std::string label_utf8; // TODO: Remove + Body *body; + }; + std::vector<Tab> tabs; RoundedRectangle background; sf::RectangleShape shade; int selected_tab = 0; |