|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xith3d.ui.hud.base.Widget
org.xith3d.ui.hud.base.BackgroundSettableWidget
org.xith3d.ui.hud.base.WidgetContainer
public abstract class WidgetContainer
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
|
getLocationHUD2Pixels(float x,
float y,
Tuple2i_ buffer)
Calculates pixel location from these HUD-values. |
|
protected
|
getLocationHUD2SG(float x,
float y,
Tuple2f_ buffer)
Calculates scenegraph location from these HUD-values. |
|
protected
|
getLocationPixels2HUD(int x,
int y,
Tuple2f_ buffer)
Calculates HUD location from these pixel-values. |
|
protected
|
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
|
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
|
getSizeHUD2Pixels(float w,
float h,
Dim2i_ buffer)
Calculates pixel size from these HUD-values. |
|
protected
|
getSizeHUD2SG(float w,
float h,
Dim2f_ buffer)
Calculates scenegraph width and height from these HUD-values. |
|
protected
|
getSizeOfPixels(int x,
int y,
Dim2f_ buffer)
Retrieves the size these pixels have on this WidgetContainer. |
|
protected
|
getSizePixels2HUD(int w,
int h,
Dim2f_ buffer)
Calculates HUD size from these pixel-values. |
|
protected
|
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 java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final org.openmali.vecmath2.Vector2f childrenOffset_HUD
protected final org.openmali.vecmath2.Vector2i childrenOffset_PX
| Constructor Detail |
|---|
protected WidgetContainer(boolean isHeavyWeight,
boolean hasWidgetAssembler,
float width,
float height,
org.openmali.vecmath2.Colorf backgroundColor,
Texture2D backgroundTex,
TileMode backgroundTileMode)
isHeavyWeight - hasWidgetAssembler - width - the new width of this Widgetheight - the new height of this WidgetbackgroundColor - the background colorbackgroundTex - the background texturebackgroundTileMode - | Method Detail |
|---|
protected final GroupNode getSGGroup()
public final boolean isContentPane()
public final Window getParentWindow()
getParentWindow in class Widgetprotected final float getEqualHeight(float width)
height - the height to calculate a visually equal width
protected final float getEqualWidth(float height)
height - the height to calculate a visually equal height
protected final <Dim2f_ extends org.openmali.types.twodee.Dim2f> Dim2f_ getSizePixels2HUD(int w,
int h,
Dim2f_ buffer)
w - the canvas-x-value to transformh - the canvas-y-value to transformbuffer - the buffer to write the values to
protected final <Tuple2f_ extends org.openmali.vecmath2.Tuple2f> Tuple2f_ getLocationPixels2HUD(int x,
int y,
Tuple2f_ buffer)
x - the canvas-x-value to transformy - the canvas-y-value to transformbuffer - the buffer to write the values to
protected final <Dim2i_ extends org.openmali.types.twodee.Dim2i> Dim2i_ getSizeHUD2Pixels(float w,
float h,
Dim2i_ buffer)
w - the HUD-x-value to transformh - the HUD-y-value to transformbuffer - the buffer to write the values to
protected final <Tuple2i_ extends org.openmali.vecmath2.Tuple2i> Tuple2i_ getRelLocationHUD2Pixels(float x,
float y,
Tuple2i_ buffer)
x - the HUD-x-value to transformy - the HUD-y-value to transformbuffer - the buffer to write the values to
protected final <Tuple2i_ extends org.openmali.vecmath2.Tuple2i> Tuple2i_ getLocationHUD2Pixels(float x,
float y,
Tuple2i_ buffer)
x - the HUD-x-value to transformy - the HUD-y-value to transformbuffer - the buffer to write the values to
protected final <Dim2f_ extends org.openmali.types.twodee.Dim2f> Dim2f_ getSizeHUD2SG(float w,
float h,
Dim2f_ buffer)
w - the HUD-x-value to transformh - the HUD-y-value to transformbuffer - the buffer to write the values to
protected final <Tuple2f_ extends org.openmali.vecmath2.Tuple2f> Tuple2f_ getLocationHUD2SG(float x,
float y,
Tuple2f_ buffer)
x - the HUD-x-value to transformy - the HUD-y-value to transformbuffer - the buffer to write the values to
protected final <Dim2f_ extends org.openmali.types.twodee.Dim2f> Dim2f_ getSizeSG2HUD(float w,
float h,
Dim2f_ buffer)
w - the scenegraph-x-value to transformh - the scenegraph-y-value to transformbuffer - the buffer to write the values to
protected final <Tuple2f_ extends org.openmali.vecmath2.Tuple2f> Tuple2f_ getLocationSG2HUD(float x,
float y,
Tuple2f_ buffer)
x - the scenegraph-x-value to transformy - the scenegraph-y-value to transformbuffer - the buffer to write the values to
protected final <Dim2f_ extends org.openmali.types.twodee.Dim2f> Dim2f_ getSizeOfPixels(int x,
int y,
Dim2f_ buffer)
x - the x-count of pixelsy - the y-count of pixelsbuffer - the buffer to write the values to
public void setResolution(float resX,
float resY)
resX - resY - public final float getResX()
public final float getResY()
public final org.openmali.vecmath2.Tuple2f getResolution()
public final float getResAspect()
public final boolean hasCustomResolution()
protected void onSizeChanged(float oldWidth,
float oldHeight,
float newWidth,
float newHeight)
onSizeChanged in class Widget
public boolean setPadding(int paddingBottom,
int paddingRight,
int paddingTop,
int paddingLeft)
setPadding in interface PaddingSettablepublic final boolean setPadding(int padding)
setPadding in interface PaddingSettablepadding - padding for bottom, right, top and left
public final int getPaddingBottom()
getPaddingBottom in interface PaddingSettablepublic final int getPaddingRight()
getPaddingRight in interface PaddingSettablepublic final int getPaddingTop()
getPaddingTop in interface PaddingSettablepublic final int getPaddingLeft()
getPaddingLeft in interface PaddingSettablepublic void setLayout(LayoutManager layout)
layout - the new LayoutManager to usepublic final LayoutManager getLayout()
protected void setZIndexSortingDirty()
public Widget addWidget(Widget widget,
float locX,
float locY,
int zIndex,
java.lang.Object constraints)
widget - the Widget to addlocX - the x-location to add the Widget atlocY - the y-location to add the Widget atzIndex - the new Widget's z-indexconstraints - the contraints to use for this Widget in the LayoutManager
public final Widget addWidget(Widget widget,
float locX,
float locY,
int zIndex)
widget - the Widget to addlocX - the x-location to add the widget atlocY - the y-location to add the widget atzIndex - the new Widget's z-index
public final Widget addWidget(Widget widget,
float locX,
float locY,
java.lang.Object constraints)
widget - the Widget to addlocX - the x-location to add the Widget atlocY - the y-location to add the Widget atconstraints - the contraints to use for this Widget in the LayoutManager
public final Widget addWidget(Widget widget,
float locX,
float locY)
widget - the Widget to addlocX - the x-location to add the widget atlocY - the y-location to add the widget at
public final Widget addWidget(Widget widget,
java.lang.Object constraints)
widget - the widget to addconstraints - the contraints to use for this Widget in the LayoutManagerpublic final Widget addWidget(Widget widget)
widget - the widget to add
public final Widget addWidgetCentered(Widget widget,
int zIndex)
widget - the widget to add (centered)zIndex - the new Widget's z-indexpublic final Widget addWidgetCentered(Widget widget)
widget - the widget to add (centered)public void removeWidget(Widget widget)
widget - the widget to removepublic void clear()
public final int getWidgetsCount()
Widgets on this container.
Widgets.public final Widget getWidget(int index)
index -
public final java.util.List<Widget> getWidgets()
protected void onVisibilityChanged(boolean visible)
onVisibilityChanged in class Widget
public void setTransparency(float transparency,
boolean childrenToo)
setTransparency in class Widget
protected HUDPickResult pick(int canvasX,
int canvasY,
HUDPickResult.HUDPickReason pickReason,
org.jagatoo.input.devices.components.MouseButton button,
long when,
long meta,
int flags)
pick in class WidgetcanvasX - the x position of the mouse on the Canvas3DcanvasY - the y position of the mouse on the Canvas3DpickReason - the action which caused this pick operationbutton - the mouse-button, that caused the pickingwhen - the timestamp of the pickingmeta - this could be either the lastPressTime, lastReleaseTime, buttonsState mask or the page-move-boolean. (depends on the pickReason)
public Widget focus(Widget widget)
widget -
public final Widget getCurrentFocusedWidget(boolean getLeaf)
getLeaf - recursively searches for the focused leaf (Widget), if true
public final Widget getCurrentFocusedWidget()
public final Widget getCurrentHoveredWidget(boolean getLeaf)
getLeaf - recursively searches for the hovered leaf (Widget), if true
protected final Widget getCurrentHoveredWidget()
protected final void resetCurrentHoveredWidget()
protected void onFocusGained()
onFocusGained in class Widgetprotected void onFocusLost()
onFocusLost in class Widget
protected void onMouseExited(boolean isTopMost,
boolean hasFocus)
Widget
onMouseExited in class WidgetisTopMost - is this Widget topMosthasFocus - is this Widget focused
protected void onKeyPressed(org.jagatoo.input.devices.components.Key key,
int modifierMask,
long when)
onKeyPressed in class Widgetkey - the key that was pressedmodifierMask - the mask of modifier keyswhen - the keyevent's timestamp
protected void onKeyReleased(org.jagatoo.input.devices.components.Key key,
int modifierMask,
long when)
onKeyReleased in class Widgetkey - the key that was releasedmodifierMask - the mask of modifier keyswhen - the keyevent's timestamp
protected void onKeyTyped(char ch,
int modifierMask,
long when)
onKeyTyped in class Widgetch - the typed key's charactermodifierMask - the mask of modifier keyswhen - the keyevent's timestamp
protected void onControllerButtonPressed(org.jagatoo.input.devices.components.ControllerButton button,
long when)
onControllerButtonPressed in class Widgetbutton - the pressed buttonwhen - the gameTime of the event
protected void onControllerButtonReleased(org.jagatoo.input.devices.components.ControllerButton button,
long when)
onControllerButtonReleased in class Widgetbutton - the released buttonwhen - the gameTime of the event
protected void onControllerAxisChanged(org.jagatoo.input.devices.components.ControllerAxis axis,
int axisDelta,
long when)
onControllerAxisChanged in class Widgetaxis - the changed axiswhen - the gameTime of the event
protected void onInputStateChanged(org.jagatoo.input.devices.components.DeviceComponent comp,
int delta,
int state,
long when,
boolean isTopMost,
boolean hasFocus)
onInputStateChanged in class Widgetwhen - the gameTime of the eventprotected void updateAbsZIndex()
updateAbsZIndex in class Widgetpublic void setClippingEnabled(boolean clippingEnabled)
clippingEnabled - public final boolean isClippingEnbaled()
protected float calculateTransformWidth_Pixels2HUD(float contentWidth)
calculateTransformWidth_Pixels2HUD in class Widgetprotected float calculateTransformHeight_Pixels2HUD(float contentHeight)
calculateTransformHeight_Pixels2HUD in class Widgetprotected void updateTranslation()
updateTranslation in class Widgetpublic void update()
update in class Widgetprotected void onAttachedToHUD(HUD hud)
onAttachedToHUD in class Widgethud - the HUD, the Widget is added toprotected void setWidgetDirty()
setWidgetDirty in class Widget
protected void drawChildWidgets(Texture2DCanvas texCanvas,
int offsetX,
int offsetY,
int width,
int height,
boolean drawsSelf)
texCanvas - offsetX - offsetY - width - height - drawsSelf -
protected void drawWidget(Texture2DCanvas texCanvas,
int offsetX,
int offsetY,
int width,
int height,
boolean drawsSelf)
drawWidget in class Widgetprotected GroupNode createChildrenGroup()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||