hyprland-plugins/hyprbars/barDeco.hpp

64 lines
2.1 KiB
C++
Raw Normal View History

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>
2023-02-28 22:59:58 +01:00
#include "globals.hpp"
2023-02-28 21:30:51 +01:00
class CHyprBar : public IHyprWindowDecoration {
public:
CHyprBar(CWindow*);
virtual ~CHyprBar();
virtual SWindowDecorationExtents getWindowDecorationExtents();
virtual void draw(CMonitor*, float a, const Vector2D& offset);
virtual eDecorationType getDecorationType();
virtual void updateWindow(CWindow*);
virtual void damageEntire();
virtual SWindowDecorationExtents getWindowDecorationReservedArea();
2023-02-28 23:53:49 +01:00
virtual bool allowsInput();
bool m_bButtonsDirty = true;
2023-02-28 21:30:51 +01:00
private:
SWindowDecorationExtents m_seExtents;
CWindow* m_pWindow = nullptr;
Vector2D m_vLastWindowPos;
Vector2D m_vLastWindowSize;
CTexture m_tTextTex;
2023-02-28 22:59:58 +01:00
CTexture m_tButtonsTex;
2023-02-28 21:30:51 +01:00
2023-02-28 22:17:46 +01:00
bool m_bWindowSizeChanged = false;
2023-02-28 22:59:58 +01:00
Vector2D cursorRelativeToBar();
void renderBarTitle(const Vector2D& bufferSize, const float scale);
void renderText(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(wlr_box* barBox, const float scale);
2023-10-29 18:33:32 +01:00
void onMouseDown(SCallbackInfo& info, wlr_pointer_button_event* e);
2023-02-28 23:53:49 +01:00
void onMouseMove(Vector2D coords);
2023-02-28 22:59:58 +01:00
HOOK_CALLBACK_FN* m_pMouseButtonCallback;
2023-02-28 23:53:49 +01:00
HOOK_CALLBACK_FN* m_pMouseMoveCallback;
2023-02-28 22:59:58 +01:00
2023-02-28 21:30:51 +01:00
std::string m_szLastTitle;
2023-02-28 23:53:49 +01:00
2023-10-29 18:33:32 +01:00
bool m_bDraggingThis = false;
bool m_bDragPending = false;
bool m_bCancelledDown = false;
// for dynamic updates
int m_iLastHeight = 0;
};