gtkmm
3.91.0
|
Represents a mouse button press or release event. More...
#include <gdkmm/event.h>
Public Member Functions | |
EventButton () | |
Creates an invalid event object. More... | |
EventButton (GdkEventButton* gobject, bool make_a_copy=false) | |
Wraps a C event instance. More... | |
void | swap (EventButton& other) noexcept |
GdkEventButton* | gobj () |
Provides access to the underlying C instance. More... | |
const GdkEventButton* | gobj () const |
Provides access to the underlying C instance. More... | |
GdkEventButton* | gobj_copy () const |
Provides access to the underlying C instance. More... | |
guint32 | get_time () const |
Returns the timestamp of the event in milliseconds. More... | |
ModifierType | get_state () const |
Returns a bit mask representing the state of the modifier keys (e.g. More... | |
double | get_x () const |
Returns the X coordinate of the pointer relative to the window. More... | |
double | get_y () const |
Returns the Y coordinate of the pointer relative to the window. More... | |
double | get_root_x () const |
Returns the X coordinate of the pointer relative to the root screen. More... | |
double | get_root_y () const |
Returns the Y coordinate of the pointer relative to the root screen. More... | |
bool | get_axis (Gdk::AxisUse axis_use, double& value) const |
Extract the axis value for a particular axis use from an event structure. More... | |
guint | get_button () const |
Returns the number of the button which was pressed or released, numbered from 1 to 5. More... | |
Glib::RefPtr< Gdk::Device > | get_device () |
Returns the device where the event originated from. More... | |
Glib::RefPtr< const Gdk::Device > | get_device () const |
guint | get_click_count () const |
Extracts the click count from an event. More... | |
bool | shall_trigger_context_menu () const |
This function returns whether a Gdk::EventButton should trigger a context menu, according to platform conventions. More... | |
![]() | |
Event () | |
Creates an invalid event object. More... | |
Event (GdkEvent* gobject, bool make_a_copy=false) | |
Wraps a C event instance. More... | |
Event (const Event& other) | |
Event& | operator= (const Event& other) |
Event (Event&& other) noexcept | |
Event& | operator= (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. More... | |
Event::Type | get_event_type () const |
Retrieves the type of the event. More... | |
Glib::RefPtr< Gdk::Window > | get_window () |
Returns the window which received the event. More... | |
Glib::RefPtr< const Gdk::Window > | get_window () const |
bool | is_send_event () const |
Returns true if the event was sent explicitly (e.g. More... | |
Glib::RefPtr< Screen > | get_screen () |
Returns the screen for the event. More... | |
Glib::RefPtr< const Screen > | get_screen () const |
Returns the screen for the event. More... | |
Glib::RefPtr< Seat > | get_seat () |
Returns the Gdk::Seat this event was generated for. More... | |
Glib::RefPtr< const Seat > | get_seat () const |
Returns the Gdk::Seat this event was generated for. 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... | |
Related Functions | |
(Note that these are not member functions.) | |
void | swap (EventButton& lhs, EventButton& rhs) noexcept |
const EventButton& | wrap_event (const GdkEventButton*& event) |
Wraps a C event instance without making unnecessary copy when the ownership can not be acquired. More... | |
EventButton& | wrap_event (GdkEventButton*& event) |
See wrap_event(const GdkEventButton*& event). More... | |
Gdk::EventButton | wrap (GdkEventButton* object, bool take_copy=false) |
A Glib::wrap() method for this object. More... | |
![]() | |
void | swap (Event& lhs, Event& rhs) noexcept |
const Event& | wrap_event (const GdkEvent*& event) |
Wraps a C event instance without making unnecessary copy when the ownership can not be acquired. More... | |
Event& | wrap_event (GdkEvent*& event) |
See wrap_event(const GdkEvent*& event). More... | |
Gdk::Event | wrap (GdkEvent* object, bool take_copy=false) |
A Glib::wrap() method for this object. More... | |
Represents a mouse button press or release event.
get_event_type() will return one of Gdk::Event::Type::BUTTON_PRESS, Gdk::Event::Type::DOUBLE_BUTTON_PRESS, Gdk::Event::Type::TRIPLE_BUTTON_PRESS or Gdk::Event::Type::BUTTON_RELEASE.
Double and triple-clicks result in a sequence of events being received. For double-clicks the order of events will be:
Note that the first click is received just like a normal button press, while the second click results in a Gdk::Event::Type::DOUBLE_BUTTON_PRESS being received just after the Gdk::Event::Type::BUTTON_PRESS.
Triple-clicks are very similar to double-clicks, except that Gdk::Event::Type::TRIPLE_BUTTON_PRESS is inserted after the third click. The order of the events is:
For a double click to occur, the second button press must occur within 1/4 of a second of the first. For a triple click to occur, the third button press must also occur within 1/2 second of the first button press.
Gdk::EventButton::EventButton | ( | ) |
Creates an invalid event object.
Calling any member functions is undefined behavior.
|
explicit |
Wraps a C event instance.
This constructor either acquires ownership of gobject, or copies it.
gobject | Event to wrap. |
make_a_copy | If false , the ownership of gobject is acquired, otherwise, a copy is made. |
bool Gdk::EventButton::get_axis | ( | Gdk::AxisUse | axis_use, |
double & | value | ||
) | const |
Extract the axis value for a particular axis use from an event structure.
axis_use | The axis use to look for. |
value | Location to store the value found. |
true
if the specified axis was found, otherwise false
. guint Gdk::EventButton::get_button | ( | ) | const |
Returns the number of the button which was pressed or released, numbered from 1 to 5.
Normally button 1 is the left mouse button, 2 is the middle button, and 3 is the right button. On 2-button mice, the middle button can often be simulated by pressing both mouse buttons together
guint Gdk::EventButton::get_click_count | ( | ) | const |
Extracts the click count from an event.
Glib::RefPtr<Gdk::Device> Gdk::EventButton::get_device | ( | ) |
Returns the device where the event originated from.
Glib::RefPtr<const Gdk::Device> Gdk::EventButton::get_device | ( | ) | const |
double Gdk::EventButton::get_root_x | ( | ) | const |
Returns the X coordinate of the pointer relative to the root screen.
double Gdk::EventButton::get_root_y | ( | ) | const |
Returns the Y coordinate of the pointer relative to the root screen.
ModifierType Gdk::EventButton::get_state | ( | ) | const |
Returns a bit mask representing the state of the modifier keys (e.g.
Control, Shift and Alt) and the pointer buttons.
guint32 Gdk::EventButton::get_time | ( | ) | const |
Returns the timestamp of the event in milliseconds.
double Gdk::EventButton::get_x | ( | ) | const |
Returns the X coordinate of the pointer relative to the window.
double Gdk::EventButton::get_y | ( | ) | const |
Returns the Y coordinate of the pointer relative to the window.
|
inline |
Provides access to the underlying C instance.
|
inline |
Provides access to the underlying C instance.
GdkEventButton* Gdk::EventButton::gobj_copy | ( | ) | const |
Provides access to the underlying C instance.
The caller is responsible for freeing it with gdk_event_free(). Use when directly setting fields in structs.
bool Gdk::EventButton::shall_trigger_context_menu | ( | ) | const |
This function returns whether a Gdk::EventButton should trigger a context menu, according to platform conventions.
The right mouse button always triggers context menus. Additionally, if Gdk::Keymap::get_modifier_mask() returns a non-0 mask for Gdk::ModifierIntent::CONTEXT_MENU, then the left mouse button will also trigger a context menu if this modifier is pressed.
This function should always be used instead of simply checking for event->button == GDK_BUTTON_SECONDARY.
true
if the event should trigger a context menu.
|
noexcept |
|
related |
lhs | The left-hand side |
rhs | The right-hand side |
|
related |
A Glib::wrap() method for this object.
object | The C instance. |
take_copy | False if the result should take ownership of the C instance. True if it should take a new copy. |
|
related |
Wraps a C event instance without making unnecessary copy when the ownership can not be acquired.
The event pointer must not be deleted until last usage of the returned instance. Note, that this requirement applies to the pointer itself, in addition to the object it is pointing to.
|
related |