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

#include <gdkmm/event.h>

Public Member Functions

 Event ()
 
 Event (GdkEvent * gobject, bool make_a_copy=true)
 
 Event (const Event & other)
 
Eventoperator= (const Event & other)
 
 Event (Event && other) noexcept
 
Eventoperator= (Event && other) noexcept
 
 ~Event () noexcept
 
void swap (Event & other) noexcept
 
GdkEvent * gobj ()
 Provides access to the underlying C instance. More...
 
const GdkEvent * gobj () const
 Provides access to the underlying C instance. More...
 
GdkEvent * gobj_copy () const
 Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs. More...
 
void put ()
 Appends a copy of the given event onto the front of the event queue for event->any.window’s display, or the default event queue if event->any.window is nullptr. More...
 
guint32 get_time () const
 Returns the time stamp from event, if there is one; otherwise returns GDK_CURRENT_TIME. More...
 
bool get_state (ModifierType & state) const
 If the event contains a “state” field, puts that field in state. More...
 
bool get_coords (double & x_win, double & y_win) const
 Extract the event window relative x/y coordinates from an event. More...
 
bool get_root_coords (double & x_root, double & y_root) const
 Extract the root window relative x/y coordinates from an event. More...
 
bool get_axis (AxisUse axis_use, double & value) const
 Extract the axis value for a particular axis use from an event structure. More...
 
Glib::RefPtr< Screenget_screen ()
 Returns the screen for the event. More...
 
Glib::RefPtr< const Screenget_screen () const
 Returns the screen for the event. More...
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system. More...
 
static Event get ()
 Checks all open displays for a Gdk::Event to process,to be processed on, fetching events from the windowing system if necessary. More...
 
static Event peek ()
 If there is an event waiting in the event queue of some open display, returns a copy of it. More...
 
static bool events_pending ()
 Checks if any events are ready to be processed for any display. More...
 
static void set_show_events (bool show_events)
 Sets whether a trace of received events is output. More...
 
static bool get_show_events ()
 Gets whether event debugging output is enabled. More...
 

Protected Attributes

GdkEvent * gobject_
 

Related Functions

(Note that these are not member functions.)

void swap (Event & lhs, Event & rhs) noexcept
 
Gdk::Event wrap (GdkEvent * object, bool take_copy=false)
 A Glib::wrap() method for this object. More...
 

Constructor & Destructor Documentation

◆ Event() [1/4]

Gdk::Event::Event ( )

◆ Event() [2/4]

Gdk::Event::Event ( GdkEvent *  gobject,
bool  make_a_copy = true 
)
explicit

◆ Event() [3/4]

Gdk::Event::Event ( const Event other)

◆ Event() [4/4]

Gdk::Event::Event ( Event &&  other)
noexcept

◆ ~Event()

Gdk::Event::~Event ( )
noexcept

Member Function Documentation

◆ events_pending()

static bool Gdk::Event::events_pending ( )
static

Checks if any events are ready to be processed for any display.

Returns
true if any events are pending.

◆ get()

static Event Gdk::Event::get ( )
static

Checks all open displays for a Gdk::Event to process,to be processed on, fetching events from the windowing system if necessary.

See Gdk::Display::get_event().

Returns
The next Gdk::Event to be processed, or nullptr if no events are pending. The returned Gdk::Event should be freed with free().

◆ get_axis()

bool Gdk::Event::get_axis ( AxisUse  axis_use,
double &  value 
) const

Extract the axis value for a particular axis use from an event structure.

Parameters
axis_useThe axis use to look for.
valueLocation to store the value found.
Returns
true if the specified axis was found, otherwise false.

◆ get_coords()

bool Gdk::Event::get_coords ( double &  x_win,
double &  y_win 
) const

Extract the event window relative x/y coordinates from an event.

Parameters
x_winLocation to put event window x coordinate.
y_winLocation to put event window y coordinate.
Returns
true if the event delivered event window coordinates.

◆ get_root_coords()

bool Gdk::Event::get_root_coords ( double &  x_root,
double &  y_root 
) const

Extract the root window relative x/y coordinates from an event.

Parameters
x_rootLocation to put root window x coordinate.
y_rootLocation to put root window y coordinate.
Returns
true if the event delivered root window coordinates.

◆ get_screen() [1/2]

Glib::RefPtr< Screen > Gdk::Event::get_screen ( )

Returns the screen for the event.

The screen is typically the screen for event->any.window, but for events such as mouse events, it is the screen where the pointer was when the event occurs - that is, the screen which has the root window to which event->motion.x_root and event->motion.y_root are relative.

Since gtkmm 2.2:
Returns
The screen for the event.

◆ get_screen() [2/2]

Glib::RefPtr< const Screen > Gdk::Event::get_screen ( ) const

Returns the screen for the event.

The screen is typically the screen for event->any.window, but for events such as mouse events, it is the screen where the pointer was when the event occurs - that is, the screen which has the root window to which event->motion.x_root and event->motion.y_root are relative.

Since gtkmm 2.2:
Returns
The screen for the event.

◆ get_show_events()

static bool Gdk::Event::get_show_events ( )
static

Gets whether event debugging output is enabled.

Returns
true if event debugging output is enabled.

◆ get_state()

bool Gdk::Event::get_state ( ModifierType state) const

If the event contains a “state” field, puts that field in state.

Otherwise stores an empty state (0). Returns true if there was a state field in the event. event may be nullptr, in which case it’s treated as if the event had no state field.

Parameters
stateReturn location for state.
Returns
true if there was a state field in the event.

◆ get_time()

guint32 Gdk::Event::get_time ( ) const

Returns the time stamp from event, if there is one; otherwise returns GDK_CURRENT_TIME.

If event is nullptr, returns GDK_CURRENT_TIME.

Returns
Time stamp field from event.

◆ get_type()

static GType Gdk::Event::get_type ( )
static

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

◆ gobj() [1/2]

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

Provides access to the underlying C instance.

◆ gobj() [2/2]

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

Provides access to the underlying C instance.

◆ gobj_copy()

GdkEvent * Gdk::Event::gobj_copy ( ) const

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

◆ operator=() [1/2]

Event & Gdk::Event::operator= ( const Event other)

◆ operator=() [2/2]

Event & Gdk::Event::operator= ( Event &&  other)
noexcept

◆ peek()

static Event Gdk::Event::peek ( )
static

If there is an event waiting in the event queue of some open display, returns a copy of it.

See Gdk::Display::peek_event().

Returns
A copy of the first Gdk::Event on some event queue, or nullptr if no events are in any queues. The returned Gdk::Event should be freed with free().

◆ put()

void Gdk::Event::put ( )

Appends a copy of the given event onto the front of the event queue for event->any.window’s display, or the default event queue if event->any.window is nullptr.

See Gdk::Display::put_event().

◆ set_show_events()

static void Gdk::Event::set_show_events ( bool  show_events)
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.

◆ swap()

void Gdk::Event::swap ( Event other)
noexcept

Friends And Related Function Documentation

◆ swap()

void swap ( Event lhs,
Event rhs 
)
related
Parameters
lhsThe left-hand side
rhsThe right-hand side

◆ wrap()

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.

Member Data Documentation

◆ gobject_

GdkEvent* Gdk::Event::gobject_
protected