diff options
| author | Dashie <fabio.lenherr@gmail.com> | 2024-02-21 12:07:39 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-21 11:07:39 +0000 |
| commit | ddf022d61c63fb36b4abba392682772690c06b5c (patch) | |
| tree | 0ffae6bc4ae3ab1cf8b2b9df3a1164ed5848e88a /src/config/ConfigDataValues.hpp | |
| parent | 13d985489788fa5349b3457d6eb1c19bad8f37e9 (diff) | |
feat: Add css style gaps (#4723)
Diffstat (limited to 'src/config/ConfigDataValues.hpp')
| -rw-r--r-- | src/config/ConfigDataValues.hpp | 58 |
1 files changed, 56 insertions, 2 deletions
diff --git a/src/config/ConfigDataValues.hpp b/src/config/ConfigDataValues.hpp index 14b5e51d..13277d10 100644 --- a/src/config/ConfigDataValues.hpp +++ b/src/config/ConfigDataValues.hpp @@ -1,10 +1,12 @@ #pragma once #include "../defines.hpp" +#include "helpers/VarList.hpp" #include <vector> enum eConfigValueDataTypes { - CVD_TYPE_INVALID = -1, - CVD_TYPE_GRADIENT = 0 + CVD_TYPE_INVALID = -1, + CVD_TYPE_GRADIENT = 0, + CVD_TYPE_CSS_VALUE = 1 }; class ICustomConfigValueData { @@ -50,3 +52,55 @@ class CGradientValueData : public ICustomConfigValueData { return true; } }; + +class CCssGapData : public ICustomConfigValueData { + public: + CCssGapData() : top(0), right(0), bottom(0), left(0){}; + CCssGapData(int64_t global) : top(global), right(global), bottom(global), left(global){}; + CCssGapData(int64_t vertical, int64_t horizontal) : top(vertical), right(horizontal), bottom(vertical), left(horizontal){}; + CCssGapData(int64_t top, int64_t horizontal, int64_t bottom) : top(top), right(horizontal), bottom(bottom), left(horizontal){}; + CCssGapData(int64_t top, int64_t right, int64_t bottom, int64_t left) : top(top), right(right), bottom(bottom), left(left){}; + + /* Css like directions */ + int64_t top; + int64_t right; + int64_t bottom; + int64_t left; + + void parseGapData(CVarList varlist) { + switch (varlist.size()) { + case 1: { + *this = CCssGapData(std::stoi(varlist[0])); + break; + } + case 2: { + *this = CCssGapData(std::stoi(varlist[0]), std::stoi(varlist[1])); + break; + } + case 3: { + *this = CCssGapData(std::stoi(varlist[0]), std::stoi(varlist[1]), std::stoi(varlist[2])); + break; + } + case 4: { + *this = CCssGapData(std::stoi(varlist[0]), std::stoi(varlist[1]), std::stoi(varlist[2]), std::stoi(varlist[3])); + break; + } + default: { + Debug::log(WARN, "Too many arguments provided for gaps."); + *this = CCssGapData(std::stoi(varlist[0]), std::stoi(varlist[1]), std::stoi(varlist[2]), std::stoi(varlist[3])); + break; + } + } + } + + void reset(int64_t global) { + top = global; + right = global; + bottom = global; + left = global; + } + + virtual eConfigValueDataTypes getDataType() { + return CVD_TYPE_CSS_VALUE; + } +}; |
