Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
hover_cursor.hpp
Go to the documentation of this file.
1#pragma once
2
17
18#include <optional>
19
21#include <pulp/view/view.hpp>
22
23namespace pulp::view {
24
30
39public:
42 pointer_ = p;
43 has_pointer_ = true;
44 }
45
49 has_pointer_ = false;
50 published_ = false;
51 }
52
53 bool has_pointer() const { return has_pointer_; }
54 Point pointer() const { return pointer_; }
55
59 last_ = style;
60 published_ = true;
61 }
62
64 View::CursorStyle published() const { return last_; }
65
71 std::optional<View::CursorStyle> poll_resolved(View::CursorStyle style);
72
77 std::optional<View::CursorStyle> poll(View& root);
78
79private:
80 Point pointer_{};
81 bool has_pointer_ = false;
82 bool published_ = false;
84};
85
86} // namespace pulp::view
Remembers the pointer position and the style last handed to the platform.
Definition hover_cursor.hpp:38
void set_pointer(Point p)
Record that the pointer is over the surface at p (root coordinates).
Definition hover_cursor.hpp:41
bool has_pointer() const
Definition hover_cursor.hpp:53
std::optional< View::CursorStyle > poll(View &root)
Re-resolve at the remembered pointer position and report a change.
std::optional< View::CursorStyle > poll_resolved(View::CursorStyle style)
Change detection over a style the caller resolved itself.
Point pointer() const
Definition hover_cursor.hpp:54
void clear_pointer()
The pointer left the surface.
Definition hover_cursor.hpp:48
void note_published(View::CursorStyle style)
Record a style the host just pushed to the platform itself, so the next poll does not push the same s...
Definition hover_cursor.hpp:58
View::CursorStyle published() const
The style last pushed to the platform, or default_ before any push.
Definition hover_cursor.hpp:64
Definition view.hpp:73
CursorStyle
Cursor style hint (CSS cursor property).
Definition view.hpp:2741
@ default_
Definition view.hpp:2742
Hover-cursor tracking for platform window hosts.
Definition fwd.hpp:27
View::CursorStyle hover_cursor_at(View &root, Point p)
The cursor style a pointer at p (root-view coordinates) should show over root: the style of the view ...
@ p
Definition input_events.hpp:40
Definition geometry.hpp:20