hyprland-plugins/hyprbars/barDeco.hpp

73 lines
2.4 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:
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-03-31 03:18:20 +02:00
virtual void draw(CMonitor*, float 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;
virtual std::string getDisplayName();
2024-04-27 14:03:46 +02:00
PHLWINDOW getOwner();
void setHidden(bool hidden);
2023-02-28 21:30:51 +01:00
private:
2024-05-08 14:48:33 +02:00
SWindowDecorationExtents m_seExtents;
2023-02-28 21:30:51 +01:00
2024-05-08 14:48:33 +02:00
PHLWINDOWREF m_pWindow;
2023-02-28 21:30:51 +01:00
2024-05-08 14:48:33 +02:00
CBox m_bAssignedBox;
2023-02-28 21:30:51 +01:00
2024-05-08 14:48:33 +02:00
CTexture m_tTextTex;
CTexture m_tButtonsTex;
2023-02-28 21:30:51 +01:00
2024-05-08 14:48:33 +02:00
bool m_bWindowSizeChanged = false;
bool m_bHidden = false;
2023-02-28 22:17:46 +01:00
2024-05-08 14:48:33 +02:00
Vector2D cursorRelativeToBar();
2023-02-28 22:59:58 +01:00
2024-05-08 14:48:33 +02:00
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(CBox* barBox, const float scale, const float a);
void onMouseDown(SCallbackInfo& info, wlr_pointer_button_event* e);
void onMouseMove(Vector2D coords);
CBox assignedBoxGlobal();
2023-02-28 22:59:58 +01:00
2024-05-08 14:48:33 +02:00
SP<HOOK_CALLBACK_FN> m_pMouseButtonCallback;
SP<HOOK_CALLBACK_FN> m_pMouseMoveCallback;
2023-02-28 22:59:58 +01:00
2024-05-08 14:48:33 +02:00
std::string m_szLastTitle;
2023-02-28 23:53:49 +01:00
2024-05-08 14:48:33 +02:00
bool m_bDraggingThis = false;
bool m_bDragPending = false;
bool m_bCancelledDown = false;
// for dynamic updates
int m_iLastHeight = 0;
};