Main Page Widgets Namespaces Book

# Gdk::Event Class Reference

List of all members.

## Public Member Functions

| Event ()
| Event (GdkEvent* gobject, bool make_a_copy=true)
| Event (const Event& other)
Event& | operator= (const Event& other)
| ~Event ()
void | swap (Event& other)
GdkEvent* | gobj ()
| Provides access to the underlying C instance.
const GdkEvent* | gobj () const
| Provides access to the underlying C instance.
GdkEvent* | gobj_copy () const
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 `0`.
guint32 | get_time () const
| Returns the time stamp from event , if there is one; otherwise returns Gdk::CURRENT_TIME.
bool | get_state (ModifierType& state) const
| If the event contains a "state" field, puts that field in state .
bool | get_coords (double& x_win, double& y_win) const
| Extract the event window relative x/y coordinates from an event.
bool | get_root_coords (double& x_root, double& y_root) const
| Extract the root window relative x/y coordinates from an event.
bool | get_axis (AxisUse axis_use, double& value) const
| Extract the axis value for a particular axis use from an event structure.
void | set_screen (const Glib::RefPtr<Screen>& screen)
| Sets the screen for event to screen .
Glib::RefPtr<Screen> | get_screen ()
| Returns the screen for the event.
Glib::RefPtr<const Screen> | get_screen () const
| Returns the screen for the event.
bool | send_client_message (GdkNativeWindow winid)
| Sends an X ClientMessage event to a given window (which must be on the default Gdk::Display.) This could be used for communicating between different applications, though the amount of data is limited to 20 bytes.
bool | send_client_message (const Glib::RefPtr<Display>& display, GdkNativeWindow winid)

## Static Public Member Functions

Event | get ()
| Checks all open displays for a Gdk::Event to process,to be processed on, fetching events from the windowing system if necessary.
Event | peek ()
| If there is an event waiting in the event queue of some open display, returns a copy of it.
Event | get_graphics_expose (const Glib::RefPtr<Window>& window)
| Waits for a GraphicsExpose or NoExpose event from the X server.
bool | events_pending ()
| Checks if any events are ready to be processed for any display.
void | set_show_events (bool show_events)
| Sets whether a trace of received events is output.
bool | get_show_events ()
| Gets whether event debugging output is enabled.

## Protected Attributes

GdkEvent* | gobject_

## Related Functions

(Note that these are not member functions.)
void | swap (Event& lhs, Event& rhs)
Gdk::Event | wrap (GdkEvent* object, bool take_copy=false)

## Constructor & Destructor Documentation

Gdk::Event::Event | ( |  | ) |

Gdk::Event::Event | ( | GdkEvent* | gobject,
|  | bool | make_a_copy = true
| ) | `[explicit]`

Gdk::Event::Event | ( | const Event& | other | ) |

Gdk::Event::~Event | ( |  | ) |

## Member Function Documentation

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.

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 `0` if no events are pending. The returned Gdk::Event should be freed with gdk_event_free().

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_use | The axis use to look for.
  value | Location to store the value found.

Returns:
  `true` if the specified axis was found, otherwise `false`.

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_win | Location to put event window x coordinate.
  y_win | Location to put event window y coordinate.

Returns:
  `true` if the event delivered event window coordinates.

Event Gdk::Event::get_graphics_expose | ( | const Glib::RefPtr<Window>& | window | ) | `[static]`

Waits for a GraphicsExpose or NoExpose event from the X server.

This is used in the Gtk::Text and Gtk::CList widgets in GTK+ to make sure any GraphicsExpose events are handled before the widget is scrolled.

Parameters:

  window | The Gdk::Window to wait for the events for.

Returns:
  A Gdk::EventExpose if a GraphicsExpose was received, or `0` if a NoExpose event was received.

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_root | Location to put root window x coordinate.
  y_root | Location to put root window y coordinate.

Returns:
  `true` if the event delivered root window coordinates.

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 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.

Returns:
  The screen for the event

Since: 2.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 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.

Returns:
  The screen for the event

Since: 2.2.

bool Gdk::Event::get_show_events | ( |  | ) | `[static]`

Gets whether event debugging output is enabled.

Returns:
  `true` if event debugging output is enabled.

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 `0`, in which case it's treated as if the event had no state field.

Parameters:

  state | Return location for state.

Returns:
  `true` if there was a state field in the event.

guint32 Gdk::Event::get_time | ( |  | ) | const

Returns the time stamp from event , if there is one; otherwise returns Gdk::CURRENT_TIME.

If event is `0`, returns Gdk::CURRENT_TIME.

Returns:
  Time stamp field from event .

const GdkEvent* Gdk::Event::gobj | ( |  | ) | const`[inline]`

| Provides access to the underlying C instance.

GdkEvent* Gdk::Event::gobj | ( |  | ) | `[inline]`

| Provides access to the underlying C instance.

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

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

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 `0` if no events are in any queues. The returned Gdk::Event should be freed with gdk_event_free().

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 `0`. See Gdk::Display::put_event().

bool Gdk::Event::send_client_message | ( | const Glib::RefPtr<Display>& | display,
|  | GdkNativeWindow | winid
| ) |

bool Gdk::Event::send_client_message | ( | GdkNativeWindow | winid | ) |

Sends an X ClientMessage event to a given window (which must be on the default Gdk::Display.) This could be used for communicating between different applications, though the amount of data is limited to 20 bytes.

Parameters:

  winid | The window to send the X ClientMessage event to.

Returns:
  Non-zero on success.

void Gdk::Event::set_screen | ( | const Glib::RefPtr<Screen>& | screen | ) |

Sets the screen for event to screen .

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

Since: 2.2

Parameters:

  screen | A Gdk::Screen.

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 <option>--enable-debug</option> option) to use this option.

Parameters:

  show_events | `true` to output event debugging information.

void Gdk::Event::swap | ( | Event& | other | ) |

## Friends And Related Function Documentation

void swap | ( | Event& | lhs,
|  | Event& | rhs
| ) | `[related]`

Gdk::Event wrap | ( | GdkEvent* | object,
|  | bool | take_copy = false
| ) | `[related]`

## Member Data Documentation

GdkEvent* Gdk::Event::gobject_ `[protected]`

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

- event.h