gdk.Event.Event Class Reference

List of all members.

Detailed Description

Description This section describes functions dealing with 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 these functions are rarely needed. Though some of the fields in the Event Structures are useful.


Public Member Functions

GdkEventgetEventStruct ()
 this (GdkEvent *gdkEvent)
 Sets our main struct and passes it to the parent class.
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 NULL.
 this (GdkEventType type)
 Creates a new event of the given type.
Event copy ()
 Copies a GdkEvent, copying or incrementing the reference count of the resources associated with it (e.g.
void free ()
 Frees a GdkEvent, freeing or decrementing any resources associated with it.
uint getTime ()
 Returns the time stamp from event, if there is one; otherwise returns GDK_CURRENT_TIME.
int getState (GdkModifierType *state)
 If the event contains a "state" field, puts that field in state.
int getAxis (GdkAxisUse axisUse, double *value)
 Extract the axis value for a particular axis use from an event structure.
int getCoords (double *xWin, double *yWin)
 Extract the event window relative x/y coordinates from an event.
int getRootCoords (double *xRoot, double *yRoot)
 Extract the root window relative x/y coordinates from an event.
int sendClientMessage (GdkNativeWindow winid)
 Sends an X ClientMessage event to a given window (which must be on the default GdkDisplay.
void sendClientmessageToall ()
 Sends an X ClientMessage event to all toplevel windows on the default GdkScreen.
void setScreen (Screen screen)
 Sets the screen for event to screen.
Screen getScreen ()
 Returns the screen for the event.

Static Public Member Functions

static bool isDoubleClick (GdkEventButton *eventButton, int buttonNumber=1)
static bool isTrippleClick (GdkEventButton *eventButton, int buttonNumber=1)
static int gdkEventsPending ()
 Checks if any events are ready to be processed for any display.
static Event peek ()
 If there is an event waiting in the event queue of some open display, returns a copy of it.
static Event get ()
 Checks all open displays for a GdkEvent to process,to be processed on, fetching events from the windowing system if necessary.
static Event getGraphicsExpose (Window window)
 Waits for a GraphicsExpose or NoExpose event from the X server.
static void handlerSet (GdkEventFunc func, void *data, GDestroyNotify notify)
 Sets the function to call to handle all events from GDK.
static int sendClientMessageForDisplay (Display display, Event event, GdkNativeWindow winid)
 On X11, sends an X ClientMessage event to a given window.
static void gdkAddClientMessageFilter (GdkAtom messageType, GdkFilterFunc func, void *data)
 Adds a filter to the default display to be called when X ClientMessage events are received.
static int gdkGetShowEvents ()
 Gets whether event debugging output is enabled.
static void gdkSetShowEvents (int showEvents)
 Sets whether a trace of received events is output.
static int gdkSettingGet (char[] name, Value value)
 Obtains a desktop-wide setting, such as the double-click time, for the default screen.

Protected Member Functions

void * getStruct ()
 the main Gtk struct as a void*

Protected Attributes

GdkEventgdkEvent
 the main Gtk struct


Constructor & Destructor Documentation

gdk.Event.Event.this ( GdkEvent gdkEvent  ) 

Sets our main struct and passes it to the parent class.

gdk.Event.Event.this ( GdkEventType  type  ) 

Creates a new event of the given type.

All fields are set to 0. type: a GdkEventType Returns: a newly-allocated GdkEvent. The returned GdkEvent should be freed with gdk_event_free(). Since 2.2


Member Function Documentation

Event gdk.Event.Event.copy (  ) 

Copies a GdkEvent, copying or incrementing the reference count of the resources associated with it (e.g.

GdkWindow's and strings). event: a GdkEvent Returns: a copy of event. The returned GdkEvent should be freed with gdk_event_free().

void gdk.Event.Event.free (  ) 

Frees a GdkEvent, freeing or decrementing any resources associated with it.

Note that this function should only be called with events returned from functions such as gdk_event_peek(), gdk_event_get(), gdk_event_get_graphics_expose() and gdk_event_copy(). event: a GdkEvent.

static void gdk.Event.Event.gdkAddClientMessageFilter ( GdkAtom  messageType,
GdkFilterFunc  func,
void *  data 
) [static]

Adds a filter to the default display to be called when X ClientMessage events are received.

See gdk_display_add_client_message_filter(). message_type: the type of ClientMessage events to receive. This will be checked against the message_type field of the XClientMessage event struct. func: the function to call to process the event. data: user data to pass to func.

static int gdk.Event.Event.gdkEventsPending (  )  [static]

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

Returns: TRUE if any events are pending.

static int gdk.Event.Event.gdkGetShowEvents (  )  [static]

Gets whether event debugging output is enabled.

Returns: TRUE if event debugging output is enabled.

static void gdk.Event.Event.gdkSetShowEvents ( int  showEvents  )  [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. show_events: TRUE to output event debugging information.

static int gdk.Event.Event.gdkSettingGet ( char[]  name,
Value  value 
) [static]

Obtains a desktop-wide setting, such as the double-click time, for the default screen.

See gdk_screen_get_setting(). name: the name of the setting. value: location to store the value of the setting. Returns: : TRUE if the setting existed and a value was stored in value, FALSE otherwise. See Also Event Structures The structs used for each type of event.

static Event gdk.Event.Event.get (  )  [static]

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

See gdk_display_get_event(). Returns: the next GdkEvent to be processed, or NULL if no events are pending. The returned GdkEvent should be freed with gdk_event_free().

int gdk.Event.Event.getAxis ( GdkAxisUse  axisUse,
double *  value 
)

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

event: a GdkEvent 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

int gdk.Event.Event.getCoords ( double *  xWin,
double *  yWin 
)

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

event: a GdkEvent 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

GdkEvent* gdk.Event.Event.getEventStruct (  ) 

static Event gdk.Event.Event.getGraphicsExpose ( Window  window  )  [static]

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

This is used in the GtkText and GtkCList widgets in GTK+ to make sure any GraphicsExpose events are handled before the widget is scrolled. window: the GdkWindow to wait for the events for. Returns: a GdkEventExpose if a GraphicsExpose was received, or NULL if a NoExpose event was received.

int gdk.Event.Event.getRootCoords ( double *  xRoot,
double *  yRoot 
)

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

event: a GdkEvent 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

Screen gdk.Event.Event.getScreen (  ) 

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. event: a GdkEvent Returns: the screen for the event Since 2.2

int gdk.Event.Event.getState ( GdkModifierType state  ) 

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 NULL, in which case it's treated as if the event had no state field. event: a GdkEvent or NULL state: return location for state Returns: TRUE if there was a state field in the event

void* gdk.Event.Event.getStruct (  )  [protected]

the main Gtk struct as a void*

uint gdk.Event.Event.getTime (  ) 

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

If event is NULL, returns GDK_CURRENT_TIME. event: a GdkEvent Returns: time stamp field from event

static void gdk.Event.Event.handlerSet ( GdkEventFunc  func,
void *  data,
GDestroyNotify  notify 
) [static]

Sets the function to call to handle all events from GDK.

Note that GTK+ uses this to install its own event handler, so it is usually not useful for GTK+ applications. (Although an application can call this function then call gtk_main_do_event() to pass events to GTK+.) func: the function to call to handle events from GDK. data: user data to pass to the function. notify: the function to call when the handler function is removed, i.e. when gdk_event_handler_set() is called with another event handler.

static bool gdk.Event.Event.isDoubleClick ( GdkEventButton eventButton,
int  buttonNumber = 1 
) [static]

static bool gdk.Event.Event.isTrippleClick ( GdkEventButton eventButton,
int  buttonNumber = 1 
) [static]

static Event gdk.Event.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 GdkEvent on some event queue, or NULL if no events are in any queues. The returned GdkEvent should be freed with gdk_event_free().

void gdk.Event.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 NULL.

See gdk_display_put_event(). event: a GdkEvent.

int gdk.Event.Event.sendClientMessage ( GdkNativeWindow  winid  ) 

Sends an X ClientMessage event to a given window (which must be on the default GdkDisplay.

) This could be used for communicating between different applications, though the amount of data is limited to 20 bytes. event: the GdkEvent to send, which should be a GdkEventClient. winid: the window to send the X ClientMessage event to. Returns: non-zero on success.

static int gdk.Event.Event.sendClientMessageForDisplay ( Display  display,
Event  event,
GdkNativeWindow  winid 
) [static]

On X11, sends an X ClientMessage event to a given window.

On Windows, sends a message registered with the name GDK_WIN32_CLIENT_MESSAGE. This could be used for communicating between different applications, though the amount of data is limited to 20 bytes on X11, and to just four bytes on Windows. display: the GdkDisplay for the window where the message is to be sent. event: the GdkEvent to send, which should be a GdkEventClient. winid: the window to send the client message to. Returns: non-zero on success. Since 2.2

void gdk.Event.Event.sendClientmessageToall (  ) 

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

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. event: the GdkEvent to send, which should be a GdkEventClient.

void gdk.Event.Event.setScreen ( Screen  screen  ) 

Sets the screen for event to screen.

The event must have been allocated by GTK+, for instance, by gdk_event_copy(). event: a GdkEvent screen: a GdkScreen Since 2.2


Member Data Documentation

GdkEvent* gdk.Event.Event.gdkEvent [protected]

the main Gtk struct


SourceForge.net Logo DSource.org Logo digitalmars.com Logo