EventButtonProtocol
public protocol EventButtonProtocol
The EventButtonProtocol protocol exposes the methods and properties of an underlying GdkEventButton instance.
The default implementation of these can be found in the protocol extension below.
For a concrete class that implements these methods and properties, see EventButton.
Alternatively, use EventButtonRef as a lighweight, unowned reference if you already have an instance you just want to use.
Used for button press and button release events. The
type field will be one of GDK_BUTTON_PRESS,
GDK_2BUTTON_PRESS, GDK_3BUTTON_PRESS or GDK_BUTTON_RELEASE,
Double and triple-clicks result in a sequence of events being received. For double-clicks the order of events will be:
GDK_BUTTON_PRESSGDK_BUTTON_RELEASEGDK_BUTTON_PRESSGDK_2BUTTON_PRESSGDK_BUTTON_RELEASE
Note that the first click is received just like a normal
button press, while the second click results in a GDK_2BUTTON_PRESS
being received just after the GDK_BUTTON_PRESS.
Triple-clicks are very similar to double-clicks, except that
GDK_3BUTTON_PRESS is inserted after the third click. The order of the
events is:
GDK_BUTTON_PRESSGDK_BUTTON_RELEASEGDK_BUTTON_PRESSGDK_2BUTTON_PRESSGDK_BUTTON_RELEASEGDK_BUTTON_PRESSGDK_3BUTTON_PRESSGDK_BUTTON_RELEASE
For a double click to occur, the second button press must occur within ¼ of a second of the first. For a triple click to occur, the third button press must also occur within ½ second of the first button press.
-
Untyped pointer to the underlying
GdkEventButtoninstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
_ptrDefault implementationTyped pointer to the underlying
GdkEventButtoninstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GdkEventButtoninstance.Declaration
Swift
var _ptr: UnsafeMutablePointer<GdkEventButton>! { get } -
Required Initialiser for types conforming to
EventButtonProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
typeExtension methodthe type of the event (
GDK_BUTTON_PRESS,GDK_2BUTTON_PRESS,GDK_3BUTTON_PRESSorGDK_BUTTON_RELEASE).Declaration
Swift
@inlinable var type: GdkEventType { get set } -
windowExtension methodthe window which received the event.
Declaration
Swift
@inlinable var window: WindowRef! { get set } -
sendEventExtension methodtrueif the event was sent explicitly.Declaration
Swift
@inlinable var sendEvent: gint8 { get set } -
timeExtension methodthe time of the event in milliseconds.
Declaration
Swift
@inlinable var time: guint32 { get set } -
xExtension methodthe x coordinate of the pointer relative to the window.
Declaration
Swift
@inlinable var x: gdouble { get set } -
yExtension methodthe y coordinate of the pointer relative to the window.
Declaration
Swift
@inlinable var y: gdouble { get set } -
axesExtension methodDeclaration
Swift
@inlinable var axes: UnsafeMutablePointer<gdouble>! { get set } -
stateExtension methoda bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt) and the pointer buttons. See
GdkModifierType.Declaration
Swift
@inlinable var state: ModifierType { get set } -
buttonExtension methodthe 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.
Declaration
Swift
@inlinable var button: guint { get set } -
deviceExtension methodthe master device that the event originated from. Use
gdk_event_get_source_device()to get the slave device.Declaration
Swift
@inlinable var device: DeviceRef! { get set } -
xRootExtension methodthe x coordinate of the pointer relative to the root of the screen.
Declaration
Swift
@inlinable var xRoot: gdouble { get set } -
yRootExtension methodthe y coordinate of the pointer relative to the root of the screen.
Declaration
Swift
@inlinable var yRoot: gdouble { get set }
View on GitHub
Install in Dash
EventButtonProtocol Protocol Reference