mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:47:35 +00:00
LibCards: Add support for card dragging
Solitaire and Spider have almost identical code for dragging cards from one stack to another, so it makes sense to move that here. But using the term "moving" for them, instead of "focused" which (to me at least) was not clear what it meant.
This commit is contained in:
parent
5960c0556f
commit
a2f0b67aea
2 changed files with 74 additions and 0 deletions
|
@ -27,6 +27,16 @@ public:
|
|||
void add_stack(NonnullRefPtr<CardStack>);
|
||||
void mark_intersecting_stacks_dirty(Card const& intersecting_card);
|
||||
|
||||
bool is_moving_cards() const { return !m_moving_cards.is_empty(); }
|
||||
NonnullRefPtrVector<Card>& moving_cards() { return m_moving_cards; }
|
||||
NonnullRefPtrVector<Card> const& moving_cards() const { return m_moving_cards; }
|
||||
Gfx::IntRect moving_cards_bounds() const;
|
||||
RefPtr<CardStack> moving_cards_source_stack() const { return m_moving_cards_source_stack; }
|
||||
void pick_up_cards_from_stack(CardStack&, Gfx::IntPoint click_location, CardStack::MovementRule);
|
||||
RefPtr<CardStack> find_stack_to_drop_on(CardStack::MovementRule) const;
|
||||
void drop_cards_on_stack(CardStack&, CardStack::MovementRule);
|
||||
void clear_moving_cards();
|
||||
|
||||
void dump_layout() const;
|
||||
|
||||
protected:
|
||||
|
@ -36,6 +46,9 @@ private:
|
|||
virtual void config_string_did_change(String const& domain, String const& group, String const& key, String const& value) override;
|
||||
|
||||
NonnullRefPtrVector<CardStack> m_stacks;
|
||||
|
||||
NonnullRefPtrVector<Card> m_moving_cards;
|
||||
RefPtr<CardStack> m_moving_cards_source_stack;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue