Detailed Description

A UI Event represents a click or keypress. An event object is always provided with any onmousedown/onmouseup/onkeydown etc.

Inheritance diagram for PowerUI.UIEvent:
Dom.Event ContextMenus.ContextEvent PowerUI.CompositionEvent PowerUI.DragEvent PowerUI.FocusEvent PowerUI.FormEvent PowerUI.InputEvent PowerUI.KeyboardEvent PowerUI.MouseEvent PowerUI.MutationEvent PowerUI.TouchEvent PowerUI.WheelEvent Windows.WindowEvent

Public Member Functions

bool getModifierState (string keyArg)
 Gets the modifier state for the given key. More...
 
 UIEvent ()
 An empty UI event. More...
 
 UIEvent (string type)
 Creates an event for the given type. More...
 
 UIEvent (string type, bool bubbles)
 Creates an event for the given type. More...
 
 UIEvent (string type, bool bubbles, bool cancelable)
 Creates an event for the given type. More...
 
 UIEvent (float x, float y, bool down)
 Creates a new UI event for the mouse. More...
 
 UIEvent (int key, char ch, bool down)
 Creates a new UI event for a keypress. More...
 
 UIEvent (string type, object init)
 
void SetModifiers ()
 Sets up the Modifiers property from the current Unity event allowing things like capsLock to work. More...
 
Css.ComputedStyle getComputedStyle ()
 Gets the target computed style. More...
 
- Public Member Functions inherited from Dom.Event
 Event ()
 
 Event (string type)
 
 Event (string type, object init)
 
virtual void Reset ()
 Reset an event so it can be reused. Doesn't affect bubbles/ trusted etc. More...
 
void initEvent (string type, bool bubb, bool canc)
 used to initialize the value of an event created using Document.createEvent() More...
 
virtual void Setup (object init)
 Sets up the init dictionary. Note that it can be null. More...
 
void stopPropagation ()
 Stops the event bubbling to any other elements. More...
 
void stopImmediatePropagation ()
 Stops the event bubbling to any other elements. More...
 
EventTarget[] deepPath ()
 The deep path of this event. (Unclear working draft spec; subject to change). http://w3c.github.io/webcomponents/spec/shadow/#widl-Event-deepPath-sequence-EventTarget More...
 
void preventDefault ()
 Stops the default event handler occuring. More...
 
void initUIEvent (string type, bool canBubble, bool cancelable, PowerUI.Window view, ulong detail)
 Sets up this UIEvent. More...
 

Public Attributes

UnityEngine.Event unityEvent
 The source Unity event if there is one. More...
 
InputPointer trigger
 The pointer that triggered this event. More...
 
EventTarget relatedTarget
 A related target, if there is one. More...
 
- Public Attributes inherited from Dom.Event
const int NONE =0
 Event phase (none). More...
 
const int CAPTURING_PHASE =1
 Event capturing phase. More...
 
const int AT_TARGET =2
 Event target phase. More...
 
const int BUBBLING_PHASE =3
 Event bubbling phase. More...
 
float clientX
 The x location of the mouse, as measured from the left of the screen. More...
 
float clientY
 The y location of the mouse, as measured from the top of the screen. More...
 
int eventPhase
 The current phase of this event. More...
 
uint Modifiers
 Modifiers such as shift. Use &x to access a particular one, where x is from e.g. EventModifierInit.MODIFIER_SHIFT_ALT_GRAPH More...
 
int keyCode
 The keycode of the key pressed. More...
 
bool heldDown
 True if the mouse button or key is currently down. More...
 
char character
 The character that has been typed. More...
 
bool bubbles =false
 True if this event bubbles or not. Doesn't bubble by default. More...
 
bool cancelable =true
 True if this event can be cancelled (from bubbling further). All are by default. More...
 
EventTarget target
 The node that was clicked on or focused. It's a node because documents generate it too. Use htmlTarget if you're sure it's a HtmlElement of some kind. More...
 
EventTarget currentTarget
 Current target of this event. More...
 

Properties

bool repeat [get]
 True if this event is repeating. More...
 
string code [get]
 The keycode as text. More...
 
string key [get]
 The keycode. More...
 
bool modifierFn [get]
 Is this an fn button? More...
 
bool capsLock [get]
 Is caps lock on? More...
 
bool metaKey [get]
 Is a meta key (Windows key/ the Mac key etc) down? More...
 
bool altKey [get]
 Is an alt key down? More...
 
bool ctrlKey [get]
 Is a control key down? More...
 
bool shiftKey [get]
 Is a shift key down? More...
 
PowerUI.Window view [get]
 The view the event came from. More...
 
HtmlElement htmlTarget [get]
 A convenience shortcut to save casting 'target' to a HtmlElement. It's like this because SVG can also generate events. More...
 
KeyCode unityKeyCode [get]
 Gets the keycode as a UnityEngine.KeyCode. More...
 
bool leftMouseDown [get]
 Is the left mouse button currently down? More...
 
bool rightMouseDown [get]
 Is the right mouse button currently down? More...
 
virtual int which [get]
 
HtmlDocument htmlDocument [get]
 The HTML document that this event has come from, if any. More...
 
WorldUI worldUI [get]
 The WorldUI that this event has come from, if any. More...
 
float relativeX [get]
 A 0-1 value of where this event occured relative to the target element. 0 is left edge, 1 is right edge. More...
 
float relativeY [get]
 A 0-1 value of where this event occured relative to the target element. 0 is top edge, 1 is bottom edge. More...
 
double x [get]
 Alias for clientX. More...
 
double y [get]
 Alias for clientY. More...
 
double offsetX [get]
 X Position relative to the parent. More...
 
double offsetY [get]
 Y Position relative to the parent. More...
 
float localX [get]
 The position of the event relative to the top left corner of the target element in pixels. More...
 
float localY [get]
 The position of the event relative to the top left corner of the target element in pixels. More...
 
- Properties inherited from Dom.Event
bool cancelBubble [get, set]
 Set to true if you do not want this event to bubble any further. More...
 
bool isTrusted [get]
 True if this was created by the UA. Use isTrusted. More...
 
string type [get, set]
 The type of this event. More...
 
Node srcElement [get]
 The node that was clicked on or focused. More...
 
bool defaultPrevented [get]
 True if the default has been prevented. More...
 
DateTime timeStamp [get]
 Current time of this event. More...
 
string char [get]
 The printable character if it is one. More...
 
int button [get]
 The mouse button that was pressed. See isLeftMouse and isRightMouse for clearer ways of using this value. More...
 
bool isLeftMouse [get]
 Mouseup/down only. Was it the left mouse button? More...
 
bool isRightMouse [get]
 Mouseup/down only. Was it the right mouse button? More...
 
Document document [get]
 The document that this event has come from, if any. More...
 
Windows.Window sparkWindow [get]
 The window that the currentTarget of the event is in. More...
 

Private Member Functions

bool GetModifier (uint mask)
 

Additional Inherited Members

- Package Functions inherited from Dom.Event
void SetTrusted ()
 
void SetTrusted (bool bubbles)
 
- Package Attributes inherited from Dom.Event
string EventType
 The type of this event. Only set if you directly use the UIEvent(type) constructor. See type instead. More...
 
bool _Cancelled
 True if this event has been cancelled via preventDefault. More...
 
bool _CancelImmediate
 True if this has been immediately cancelled. More...
 
bool _IsTrusted
 True if this was created by the UA. Use isTrusted. More...
 

Constructor & Destructor Documentation

PowerUI.UIEvent.UIEvent ( )
inline

An empty UI event.

PowerUI.UIEvent.UIEvent ( string  type)
inline

Creates an event for the given type.

PowerUI.UIEvent.UIEvent ( string  type,
bool  bubbles 
)
inline

Creates an event for the given type.

PowerUI.UIEvent.UIEvent ( string  type,
bool  bubbles,
bool  cancelable 
)
inline

Creates an event for the given type.

PowerUI.UIEvent.UIEvent ( float  x,
float  y,
bool  down 
)
inline

Creates a new UI event for the mouse.

Parameters
xThe x location of the mouse.
yThe y location of the mouse.
downTrue if the button is held down.
PowerUI.UIEvent.UIEvent ( int  key,
char  ch,
bool  down 
)
inline

Creates a new UI event for a keypress.

Parameters
keyThe keycode.
chThe newly typed character.
downTrue if the key is held down.
PowerUI.UIEvent.UIEvent ( string  type,
object  init 
)
inline

Member Function Documentation

Css.ComputedStyle PowerUI.UIEvent.getComputedStyle ( )
inline

Gets the target computed style.

bool PowerUI.UIEvent.GetModifier ( uint  mask)
inlineprivate
bool PowerUI.UIEvent.getModifierState ( string  keyArg)
inline

Gets the modifier state for the given key.

void PowerUI.UIEvent.SetModifiers ( )
inline

Sets up the Modifiers property from the current Unity event allowing things like capsLock to work.

Member Data Documentation

EventTarget PowerUI.UIEvent.relatedTarget

A related target, if there is one.

InputPointer PowerUI.UIEvent.trigger

The pointer that triggered this event.

UnityEngine.Event PowerUI.UIEvent.unityEvent

The source Unity event if there is one.

Property Documentation

bool PowerUI.UIEvent.altKey
get

Is an alt key down?

bool PowerUI.UIEvent.capsLock
get

Is caps lock on?

string PowerUI.UIEvent.code
get

The keycode as text.

bool PowerUI.UIEvent.ctrlKey
get

Is a control key down?

HtmlDocument PowerUI.UIEvent.htmlDocument
get

The HTML document that this event has come from, if any.

HtmlElement PowerUI.UIEvent.htmlTarget
get

A convenience shortcut to save casting 'target' to a HtmlElement. It's like this because SVG can also generate events.

string PowerUI.UIEvent.key
get

The keycode.

bool PowerUI.UIEvent.leftMouseDown
get

Is the left mouse button currently down?

float PowerUI.UIEvent.localX
get

The position of the event relative to the top left corner of the target element in pixels.

float PowerUI.UIEvent.localY
get

The position of the event relative to the top left corner of the target element in pixels.

bool PowerUI.UIEvent.metaKey
get

Is a meta key (Windows key/ the Mac key etc) down?

bool PowerUI.UIEvent.modifierFn
get

Is this an fn button?

double PowerUI.UIEvent.offsetX
get

X Position relative to the parent.

double PowerUI.UIEvent.offsetY
get

Y Position relative to the parent.

float PowerUI.UIEvent.relativeX
get

A 0-1 value of where this event occured relative to the target element. 0 is left edge, 1 is right edge.

float PowerUI.UIEvent.relativeY
get

A 0-1 value of where this event occured relative to the target element. 0 is top edge, 1 is bottom edge.

bool PowerUI.UIEvent.repeat
get

True if this event is repeating.

bool PowerUI.UIEvent.rightMouseDown
get

Is the right mouse button currently down?

bool PowerUI.UIEvent.shiftKey
get

Is a shift key down?

KeyCode PowerUI.UIEvent.unityKeyCode
get

Gets the keycode as a UnityEngine.KeyCode.

PowerUI.Window PowerUI.UIEvent.view
get

The view the event came from.

virtual int PowerUI.UIEvent.which
get
WorldUI PowerUI.UIEvent.worldUI
get

The WorldUI that this event has come from, if any.

double PowerUI.UIEvent.x
get

Alias for clientX.

double PowerUI.UIEvent.y
get

Alias for clientY.