1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:28:12 +00:00

GWidget: Add a flag to ignore greediness in GWidget::hit_test()

Normally if a GWidget has the is_greedy_for_hits() flag set, all hit
tests will hit the widget itself instead of its descendants.

Sometimes it may be desirable to override this behavior, and so this
flag now allows you to do that.
This commit is contained in:
Andreas Kling 2019-09-17 20:58:13 +02:00
parent a77814bdee
commit ce44d9a32f
2 changed files with 4 additions and 3 deletions

View file

@ -119,11 +119,12 @@ public:
bool is_focused() const;
void set_focus(bool);
enum class ShouldRespectGreediness { No = 0, Yes };
struct HitTestResult {
GWidget* widget { nullptr };
Point local_position;
};
HitTestResult hit_test(const Point&);
HitTestResult hit_test(const Point&, ShouldRespectGreediness = ShouldRespectGreediness::Yes);
GWidget* child_at(const Point&) const;
void set_relative_rect(const Rect&);