blob: a1ae6951305d66b39b2196ef19d61bab30b088f3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
#pragma once
#include "SharedDefines.hpp"
#include "../desktop/DesktopTypes.hpp"
#include "../render/Texture.hpp"
#include "../helpers/time/Time.hpp"
namespace Notification {
class CNotification {
public:
CNotification(std::string&& text, float timeout, CHyprColor color, eIcons icon, float fontSize);
struct SRenderCache {
SP<Render::ITexture> textTex;
SP<Render::ITexture> iconTex;
Vector2D textSize = {};
Vector2D iconSize = {};
PHLMONITORREF monitor;
std::string fontFamily;
int fontSizePx = -1;
eIconBackend iconBackend = ICONS_BACKEND_NONE;
} m_cache;
void setText(std::string&& text);
void setColor(CHyprColor color);
void setIcon(eIcons icon);
void setFontSize(float fontSize);
void resetTimeout(float timeMs);
const std::string& text() const;
const CHyprColor& color() const;
eIcons icon() const;
float fontSize() const;
float timeMs() const;
float timeElapsedSinceCreationMs() const;
float timeElapsedMs() const;
bool gone() const;
// lock the notification - stops the timer.
bool isLocked() const;
void lock();
void unlock();
private:
const Time::steady_tp m_createdAt = Time::steadyNow();
std::string m_text = "";
CHyprColor m_color;
eIcons m_icon = ICON_NONE;
float m_fontSize = 13.F;
Time::steady_tp m_startedAt = Time::steadyNow();
float m_timeMs = 0.F;
float m_lastPauseElapsed = 0.F;
size_t m_pauseLocks = 0;
};
}
|