Gorgon Game Engine
Gorgon::Input Namespace Reference

This namespace contains general input related functionality. More...

Namespaces

 internal
 
 Keyboard
 Keyboard related functions and enumerations.
 
 Mouse
 

Classes

class  DragInfo
 Contains information about a drag operation. More...
 
class  DragSource
 
class  DropTarget
 This layer acts as a drop target. More...
 
class  KeyRepeater
 This class simplifies the use of repeated keystrokes when a key is pressed. More...
 
class  Layer
 Input layer allows mouse events to be handled. More...
 

Typedefs

typedef int Key
 A type to represent an input key. More...
 

Functions

void begindrag ()
 
template<class ... A_>
DragInfoBeginDrag (A_ &&... data)
 Begins a drag operation using the given data, without a source. More...
 
void begindrag (DragSource &source)
 
template<class ... A_>
DragInfoBeginDrag (DragSource &source, A_ &&... data)
 Begins a drag operation using the given source and data. More...
 
void CancelDrag ()
 Cancel the current drag operation. More...
 
void Drop (Geometry::Point location={0, 0})
 Drop the current drag object. More...
 
void finishdrag (bool success)
 
DragInfoGetDragOperation ()
 Returns the current drag operation, throws if IsDragPrepared is false. More...
 
void initdrag ()
 
bool IsDragging ()
 Returns whether a drag operation is in progress. More...
 
bool IsDragPrepared ()
 Returns whether a drag operation is available. More...
 
bool needsclip (Input::Mouse::EventType event)
 
DragInfoPrepareDrag ()
 Prepares the drag operation. More...
 
DragInfoPrepareDrag (DragSource &source)
 Prepares the drag operation. More...
 
void startdrag ()
 
DragInfoStartDrag ()
 Starts the drag operation. More...
 

Variables

bool AllowCharEvent
 During keyevent this variable can be set to true, if done so, it will allow character events even if key event is handled. More...
 
Event< void, DragInfo &, bool > DragEnded
 This event is fired whenever a drag operation ends. More...
 
DragInfoDragOperation
 Current Drag operation, could be nullptr, denoting there is none. More...
 
bool dragstarted
 
Event< void, DragInfo & > DragStarted
 This event is fired whenever a drag operation begins. More...
 

Detailed Description

This namespace contains general input related functionality.

Also check Gorgon::Keyboard and Gorgon::Mouse.

Typedef Documentation

◆ Key

typedef int Key

A type to represent an input key.

Function Documentation

◆ begindrag() [1/2]

void Gorgon::Input::begindrag ( )

References DragOperation, and initdrag().

◆ BeginDrag() [1/2]

DragInfo& Gorgon::Input::BeginDrag ( A_ &&...  data)

Begins a drag operation using the given data, without a source.

Data will be assigned immediately for events to work properly. Additional data items can be added later if additional data become available at a later time. It is not possible to receive any drag related events without a source.

References begindrag(), DragInfo::DataReady(), DragOperation, and startdrag().

◆ begindrag() [2/2]

void Gorgon::Input::begindrag ( DragSource source)

References DragOperation, and initdrag().

◆ BeginDrag() [2/2]

DragInfo& Gorgon::Input::BeginDrag ( DragSource source,
A_ &&...  data 
)

Begins a drag operation using the given source and data.

Data will be assigned immediately for events to work properly. Additional data items can be added later if additional data become available at a later time.

References begindrag(), DragInfo::DataReady(), DragOperation, and startdrag().

◆ CancelDrag()

void CancelDrag ( )

Cancel the current drag operation.

References finishdrag(), GetDragOperation(), and IsDragging().

◆ Drop()

void Drop ( Geometry::Point  location = {0, 0})

Drop the current drag object.

If there is no target receiving it, it will be canceled

References CancelDrag(), finishdrag(), GetDragOperation(), and IsDragging().

◆ finishdrag()

void Gorgon::Input::finishdrag ( bool  success)

◆ GetDragOperation()

DragInfo& Gorgon::Input::GetDragOperation ( )

Returns the current drag operation, throws if IsDragPrepared is false.

References DragOperation.

◆ initdrag()

void initdrag ( )

◆ IsDragging()

bool Gorgon::Input::IsDragging ( )

Returns whether a drag operation is in progress.

References DragOperation, and dragstarted.

◆ IsDragPrepared()

bool Gorgon::Input::IsDragPrepared ( )

Returns whether a drag operation is available.

References DragOperation.

◆ needsclip()

◆ PrepareDrag() [1/2]

DragInfo& Gorgon::Input::PrepareDrag ( )

Prepares the drag operation.

This function does not fully start the drag operation. You should call StartDrag after setting the data of the drag object

References DragOperation, and initdrag().

◆ PrepareDrag() [2/2]

DragInfo& Gorgon::Input::PrepareDrag ( DragSource source)

Prepares the drag operation.

This function does not fully start the drag operation. You should call StartDrag after setting the data of the drag object

References DragOperation, and initdrag().

◆ startdrag()

void Gorgon::Input::startdrag ( )

◆ StartDrag()

DragInfo& Gorgon::Input::StartDrag ( )

Starts the drag operation.

You should first call PrepareDrag and set the data before starting the drag operation.

References DragOperation, and startdrag().

Variable Documentation

◆ AllowCharEvent

bool AllowCharEvent

During keyevent this variable can be set to true, if done so, it will allow character events even if key event is handled.

However, doing so will not direct the up event to the handler directly.

◆ DragEnded

Event< void, DragInfo &, bool > DragEnded

This event is fired whenever a drag operation ends.

Second parameter is set to true if the drag is accepted, if canceled it will be set to false. First parameter might not be reliable as this event is called after cancel/accept events.

◆ DragOperation

DragInfo * DragOperation

Current Drag operation, could be nullptr, denoting there is none.

It is better to use GetDragOperation function.

◆ dragstarted

bool dragstarted

◆ DragStarted

Event< void, DragInfo & > DragStarted

This event is fired whenever a drag operation begins.