org.xith3d.ui.hud.base
Class WidgetContainer

java.lang.Object
  extended by org.xith3d.ui.hud.base.Widget
      extended by org.xith3d.ui.hud.base.BackgroundSettableWidget
          extended by org.xith3d.ui.hud.base.WidgetContainer
All Implemented Interfaces:
org.jagatoo.datatypes.NamableObject, org.jagatoo.datatypes.NamedObject, org.openmali.types.twodee.Positioned2f, org.openmali.types.twodee.Positioned2fRO, org.openmali.types.twodee.Sized2f, org.openmali.types.twodee.Sized2fRO, PaddingSettable
Direct Known Subclasses:
Panel

public abstract class WidgetContainer
extends BackgroundSettableWidget
implements PaddingSettable

A WidgetContainer is a Widget, that can hold arbitrary Widgets. It can have it's own coordinate system and the contained Widget's transformations are relative to it.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.xith3d.ui.hud.base.BackgroundSettableWidget
BackgroundSettableWidget.BackgroundSettableDescriptionBase
 
Nested classes/interfaces inherited from class org.xith3d.ui.hud.base.Widget
Widget.DescriptionBase
 
Field Summary
protected  org.openmali.vecmath2.Vector2f childrenOffset_HUD
           
protected  org.openmali.vecmath2.Vector2i childrenOffset_PX
           
 
Fields inherited from class org.xith3d.ui.hud.base.Widget
transformHeight_Pixels2HUD, transformWidth_Pixels2HUD
 
Constructor Summary
protected WidgetContainer(boolean isHeavyWeight, boolean hasWidgetAssembler, float width, float height, org.openmali.vecmath2.Colorf backgroundColor, Texture2D backgroundTex, TileMode backgroundTileMode)
          Creates a new WidgetContainer with the given width, height and z-index.
 
Method Summary
 Widget addWidget(Widget widget)
          Adds a Widget to this container at the Widget's location.
 Widget addWidget(Widget widget, float locX, float locY)
          Adds a Widget to this container at the given location.
 Widget addWidget(Widget widget, float locX, float locY, int zIndex)
          Adds a Widget to this container at the given location.
 Widget addWidget(Widget widget, float locX, float locY, int zIndex, java.lang.Object constraints)
          Adds a Widget to this container at the given location.
 Widget addWidget(Widget widget, float locX, float locY, java.lang.Object constraints)
          Adds a Widget to this container at the given location.
 Widget addWidget(Widget widget, java.lang.Object constraints)
          Adds a Widget to this container at the Widget's location.
 Widget addWidgetCentered(Widget widget)
          Adds a Widget to this container at the center.
 Widget addWidgetCentered(Widget widget, int zIndex)
          Adds a Widget to this container at the center.
protected  float calculateTransformHeight_Pixels2HUD(float contentHeight)
          
protected  float calculateTransformWidth_Pixels2HUD(float contentWidth)
          
 void clear()
          Removes all Widgets from this WidgetContainer.
protected  GroupNode createChildrenGroup()
           
protected  void drawChildWidgets(Texture2DCanvas texCanvas, int offsetX, int offsetY, int width, int height, boolean drawsSelf)
           
protected  void drawWidget(Texture2DCanvas texCanvas, int offsetX, int offsetY, int width, int height, boolean drawsSelf)
          
 Widget focus(Widget widget)
          Focusses the given Widget (non thread-safe).
 Widget getCurrentFocusedWidget()
           
 Widget getCurrentFocusedWidget(boolean getLeaf)
           
protected  Widget getCurrentHoveredWidget()
           
 Widget getCurrentHoveredWidget(boolean getLeaf)
           
protected  float getEqualHeight(float width)
           
protected  float getEqualWidth(float height)
           
 LayoutManager getLayout()
           
protected
<Tuple2i_ extends org.openmali.vecmath2.Tuple2i>
Tuple2i_
getLocationHUD2Pixels(float x, float y, Tuple2i_ buffer)
          Calculates pixel location from these HUD-values.
protected
<Tuple2f_ extends org.openmali.vecmath2.Tuple2f>
Tuple2f_
getLocationHUD2SG(float x, float y, Tuple2f_ buffer)
          Calculates scenegraph location from these HUD-values.
protected
<Tuple2f_ extends org.openmali.vecmath2.Tuple2f>
Tuple2f_
getLocationPixels2HUD(int x, int y, Tuple2f_ buffer)
          Calculates HUD location from these pixel-values.
protected
<Tuple2f_ extends org.openmali.vecmath2.Tuple2f>
Tuple2f_
getLocationSG2HUD(float x, float y, Tuple2f_ buffer)
          Calculates HUD location from these scenegraph-values.
 int getPaddingBottom()
          
 int getPaddingLeft()
          
 int getPaddingRight()
          
 int getPaddingTop()
          
 Window getParentWindow()
          Gets, the Window, of which this is the content pane.
protected
<Tuple2i_ extends org.openmali.vecmath2.Tuple2i>
Tuple2i_
getRelLocationHUD2Pixels(float x, float y, Tuple2i_ buffer)
          Calculates container relative pixel location from these HUD-values.
 float getResAspect()
           
 org.openmali.vecmath2.Tuple2f getResolution()
           
 float getResX()
           
 float getResY()
           
protected  GroupNode getSGGroup()
           
protected
<Dim2i_ extends org.openmali.types.twodee.Dim2i>
Dim2i_
getSizeHUD2Pixels(float w, float h, Dim2i_ buffer)
          Calculates pixel size from these HUD-values.
protected
<Dim2f_ extends org.openmali.types.twodee.Dim2f>
Dim2f_
getSizeHUD2SG(float w, float h, Dim2f_ buffer)
          Calculates scenegraph width and height from these HUD-values.
protected
<Dim2f_ extends org.openmali.types.twodee.Dim2f>
Dim2f_
getSizeOfPixels(int x, int y, Dim2f_ buffer)
          Retrieves the size these pixels have on this WidgetContainer.
protected
<Dim2f_ extends org.openmali.types.twodee.Dim2f>
Dim2f_
getSizePixels2HUD(int w, int h, Dim2f_ buffer)
          Calculates HUD size from these pixel-values.
protected
<Dim2f_ extends org.openmali.types.twodee.Dim2f>
Dim2f_
getSizeSG2HUD(float w, float h, Dim2f_ buffer)
          Calculates HUD size from these scenegraph-values.
 Widget getWidget(int index)
          Gets the index'th Widget on this Container.
 java.util.List<Widget> getWidgets()
           
 int getWidgetsCount()
          Gets the number of Widgets on this container.
 boolean hasCustomResolution()
          Returns whether a custom resolution is defined on the widget container.
 boolean isClippingEnbaled()
           
 boolean isContentPane()
          Gets, if this WidgetContainer is a content pane of a Window.
protected  void onAttachedToHUD(HUD hud)
          This event is fired, when this Widget is added to the HUD live Widget hierarchy.
protected  void onControllerAxisChanged(org.jagatoo.input.devices.components.ControllerAxis axis, int axisDelta, long when)
          This event is fired when a ControllerAxis has changed and this Widget is the currently focussed one.
protected  void onControllerButtonPressed(org.jagatoo.input.devices.components.ControllerButton button, long when)
          This event is fired when a ControllerButton has been pressed and this Widget is the currently focussed one.
protected  void onControllerButtonReleased(org.jagatoo.input.devices.components.ControllerButton button, long when)
          This event is fired when a ControllerButton has been released and this Widget is the currently focussed one.
protected  void onFocusGained()
          This event is fired, when the focus is gained to a Widget.
protected  void onFocusLost()
          This event is fired, when the focus is lost by a Widget.
protected  void onInputStateChanged(org.jagatoo.input.devices.components.DeviceComponent comp, int delta, int state, long when, boolean isTopMost, boolean hasFocus)
          This event is fired when the state of any DeviceComponent has changed.
protected  void onKeyPressed(org.jagatoo.input.devices.components.Key key, int modifierMask, long when)
          This event is fired, when a key is pressed on a focused Widget.
protected  void onKeyReleased(org.jagatoo.input.devices.components.Key key, int modifierMask, long when)
          This event is fired, when a key is released on a focused Widget.
protected  void onKeyTyped(char ch, int modifierMask, long when)
          This event is fired when a key is typed on the keyboard.
protected  void onMouseExited(boolean isTopMost, boolean hasFocus)
          This method is called when the mouse exited the Widget area.
protected  void onSizeChanged(float oldWidth, float oldHeight, float newWidth, float newHeight)
          
protected  void onVisibilityChanged(boolean visible)
          This method is triggered when the visibility state has eeffectively changed.
protected  HUDPickResult pick(int canvasX, int canvasY, HUDPickResult.HUDPickReason pickReason, org.jagatoo.input.devices.components.MouseButton button, long when, long meta, int flags)
          Tests whether a Widget is under the cursor and runs the approriate methods if true.
 void removeWidget(Widget widget)
          Removes a Widget from this container.
protected  void resetCurrentHoveredWidget()
           
 void setClippingEnabled(boolean clippingEnabled)
          Enables or disables clipping for this WidgetContainer.
 void setLayout(LayoutManager layout)
          Sets which LayoutManager to use for the child Widgets of this Container.
 boolean setPadding(int padding)
          Sets padding for this PaddingSettable Widget.
 boolean setPadding(int paddingBottom, int paddingRight, int paddingTop, int paddingLeft)
          Sets padding for this PaddingSettable Widget.
 void setResolution(float resX, float resY)
          Sets the container's resolution.
 void setTransparency(float transparency, boolean childrenToo)
          Sets the whole Widget's transparency.
protected  void setWidgetDirty()
           
protected  void setZIndexSortingDirty()
           
 void update()
          Updates the Widget's internals.
protected  void updateAbsZIndex()
          
protected  void updateTranslation()
          Effectively changes the translation of this Widget (location and z-index)
 
Methods inherited from class org.xith3d.ui.hud.base.BackgroundSettableWidget
drawBackground, getBackgroundColor, getBackgroundTexture, getBackgroundTileMode, setBackground, setBackground, setBackground, setBackgroundColor, setBackgroundTexture, setBackgroundTexture, setBackgroundTexture, setBackgroundTexture, setBackgroundTileMode, setNoBackground
 
Methods inherited from class org.xith3d.ui.hud.base.Widget
addContainerListener, addControllerListener, addFocusListener, addInputListener, addKeyboardListener, addLocationListener, addMouseListener, addSizeListener, addVisibilityListener, bindToGlobalMouseMovement, blocksFocusMoveDeviceComponent, compareAbsZIndex, createShape, detach, drawAndUpdateWidget, drawBorder, drawWidgetAfterWidgetAssembler, drawWidgetContents, getAbsoluteLocationOnHUD_, getAspect, getAssembly, getBorder, getContainer, getContentAspect, getContentHeight, getContentHeightPX, getContentLeftPX, getContentOffset, getContentTopPX, getContentWidth, getContentWidthPX, getContextMenu, getCursor, getEqualHeight_, getEqualWidth_, getForcedRedrawFrequency, getHeight, getHeightPX, getHUD, getLeft, getLevel, getLocation, getLocation, getLocationHUD2Pixels_, getLocationHUD2SG_, getLocationPixels2HUD_, getLocationSG2HUD_, getMaxRedrawFrequency, getMinHeight, getMinWidth, getName, getPickHeight, getPickWidth, getRelLocationHUD2Pixels_, getRootHostWidget, getShape, getSize, getSizeHUD2Pixels_, getSizeHUD2SG_, getSizeOfPixels_, getSizePixels2HUD_, getSizeSG2HUD_, getToolTip, getTop, getTransparency, getUserObject, getWidgetAssembler, getWidth, getWidthPX, getZIndex, hasDropShadow, hasFocus, hasFocus, hasToolTip, init, initSize, isAHostedWidgetDirty, isClickable, isDraggable, isFocussable, isHeavyWeight, isHovered, isInitialized, isInitializing, isPickable, isThisWidgetDirty, isVisible, notifyOnDragStopped, onAttachedToContainer, onDetachedFromContainer, onDetachedFromHUD, onLocationChanged, onMouseButtonPressed, onMouseButtonReleased, onMouseEntered, onMouseMoved, onMouseStopped, onMouseWheelMoved, pickConditionsMatch, removeContainerListener, removeControllerListener, removeFocusListener, removeInputListener, removeKeyboardListener, removeLocationListener, removeMouseListener, removeSizeListener, removeVisibilityListener, requestFocus, resetWidgetDirty, setBorder, setBorder, setClickable, setContentClipRect, setContextMenu, setCursor, setDraggable, setFocussable, setForcedRedrawFrequency, setHasDropShadow, setHeight, setHostedWidgetDirty, setHostTextureDirty, setHostTextureDirty, setHostWidget, setLocation, setLocation, setLocation, setMaxRedrawFrequency, setName, setPickable, setSize, setSize, setSize, setSize, setTextureDirty, setTextureDirty, setToolTip, setTransparency, setUserObject, setVisible, setWidth, setZIndex, startDragging, toString, updateSizeFactors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

childrenOffset_HUD

protected final org.openmali.vecmath2.Vector2f childrenOffset_HUD

childrenOffset_PX

protected final org.openmali.vecmath2.Vector2i childrenOffset_PX
Constructor Detail

WidgetContainer

protected WidgetContainer(boolean isHeavyWeight,
                          boolean hasWidgetAssembler,
                          float width,
                          float height,
                          org.openmali.vecmath2.Colorf backgroundColor,
                          Texture2D backgroundTex,
                          TileMode backgroundTileMode)
Creates a new WidgetContainer with the given width, height and z-index. The WidgetContainer will have a differen coordinate system then it's parent WidgetContainer.

Parameters:
isHeavyWeight -
hasWidgetAssembler -
width - the new width of this Widget
height - the new height of this Widget
backgroundColor - the background color
backgroundTex - the background texture
backgroundTileMode -
Method Detail

getSGGroup

protected final GroupNode getSGGroup()
Returns:
the scenegraph Group to add children to

isContentPane

public final boolean isContentPane()
Gets, if this WidgetContainer is a content pane of a Window.

Returns:
true, if this container is the contentpane of a Window.

getParentWindow

public final Window getParentWindow()
Gets, the Window, of which this is the content pane.

Overrides:
getParentWindow in class Widget
Returns:
the parent Window.

getEqualHeight

protected final float getEqualHeight(float width)
Parameters:
height - the height to calculate a visually equal width
Returns:
a height that's visually equal to the given width

getEqualWidth

protected final float getEqualWidth(float height)
Parameters:
height - the height to calculate a visually equal height
Returns:
a width that's visually equal to the given height

getSizePixels2HUD

protected final <Dim2f_ extends org.openmali.types.twodee.Dim2f> Dim2f_ getSizePixels2HUD(int w,
                                                                                          int h,
                                                                                          Dim2f_ buffer)
Calculates HUD size from these pixel-values.

Parameters:
w - the canvas-x-value to transform
h - the canvas-y-value to transform
buffer - the buffer to write the values to
Returns:
the buffer back again

getLocationPixels2HUD

protected final <Tuple2f_ extends org.openmali.vecmath2.Tuple2f> Tuple2f_ getLocationPixels2HUD(int x,
                                                                                                int y,
                                                                                                Tuple2f_ buffer)
Calculates HUD location from these pixel-values.

Parameters:
x - the canvas-x-value to transform
y - the canvas-y-value to transform
buffer - the buffer to write the values to
Returns:
the buffer back again

getSizeHUD2Pixels

protected final <Dim2i_ extends org.openmali.types.twodee.Dim2i> Dim2i_ getSizeHUD2Pixels(float w,
                                                                                          float h,
                                                                                          Dim2i_ buffer)
Calculates pixel size from these HUD-values.

Parameters:
w - the HUD-x-value to transform
h - the HUD-y-value to transform
buffer - the buffer to write the values to
Returns:
the buffer back again

getRelLocationHUD2Pixels

protected final <Tuple2i_ extends org.openmali.vecmath2.Tuple2i> Tuple2i_ getRelLocationHUD2Pixels(float x,
                                                                                                   float y,
                                                                                                   Tuple2i_ buffer)
Calculates container relative pixel location from these HUD-values.

Parameters:
x - the HUD-x-value to transform
y - the HUD-y-value to transform
buffer - the buffer to write the values to
Returns:
the buffer back again

getLocationHUD2Pixels

protected final <Tuple2i_ extends org.openmali.vecmath2.Tuple2i> Tuple2i_ getLocationHUD2Pixels(float x,
                                                                                                float y,
                                                                                                Tuple2i_ buffer)
Calculates pixel location from these HUD-values.

Parameters:
x - the HUD-x-value to transform
y - the HUD-y-value to transform
buffer - the buffer to write the values to
Returns:
the buffer back again

getSizeHUD2SG

protected final <Dim2f_ extends org.openmali.types.twodee.Dim2f> Dim2f_ getSizeHUD2SG(float w,
                                                                                      float h,
                                                                                      Dim2f_ buffer)
Calculates scenegraph width and height from these HUD-values.

Parameters:
w - the HUD-x-value to transform
h - the HUD-y-value to transform
buffer - the buffer to write the values to
Returns:
the buffer back again

getLocationHUD2SG

protected final <Tuple2f_ extends org.openmali.vecmath2.Tuple2f> Tuple2f_ getLocationHUD2SG(float x,
                                                                                            float y,
                                                                                            Tuple2f_ buffer)
Calculates scenegraph location from these HUD-values.

Parameters:
x - the HUD-x-value to transform
y - the HUD-y-value to transform
buffer - the buffer to write the values to
Returns:
the buffer back again

getSizeSG2HUD

protected final <Dim2f_ extends org.openmali.types.twodee.Dim2f> Dim2f_ getSizeSG2HUD(float w,
                                                                                      float h,
                                                                                      Dim2f_ buffer)
Calculates HUD size from these scenegraph-values.

Parameters:
w - the scenegraph-x-value to transform
h - the scenegraph-y-value to transform
buffer - the buffer to write the values to
Returns:
the buffer back again

getLocationSG2HUD

protected final <Tuple2f_ extends org.openmali.vecmath2.Tuple2f> Tuple2f_ getLocationSG2HUD(float x,
                                                                                            float y,
                                                                                            Tuple2f_ buffer)
Calculates HUD location from these scenegraph-values.

Parameters:
x - the scenegraph-x-value to transform
y - the scenegraph-y-value to transform
buffer - the buffer to write the values to
Returns:
the buffer back again

getSizeOfPixels

protected final <Dim2f_ extends org.openmali.types.twodee.Dim2f> Dim2f_ getSizeOfPixels(int x,
                                                                                        int y,
                                                                                        Dim2f_ buffer)
Retrieves the size these pixels have on this WidgetContainer.

Parameters:
x - the x-count of pixels
y - the y-count of pixels
buffer - the buffer to write the values to
Returns:
the buffer back again

setResolution

public void setResolution(float resX,
                          float resY)
Sets the container's resolution.
Set one of the values to -1 to use not custom resolution.

Parameters:
resX -
resY -

getResX

public final float getResX()
Returns:
the x-resolution of the WidgetContainer.

getResY

public final float getResY()
Returns:
the y-resolution of the WidgetContainer.

getResolution

public final org.openmali.vecmath2.Tuple2f getResolution()
Returns:
this WidgetContainer's resolution. By default this is equal to width and height.

getResAspect

public final float getResAspect()
Returns:
the aspect ratio of the resolution of the WidgetContainer.

hasCustomResolution

public final boolean hasCustomResolution()
Returns whether a custom resolution is defined on the widget container.

Returns:
whether a custom resolution is defined on the widget container.

onSizeChanged

protected void onSizeChanged(float oldWidth,
                             float oldHeight,
                             float newWidth,
                             float newHeight)

Overrides:
onSizeChanged in class Widget

setPadding

public boolean setPadding(int paddingBottom,
                          int paddingRight,
                          int paddingTop,
                          int paddingLeft)
Sets padding for this PaddingSettable Widget.
Padding translates local coordinates and shrinks the clipping area.

Specified by:
setPadding in interface PaddingSettable
Returns:
true, if the padding actually has changed

setPadding

public final boolean setPadding(int padding)
Sets padding for this PaddingSettable Widget.
Padding translates local coordinates and shrinks the clipping area.

Specified by:
setPadding in interface PaddingSettable
Parameters:
padding - padding for bottom, right, top and left
Returns:
true, if the padding actually has changed

getPaddingBottom

public final int getPaddingBottom()

Specified by:
getPaddingBottom in interface PaddingSettable
Returns:
bottom-padding for this PaddingSettable Widget.
Padding translates local coordinates and shrinks the clipping area.

getPaddingRight

public final int getPaddingRight()

Specified by:
getPaddingRight in interface PaddingSettable
Returns:
right-padding for this PaddingSettable Widget.
Padding translates local coordinates and shrinks the clipping area.

getPaddingTop

public final int getPaddingTop()

Specified by:
getPaddingTop in interface PaddingSettable
Returns:
top-padding for this PaddingSettable Widget.
Padding translates local coordinates and shrinks the clipping area.

getPaddingLeft

public final int getPaddingLeft()

Specified by:
getPaddingLeft in interface PaddingSettable
Returns:
left-padding for this PaddingSettable Widget.
Padding translates local coordinates and shrinks the clipping area.

setLayout

public void setLayout(LayoutManager layout)
Sets which LayoutManager to use for the child Widgets of this Container.

Parameters:
layout - the new LayoutManager to use

getLayout

public final LayoutManager getLayout()
Returns:
the currently used LayoutManager

setZIndexSortingDirty

protected void setZIndexSortingDirty()

addWidget

public Widget addWidget(Widget widget,
                        float locX,
                        float locY,
                        int zIndex,
                        java.lang.Object constraints)
Adds a Widget to this container at the given location.

Parameters:
widget - the Widget to add
locX - the x-location to add the Widget at
locY - the y-location to add the Widget at
zIndex - the new Widget's z-index
constraints - the contraints to use for this Widget in the LayoutManager

addWidget

public final Widget addWidget(Widget widget,
                              float locX,
                              float locY,
                              int zIndex)
Adds a Widget to this container at the given location.

Parameters:
widget - the Widget to add
locX - the x-location to add the widget at
locY - the y-location to add the widget at
zIndex - the new Widget's z-index

addWidget

public final Widget addWidget(Widget widget,
                              float locX,
                              float locY,
                              java.lang.Object constraints)
Adds a Widget to this container at the given location.

Parameters:
widget - the Widget to add
locX - the x-location to add the Widget at
locY - the y-location to add the Widget at
constraints - the contraints to use for this Widget in the LayoutManager

addWidget

public final Widget addWidget(Widget widget,
                              float locX,
                              float locY)
Adds a Widget to this container at the given location.

Parameters:
widget - the Widget to add
locX - the x-location to add the widget at
locY - the y-location to add the widget at

addWidget

public final Widget addWidget(Widget widget,
                              java.lang.Object constraints)
Adds a Widget to this container at the Widget's location.

Parameters:
widget - the widget to add
constraints - the contraints to use for this Widget in the LayoutManager

addWidget

public final Widget addWidget(Widget widget)
Adds a Widget to this container at the Widget's location.

Parameters:
widget - the widget to add

addWidgetCentered

public final Widget addWidgetCentered(Widget widget,
                                      int zIndex)
Adds a Widget to this container at the center.

Parameters:
widget - the widget to add (centered)
zIndex - the new Widget's z-index

addWidgetCentered

public final Widget addWidgetCentered(Widget widget)
Adds a Widget to this container at the center.

Parameters:
widget - the widget to add (centered)

removeWidget

public void removeWidget(Widget widget)
Removes a Widget from this container.

Parameters:
widget - the widget to remove

clear

public void clear()
Removes all Widgets from this WidgetContainer.


getWidgetsCount

public final int getWidgetsCount()
Gets the number of Widgets on this container.

Returns:
the number of contained Widgets.

getWidget

public final Widget getWidget(int index)
Gets the index'th Widget on this Container. The order may change depending on the z-index.

Parameters:
index -
Returns:
te index'th Widget.

getWidgets

public final java.util.List<Widget> getWidgets()
Returns:
a List of all Widgets contained by this WidgetContainer. The returned Set is unmodifiable.

onVisibilityChanged

protected void onVisibilityChanged(boolean visible)
This method is triggered when the visibility state has eeffectively changed.

Overrides:
onVisibilityChanged in class Widget

setTransparency

public void setTransparency(float transparency,
                            boolean childrenToo)
Sets the whole Widget's transparency.

Overrides:
setTransparency in class Widget

pick

protected HUDPickResult pick(int canvasX,
                             int canvasY,
                             HUDPickResult.HUDPickReason pickReason,
                             org.jagatoo.input.devices.components.MouseButton button,
                             long when,
                             long meta,
                             int flags)
Tests whether a Widget is under the cursor and runs the approriate methods if true.

Overrides:
pick in class Widget
Parameters:
canvasX - the x position of the mouse on the Canvas3D
canvasY - the y position of the mouse on the Canvas3D
pickReason - the action which caused this pick operation
button - the mouse-button, that caused the picking
when - the timestamp of the picking
meta - this could be either the lastPressTime, lastReleaseTime, buttonsState mask or the page-move-boolean. (depends on the pickReason)
Returns:
an instance of HUDPickResult holding the picked Widget and absolute and relative picking positions or null.

focus

public Widget focus(Widget widget)
Focusses the given Widget (non thread-safe).

Parameters:
widget -
Returns:
the previously focussed Widget

getCurrentFocusedWidget

public final Widget getCurrentFocusedWidget(boolean getLeaf)
Parameters:
getLeaf - recursively searches for the focused leaf (Widget), if true
Returns:
the current focused Widget

getCurrentFocusedWidget

public final Widget getCurrentFocusedWidget()
Returns:
the current focused Widget

getCurrentHoveredWidget

public final Widget getCurrentHoveredWidget(boolean getLeaf)
Parameters:
getLeaf - recursively searches for the hovered leaf (Widget), if true
Returns:
the current hovered Widget

getCurrentHoveredWidget

protected final Widget getCurrentHoveredWidget()

resetCurrentHoveredWidget

protected final void resetCurrentHoveredWidget()

onFocusGained

protected void onFocusGained()
This event is fired, when the focus is gained to a Widget.

Overrides:
onFocusGained in class Widget

onFocusLost

protected void onFocusLost()
This event is fired, when the focus is lost by a Widget.

Overrides:
onFocusLost in class Widget

onMouseExited

protected void onMouseExited(boolean isTopMost,
                             boolean hasFocus)
Description copied from class: Widget
This method is called when the mouse exited the Widget area.

Overrides:
onMouseExited in class Widget
Parameters:
isTopMost - is this Widget topMost
hasFocus - is this Widget focused

onKeyPressed

protected void onKeyPressed(org.jagatoo.input.devices.components.Key key,
                            int modifierMask,
                            long when)
This event is fired, when a key is pressed on a focused Widget.

Overrides:
onKeyPressed in class Widget
Parameters:
key - the key that was pressed
modifierMask - the mask of modifier keys
when - the keyevent's timestamp

onKeyReleased

protected void onKeyReleased(org.jagatoo.input.devices.components.Key key,
                             int modifierMask,
                             long when)
This event is fired, when a key is released on a focused Widget.

Overrides:
onKeyReleased in class Widget
Parameters:
key - the key that was released
modifierMask - the mask of modifier keys
when - the keyevent's timestamp

onKeyTyped

protected void onKeyTyped(char ch,
                          int modifierMask,
                          long when)
This event is fired when a key is typed on the keyboard.

Overrides:
onKeyTyped in class Widget
Parameters:
ch - the typed key's character
modifierMask - the mask of modifier keys
when - the keyevent's timestamp

onControllerButtonPressed

protected void onControllerButtonPressed(org.jagatoo.input.devices.components.ControllerButton button,
                                         long when)
This event is fired when a ControllerButton has been pressed and this Widget is the currently focussed one.

Overrides:
onControllerButtonPressed in class Widget
Parameters:
button - the pressed button
when - the gameTime of the event

onControllerButtonReleased

protected void onControllerButtonReleased(org.jagatoo.input.devices.components.ControllerButton button,
                                          long when)
This event is fired when a ControllerButton has been released and this Widget is the currently focussed one.

Overrides:
onControllerButtonReleased in class Widget
Parameters:
button - the released button
when - the gameTime of the event

onControllerAxisChanged

protected void onControllerAxisChanged(org.jagatoo.input.devices.components.ControllerAxis axis,
                                       int axisDelta,
                                       long when)
This event is fired when a ControllerAxis has changed and this Widget is the currently focussed one.

Overrides:
onControllerAxisChanged in class Widget
Parameters:
axis - the changed axis
when - the gameTime of the event

onInputStateChanged

protected void onInputStateChanged(org.jagatoo.input.devices.components.DeviceComponent comp,
                                   int delta,
                                   int state,
                                   long when,
                                   boolean isTopMost,
                                   boolean hasFocus)
This event is fired when the state of any DeviceComponent has changed.

Overrides:
onInputStateChanged in class Widget
when - the gameTime of the event

updateAbsZIndex

protected void updateAbsZIndex()

Overrides:
updateAbsZIndex in class Widget

setClippingEnabled

public void setClippingEnabled(boolean clippingEnabled)
Enables or disables clipping for this WidgetContainer.

Parameters:
clippingEnabled -

isClippingEnbaled

public final boolean isClippingEnbaled()
Returns:
whether clipping is enabled or disabled for this WidgetContainer.

calculateTransformWidth_Pixels2HUD

protected float calculateTransformWidth_Pixels2HUD(float contentWidth)

Overrides:
calculateTransformWidth_Pixels2HUD in class Widget

calculateTransformHeight_Pixels2HUD

protected float calculateTransformHeight_Pixels2HUD(float contentHeight)

Overrides:
calculateTransformHeight_Pixels2HUD in class Widget

updateTranslation

protected void updateTranslation()
Effectively changes the translation of this Widget (location and z-index)

Overrides:
updateTranslation in class Widget

update

public void update()
Updates the Widget's internals.
Called by the Widget system and can be called from outside.

Overrides:
update in class Widget

onAttachedToHUD

protected void onAttachedToHUD(HUD hud)
This event is fired, when this Widget is added to the HUD live Widget hierarchy.

Overrides:
onAttachedToHUD in class Widget
Parameters:
hud - the HUD, the Widget is added to

setWidgetDirty

protected void setWidgetDirty()
Overrides:
setWidgetDirty in class Widget

drawChildWidgets

protected void drawChildWidgets(Texture2DCanvas texCanvas,
                                int offsetX,
                                int offsetY,
                                int width,
                                int height,
                                boolean drawsSelf)
Parameters:
texCanvas -
offsetX -
offsetY -
width -
height -
drawsSelf -

drawWidget

protected void drawWidget(Texture2DCanvas texCanvas,
                          int offsetX,
                          int offsetY,
                          int width,
                          int height,
                          boolean drawsSelf)

Specified by:
drawWidget in class Widget

createChildrenGroup

protected GroupNode createChildrenGroup()