2023-02-28 21:30:51 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#define WLR_USE_UNSTABLE
|
|
|
|
|
2023-05-01 03:57:48 +02:00
|
|
|
#include <hyprland/src/render/decorations/IHyprWindowDecoration.hpp>
|
|
|
|
#include <hyprland/src/render/OpenGL.hpp>
|
2024-05-14 23:40:06 +02:00
|
|
|
#include <hyprland/src/devices/IPointer.hpp>
|
2023-02-28 22:59:58 +01:00
|
|
|
#include "globals.hpp"
|
2023-02-28 21:30:51 +01:00
|
|
|
|
|
|
|
class CHyprBar : public IHyprWindowDecoration {
|
|
|
|
public:
|
2024-04-27 14:03:46 +02:00
|
|
|
CHyprBar(PHLWINDOW);
|
2023-02-28 21:30:51 +01:00
|
|
|
virtual ~CHyprBar();
|
|
|
|
|
2023-11-11 15:39:46 +01:00
|
|
|
virtual SDecorationPositioningInfo getPositioningInfo();
|
2023-02-28 21:30:51 +01:00
|
|
|
|
2023-11-11 15:39:46 +01:00
|
|
|
virtual void onPositioningReply(const SDecorationPositioningReply& reply);
|
2023-02-28 21:30:51 +01:00
|
|
|
|
2024-10-31 12:18:29 +01:00
|
|
|
virtual void draw(PHLMONITOR, float const& a);
|
2023-02-28 21:30:51 +01:00
|
|
|
|
2023-11-11 15:39:46 +01:00
|
|
|
virtual eDecorationType getDecorationType();
|
2023-02-28 21:30:51 +01:00
|
|
|
|
2024-04-27 14:03:46 +02:00
|
|
|
virtual void updateWindow(PHLWINDOW);
|
2023-02-28 21:30:51 +01:00
|
|
|
|
2023-11-11 15:39:46 +01:00
|
|
|
virtual void damageEntire();
|
2023-02-28 21:30:51 +01:00
|
|
|
|
2023-11-11 15:39:46 +01:00
|
|
|
virtual eDecorationLayer getDecorationLayer();
|
2023-11-04 14:15:30 +01:00
|
|
|
|
2023-11-11 15:39:46 +01:00
|
|
|
virtual uint64_t getDecorationFlags();
|
2023-02-28 23:53:49 +01:00
|
|
|
|
2023-11-11 15:39:46 +01:00
|
|
|
bool m_bButtonsDirty = true;
|
2023-10-29 23:31:11 +01:00
|
|
|
|
2023-12-29 10:31:24 +01:00
|
|
|
virtual std::string getDisplayName();
|
|
|
|
|
2024-04-27 14:03:46 +02:00
|
|
|
PHLWINDOW getOwner();
|
2024-03-21 19:58:10 +01:00
|
|
|
|
2024-08-08 20:59:51 +02:00
|
|
|
void updateRules();
|
|
|
|
void applyRule(const SWindowRule&);
|
2024-05-02 03:31:33 +02:00
|
|
|
|
2023-02-28 21:30:51 +01:00
|
|
|
private:
|
2024-08-08 20:59:51 +02:00
|
|
|
SBoxExtents m_seExtents;
|
2023-02-28 21:30:51 +01:00
|
|
|
|
2024-08-08 20:59:51 +02:00
|
|
|
PHLWINDOWREF m_pWindow;
|
2023-02-28 21:30:51 +01:00
|
|
|
|
2024-08-08 20:59:51 +02:00
|
|
|
CBox m_bAssignedBox;
|
2023-02-28 21:30:51 +01:00
|
|
|
|
2024-08-08 20:59:51 +02:00
|
|
|
SP<CTexture> m_pTextTex;
|
|
|
|
SP<CTexture> m_pButtonsTex;
|
2023-02-28 21:30:51 +01:00
|
|
|
|
2024-08-08 20:59:51 +02:00
|
|
|
bool m_bWindowSizeChanged = false;
|
|
|
|
bool m_bHidden = false;
|
|
|
|
bool m_bTitleColorChanged = false;
|
|
|
|
std::optional<CColor> m_bForcedBarColor;
|
|
|
|
std::optional<CColor> m_bForcedTitleColor;
|
2023-02-28 22:17:46 +01:00
|
|
|
|
2024-08-08 20:59:51 +02:00
|
|
|
Vector2D cursorRelativeToBar();
|
2023-02-28 22:59:58 +01:00
|
|
|
|
2024-08-08 20:59:51 +02:00
|
|
|
void renderBarTitle(const Vector2D& bufferSize, const float scale);
|
|
|
|
void renderText(SP<CTexture> out, const std::string& text, const CColor& color, const Vector2D& bufferSize, const float scale, const int fontSize);
|
|
|
|
void renderBarButtons(const Vector2D& bufferSize, const float scale);
|
|
|
|
void renderBarButtonsText(CBox* barBox, const float scale, const float a);
|
|
|
|
void onMouseDown(SCallbackInfo& info, IPointer::SButtonEvent e);
|
|
|
|
void onMouseMove(Vector2D coords);
|
|
|
|
CBox assignedBoxGlobal();
|
2023-02-28 22:59:58 +01:00
|
|
|
|
2024-08-08 20:59:51 +02:00
|
|
|
SP<HOOK_CALLBACK_FN> m_pMouseButtonCallback;
|
|
|
|
SP<HOOK_CALLBACK_FN> m_pMouseMoveCallback;
|
2023-02-28 22:59:58 +01:00
|
|
|
|
2024-08-08 20:59:51 +02:00
|
|
|
std::string m_szLastTitle;
|
2023-02-28 23:53:49 +01:00
|
|
|
|
2024-08-08 20:59:51 +02:00
|
|
|
bool m_bDraggingThis = false;
|
|
|
|
bool m_bDragPending = false;
|
|
|
|
bool m_bCancelledDown = false;
|
2023-10-29 23:57:55 +01:00
|
|
|
|
|
|
|
// for dynamic updates
|
|
|
|
int m_iLastHeight = 0;
|
2023-08-17 10:10:33 +02:00
|
|
|
};
|