Xfce Foundation Classes
Main Page | Index | Namespace List | Alphabetical List | Class List | File List

# Xfc::Gdk::Event Class Reference

The Event object represents a GdkEvent. More...

`#include <xfc/gdk/events.hh>`

Inheritance diagram for Xfc::Gdk::Event:

List of all members.

## Public Member Functions

Constructors

- Event (EventType type)
    Construct a new event of the specified type.
- Event (GdkEvent *event)
    Construct a new event from an existing GdkEvent.
- Event (GdkEvent *event, bool copy)
    Construct a new event from an existing GdkEvent.
- Event (const Event &src)
    Copy constructor.
- ~Event ()
    Destructor.
- Event & operator= (const Event &src)
    Assignment operator.

Accessors

- GdkEvent * gdk_event () const
    Get a pointer to the GdkEvent structure.
- operator GdkEvent * () const
    Conversion operator; safely converts a Event to a GdkEvent pointer.
- EventType type () const
    Returns the type of the event;.
- EventAny * any () const
    Return this event as a pointer to an EventAny.
- EventExpose * expose () const
    If this is a "expose" event, returns a pointer to the EventExpose, otherwise returns null.
- EventVisibility * visibility () const
    If this is a "visibility-notify" event, returns a pointer to the EventVisibility, otherwise returns null.
- EventMotion * motion () const
    If this is a "motion-notify" event, returns a pointer to the EventMotion, otherwise returns null.
- EventButton * button () const
    If this is a "button-press" or "button-release" event, returns a pointer to the EventButton, otherwise returns null.
- EventScroll * scroll () const
    If this is a "scroll" event, returns a pointer to the EventScroll, otherwise returns null.
- EventKey * key () const
    If this is a "key-press" or "key-release" event, returns a pointer to the EventKey, otherwise returns null.
- EventCrossing * crossing () const
    If this is an "enter-notify" or "leave-notify" event, returns a pointer to the EventCrossing, otherwise returns null.
- EventFocus * focus_change () const
    If this is a "focus-change" event, returns a pointer to the EventFocus, otherwise returns null.
- EventConfigure * configure () const
    If this is a "configure" event, returns a pointer to the EventConfigure, otherwise returns null.
- EventProperty * property () const
    If this is a "property-notify" event, returns a pointer to the EventProperty, otherwise returns null.
- EventSelection * selection () const
    If this is a "selection" event, returns a pointer to the EventSelection, otherwise returns null.
- EventOwnerChange * owner_change () const
    If this is an "owner_change" event, returns a pointer to the EventOwnerChange, otherwise returns null.
- EventProximity * proximity () const
    If this is an "proximity-in" or "proximity-out" event, returns a pointer to the EventProximity, otherwise returns null.
- EventClient * client () const
    If this is a "client" event, returns a pointer to the EventClient, otherwise returns null.
- EventSetting * setting () const
    If this is a "setting" event, returns a pointer to the EventSetting, otherwise returns null.
- EventWindowState * window_state () const
    If this is a "window-state" event, returns a pointer to the EventWindowState, otherwise returns null.
- EventDND * dnd () const
    If this is an "drag" or "drop" event, returns a pointer to the EventDND, otherwise returns null.
- unsigned int get_time () const
    Returns the time stamp of the event, if there is one; otherwise returns GDK_CURRENT_TIME.
- bool get_state (ModifierTypeField *state) const
    If the event contains a "state" field, puts that field in state; otherwise stores an empty state (0).
- bool get_axis (AxisUse axis_use, double *value) const
    Extract the axis value for a particular axis use from an event structure.
- bool get_coords (double *x_win, double *y_win) const
    Extract the event window relative x/y coordinates from the event.
- bool get_root_coords (double *x_root, double *y_root) const
    Extract the root window relative x/y coordinates from the event.
- Screen * get_screen () const
    Returns the screen for the event.

Methods

- void put ()
    Appends a copy of this event onto the front of the event queue for any()->window()'s display, or the default event queue if any()->window() is null (see Gdk::Display::put_event()).
- bool send_client_message (GdkNativeWindow winid, const Display *display=0)
    Sends an X ClientMessage event to a given window.
- void send_clientmessage_toall ()
    Sends an X ClientMessage event to all toplevel windows on the default Screen.
- void set_screen (Screen &screen)
    Sets the screen for event to screen.

## Static Public Member Functions

Accessors

- Pointer< Event > get ()
    Checks all open displays for an event to process, fetching events from the windowing system if necessary (see Gdk::Display::get_event()).
- Pointer< EventExpose > get_graphics_expose (const Window &window)
    Waits for a GraphicsExpose or NoExpose event from the X server.
- Pointer< Event > peek ()
    If there is an event waiting in the event queue of some open display, returns a wrapped copy of it (see Gdk::Display::peek_event()).

## Detailed Description

The Event object represents a GdkEvent.

Event is the base class from which all event objects are derived. Event doesn't have a virtual destructor because it's not meant to be used to derive suclasses, other than the ones derived by XFC.

## Constructor & Destructor Documentation

Xfc::Gdk::Event::Event | ( | EventType | type | ) | `[explicit]`

Construct a new event of the specified type.

Parameters:

  | type | The EventType.

Xfc::Gdk::Event::Event | ( | GdkEvent * | event | ) | `[explicit]`

Construct a new event from an existing GdkEvent.

Parameters:

  | event | A pointer to a GdkEvent.

The event can be a newly created GdkEvent or an existing GdkEvent. The Event object created is a temporary object. It doesn't take over the ownership of GdkEvent and GdkEvent is not freed by the destructor.

Xfc::Gdk::Event::Event | ( | GdkEvent * | event,
|  | bool | copy
| ) |

Construct a new event from an existing GdkEvent.

Parameters:

  | event | A pointer to a GdkEvent.
  | copy | Whether the Color object should make a copy of GdkEvent or not.

The event can be a newly created GdkEvent or an existing GdkEvent. If copy is true Event will make a copy of GdkEvent. If copy is false Event wont make a copy but instead takes over the ownership of GdkEvent. Either way, the destructor will free GdkEvent when the Event object is destroyed. This constructor is used by G::Boxed::wrap() to wrap GdkEvent objects in a C++ wrapper.

Xfc::Gdk::Event::Event | ( | const Event & | src | ) |

Copy constructor.

Parameters:

  | src | The source event.

## Member Function Documentation

Pointer<Event> Xfc::Gdk::Event::get | ( |  | ) | `[static]`

Checks all open displays for an event to process, fetching events from the windowing system if necessary (see Gdk::Display::get_event()).

Returns:
  A smart pointer to the next event to be processed, or null if no events are pending.

bool Xfc::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 | The location to store the value found.

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

bool Xfc::Gdk::Event::get_coords | ( | double * | x_win,
|  | double * | y_win
| ) | const

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

Parameters:

  | x_win | The location to put event window x coordinate.
  | y_win | The location to put event window y coordinate.

Returns:
  true if the event delivered event window coordinates.

Pointer<EventExpose> Xfc::Gdk::Event::get_graphics_expose | ( | const Window & | window | ) | `[static]`

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

Returns:
  An EventExpose if a GraphicsExpose event was received, or null if a NoExpose event was received.

This is used in the GtkText widget in GTK+ to make sure any GraphicsExpose events are handled before the widget is scrolled.

bool Xfc::Gdk::Event::get_root_coords | ( | double * | x_root,
|  | double * | y_root
| ) | const

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

Parameters:

  | x_root | The location to put root window x coordinate.
  | y_root | The location to put root window y coordinate.

Returns:
  true if the event delivered root window coordinates.

Screen* Xfc::Gdk::Event::get_screen | ( |  | ) | const

Returns the screen for the event.

Returns:
  The Screen for the event.

The screen is typically the screen for 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 motion()->x_root and motion()->y_root are relative.

bool Xfc::Gdk::Event::get_state | ( | ModifierTypeField * | state | ) | const

If the event contains a "state" field, puts that field in state; otherwise stores an empty state (0).

Parameters:

  | state | The return location for the state.

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

The event may be null, in which case it's treated as if the event had no state field.

unsigned int Xfc::Gdk::Event::get_time | ( |  | ) | const

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

Returns:
  The time stamp field from the event.

If event is null, returns GDK_CURRENT_TIME.

Event& Xfc::Gdk::Event::operator= | ( | const Event & | src | ) |

Assignment operator.

Parameters:

  | src | The source event.

Pointer<Event> Xfc::Gdk::Event::peek | ( |  | ) | `[static]`

If there is an event waiting in the event queue of some open display, returns a wrapped copy of it (see Gdk::Display::peek_event()).

Returns:
  A smart pointer to a newly allocated Event, or null if no events are in any queues.

bool Xfc::Gdk::Event::send_client_message | ( | GdkNativeWindow | winid,
|  | const Display * | display = `0`
| ) |

Sends an X ClientMessage event to a given window.

Parameters:

  | display | The Display for the window where the message is to be sent, or null for the default display.
  | winid | The window to send the X ClientMessage event to.

Returns:
  true on success, false on failure or if the event is not an EventClient.

This could be used for communicating between different applications, though the amount of data is limited to 20 bytes. If display is null the given window must be on the default Display.

void Xfc::Gdk::Event::send_clientmessage_toall | ( |  | ) |

Sends an X ClientMessage event to all toplevel windows on the default Screen.

Toplevel windows are determined by checking for the WM_STATE property, as described in the Inter-Client Communication Conventions Manual (ICCCM). If no windows are found with the WM_STATE property set, the message is sent to all children of the root window.

Note: This method does nothing if the event is not an EventClient.

void Xfc::Gdk::Event::set_screen | ( | Screen & | screen | ) |

Sets the screen for event to screen.

The event must have been allocated by GTK+.

Parameters:

  | screen | A Screen.

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

- events.hh

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3