org.xith3d.ui.hud.utils
Class HUDPickResult

java.lang.Object
  extended by org.xith3d.ui.hud.utils.HUDPickResult
All Implemented Interfaces:
java.lang.Comparable<HUDPickResult>

public class HUDPickResult
extends java.lang.Object
implements java.lang.Comparable<HUDPickResult>

An instance of this class is returned by an pick method call of a Widget, if the picking was successful.


Nested Class Summary
static class HUDPickResult.HUDPickReason
           
 
Field Summary
static int HUD_PICK_FLAG_EVENTS_SUPPRESSED
           
static int HUD_PICK_FLAG_IS_INTERNAL
           
static int HUD_PICK_FLAG_JUST_TEST_AND_DO_NOTHING
           
 
Constructor Summary
HUDPickResult()
          Constructs a new WidgetPickResult.
HUDPickResult(Widget widget, Cursor.Type cursor, org.openmali.vecmath2.Tuple2f absPos, float relPosX, float relPosY, HUDPickResult.HUDPickReason pickReason, org.jagatoo.input.devices.components.MouseButton button)
          Constructs a new WidgetPickResult.
 
Method Summary
 int compareTo(HUDPickResult hpr2)
          
static HUDPickResult fromPool()
           
 org.openmali.vecmath2.Tuple2f getAbsPos()
           
 org.jagatoo.input.devices.components.MouseButton getButton()
           
 Cursor.Type getInheritedCursorType()
           
 HUDPickResult getLeafResult()
           
 HUDPickResult.HUDPickReason getPickReason()
           
 org.openmali.vecmath2.Tuple2f getRelPos()
           
 HUDPickResult getSubResult()
           
 Widget getWidget()
           
 boolean isLeafResult()
           
 HUDPickResult set(Widget widget, Cursor.Type cursor, float absPosX, float absPosY, float relPosX, float relPosY, HUDPickResult.HUDPickReason pickReason, org.jagatoo.input.devices.components.MouseButton button)
          Fills this WidgetPickResult.
 void setSubResult(HUDPickResult subResult)
          Sets the HUDPickResult of the picked child Widget, if any and if this is a result of a WidgetContainer picking
static void toPool(HUDPickResult hpr)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

HUD_PICK_FLAG_IS_INTERNAL

public static final int HUD_PICK_FLAG_IS_INTERNAL
See Also:
Constant Field Values

HUD_PICK_FLAG_EVENTS_SUPPRESSED

public static final int HUD_PICK_FLAG_EVENTS_SUPPRESSED
See Also:
Constant Field Values

HUD_PICK_FLAG_JUST_TEST_AND_DO_NOTHING

public static final int HUD_PICK_FLAG_JUST_TEST_AND_DO_NOTHING
See Also:
Constant Field Values
Constructor Detail

HUDPickResult

public HUDPickResult(Widget widget,
                     Cursor.Type cursor,
                     org.openmali.vecmath2.Tuple2f absPos,
                     float relPosX,
                     float relPosY,
                     HUDPickResult.HUDPickReason pickReason,
                     org.jagatoo.input.devices.components.MouseButton button)
Constructs a new WidgetPickResult.

Parameters:
widget - the picked Widget
cursor -
absPos - the absolute position of the picking
relPosX - the relative position of the picking (relative to the (0, 0) position of the Widget. For rectangular Widgets this is the upper-left corner.)
relPosY - the relative position of the picking (relative to the (0, 0) position of the Widget. For rectangular Widgets this is the upper-left corner.)
pickReason - the action which caused this pick operation
button - the mouse-button, that caused the picking

HUDPickResult

public HUDPickResult()
Constructs a new WidgetPickResult.

Method Detail

getWidget

public final Widget getWidget()
Returns:
the picked Widget instance

getAbsPos

public final org.openmali.vecmath2.Tuple2f getAbsPos()
Returns:
the absolute position of the picking

getRelPos

public final org.openmali.vecmath2.Tuple2f getRelPos()
Returns:
the relative position of the picking (relative to the (0, 0) position of the Widget. For rectangular Widgets this is the upper-left corner.)

getPickReason

public final HUDPickResult.HUDPickReason getPickReason()
Returns:
the action which caused this picking

getButton

public final org.jagatoo.input.devices.components.MouseButton getButton()
Returns:
the mouse-button, that caused the picking or null, if the picking wasn't caused by a button event.

compareTo

public int compareTo(HUDPickResult hpr2)

Specified by:
compareTo in interface java.lang.Comparable<HUDPickResult>

setSubResult

public void setSubResult(HUDPickResult subResult)
Sets the HUDPickResult of the picked child Widget, if any and if this is a result of a WidgetContainer picking


getSubResult

public HUDPickResult getSubResult()
Returns:
the HUDPickResult of the picked child Widget, if any and if this is a result of a WidgetContainer picking

getLeafResult

public HUDPickResult getLeafResult()
Returns:
if this HUDPickResult doesn't have a sub-result, this is returned. If it has a sub-resultm the result of subResult.getLeafResult is returned. This means, that the "deepest" result is returned.

isLeafResult

public boolean isLeafResult()
Returns:
if this HUDPickResult doesn't have a sub-result.

getInheritedCursorType

public final Cursor.Type getInheritedCursorType()
Returns:
the cursor type, that is inherited by the topmost sub-result.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a String representation of this object.

set

public HUDPickResult set(Widget widget,
                         Cursor.Type cursor,
                         float absPosX,
                         float absPosY,
                         float relPosX,
                         float relPosY,
                         HUDPickResult.HUDPickReason pickReason,
                         org.jagatoo.input.devices.components.MouseButton button)
Fills this WidgetPickResult.

Parameters:
widget - the picked Widget
cursor -
absPosX - the absolute position of the picking
absPosY - the absolute position of the picking
relPosX - the relative position of the picking (relative to the (0, 0) position of the Widget. For rectangular Widgets this is the upper-left corner.)
relPosY - the relative position of the picking (relative to the (0, 0) position of the Widget. For rectangular Widgets this is the upper-left corner.)
pickReason - the action which caused this pick operation
button - the mouse-button, that caused the picking

fromPool

public static final HUDPickResult fromPool()

toPool

public static final void toPool(HUDPickResult hpr)