Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::view::ComponentDragger Class Reference

#include <component_dragger.hpp>

Public Member Functions

 ComponentDragger ()=default
void start_dragging (View &view, Point mouse_local)
 Begin a drag gesture.
void drag_view (View &view, Point mouse_local)
 Continue a drag gesture.
void end_dragging ()
 End the gesture.
void set_constrain_to_parent (bool yes)
 When true (the default), drag_view clamps the dragged view's origin so it stays fully inside the parent's local bounds.
bool constrain_to_parent () const
bool is_dragging () const
Point mouse_start () const
 Mouse-local press position captured at start_dragging.
Rect bounds_start () const
 Dragged view's bounds captured at start_dragging.

Public Attributes

std::function< void(Rect)> on_drag
 Optional callbacks for tests / app glue.
std::function< void()> on_end

Constructor & Destructor Documentation

◆ ComponentDragger()

pulp::view::ComponentDragger::ComponentDragger ( )
default

Member Function Documentation

◆ bounds_start()

Rect pulp::view::ComponentDragger::bounds_start ( ) const
inline

Dragged view's bounds captured at start_dragging.

◆ constrain_to_parent()

bool pulp::view::ComponentDragger::constrain_to_parent ( ) const
inline

◆ drag_view()

void pulp::view::ComponentDragger::drag_view ( View & view,
Point mouse_local )
inline

Continue a drag gesture.

Moves the view's bounds so the press position stays under the cursor. Honors constrain_to_parent(). No-op when not currently dragging.

◆ end_dragging()

void pulp::view::ComponentDragger::end_dragging ( )
inline

End the gesture.

Subsequent drag_view calls become no-ops until the next start_dragging.

◆ is_dragging()

bool pulp::view::ComponentDragger::is_dragging ( ) const
inline

◆ mouse_start()

Point pulp::view::ComponentDragger::mouse_start ( ) const
inline

Mouse-local press position captured at start_dragging.

◆ set_constrain_to_parent()

void pulp::view::ComponentDragger::set_constrain_to_parent ( bool yes)
inline

When true (the default), drag_view clamps the dragged view's origin so it stays fully inside the parent's local bounds.

◆ start_dragging()

void pulp::view::ComponentDragger::start_dragging ( View & view,
Point mouse_local )
inline

Begin a drag gesture.

mouse_local is the press position in the dragged view's LOCAL coordinate space (i.e. the same pos value you'd hand to View::on_mouse_down).

Member Data Documentation

◆ on_drag

std::function<void(Rect)> pulp::view::ComponentDragger::on_drag

Optional callbacks for tests / app glue.

◆ on_end

std::function<void()> pulp::view::ComponentDragger::on_end

The documentation for this class was generated from the following file: