1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-27 05:45:18 +01:00

Add focused styling to buttons (#13414)

This commit is contained in:
rubenwardy
2023-04-14 00:09:29 +01:00
committed by GitHub
parent 2a1bc82887
commit 9d1ae80e89
7 changed files with 31 additions and 8 deletions

View File

@@ -61,13 +61,16 @@ public:
NUM_PROPERTIES,
NONE
};
enum State
// State is a bitfield, it's possible to have multiple of these at once
enum State : u8
{
STATE_DEFAULT = 0,
STATE_HOVERED = 1 << 0,
STATE_PRESSED = 1 << 1,
NUM_STATES = 1 << 2,
STATE_INVALID = 1 << 3,
STATE_FOCUSED = 1 << 0,
STATE_HOVERED = 1 << 1,
STATE_PRESSED = 1 << 2,
NUM_STATES = 1 << 3, // This includes all permutations
STATE_INVALID = 1 << 4,
};
private:
@@ -150,6 +153,8 @@ public:
{
if (name == "default") {
return STATE_DEFAULT;
} else if (name == "focused") {
return STATE_FOCUSED;
} else if (name == "hovered") {
return STATE_HOVERED;
} else if (name == "pressed") {