gtkmm  3.97.1
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions | List of all members
Gdk::Event Class Reference

Functions for handling events from the window system. More...

#include <gdkmm/event.h>

Inheritance diagram for Gdk::Event:
Inheritance graph
[legend]

Public Types

enum  Type {
  Type::NOTHING,
  Type::DELETE,
  Type::DESTROY,
  Type::MOTION_NOTIFY,
  Type::BUTTON_PRESS,
  Type::BUTTON_RELEASE,
  Type::KEY_PRESS,
  Type::KEY_RELEASE,
  Type::ENTER_NOTIFY,
  Type::LEAVE_NOTIFY,
  Type::FOCUS_CHANGE,
  Type::CONFIGURE,
  Type::PROXIMITY_IN,
  Type::PROXIMITY_OUT,
  Type::DRAG_ENTER,
  Type::DRAG_LEAVE,
  Type::DRAG_MOTION,
  Type::DROP_START,
  Type::SCROLL,
  Type::GRAB_BROKEN,
  Type::TOUCH_BEGIN,
  Type::TOUCH_UPDATE,
  Type::TOUCH_END,
  Type::TOUCH_CANCEL,
  Type::TOUCHPAD_SWIPE,
  Type::TOUCHPAD_PINCH,
  Type::PAD_BUTTON_PRESS,
  Type::PAD_BUTTON_RELEASE,
  Type::PAD_RING,
  Type::PAD_STRIP,
  Type::PAD_GROUP_MODE,
  Type::EVENT_LAST
}
 Specifies the type of the event. 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

 Event (Event&& src) noexcept
 
Eventoperator= (Event&& src) noexcept
 
 ~Event () noexcept override
 
GdkEvent* gobj ()
 Provides access to the underlying C GObject. More...
 
const GdkEvent* gobj () const
 Provides access to the underlying C GObject. More...
 
GdkEvent* gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
 
Glib::RefPtr< Eventcopy () const
 Copies a Gdk::Event, copying or incrementing the reference count of the resources associated with it (e.g. Gdk::Surface’s and strings). More...
 
Type get_event_type () const
 Retrieves the type of the event. More...
 
Glib::RefPtr< Gdk::Surfaceget_surface ()
 Extracts the Gdk::Surface associated with an event. More...
 
Glib::RefPtr< const Gdk::Surfaceget_surface () const
 Extracts the Gdk::Surface associated with an event. More...
 
bool is_sent () const
 Returns true if the event was sent explicitly (e.g. More...
 
void set_device (const Glib::RefPtr< Device >& device)
 Sets the device for event to device. More...
 
Glib::RefPtr< Deviceget_device ()
 If the event contains a “device” field, this function will return it, else it will return nullptr. More...
 
Glib::RefPtr< const Deviceget_device () const
 If the event contains a “device” field, this function will return it, else it will return nullptr. More...
 
void set_source_device (const Glib::RefPtr< Device >& device)
 Sets the slave device for event to device. More...
 
Glib::RefPtr< Deviceget_source_device ()
 This function returns the hardware (slave) Gdk::Device that has triggered the event, falling back to the virtual (master) device (as in get_device()) if the event wasn’t caused by interaction with a hardware device. More...
 
Glib::RefPtr< const Deviceget_source_device () const
 This function returns the hardware (slave) Gdk::Device that has triggered the event, falling back to the virtual (master) device (as in get_device()) if the event wasn’t caused by interaction with a hardware device. More...
 
void set_display (const Glib::RefPtr< Display >& display)
 Sets the display that an event is associated with. More...
 
Glib::RefPtr< Displayget_display ()
 Retrieves the Gdk::Display associated to the event. More...
 
Glib::RefPtr< const Displayget_display () const
 Retrieves the Gdk::Display associated to the event. More...
 
Glib::RefPtr< Seatget_seat ()
 Returns the Gdk::Seat this event was generated for. More...
 
Glib::RefPtr< const Seatget_seat () const
 Returns the Gdk::Seat this event was generated for. More...
 
Glib::PropertyProxy_ReadOnly< Typeproperty_event_type () const
 Event type. 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< Eventcreate (Type event_type)
 Creates a new event of the given type. More...
 
static void set_show_events (bool show_events=true)
 Sets whether a trace of received events is output. More...
 
static bool get_show_events ()
 Gets whether event debugging output is enabled. More...
 

Protected Member Functions

 Event (Type event_type)
 
- 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< Gdk::Eventwrap (GdkEvent* object, bool take_copy=false)
 A Glib::wrap() method for this object. More...
 

Detailed Description

Functions for handling events from the window system.

In GTK+ applications the events are handled automatically in gtk_main_do_event() and passed on to the appropriate widgets, so Gdk::Event and its subclasses are rarely needed.

Constructor & Destructor Documentation

Gdk::Event::Event ( Event&&  src)
noexcept
Gdk::Event::~Event ( )
overridenoexcept
Gdk::Event::Event ( Type  event_type)
explicitprotected

Member Function Documentation

Glib::RefPtr<Event> Gdk::Event::copy ( ) const

Copies a Gdk::Event, copying or incrementing the reference count of the resources associated with it (e.g. Gdk::Surface’s and strings).

Returns
A copy of event. Free with Glib::object_unref().
static Glib::RefPtr<Event> Gdk::Event::create ( Type  event_type)
static

Creates a new event of the given type.

All fields are set to 0.

Glib::RefPtr<Device> Gdk::Event::get_device ( )

If the event contains a “device” field, this function will return it, else it will return nullptr.

Since gtkmm 3.94:
Returns
A Gdk::Device, or nullptr.
Glib::RefPtr<const Device> Gdk::Event::get_device ( ) const

If the event contains a “device” field, this function will return it, else it will return nullptr.

Since gtkmm 3.94:
Returns
A Gdk::Device, or nullptr.
Glib::RefPtr<Display> Gdk::Event::get_display ( )

Retrieves the Gdk::Display associated to the event.

Returns
A Gdk::Display.
Glib::RefPtr<const Display> Gdk::Event::get_display ( ) const

Retrieves the Gdk::Display associated to the event.

Returns
A Gdk::Display.
Type Gdk::Event::get_event_type ( ) const

Retrieves the type of the event.

Returns
A Gdk::Event::Type.
Glib::RefPtr<Seat> Gdk::Event::get_seat ( )

Returns the Gdk::Seat this event was generated for.

Since gtkmm 3.90:
Returns
The Gdk::Seat of this event.
Glib::RefPtr<const Seat> Gdk::Event::get_seat ( ) const

Returns the Gdk::Seat this event was generated for.

Since gtkmm 3.90:
Returns
The Gdk::Seat of this event.
static bool Gdk::Event::get_show_events ( )
static

Gets whether event debugging output is enabled.

Returns
true if event debugging output is enabled.
Glib::RefPtr<Device> Gdk::Event::get_source_device ( )

This function returns the hardware (slave) Gdk::Device that has triggered the event, falling back to the virtual (master) device (as in get_device()) if the event wasn’t caused by interaction with a hardware device.

This may happen for example in synthesized crossing events after a Gdk::Surface updates its geometry or a grab is acquired/released.

If the event does not contain a device field, this function will return nullptr.

Since gtkmm 3.94:
Returns
A Gdk::Device, or nullptr.
Glib::RefPtr<const Device> Gdk::Event::get_source_device ( ) const

This function returns the hardware (slave) Gdk::Device that has triggered the event, falling back to the virtual (master) device (as in get_device()) if the event wasn’t caused by interaction with a hardware device.

This may happen for example in synthesized crossing events after a Gdk::Surface updates its geometry or a grab is acquired/released.

If the event does not contain a device field, this function will return nullptr.

Since gtkmm 3.94:
Returns
A Gdk::Device, or nullptr.
Glib::RefPtr<Gdk::Surface> Gdk::Event::get_surface ( )

Extracts the Gdk::Surface associated with an event.

Returns
The Gdk::Surface associated with the event.
Glib::RefPtr<const Gdk::Surface> Gdk::Event::get_surface ( ) const

Extracts the Gdk::Surface associated with an event.

Returns
The Gdk::Surface associated with the event.
static GType Gdk::Event::get_type ( )
static

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

GdkEvent* Gdk::Event::gobj ( )
inline

Provides access to the underlying C GObject.

const GdkEvent* Gdk::Event::gobj ( ) const
inline

Provides access to the underlying C GObject.

GdkEvent* Gdk::Event::gobj_copy ( )

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

bool Gdk::Event::is_sent ( ) const

Returns true if the event was sent explicitly (e.g.

using XSendEvent)

Event& Gdk::Event::operator= ( Event&&  src)
noexcept
Glib::PropertyProxy_ReadOnly< Type > Gdk::Event::property_event_type ( ) const

Event type.

Default value: Gdk::Event::Type::NOTHING

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 Gdk::Event::set_device ( const Glib::RefPtr< Device >&  device)

Sets the device for event to device.

The event must have been allocated by GTK+, for instance, by copy().

Since gtkmm 3.94:
Parameters
deviceA Gdk::Device.
void Gdk::Event::set_display ( const Glib::RefPtr< Display >&  display)

Sets the display that an event is associated with.

Parameters
displayA Gdk::Display.
static void Gdk::Event::set_show_events ( bool  show_events = true)
static

Sets whether a trace of received events is output.

Note that GTK+ must be compiled with debugging (that is, configured using the --enable-debug option) to use this option.

Parameters
show_eventstrue to output event debugging information.
void Gdk::Event::set_source_device ( const Glib::RefPtr< Device >&  device)

Sets the slave device for event to device.

The event must have been allocated by GTK+, for instance by copy().

Since gtkmm 3.94:
Parameters
deviceA Gdk::Device.

Friends And Related Function Documentation

Glib::RefPtr< Gdk::Event > wrap ( GdkEvent *  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.