2023-05-16 03:02:26 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <hyprland/src/helpers/AnimatedVariable.hpp>
|
|
|
|
#include <hyprland/src/helpers/Vector2D.hpp>
|
2023-05-25 02:27:02 -07:00
|
|
|
#include <list>
|
2023-05-16 03:02:26 -07:00
|
|
|
|
|
|
|
class Hy3TabGroup;
|
2023-05-25 02:27:02 -07:00
|
|
|
class Hy3TabBar;
|
2023-05-16 03:02:26 -07:00
|
|
|
|
|
|
|
#include "Hy3Layout.hpp"
|
|
|
|
#include <hyprland/src/render/Texture.hpp>
|
|
|
|
|
|
|
|
struct Hy3TabBarEntry {
|
|
|
|
std::string window_title;
|
|
|
|
bool urgent = false;
|
2023-05-25 02:27:02 -07:00
|
|
|
CAnimatedVariable offset; // offset 0, 0.0-1.0 of total bar
|
|
|
|
CAnimatedVariable width; // 0.0-1.0 of total bar
|
|
|
|
Hy3TabBar& tab_bar;
|
|
|
|
Hy3Node& node; // only used for comparioson. do not deref.
|
|
|
|
|
|
|
|
Hy3TabBarEntry(Hy3TabBar&, Hy3Node&);
|
|
|
|
bool operator==(const Hy3Node& node) const;
|
2023-05-16 03:02:26 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class Hy3TabBar {
|
|
|
|
public:
|
2023-05-25 02:27:02 -07:00
|
|
|
CTexture mask_texture;
|
|
|
|
CAnimatedVariable vertical_pos;
|
|
|
|
CAnimatedVariable fade_opacity;
|
|
|
|
|
|
|
|
Hy3TabBar();
|
2023-05-16 03:02:26 -07:00
|
|
|
|
2023-05-25 02:27:02 -07:00
|
|
|
void focusNode(Hy3Node*);
|
|
|
|
void updateNodeList(std::list<Hy3Node*>& nodes);
|
|
|
|
void updateAnimations(bool warp = false);
|
2023-05-16 03:02:26 -07:00
|
|
|
void setSize(Vector2D);
|
|
|
|
|
2023-05-25 02:27:02 -07:00
|
|
|
// Redraw the mask texture if necessary, and bind it to GL_TEXTURE_2D
|
|
|
|
void prepareMask();
|
|
|
|
|
2023-05-16 03:02:26 -07:00
|
|
|
private:
|
2023-05-25 02:27:02 -07:00
|
|
|
bool need_mask_redraw = false;
|
|
|
|
int last_mask_rounding = 0;
|
|
|
|
|
|
|
|
Hy3Node* focused_node = nullptr;
|
|
|
|
CAnimatedVariable focus_opacity;
|
|
|
|
CAnimatedVariable focus_start;
|
|
|
|
CAnimatedVariable focus_end;
|
2023-05-16 03:02:26 -07:00
|
|
|
|
2023-05-25 02:27:02 -07:00
|
|
|
std::list<Hy3TabBarEntry> entries;
|
2023-05-16 03:02:26 -07:00
|
|
|
Vector2D size;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Hy3TabGroup {
|
|
|
|
public:
|
|
|
|
Hy3TabBar bar;
|
|
|
|
CAnimatedVariable pos;
|
|
|
|
CAnimatedVariable size;
|
|
|
|
|
|
|
|
// initialize a group with the given node. UB if node is not a group.
|
|
|
|
Hy3TabGroup(Hy3Node&);
|
|
|
|
|
|
|
|
// update tab bar with node position and data. UB if node is not a group.
|
|
|
|
void updateWithGroup(Hy3Node&);
|
|
|
|
// render the scaled tab bar on the current monitor.
|
|
|
|
void renderTabBar();
|
|
|
|
|
|
|
|
private:
|
|
|
|
// moving a Hy3TabGroup will unregister any active animations
|
|
|
|
Hy3TabGroup(Hy3TabGroup&&) = delete;
|
|
|
|
};
|