BaseContainerChild, SimpleContainerpublic abstract class BaseWidget extends BaseElement implements Widget
Element.Alignment| Modifier and Type | Field | Description |
|---|---|---|
protected Set<be.yildizgames.common.geometry.Rectangle> |
emptyZones |
List of zones to ignore to check if a point is inside the container.
|
MAX_OPACITY, virtualHeight| Modifier | Constructor | Description |
|---|---|---|
protected |
BaseWidget(String name,
BaseCoordinate coordinates) |
Full constructor.
|
protected |
BaseWidget(String name,
BaseCoordinate coordinates,
SimpleContainer parent) |
Full constructor.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
addEmptyZone(be.yildizgames.common.geometry.Rectangle zone) |
Add a zone to ignore when checking if the container contains the mouse,
if the mouse position is inside this zone, it will be considered as
outside of the container.
|
protected abstract void |
addEmptyZoneImpl(be.yildizgames.common.geometry.Rectangle zone) |
|
void |
addKeyboardListener(KeyboardListener listener) |
Add a new KeyboardListener on this widget and set the widget focusable.
|
void |
addMouseDoubleLeftClickListener(MouseDoubleLeftClickListener listener) |
Add a new MouseDoubleClickListener on this widget.
|
void |
addMouseDragListener(MouseDragListener listener) |
Add a new MouseDragListener on this widget.
|
void |
addMouseLeftClickListener(MouseLeftClickListener listener) |
Add a new MouseClickListener on this widget.
|
void |
addMouseMoveListener(MouseMoveListener listener) |
Add a new MouseMoveListener on this widget.
|
void |
addMouseReleaseListener(MouseReleaseListener listener) |
Add a new MouseReleaseClickListener on this widget.
|
void |
addMouseWheelListener(MouseWheelListener listener) |
Add a new MouseWheelListener on this widget.
|
void |
addOnMouseOverListener(OnMouseOverListener listener) |
Add a new OnMouseOverListener on this widget.
|
void |
addSpecialKeyListener(SpecialKeyPressedListener listener) |
Add a new SpecialKeyListener on this widget and set the widget focusable.
|
void |
align(Element.Alignment alignment) |
Align the widget
|
boolean |
contains(int x,
int y) |
|
boolean |
contains(MousePosition position) |
Check if a point in contained in this container.
|
void |
deleteKeyPressed() |
Called when the delete enter is pressed.
|
void |
disableEmptyZone() |
|
void |
enableEmptyZone() |
|
void |
enterKeyPressed() |
Called when the key enter is pressed.
|
Optional<Container> |
findParent() |
|
void |
focus(boolean over) |
Called when the focus status must be updated.
|
void |
forceContainsFalse() |
Force the contains method to always return false, in order to ignore
inputs.
|
int |
getAbsoluteLeft() |
Give the absolute left position instead of relative from parent.
|
protected be.yildizgames.common.geometry.Point2D |
getAbsolutePosition() |
|
int |
getAbsoluteTop() |
Give the absolute top position instead of relative from parent.
|
void |
highlight(boolean over) |
Called when the highlight status must be updated.
|
protected abstract void |
highlightImpl(boolean highlightState) |
Implementation to set the widget highlight.
|
boolean |
isContainer() |
|
boolean |
isFocusable() |
|
protected boolean |
isMouseOver() |
|
void |
keyPressed(char key) |
Called when a key is pressed on the keyboard.
|
void |
mouseLeftClick(MousePosition position) |
Called when the mouse left button is pressed.
|
void |
playAnimation(String name) |
|
void |
registerAnimation(BaseAnimationGui anim) |
|
void |
removeAllClickListeners() |
Clear the list of all click listeners.
|
void |
setFocusable(boolean focusable) |
Set the widget to be considered as focusable or not.
|
protected void |
setHighlightable(boolean value) |
Set the widget to be considered as hightligthable or not.
|
protected void |
setMouseClickActive(boolean active) |
Activate or disable the mouse button action on this widget.
|
Element |
setMouseOver(boolean over,
MousePosition position) |
Called when the mouse enter or get out of a widget.
|
BaseWidget |
setStatic() |
Optimization to avoid to check this element when receiving events.
|
void |
stopAnimation(String name) |
|
String |
toString() |
addToLeft, addToPosition, addToTop, delete, getBottom, getCoordinates, getHeight, getLeft, getOpacity, getRight, getTop, getWidth, hide, hideImpl, isVisible, multiplySize, resetVirtualHeight, setCoordinates, setHeight, setLeft, setLeft, setLeft, setLeft, setPosition, setPosition, setPosition, setPositionImpl, setSize, setSize, setSizeImpl, setTop, setTop, setTop, setTop, setVirtualHeight, setVisible, setWidth, show, showImpl, updateAddPositionValueaddToLeft, addToPosition, addToTop, getBottom, getCoordinates, getHeight, getLeft, getRight, getTop, getWidth, hide, isVisible, resetVirtualHeight, setCoordinates, setHeight, setLeft, setLeft, setLeft, setLeft, setPosition, setPosition, setPosition, setSize, setSize, setTop, setTop, setTop, setTop, setVirtualHeight, setVisible, setWidth, showprotected final Set<be.yildizgames.common.geometry.Rectangle> emptyZones
protected BaseWidget(String name, BaseCoordinate coordinates)
name - Widget unique name.coordinates - Widget initial size and position.protected BaseWidget(String name, BaseCoordinate coordinates, SimpleContainer parent)
name - Widget unique name.coordinates - Widget initial size and position.parent - Optional parent container.public final void addMouseLeftClickListener(MouseLeftClickListener listener)
WidgetaddMouseLeftClickListener in interface Widgetlistener - Listener to add.public final void addMouseDoubleLeftClickListener(MouseDoubleLeftClickListener listener)
WidgetaddMouseDoubleLeftClickListener in interface Widgetlistener - Listener to add.public final void addMouseReleaseListener(MouseReleaseListener listener)
WidgetaddMouseReleaseListener in interface Widgetlistener - Listener to add.public final void removeAllClickListeners()
WidgetremoveAllClickListeners in interface Widgetpublic final void addKeyboardListener(KeyboardListener listener)
WidgetaddKeyboardListener in interface Widgetlistener - Listener to add.public void addSpecialKeyListener(SpecialKeyPressedListener listener)
WidgetaddSpecialKeyListener in interface Widgetlistener - Listener to add.public final void addMouseMoveListener(MouseMoveListener listener)
WidgetaddMouseMoveListener in interface Widgetlistener - Listener to add.public final void addMouseWheelListener(MouseWheelListener listener)
WidgetaddMouseWheelListener in interface Widgetlistener - Listener to add.public final void addMouseDragListener(MouseDragListener listener)
WidgetaddMouseDragListener in interface Widgetlistener - Listener to add.public final void addOnMouseOverListener(OnMouseOverListener listener)
WidgetaddOnMouseOverListener in interface Widgetlistener - Listener to add.public final void registerAnimation(BaseAnimationGui anim)
registerAnimation in interface Widgetpublic final void playAnimation(String name)
playAnimation in interface Widgetpublic final void stopAnimation(String name)
stopAnimation in interface Widgetprotected abstract void highlightImpl(boolean highlightState)
highlightState - Highlight state.public BaseWidget setStatic()
public final boolean contains(MousePosition position)
Widgetpublic final void addEmptyZone(be.yildizgames.common.geometry.Rectangle zone)
WidgetaddEmptyZone in interface Widgetzone - Empty zone.protected abstract void addEmptyZoneImpl(be.yildizgames.common.geometry.Rectangle zone)
public final void mouseLeftClick(MousePosition position)
position - Mouse position.protected final be.yildizgames.common.geometry.Point2D getAbsolutePosition()
public final void keyPressed(char key)
key - Character pressed.public final void enterKeyPressed()
public final void deleteKeyPressed()
public final void highlight(boolean over)
public final void focus(boolean over)
public final void align(Element.Alignment alignment)
Widgetprotected final void setMouseClickActive(boolean active)
active - true will set the mouse button active,
false will deactivate them.public final boolean isFocusable()
isFocusable in interface Widgettrue if the widget can be focused, false otherwise.public final void setFocusable(boolean focusable)
focusable - true to set the widget focusable.protected final void setHighlightable(boolean value)
value - true to make the widget highlitable.public final Element setMouseOver(boolean over, MousePosition position)
over - New mouse over status.position - Current mouse position.protected final boolean isMouseOver()
true if the mouse is over this widget.public final void forceContainsFalse()
public String toString()
toString in class be.yildizgames.common.util.BaseRegisterablepublic final int getAbsoluteLeft()
WidgetgetAbsoluteLeft in interface Widgetpublic final int getAbsoluteTop()
WidgetgetAbsoluteTop in interface Widgetpublic boolean isContainer()
public final void disableEmptyZone()
public final void enableEmptyZone()
Copyright © 2014–2018. All rights reserved.