The Vish Visualization Shell 0.3
Vish
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
Wizt::VInteractionEvent Class Reference

Communication type for mouse and keyboard interactions. More...

#include <ocean/shrimp/VInteractionEvent.hpp>

Classes

struct  GrabReason
 
struct  InteractionGrabber
 The interaction grabber property of a VInteractionEvent contains a list of objects that are allowed to retrieve these events. More...
 

Public Types

enum  key_alias
 Function Key codes set in the key member.
 

Public Member Functions

GrabReasongrab (const WeakPtr< VObject > &, GrabReason::Type=GrabReason::Select, int CursorShapeWidth=0, const RefPtr< ChunkBase > &CursorShape=nullptr)
 Grab this interaction event exclusively to be interpreted by this object only.
 
bool isMine (const WeakPtr< VObject > &what) const
 Check whether this interaction event is exclusively mine.
 
bool mayuse (const WeakPtr< VObject > &) const
 May the specified object make use of this interaction event or is it supposed to ignore it?
 
void ungrab (const WeakPtr< VObject > &)
 Ungrab this interaction event.
 
 VInteractionEvent (InteractionID_t IID=1, const RefPtr< InteractionGrabber > &IG=nullptr)
 Constructor, need to specify an InteractionGrabber which will be shared among all copies.
 
 ~VInteractionEvent ()
 Destructor.
 

Public Attributes

InteractionID_t InteractionID
 Interaction ID - only events with the same interaction ID are supposed to be incremental.
 
double PosX
 Scaled position [0,1]x[0,1] of the mouse relative to the current input device.
 
string text
 Text is input, could be single key, could be more.
 
string txet
 Text that is constructed by keys that have been released, versus text that is constructed by key that have been pressed.
 
double wheel
 Continuously changes the origin of the wheel position.
 
int x
 horizontal coordinate of mouse
 
int y
 vertical coordinate of mouse
 

Detailed Description

Communication type for mouse and keyboard interactions.

Interaction may be exclusive or non-exclusive. Exclusion is done by cooperation, i.e. each objects must actively cooperate with others to allow exclusive access. Exclusive interaction is required when multiple objects want to make use of the same interaction, for instance the mouse or the cursor keys. If an object only wants to act on one certain hotkey and it is "pretty safe" to assume that no other object would want the same hotkey, then access can be done non-exclusively. That way multiple objects can act on different hotkeys.

Exclusive interaction is done via the VInteractionEvent::grab(), VInteractionEvent::ungrab() and VInteractionEvent::mayuse() member functions. It is up to the respective implementation to decide under which circumstances to grab() and ungrab() an interaction. This can be done, for instance, by some external flag, or via some non-exclusive hotkey.

Non-exclusive interaction is done by simply retrieving the VInteractionEvent from an object's input slot and acting on it.

See also class Interactive as a convenience class for derivation.

Examples
InteractivePoint.cpp, and LocalCompoundInput.cpp.

Member Function Documentation

◆ grab()

VInteractionEvent::GrabReason * Wizt::VInteractionEvent::grab ( const WeakPtr< VObject > &  what,
GrabReason::Type  T = GrabReason::Select,
int  CursorShapeWidth = 0,
const RefPtr< ChunkBase > &  CursorShape = nullptr 
)

Grab this interaction event exclusively to be interpreted by this object only.

Note that this can still be ignored.

Examples
InteractivePoint.cpp.

Member Data Documentation

◆ txet

string Wizt::VInteractionEvent::txet

Text that is constructed by keys that have been released, versus text that is constructed by key that have been pressed.

This interaction is required for implementing toggles to see if a pressed key has been released.

◆ wheel

double Wizt::VInteractionEvent::wheel

Continuously changes the origin of the wheel position.

Deprecated: