1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-02 16:38:41 +00: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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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") {