hyprlock/src/renderer/widgets/PasswordInputField.hpp

67 lines
1.7 KiB
C++
Raw Normal View History

2024-02-19 00:08:03 +01:00
#pragma once
#include "IWidget.hpp"
#include "../../helpers/Vector2D.hpp"
#include "../../helpers/Color.hpp"
#include <chrono>
#include <vector>
#include <any>
#include <unordered_map>
2024-02-19 00:08:03 +01:00
2024-02-19 23:58:59 +01:00
struct SPreloadedAsset;
2024-02-19 00:08:03 +01:00
class CPasswordInputField : public IWidget {
public:
CPasswordInputField(const Vector2D& viewport, const std::unordered_map<std::string, std::any>& props);
2024-02-19 00:08:03 +01:00
2024-02-19 17:26:08 +01:00
virtual bool draw(const SRenderData& data);
2024-02-19 00:08:03 +01:00
private:
void updateDots();
2024-02-19 02:22:22 +01:00
void updateFade();
void updateFailTex();
2024-02-20 15:42:04 +01:00
void updateHiddenInputState();
2024-02-19 00:08:03 +01:00
Vector2D size;
Vector2D pos;
2024-02-20 15:42:04 +01:00
Vector2D viewport;
2024-02-19 00:08:03 +01:00
float dt_size, dt_space;
2024-02-19 00:08:03 +01:00
int out_thick;
CColor inner, outer, font;
2024-02-19 00:08:03 +01:00
struct {
float currentAmount = 0;
float speedPerSecond = 5; // actually per... something. I am unsure xD
std::chrono::system_clock::time_point lastFrame;
2024-02-21 12:42:18 +01:00
bool center = false;
} dots;
2024-02-19 00:08:03 +01:00
2024-02-19 02:22:22 +01:00
struct {
std::chrono::system_clock::time_point start;
float a = 0;
bool appearing = true;
bool animated = false;
} fade;
2024-02-19 23:58:59 +01:00
struct {
std::string resourceID = "";
SPreloadedAsset* asset = nullptr;
std::string failID = "";
SPreloadedAsset* failAsset = nullptr;
bool canGetNewFail = true;
2024-02-19 23:58:59 +01:00
} placeholder;
2024-02-20 15:42:04 +01:00
struct {
CColor lastColor;
int lastQuadrant = 0;
int lastPasswordLength = 0;
bool enabled = false;
} hiddenInputState;
bool fadeOnEmpty;
};