Package com.avrix.ui.widgets
Class WindowWidget
java.lang.Object
com.avrix.ui.widgets.Widget
com.avrix.ui.widgets.PanelWidget
com.avrix.ui.widgets.ScrollPanelWidget
com.avrix.ui.widgets.WindowWidget
Represents a
Widget
panel that can be customized with various properties such as font, title,
header color, and header height.-
Field Summary
-
Constructor Summary
ConstructorDescriptionWindowWidget
(String title, int x, int y, int width, int height) Constructs a newWidget
with the specified position and size. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a child widget to this widget's list of children.final void
Closing a window (removes it from the screen)final String
Gets the current font name used by theWidget
.final int
Returns the height of theWidget
's headerfinal int
Returns the minimum width of the widget.final int
Returns the minimum height of the widget.final String
getTitle()
Gets the current title of theWidget
's header.final boolean
Checks if the widget is resizable.void
Initializes theWidget
void
onLeftMouseDown
(int x, int y) Called when the left mouse button is pressed down over theWidget
.void
onLeftMouseUp
(int x, int y) Called when the left mouse button is released over theWidget
.void
onLeftMouseUpOutside
(int x, int y) Handles the left mouse button up event outside any visibleWidget
void
Final rendering, after the main render and rendering of child elementsvoid
removeChild
(Widget widget) Removes a child widget from this widget's list of children.void
render()
Renders theWidget
void
Updates and renders all child widgets of thisWidget
.final void
Sets the font name for theWidget
.final void
setHeaderColor
(NanoColor headerColor) Sets the color of theWidget
's header.final void
setHeaderHeight
(int headerHeight) Sets the height of theWidget
's header.final void
setMinSizeX
(int minSizeX) Sets the minimum width of the widget.final void
setMinSizeY
(int minSizeY) Sets the minimum height of the widget.final void
setResizable
(boolean resizable) Sets the ability to resize the widget.final void
Sets the title of theWidget
's header.void
update()
Updates theWidget
Methods inherited from class com.avrix.ui.widgets.ScrollPanelWidget
getHorizontalScrollbar, getVerticalScrollbar, setMaxScrollX, setMaxScrollY
Methods inherited from class com.avrix.ui.widgets.PanelWidget
isDraggable, setBackgroundColor, setBorderColor, setBorderRadius, setBorderWidth, setDraggable, setDrawBorder
Methods inherited from class com.avrix.ui.widgets.Widget
addToScreen, bringToTop, drawArc, drawArc, drawCircle, drawEllipse, drawImage, drawLine, drawRect, drawRectOutline, drawRoundedRect, drawRoundedRectOutline, drawText, getAbsoluteParent, getChildren, getHeight, getMaxScrollX, getMaxScrollY, getParent, getScrollSpeed, getScrollX, getScrollY, getWidth, getX, getXA, getY, getYA, intersectScissor, isAlwaysOnTop, isHovered, isPointOver, isScrollable, isScrollLock, isVisible, isVisibleWithinParent, isVisibleWithinWindow, onKeyPress, onKeyRelease, onKeyRepeat, onLeftMouseDownOutside, onMouseEnter, onMouseExit, onMouseMove, onMouseMoveOutside, onMouseWheel, onRightMouseDown, onRightMouseDownOutside, onRightMouseUp, onRightMouseUpOutside, preRender, removeFromScreen, setAlwaysOnTop, setHeight, setScrollable, setScrollLock, setScrollSpeed, setScrollX, setScrollY, setVisible, setWidth, setX, setXA, setY, setYA
-
Constructor Details
-
Method Details
-
closeWindow
public final void closeWindow()Closing a window (removes it from the screen) -
onInitialize
public void onInitialize()Initializes theWidget
- Overrides:
onInitialize
in classScrollPanelWidget
-
getMinSizeX
public final int getMinSizeX()Returns the minimum width of the widget.- Returns:
- the minimum width of the widget in pixels.
-
setMinSizeX
public final void setMinSizeX(int minSizeX) Sets the minimum width of the widget.- Parameters:
minSizeX
- the minimum width of the widget in pixels.
-
getMinSizeY
public final int getMinSizeY()Returns the minimum height of the widget.- Returns:
- the minimum height of the widget in pixels.
-
setMinSizeY
public final void setMinSizeY(int minSizeY) Sets the minimum height of the widget.- Parameters:
minSizeY
- the minimum height of the widget in pixels.
-
isResizable
public final boolean isResizable()Checks if the widget is resizable.- Returns:
true
if the widget is resizable,false
otherwise.
-
setResizable
public final void setResizable(boolean resizable) Sets the ability to resize the widget.- Parameters:
resizable
-true
if the widget is resizable,false
otherwise.
-
addChild
Adds a child widget to this widget's list of children.- Overrides:
addChild
in classScrollPanelWidget
- Parameters:
widget
- the widget to add as a child
-
removeChild
Removes a child widget from this widget's list of children.- Overrides:
removeChild
in classScrollPanelWidget
- Parameters:
widget
- the widget to remove from the list of children
-
setFont
Sets the font name for theWidget
.- Parameters:
fontName
- the name of the font to use, specified as a string (e.g., "Arial", "Helvetica")
-
setTitle
Sets the title of theWidget
's header.- Parameters:
title
- the title text to display in the header
-
getFontName
Gets the current font name used by theWidget
.- Returns:
- the name of the font being used
-
getTitle
Gets the current title of theWidget
's header.- Returns:
- the title text currently set for the header
-
setHeaderColor
Sets the color of theWidget
's header.- Parameters:
headerColor
- the color to use for the header
-
setHeaderHeight
public final void setHeaderHeight(int headerHeight) Sets the height of theWidget
's header.- Parameters:
headerHeight
- the height of the header in pixels
-
getHeaderHeight
public final int getHeaderHeight()Returns the height of theWidget
's header- Returns:
- header height in pixels
-
onLeftMouseDown
public void onLeftMouseDown(int x, int y) Called when the left mouse button is pressed down over theWidget
.- Overrides:
onLeftMouseDown
in classPanelWidget
- Parameters:
x
- relative x-coordinate of the mouse positiony
- relative y-coordinate of the mouse position
-
onLeftMouseUpOutside
public void onLeftMouseUpOutside(int x, int y) Handles the left mouse button up event outside any visibleWidget
- Overrides:
onLeftMouseUpOutside
in classPanelWidget
- Parameters:
x
- absolute x-coordinate of the mouse positiony
- absolute y-coordinate of the mouse position
-
onLeftMouseUp
public void onLeftMouseUp(int x, int y) Called when the left mouse button is released over theWidget
.- Overrides:
onLeftMouseUp
in classPanelWidget
- Parameters:
x
- relative x-coordinate of the mouse positiony
- relative y-coordinate of the mouse position
-
update
public void update()Updates theWidget
- Overrides:
update
in classScrollPanelWidget
-
renderChildren
public void renderChildren()Updates and renders all child widgets of thisWidget
. This method recursively calls the update and render methods on each child widget, ensuring that the rendering order respects the hierarchy of widgets.- Overrides:
renderChildren
in classScrollPanelWidget
-
render
public void render()Renders theWidget
- Overrides:
render
in classPanelWidget
-
postRender
public void postRender()Final rendering, after the main render and rendering of child elements- Overrides:
postRender
in classPanelWidget
-