hyprland-plugins/hyprbars/barDeco.hpp

66 lines
2.2 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();
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
2023-11-11 15:39:46 +01:00
virtual void draw(CMonitor*, float a, const Vector2D& offset);
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
2023-11-11 15:39:46 +01:00
virtual void updateWindow(CWindow*);
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-02-28 21:30:51 +01:00
private:
SWindowDecorationExtents m_seExtents;
CWindow* m_pWindow = nullptr;
2023-11-11 15:39:46 +01:00
CBox m_bAssignedBox;
2023-02-28 21:30:51 +01:00
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);
2023-11-04 18:22:55 +01:00
void renderBarButtonsText(CBox* barBox, const float scale, const float a);
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-11-11 15:39:46 +01:00
CBox assignedBoxGlobal();
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;
};