gtkmm: Gtk::EventControllerScroll Class Reference

Event controller for scroll events. More...

#include <gtkmm/eventcontrollerscroll.h>

Inheritance diagram for Gtk::EventControllerScroll:

Public Types

enum  Flags {

  Flags::NONE = 0x0,

  Flags::VERTICAL = 1 << 0,

  Flags::HORIZONTAL = 1 << 1,

  Flags::DISCRETE = 1 << 2,

  Flags::KINETIC = 1 << 3,

  Flags::BOTH_AXES = 0x3

}
 Describes the behavior of a Gtk::EventControllerScroll. More...

 
- Public Types inherited from Glib::Object
typedef void(*)(gpointer data DestroyNotify)
 
- Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify func_destroy_notify
 
- Public Types inherited from sigc::notifiable
typedef internal::func_destroy_notify func_destroy_notify
 

Public Member Functions

 EventControllerScroll (EventControllerScroll&& src) noexcept
 
EventControllerScrolloperator= (EventControllerScroll&& src) noexcept
 
 ~EventControllerScroll () noexcept override
 
GtkEventControllerScroll* gobj ()
 Provides access to the underlying C GObject. More...

 
const GtkEventControllerScroll* gobj () const
 Provides access to the underlying C GObject. More...

 
GtkEventControllerScroll* gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...

 
void set_flags (Flags flags)
 Sets the flags conditioning scroll controller behavior. More...

 
Flags get_flags () const
 Gets the flags conditioning the scroll controller behavior. More...

 
Glib::PropertyProxy< Flagsproperty_flags ()
 The flags affecting event controller behavior. More...

 
Glib::PropertyProxy_ReadOnly< Flagsproperty_flags () const
 The flags affecting event controller behavior. More...

 
Glib::SignalProxy< void()> signal_scroll_begin ()
 
Glib::SignalProxy< bool(double, double)> signal_scroll ()
 
Glib::SignalProxy< void()> signal_scroll_end ()
 
Glib::SignalProxy< void(double, double)> signal_decelerate ()
 
- Public Member Functions inherited from Gtk::EventController
 EventController (EventController&& src) noexcept
 
EventControlleroperator= (EventController&& src) noexcept
 
 ~EventController () noexcept override
 
GtkEventController* gobj ()
 Provides access to the underlying C GObject. More...

 
const GtkEventController* gobj () const
 Provides access to the underlying C GObject. More...

 
GtkEventController* gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...

 
Widgetget_widget ()
 Returns the Gtk::Widget this controller relates to. More...

 
const Widgetget_widget () const
 Returns the Gtk::Widget this controller relates to. More...

 
void reset ()
 Resets the controller to a clean state. More...

 
PropagationPhase get_propagation_phase () const
 Gets the propagation phase at which controller handles events. More...

 
void set_propagation_phase (PropagationPhase phase)
 Sets the propagation phase at which a controller handles events. More...

 
PropagationLimit get_propagation_limit () const
 Gets the propagation limit of the event controller. More...

 
void set_propagation_limit (PropagationLimit limit)
 Sets the event propagation limit on the event controller. More...

 
Glib::ustring get_name () const
 Gets the name of controller. More...

 
void set_name (const Glib::ustring& name)
 Sets a name on the controller that can be used for debugging. More...

 
Glib::RefPtr< const Gdk::Eventget_current_event () const
 Returns the event that is currently being handled by the controller, and nullptr at other times. More...

 
guint32 get_current_event_time () const
 Returns the timestamp of the event that is currently being handled by the controller, and 0 otherwise. More...

 
Glib::RefPtr< Gdk::Deviceget_current_event_device ()
 Returns the device of the event that is currently being handled by the controller, and nullptr otherwise. More...

 
Glib::RefPtr< const Gdk::Deviceget_current_event_device () const
 Returns the event that is currently being handled by the controller, and nullptr at other times. More...

 
Gdk::ModifierType get_current_event_state () const
 Returns the modifier state of the event that is currently being handled by the controller, and 0 otherwise. More...

 
Glib::PropertyProxy_ReadOnly< Widget* > property_widget () const
 The widget receiving the Gdk::Events that the controller will handle. More...

 
Glib::PropertyProxy< PropagationPhaseproperty_propagation_phase ()
 The propagation phase at which this controller will handle events. More...

 
Glib::PropertyProxy_ReadOnly< PropagationPhaseproperty_propagation_phase () const
 The propagation phase at which this controller will handle events. More...

 
Glib::PropertyProxy< PropagationLimitproperty_propagation_limit ()
 The limit for which events this controller will handle. More...

 
Glib::PropertyProxy_ReadOnly< PropagationLimitproperty_propagation_limit () const
 The limit for which events this controller will handle. More...

 
Glib::PropertyProxy< Glib::ustringproperty_name ()
 The name for this controller, typically used for debugging purposes. More...

 
Glib::PropertyProxy_ReadOnly< Glib::ustringproperty_name () const
 The name for this controller, typically used for debugging purposes. More...

 
- Public Member Functions inherited from Glib::Object
 Object (const Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&src) noexcept
 
Objectoperator= (Object &&src) noexcept
 
void * get_data (const QueryQuark &key)
 
void set_data (const Quark &key, void *data)
 
void set_data (const Quark &key, void *data, DestroyNotify notify)
 
void remove_data (const QueryQuark &quark)
 
void * steal_data (const QueryQuark &quark)
 
Glib::RefPtr< Glib::Objectwrap (GObject *object, bool take_copy=false)
 
- Public Member Functions inherited from Glib::ObjectBase
 ObjectBase (const ObjectBase &)=delete
 
ObjectBaseoperator= (const ObjectBase &)=delete
 
void set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
 
void get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
 
void set_property (const Glib::ustring &property_name, const PropertyType &value)
 
void get_property (const Glib::ustring &property_name, PropertyType &value) const
 
PropertyType get_property (const Glib::ustring &property_name) const
 
sigc::connection connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void()> &slot)
 
sigc::connection connect_property_changed (const Glib::ustring &property_name, sigc::slot< void()> &&slot)
 
void freeze_notify ()
 
void thaw_notify ()
 
virtual void reference () const
 
virtual void unreference () const
 
GObject * gobj ()
 
const GObject * gobj () const
 
GObject * gobj_copy () const
 
- Public Member Functions inherited from sigc::trackable
 trackable () noexcept
 
 trackable (const trackable &src) noexcept
 
 trackable (trackable &&src) noexcept
 
 ~trackable ()
 
void add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const
 
void notify_callbacks ()
 
trackableoperator= (const trackable &src)
 
trackableoperator= (trackable &&src) noexcept
 
void remove_destroy_notify_callback (notifiable *data) const
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system. More...

 
static Glib::RefPtr< EventControllerScrollcreate ()
 
- Static Public Member Functions inherited from Gtk::EventController
static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system. More...

 

Protected Member Functions

 EventControllerScroll ()
 
- Protected Member Functions inherited from Gtk::EventController
 EventController ()
 There is no create() method that corresponds to this constructor, because only derived classes shall be created. More...

 
- Protected Member Functions inherited from Glib::Object
 Object ()
 
 Object (const Glib::ConstructParams &construct_params)
 
 Object (GObject *castitem)
 
 ~Object () noexcept override
 
- Protected Member Functions inherited from Glib::ObjectBase
 ObjectBase ()
 
 ObjectBase (const char *custom_type_name)
 
 ObjectBase (const std::type_info &custom_type_info)
 
 ObjectBase (ObjectBase &&src) noexcept
 
ObjectBaseoperator= (ObjectBase &&src) noexcept
 
virtual ~ObjectBase () noexcept=0
 
void initialize (GObject *castitem)
 
void initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)
 

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Gtk::EventControllerScrollwrap (GtkEventControllerScroll* object, bool take_copy=false)
 A Glib::wrap() method for this object. More...

 

Detailed Description

Event controller for scroll events.

Gtk::EventControllerScroll is an event controller meant to handle scroll events from mice and touchpads. It is capable of handling both discrete and continuous scroll events, abstracting them both on the signal_scroll() signal (deltas in the discrete case are multiples of 1).

In the case of continuous scroll events, EventControllerScroll encloses all signal_scroll() events between two signal_scroll_begin() and signal_scroll_end() signals.

The behavior of the event controller can be modified by the flags given at creation time, or modified at a later point through set_flags() (e.g. because the scrolling conditions of the widget changed).

The controller can be set up to emit motion for either/both vertical and horizontal scroll events through Gtk::EventControllerScroll::Flags::VERTICAL, Gtk::EventControllerScroll::Flags::HORIZONTAL and Gtk::EventControllerScroll::Flags::BOTH_AXES. If any axis is disabled, the respective signal_scroll() delta will be 0. Vertical scroll events will be translated to horizontal motion for the devices incapable of horizontal scrolling.

The event controller can also be forced to emit discrete events on all devices through Gtk::EventControllerScroll::Flags::DISCRETE. This can be used to implement discrete actions triggered through scroll events (e.g. switching across combobox options).

The Gtk::EventControllerScroll::Flags::KINETIC flag toggles the emission of the signal_decelerate() signal, emitted at the end of scrolling with two X/Y velocity arguments that are consistent with the motion that was received.

Since gtkmm 3.94:

Constructor & Destructor Documentation

Gtk::EventControllerScroll::EventControllerScroll ( EventControllerScroll&&  src)
noexcept
Gtk::EventControllerScroll::~EventControllerScroll ( )
overridenoexcept
Gtk::EventControllerScroll::EventControllerScroll ( )
protected

Member Function Documentation

static Glib::RefPtr<EventControllerScroll> Gtk::EventControllerScroll::create ( )
static
Flags Gtk::EventControllerScroll::get_flags ( ) const

Gets the flags conditioning the scroll controller behavior.

Returns
The controller flags.
static GType Gtk::EventControllerScroll::get_type ( )
static

Get the GType for this class, for use with the underlying GObject type system.

GtkEventControllerScroll* Gtk::EventControllerScroll::gobj ( )
inline

Provides access to the underlying C GObject.

const GtkEventControllerScroll* Gtk::EventControllerScroll::gobj ( ) const
inline

Provides access to the underlying C GObject.

GtkEventControllerScroll* Gtk::EventControllerScroll::gobj_copy ( )

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

EventControllerScroll& Gtk::EventControllerScroll::operator= ( EventControllerScroll&&  src)
noexcept
Glib::PropertyProxy< Flags > Gtk::EventControllerScroll::property_flags ( )

The flags affecting event controller behavior.

Default value: Gtk::EventControllerScroll::Flags::NONE

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< Flags > Gtk::EventControllerScroll::property_flags ( ) const

The flags affecting event controller behavior.

Default value: Gtk::EventControllerScroll::Flags::NONE

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
void Gtk::EventControllerScroll::set_flags ( Flags  flags)

Sets the flags conditioning scroll controller behavior.

Parameters
flagsBehavior flags.
Glib::SignalProxy<void(double, double)> Gtk::EventControllerScroll::signal_decelerate ( )
Slot Prototype:
void on_my_decelerate(double vel_x, double vel_y)

Flags: Run First

Emitted after scroll is finished if the Gtk::EventControllerScroll::Flags::KINETIC flag is set. vel_x and vel_y express the initial velocity that was imprinted by the scroll events. vel_x and vel_y are expressed in pixels/ms.

Parameters
vel_xX velocity.
vel_yY velocity.
Glib::SignalProxy<bool(double, double)> Gtk::EventControllerScroll::signal_scroll ( )
Slot Prototype:
bool on_my_scroll(double dx, double dy)

Flags: Run Last

Signals that the widget should scroll by the amount specified by dx and dy.

Parameters
dxX delta.
dyY delta.
Returns
true if the scroll event was handled, false otherwise.
Glib::SignalProxy<void()> Gtk::EventControllerScroll::signal_scroll_begin ( )
Slot Prototype:
void on_my_scroll_begin()

Flags: Run First

Signals that a new scrolling operation has begun. It will only be emitted on devices capable of it.

Glib::SignalProxy<void()> Gtk::EventControllerScroll::signal_scroll_end ( )
Slot Prototype:
void on_my_scroll_end()

Flags: Run First

Signals that a new scrolling operation has finished. It will only be emitted on devices capable of it.

Friends And Related Function Documentation

Glib::RefPtr< Gtk::EventControllerScroll > wrap ( GtkEventControllerScroll *  object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns
A C++ instance that wraps this C instance.