aboutsummaryrefslogtreecommitdiff
path: root/include/Tabs.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-06-04 19:22:04 +0200
committerdec05eba <dec05eba@protonmail.com>2021-06-04 19:22:04 +0200
commit59e4ce5c35e7e5a73d61e7111e8d4f07d63b7056 (patch)
treea8465d03cc8e6de2999c2fd22bbc83592e7ddd06 /include/Tabs.hpp
parent31efd6ba39036291955babd900c86a897c5cbd86 (diff)
Add grid view
Diffstat (limited to 'include/Tabs.hpp')
-rw-r--r--include/Tabs.hpp13
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;