rl-api: fluent widget api

This commit is contained in:
Max Weber
2021-09-07 17:55:30 -06:00
parent 86b15a31bb
commit 4f01dabed4

View File

@@ -76,7 +76,7 @@ public interface Widget
/** /**
* Sets the type of content displayed by the widget. * Sets the type of content displayed by the widget.
*/ */
void setContentType(int contentType); Widget setContentType(int contentType);
/** /**
* Gets the current click configuration of the widget. * Gets the current click configuration of the widget.
@@ -91,7 +91,7 @@ public interface Widget
* *
* @see WidgetConfig * @see WidgetConfig
*/ */
void setClickMask(int mask); Widget setClickMask(int mask);
/** /**
* Gets the parent widget, if this widget is a child. * Gets the parent widget, if this widget is a child.
@@ -192,7 +192,7 @@ public interface Widget
* *
* @param text the text to display * @param text the text to display
*/ */
void setText(String text); Widget setText(String text);
/** /**
* Gets the color as an RGB value. * Gets the color as an RGB value.
@@ -208,7 +208,7 @@ public interface Widget
* @param textColor RGB24 color * @param textColor RGB24 color
* @see java.awt.Color#getRGB() * @see java.awt.Color#getRGB()
*/ */
void setTextColor(int textColor); Widget setTextColor(int textColor);
/** /**
* Gets the transparency of the rectangle * Gets the transparency of the rectangle
@@ -222,7 +222,7 @@ public interface Widget
* *
* @param transparency 0 = fully opaque, 255 = fully transparent * @param transparency 0 = fully opaque, 255 = fully transparent
*/ */
void setOpacity(int transparency); Widget setOpacity(int transparency);
/** /**
* Gets the name "op base" of the widget. * Gets the name "op base" of the widget.
@@ -241,7 +241,7 @@ public interface Widget
* *
* @param name the new name * @param name the new name
*/ */
void setName(String name); Widget setName(String name);
/** /**
* Gets the Model/NPC/Item ID displayed in the widget. * Gets the Model/NPC/Item ID displayed in the widget.
@@ -255,7 +255,7 @@ public interface Widget
* *
* @see WidgetModelType * @see WidgetModelType
*/ */
void setModelId(int id); Widget setModelId(int id);
/** /**
* Gets the model type of the widget. * Gets the model type of the widget.
@@ -270,7 +270,7 @@ public interface Widget
* @param type the new model type * @param type the new model type
* @see WidgetModelType * @see WidgetModelType
*/ */
void setModelType(int type); Widget setModelType(int type);
/** /**
* Gets the sequence ID used to animate the model in the widget * Gets the sequence ID used to animate the model in the widget
@@ -284,7 +284,7 @@ public interface Widget
* *
* @see net.runelite.api.AnimationID * @see net.runelite.api.AnimationID
*/ */
void setAnimationId(int animationId); Widget setAnimationId(int animationId);
/** /**
* Gets the x rotation of the model displayed in the widget. * Gets the x rotation of the model displayed in the widget.
@@ -300,7 +300,7 @@ public interface Widget
* *
* @param modelX the new model x rotation value * @param modelX the new model x rotation value
*/ */
void setRotationX(int modelX); Widget setRotationX(int modelX);
/** /**
* Gets the y rotation of the model displayed in the widget. * Gets the y rotation of the model displayed in the widget.
@@ -316,7 +316,7 @@ public interface Widget
* *
* @param modelY the new model y rotation value * @param modelY the new model y rotation value
*/ */
void setRotationY(int modelY); Widget setRotationY(int modelY);
/** /**
* Gets the z rotation of the model displayed in the widget. * Gets the z rotation of the model displayed in the widget.
@@ -332,7 +332,7 @@ public interface Widget
* *
* @param modelZ the new model z rotation value * @param modelZ the new model z rotation value
*/ */
void setRotationZ(int modelZ); Widget setRotationZ(int modelZ);
/** /**
* Gets the amount zoomed in on the model displayed in the widget. * Gets the amount zoomed in on the model displayed in the widget.
@@ -344,7 +344,7 @@ public interface Widget
* *
* @param modelZoom the new model zoom value * @param modelZoom the new model zoom value
*/ */
void setModelZoom(int modelZoom); Widget setModelZoom(int modelZoom);
/** /**
* Gets the sprite ID displayed in the widget. * Gets the sprite ID displayed in the widget.
@@ -362,7 +362,7 @@ public interface Widget
/** /**
* Sets if sprites are repeated or stretched * Sets if sprites are repeated or stretched
*/ */
void setSpriteTiling(boolean tiling); Widget setSpriteTiling(boolean tiling);
/** /**
* Sets the sprite ID displayed in the widget. * Sets the sprite ID displayed in the widget.
@@ -370,7 +370,7 @@ public interface Widget
* @param spriteId the sprite ID * @param spriteId the sprite ID
* @see net.runelite.api.SpriteID * @see net.runelite.api.SpriteID
*/ */
void setSpriteId(int spriteId); Widget setSpriteId(int spriteId);
/** /**
* Checks whether this widget or any of its parents are hidden. * Checks whether this widget or any of its parents are hidden.
@@ -394,7 +394,7 @@ public interface Widget
* *
* @param hidden new hidden state * @param hidden new hidden state
*/ */
void setHidden(boolean hidden); Widget setHidden(boolean hidden);
/** /**
* The index of this widget in it's parent's children array * The index of this widget in it's parent's children array
@@ -484,7 +484,7 @@ public interface Widget
* *
* @param itemId the item ID * @param itemId the item ID
*/ */
void setItemId(int itemId); Widget setItemId(int itemId);
/** /**
* Gets the quantity of the item displayed by the widget. * Gets the quantity of the item displayed by the widget.
@@ -498,7 +498,7 @@ public interface Widget
* *
* @param quantity the quantity of the item * @param quantity the quantity of the item
*/ */
void setItemQuantity(int quantity); Widget setItemQuantity(int quantity);
/** /**
* Checks if the passed canvas points is inside of this widget's * Checks if the passed canvas points is inside of this widget's
@@ -517,7 +517,7 @@ public interface Widget
/** /**
* Sets the amount of pixels the widget is scrolled in the X axis * Sets the amount of pixels the widget is scrolled in the X axis
*/ */
void setScrollX(int scrollX); Widget setScrollX(int scrollX);
/** /**
* Gets the amount of pixels the widget is scrolled in the Y axis * Gets the amount of pixels the widget is scrolled in the Y axis
@@ -527,7 +527,7 @@ public interface Widget
/** /**
* sets the amount of pixels the widget is scrolled in the Y axis * sets the amount of pixels the widget is scrolled in the Y axis
*/ */
void setScrollY(int scrollY); Widget setScrollY(int scrollY);
/** /**
* Gets the size of the widget's viewport in the X axis * Gets the size of the widget's viewport in the X axis
@@ -537,7 +537,7 @@ public interface Widget
/** /**
* Sets the size of the widget's viewport in the X axis * Sets the size of the widget's viewport in the X axis
*/ */
void setScrollWidth(int width); Widget setScrollWidth(int width);
/** /**
* Gets the size of the widget's viewport in the Y axis * Gets the size of the widget's viewport in the Y axis
@@ -547,7 +547,7 @@ public interface Widget
/** /**
* Sets the size of the widget's viewport in the Y axis * Sets the size of the widget's viewport in the Y axis
*/ */
void setScrollHeight(int height); Widget setScrollHeight(int height);
/** /**
* Gets the X coordinate of this widget before being adjusted by * Gets the X coordinate of this widget before being adjusted by
@@ -561,7 +561,7 @@ public interface Widget
* *
* @see #setXPositionMode(int) * @see #setXPositionMode(int)
*/ */
void setOriginalX(int originalX); Widget setOriginalX(int originalX);
/** /**
* Gets the Y coordinate of this widget before being adjusted by * Gets the Y coordinate of this widget before being adjusted by
@@ -575,7 +575,10 @@ public interface Widget
* *
* @see #setYPositionMode(int) * @see #setYPositionMode(int)
*/ */
void setOriginalY(int originalY); Widget setOriginalY(int originalY);
Widget setPos(int x, int y);
Widget setPos(int x, int y, int xMode, int yMode);
/** /**
* Gets the height coordinate of this widget before being adjusted by * Gets the height coordinate of this widget before being adjusted by
@@ -589,7 +592,7 @@ public interface Widget
* *
* @see #setHeightMode(int) * @see #setHeightMode(int)
*/ */
void setOriginalHeight(int originalHeight); Widget setOriginalHeight(int originalHeight);
/** /**
* Gets the width coordinate of this widget before being adjusted by * Gets the width coordinate of this widget before being adjusted by
@@ -603,7 +606,10 @@ public interface Widget
* *
* @see #setWidthMode(int) * @see #setWidthMode(int)
*/ */
void setOriginalWidth(int originalWidth); Widget setOriginalWidth(int originalWidth);
Widget setSize(int width, int height);
Widget setSize(int width, int height, int widthMode, int heightMode);
/** /**
* Gets the menu options available on the widget as a sparse array. * Gets the menu options available on the widget as a sparse array.
@@ -614,10 +620,17 @@ public interface Widget
* Creates a dynamic widget child * Creates a dynamic widget child
* *
* @param index the index of the new widget in the children list or -1 to append to the back * @param index the index of the new widget in the children list or -1 to append to the back
* @param type the type of the widget * @param type the {@link WidgetType} of the widget
*/ */
Widget createChild(int index, int type); Widget createChild(int index, int type);
/**
* Creates a dynamic widget child at the end of the children list
*
* @param type the {@link WidgetType} of the widget
*/
Widget createChild(int type);
/** /**
* Removes all of this widget's dynamic children * Removes all of this widget's dynamic children
*/ */
@@ -703,7 +716,7 @@ public interface Widget
/** /**
* Sets if the widget has any listeners. This should be called whenever a setXListener function is called * Sets if the widget has any listeners. This should be called whenever a setXListener function is called
*/ */
void setHasListener(boolean hasListener); Widget setHasListener(boolean hasListener);
/** /**
* This is true if the widget is from an if3 interface, or is dynamically created * This is true if the widget is from an if3 interface, or is dynamically created
@@ -760,7 +773,7 @@ public interface Widget
* *
* @see net.runelite.api.FontID * @see net.runelite.api.FontID
*/ */
void setFontId(int id); Widget setFontId(int id);
/** /**
* Returns the border type of item/sprite on the widget * Returns the border type of item/sprite on the widget
@@ -783,7 +796,7 @@ public interface Widget
/** /**
* Sets if text should be shadowed * Sets if text should be shadowed
*/ */
void setTextShadowed(boolean shadowed); Widget setTextShadowed(boolean shadowed);
/** /**
* Returns the widget drag dead zone * Returns the widget drag dead zone
@@ -813,7 +826,7 @@ public interface Widget
/** /**
* Sets the widget {@link net.runelite.api.widgets.ItemQuantityMode} * Sets the widget {@link net.runelite.api.widgets.ItemQuantityMode}
*/ */
void setItemQuantityMode(int itemQuantityMode); Widget setItemQuantityMode(int itemQuantityMode);
/** /**
* Gets the mode that the X position is calculated from the original X position * Gets the mode that the X position is calculated from the original X position
@@ -828,7 +841,7 @@ public interface Widget
* *
* @see WidgetPositionMode * @see WidgetPositionMode
*/ */
void setXPositionMode(int xpm); Widget setXPositionMode(int xpm);
/** /**
* Gets the mode that the Y position is calculated from the original Y position * Gets the mode that the Y position is calculated from the original Y position
@@ -843,7 +856,7 @@ public interface Widget
* *
* @see WidgetPositionMode * @see WidgetPositionMode
*/ */
void setYPositionMode(int ypm); Widget setYPositionMode(int ypm);
/** /**
* Get the line height for this widget. * Get the line height for this widget.
@@ -857,7 +870,7 @@ public interface Widget
* *
* @param lineHeight * @param lineHeight
*/ */
void setLineHeight(int lineHeight); Widget setLineHeight(int lineHeight);
/** /**
* Gets the X axis text position mode * Gets the X axis text position mode
@@ -871,7 +884,7 @@ public interface Widget
* *
* @see WidgetTextAlignment * @see WidgetTextAlignment
*/ */
void setXTextAlignment(int xta); Widget setXTextAlignment(int xta);
/** /**
* Gets the Y axis text position mode * Gets the Y axis text position mode
@@ -885,7 +898,7 @@ public interface Widget
* *
* @see WidgetTextAlignment * @see WidgetTextAlignment
*/ */
void setYTextAlignment(int yta); Widget setYTextAlignment(int yta);
/** /**
* Gets the mode controlling widget width * Gets the mode controlling widget width
@@ -900,7 +913,7 @@ public interface Widget
* *
* @see WidgetSizeMode * @see WidgetSizeMode
*/ */
void setWidthMode(int widthMode); Widget setWidthMode(int widthMode);
/** /**
* Gets the mode controlling widget width * Gets the mode controlling widget width
@@ -915,7 +928,7 @@ public interface Widget
* *
* @see WidgetSizeMode * @see WidgetSizeMode
*/ */
void setHeightMode(int heightMode); Widget setHeightMode(int heightMode);
/** /**
* Gets the font that this widget uses * Gets the font that this widget uses
@@ -930,7 +943,7 @@ public interface Widget
/** /**
* Sets if the rectangle is filled or just stroked * Sets if the rectangle is filled or just stroked
*/ */
void setFilled(boolean filled); Widget setFilled(boolean filled);
/** /**
* Verb for spell targets * Verb for spell targets
@@ -1011,7 +1024,7 @@ public interface Widget
/** /**
* Container this can be dragged in * Container this can be dragged in
*/ */
void setDragParent(Widget dragParent); Widget setDragParent(Widget dragParent);
/** /**
* Gets the script and arguments to be ran when one of the listened for vars changes. * Gets the script and arguments to be ran when one of the listened for vars changes.