Index

Package: Input

Description

package Events.Input is
Copyright (c) 2012 Kevin Wellwood All rights reserved. This source code is distributed under the Modified BSD License. For terms and conditions, see license.txt.

Classes

Key_Event

type Key_Event is new Event with private;

Ancestors:

Immediate Children:

Primitive operations:

Construct
Events.Construct (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
To_String (overriding Events.To_String)
A notification of a keyboard-based event.

Key_Typed_Event

type Key_Typed_Event is new Key_Event with private;

Ancestors:

Primitive operations:

Construct
Construct (Inherited)
Events.Construct (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
To_String (Inherited)
A character was typed, or repeated due to holding down the key.

Mouse_Event

type Mouse_Event is new Event with private;

Ancestors:

Immediate Children:

Primitive operations:

Construct
Events.Construct (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
To_String (overriding Events.To_String)
A notification of a mouse-based event.

Mouse_Scroll_Event

type Mouse_Scroll_Event is new Mouse_Event with private;

Ancestors:

Primitive operations:

Construct
Construct (Inherited)
Events.Construct (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
To_String (Inherited)
A notification that the mouse wheel was scrolled.

Mouse_Button_Event

type Mouse_Button_Event is new Mouse_Event with private;

Ancestors:

Primitive operations:

Construct (Inherited)
Construct
Events.Construct (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
To_String (overriding To_String)
A notification of a mouse button-based event.

Types

A_Key_Event

type A_Key_Event is access all Key_Event'Class;

A_Key_Typed_Event

type A_Key_Typed_Event is access all Key_Typed_Event'Class;

A_Mouse_Event

type A_Mouse_Event is access all Mouse_Event'Class;

A_Mouse_Scroll_Event

type A_Mouse_Scroll_Event is access all Mouse_Scroll_Event'Class;

A_Mouse_Button_Event

type A_Mouse_Button_Event is access all Mouse_Button_Event'Class;

Constants & Global variables

KEY_PRESS_ID (Events.Event_Id)

KEY_PRESS_ID : constant Event_Id := To_Event_Id( "Key_Press" );
A notification that a key was pressed.

KEY_RELEASE_ID (Events.Event_Id)

KEY_RELEASE_ID : constant Event_Id := To_Event_Id( "Key_Release" );
A notification that a key was released.

KEY_TYPED_ID (Events.Event_Id)

KEY_TYPED_ID : constant Event_Id := To_Event_Id( "Key_Typed" );
A notification that a key was typed or held down for the repeat delay.

MOUSE_MOVE_ID (Events.Event_Id)

MOUSE_MOVE_ID : constant Event_Id := To_Event_Id( "Mouse_Move" );
A notification that the mouse moved.

MOUSE_SCROLL_ID (Events.Event_Id)

MOUSE_SCROLL_ID : constant Event_Id := To_Event_Id( "Mouse_Scroll" );

MOUSE_CLICK_ID (Events.Event_Id)

MOUSE_CLICK_ID : constant Event_Id := To_Event_Id( "Mouse_Click" );
A notification that a mouse button was clicked (pressed and released rapidly).

MOUSE_DOUBLECLICK_ID (Events.Event_Id)

MOUSE_DOUBLECLICK_ID : constant Event_Id := To_Event_Id( "Mouse_Doubleclick" );
A notification that a mouse button was double-clicked (clicked twice, rapidly).

MOUSE_HELD_ID (Events.Event_Id)

MOUSE_HELD_ID : constant Event_Id := To_Event_Id( "Mouse_Held" );
A notification that a mouse button was held down for the mouse button repeat rate delay.

MOUSE_PRESS_ID (Events.Event_Id)

MOUSE_PRESS_ID : constant Event_Id := To_Event_Id( "Mouse_Press" );
A notification that a mouse button was pressed.

MOUSE_RELEASE_ID (Events.Event_Id)

MOUSE_RELEASE_ID : constant Event_Id := To_Event_Id( "Mouse_Release" );
A notification that a mouse button was released.

Subprograms & Entries

Get_Key

function Get_Key
( this: not null access Key_Event'Class ) return Positive;
Returns the Allegro key code of the key involved.

Get_Modifiers

procedure Get_Modifiers
( this: not null access Key_Event'Class;
modifiers: out Modifiers_Array );
Returns a boolean array of modifier keys that were pressed/not pressed at the time of the event.

No_Modifiers

function No_Modifiers
( this: not null access Key_Event'Class ) return Boolean;
Returns True if no modifier keys were pressed at the time of the event.

Only_Alt

function Only_Alt
( this: not null access Key_Event'Class ) return Boolean;
Returns True if the Alt key was the only pressed modifier at the time of the event.

Only_Ctrl

function Only_Ctrl
( this: not null access Key_Event'Class ) return Boolean;
Returns True if the Ctrl key was the only pressed modifier at the time of the event.

Only_Shift

function Only_Shift
( this: not null access Key_Event'Class ) return Boolean;
Returns True if the Shift key was the only pressed modifier at the time of the event.

Get_Char

function Get_Char
( this: not null access Key_Typed_Event'Class ) return Character;
Returns the character that was typed, or nul if not a visible character.

Get_X

function Get_X
( this: not null access Mouse_Event'Class ) return Integer;
Returns the X location of the mouse at the time of the event.

Get_Y

function Get_Y
( this: not null access Mouse_Event'Class ) return Integer;
Returns the Y location of the mouse within the window at the time of the event.

Set_XY

procedure Set_XY
( this: not null access Mouse_Event'Class;
x, y: Integer );
Sets the location of the mouse at the time of the event. This can be called by an event handler to filter the mouse even location for later mouse event handlers, to make the event location relative to some widget.

Get_Amount

function Get_Amount
( this: not null access Mouse_Scroll_Event'Class ) return Integer;
Returns the amount that the mouse wheel was scrolled.

Get_Button

function Get_Button
( this: not null access Mouse_Button_Event'Class ) return Mouse_Button;
Returns the mouse button involved in the event.

Get_Modifiers

function Get_Modifiers
( this: not null access Mouse_Button_Event'Class ) return Modifiers_Array;
Returns a boolean array of keyboard modifiers that were pressed at the time of the event.

Queue_Key_Typed

procedure Queue_Key_Typed
( key: Positive;
char: Character;
modifiers: Modifiers_Array );
Queues a Key_Typed event.

Queue_Key_Press

procedure Queue_Key_Press
( key: Positive;
modifiers: Modifiers_Array );
Queues a Key_Press event.

Queue_Key_Release

procedure Queue_Key_Release
( key: Positive;
modifiers: Modifiers_Array );
Queues a Key_Release event.

Generate_Key_Release

function Generate_Key_Release
( key: Positive;
modifiers: Modifiers_Array ) return A_Key_Event;
Creates and returns a Key_Release event without queueing it.

Queue_Mouse_Click

procedure Queue_Mouse_Click
( x, y: Integer;
btn: Mouse_Button );
Queues a Mouse_Click event.

Queue_Mouse_Doubleclick

procedure Queue_Mouse_Doubleclick
( x, y: Integer;
btn: Mouse_Button );
Queues a Mouse_Doubleclick event.

Queue_Mouse_Held

procedure Queue_Mouse_Held
( x, y: Integer;
btn: Mouse_Button );
Queues a Mouse_Held event.

Queue_Mouse_Move

procedure Queue_Mouse_Move
( x, y: Integer );
Queues a Mouse_Move event.

Queue_Mouse_Press

procedure Queue_Mouse_Press
( x, y: Integer;
btn: Mouse_Button;
modifiers: Modifiers_Array );
Queues a Mouse_Press event.

Queue_Mouse_Release

procedure Queue_Mouse_Release
( x, y: Integer;
btn: Mouse_Button );
Queues a Mouse_Release event.

Create_Mouse_Release

function Create_Mouse_Release
( x, y: Integer;
btn: Mouse_Button ) return A_Mouse_Button_Event;
Creates a Mouse_Release_Event instance without queueing it. This is used only for a special case in the Window widget. The event is never queued; it's passed directly to a handler procedure to simulate an event.

Queue_Mouse_Scroll

procedure Queue_Mouse_Scroll
( x, y, amount: Integer );
Queues a Mouse_Scroll event.