Package rsb.wrappers

Class RSWidget

All Implemented Interfaces:
Clickable, Clickable07

public class RSWidget extends MethodProvider implements Clickable07
  • Constructor Details

    • RSWidget

      public RSWidget(MethodContext ctx, int parentId, int id)
    • RSWidget

      public RSWidget(MethodContext ctx, net.runelite.api.widgets.Widget widget)
  • Method Details

    • isValid

      public boolean isValid()
    • isVisible

      public boolean isVisible()
    • isSelfVisible

      public boolean isSelfVisible()
    • doAction

      public boolean doAction(String action)
      Performs the given action on this RSInterfaceChild if it is showing (valid).
      Specified by:
      doAction in interface Clickable
      Parameters:
      action - The menu action to click.
      Returns:
      true if the action was clicked; otherwise false.
    • doAction

      public boolean doAction(String action, String option)
      Performs the given action on this RSInterfaceChild if it is showing (valid).
      Specified by:
      doAction in interface Clickable
      Parameters:
      action - The menu action to click.
      option - The option of the menu action to click.
      Returns:
      true if the action was clicked; otherwise false.
    • doClick

      public boolean doClick()
      Left-clicks this component.
      Specified by:
      doClick in interface Clickable
      Returns:
      true if the component was clicked.
    • doClick

      public boolean doClick(boolean leftClick)
      Clicks this component.
      Specified by:
      doClick in interface Clickable
      Parameters:
      leftClick - true to left-click; false to right-click.
      Returns:
      true if the component was clicked.
    • doHover

      public boolean doHover()
      Moves the mouse over this component (with normally distributed randomness) if it is not already.
      Specified by:
      doHover in interface Clickable
      Returns:
      true if the mouse was moved; otherwise false.
    • getAbsoluteX

      public int getAbsoluteX()
      Gets the absolute x position of the child, calculated from the beginning of the game screen
      Returns:
      the absolute x or -1 if null
    • getAbsoluteY

      public int getAbsoluteY()
      Gets the absolute y position of the child, calculated from the beginning of the game screen
      Returns:
      the absolute y position or -1 if null
    • getArea

      public Rectangle getArea()
      Gets the area of this component
      Returns:
      the area or new Rectangle(-1, -1, -1, -1) if null
    • getComponents

      public RSWidget[] getComponents()
      The child components (bank items etc) of this component.
      Returns:
      The components or RSWidget[0] if null
    • getWidgetItems

      public RSWidgetItem[] getWidgetItems()
    • getWidgetItem

      public RSWidgetItem getWidgetItem(int idx)
    • getDynamicComponent

      public RSWidget getDynamicComponent(int idx)
    • getComponent

      public RSWidget getComponent(int idx)
      Gets the child component at a given index
      Parameters:
      idx - The child index
      Returns:
      The child component, or null
    • getBorderThickness

      public int getBorderThickness()
      Gets the border thickness of this component
      Returns:
      the border thickness or -1 if null
    • getId

      public int getId()
      Gets the id of this component
      Returns:
      The id of this component, or -1 if component == null
    • getIndex

      public int getIndex()
      Gets the index of this component
      Returns:
      The index of this component, or -1 if component == null
    • getStackSize

      public int getStackSize()
      Gets the stack size of this component
      Returns:
      The stack size of this component, or -1 if component == null
    • getName

      public String getName()
      Gets the name of this component
      Returns:
      The name of this component, or "" if component == null
    • getHeight

      public int getHeight()
      Gets the height of this component
      Returns:
      the height of this component or -1 if null
    • getSpriteId

      public int getSpriteId()
      Gets the sprite ID of this component
      Returns:
      the sprite ID or -1 if null
    • getItemId

      public int getItemId()
      Gets the item ID of this component
      Returns:
      the item ID or -1 if null
    • getModelId

      public int getModelId()
      Gets the model ID of this component
      Returns:
      the model ID or -1 if null
    • getParentId

      public int getParentId()
      Gets the parent id of this component. It will first look at the internal parentID, if that's -1 then it will search the RSInterfaceNC to find its parent.
      Returns:
      the parentID or -1 if none
    • getParent

      public RSWidget getParent()
      Gets the parent widget
      Returns:
      the parent widget for this RSWidget object
    • getGroupIndex

      public int getGroupIndex()
      Gets the group index of this widget
      Returns:
      the group index
    • getChildIndex

      public int getChildIndex()
      Gets the child index of this widget
      Returns:
      the child index
    • getLocation

      public Point getLocation()
      Gets the absolute position of the child
      Returns:
      the absolute position or new Point(-1, -1) if null
    • getCenter

      public Point getCenter()
      Returns the center point of this interface
      Returns:
      The center point of this interface
    • getRelativeX

      public int getRelativeX()
      Gets the relative x position of the child, calculated from the beginning of the interface
      Returns:
      the relative x position or -1 if null
    • getRelativeY

      public int getRelativeY()
      Gets the relative y position of the child, calculated from the beginning of the interface
      Returns:
      the relative y position -1 if null
    • getVerticalScrollPosition

      public int getVerticalScrollPosition()
    • getHorizontalScrollPosition

      public int getHorizontalScrollPosition()
    • getScrollableContentHeight

      public int getScrollableContentHeight()
    • getScrollableContentWidth

      public int getScrollableContentWidth()
    • getRealHeight

      public int getRealHeight()
    • getRealWidth

      public int getRealWidth()
    • isInScrollableArea

      public boolean isInScrollableArea()
    • getSelectedActionName

      public String getSelectedActionName()
      Gets the selected action name of this component
      Returns:
      the selected action name or "" if null
    • getText

      public String getText()
      Gets the text of this component
      Returns:
      the text or "" if null
    • getBackgroundColor

      public int getBackgroundColor()
      Gets the text color of this component
      Returns:
      the text color or -1 if null
    • getFontID

      public int getFontID()
      Gets the FontID of this component
      Returns:
      the fontID or -1 if null
    • isTextShadowed

      public boolean isTextShadowed()
      Returns whether the text is shadowed
      Returns:
      true unless font isn't shadowed or component is null
    • getType

      public int getType()
      Gets the type of this component
      Returns:
      the type or -1 if null
    • containsAction

      public boolean containsAction(String phrase)
      Checks the actions of the child for a given substring
      Parameters:
      phrase - The phrase to check for
      Returns:
      true if found
    • getActions

      public String[] getActions()
      Gets the actions of this component.
      Returns:
      the actions or an empty array if null
    • containsText

      public boolean containsText(String phrase)
      Checks the text of this component for a given substring
      Parameters:
      phrase - The phrase to check for
      Returns:
      true if the text contained the phrase
      See Also:
    • getValueIndexArray

      public int[][] getValueIndexArray()
      Gets the value index array of this component
      Returns:
      the value index array or new int[0][0] if null
    • getWidth

      public int getWidth()
      Gets the width of this component
      Returns:
      the width of the component or -1 if null
    • getBounds

      public Rectangle getBounds()
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • isClickable

      public boolean isClickable()
      Specified by:
      isClickable in interface Clickable07