summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCards/CardStack.h
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2023-01-05 10:16:16 -0500
committerAndreas Kling <kling@serenityos.org>2023-01-06 12:02:10 +0100
commit4cbdc747abbef74a3de8b05428fa5c0ca0dd09ba (patch)
tree47353fcaf7e5fc1bd8bd8d40b41cd480a503730a /Userland/Libraries/LibCards/CardStack.h
parent8d8fcd0d648d3b851283d1122f6294ca80181c92 (diff)
downloadserenity-4cbdc747abbef74a3de8b05428fa5c0ca0dd09ba.zip
LibCards+Solitaire: Elevate card highlight management to the card stack
Instead of indicating which individual cards should be highlighted, card games now indicate which stack is highlighted. This lets the stack draw empty stacks with a highlight (e.g. the Foundation stack in Solitaire). If the stack is non-empty, the stack can delegate highlighting to the top-most card.
Diffstat (limited to 'Userland/Libraries/LibCards/CardStack.h')
-rw-r--r--Userland/Libraries/LibCards/CardStack.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibCards/CardStack.h b/Userland/Libraries/LibCards/CardStack.h
index b558c18a19..bebbb10a39 100644
--- a/Userland/Libraries/LibCards/CardStack.h
+++ b/Userland/Libraries/LibCards/CardStack.h
@@ -53,6 +53,8 @@ public:
void paint(GUI::Painter&, Gfx::Color background_color);
void clear();
+ void set_highlighted(bool highlighted) { m_highlighted = highlighted; }
+
private:
struct StackRules {
uint8_t shift_x { 0 };
@@ -92,6 +94,7 @@ private:
Type m_type { Type::Invalid };
StackRules m_rules;
Gfx::IntRect m_base;
+ bool m_highlighted { false };
};
}