Search in sources :

Example 6 with Widget

use of org.powerbot.bot.rt6.client.Widget in project powerbot by powerbot.

the class Component method tooltip.

public String tooltip() {
    final Widget component = getInternalComponent();
    String tip = "";
    if (component != null && (tip = component.getTooltip()) == null) {
        tip = "";
    }
    return tip;
}
Also used : Widget(org.powerbot.bot.rt6.client.Widget)

Example 7 with Widget

use of org.powerbot.bot.rt6.client.Widget in project powerbot by powerbot.

the class Widgets method get.

/**
 * {@inheritDoc}
 */
@Override
protected List<Widget> get() {
    final Client client = ctx.client();
    if (client == null) {
        return new ArrayList<Widget>(0);
    }
    final Object[] cache = client.getWidgets();
    if (cache == null || cache.length == 0) {
        return new ArrayList<Widget>(0);
    }
    final List<Widget> w = new ArrayList<Widget>(cache.length);
    for (int i = 0; i < cache.length; i++) {
        w.add(new Widget(ctx, i));
    }
    return w;
}
Also used : ArrayList(java.util.ArrayList) Client(org.powerbot.bot.rt6.client.Client) Point(java.awt.Point)

Example 8 with Widget

use of org.powerbot.bot.rt6.client.Widget in project powerbot by powerbot.

the class Component method _screenPoint.

private Point _screenPoint(final int depth) {
    if (depth > RECURSION_DEPTH) {
        return new Point(-1, -1);
    }
    final Client client = ctx.client();
    final Widget component = getInternalComponent();
    if (client == null || component == null) {
        return new Point(-1, -1);
    }
    final int pId = parentId();
    int x = 0, y = 0;
    if (pId != -1) {
        final Point point = ctx.widgets.component(pId >> 16, pId & 0xffff)._screenPoint(depth + 1);
        x = point.x;
        y = point.y;
    } else {
        final Rectangle[] bounds = client.getWidgetBoundsArray();
        final int index = component.getBoundsArrayIndex();
        if (bounds != null && index > 0 && index < bounds.length && bounds[index] != null) {
            return new Point(bounds[index].x, bounds[index].y);
        }
    }
    if (pId != -1) {
        final Component child = ctx.widgets.component(pId >> 16, pId & 0xffff);
        final int horizontalScrollSize = child.scrollWidthMax(), verticalScrollSize = child.scrollHeightMax();
        if (horizontalScrollSize > 0 || verticalScrollSize > 0) {
            x -= child.scrollX();
            y -= child.scrollY();
        }
    }
    x += component.getX();
    y += component.getY();
    return new Point(x, y);
}
Also used : Widget(org.powerbot.bot.rt6.client.Widget) Rectangle(java.awt.Rectangle) Point(java.awt.Point) Client(org.powerbot.bot.rt6.client.Client) Point(java.awt.Point)

Example 9 with Widget

use of org.powerbot.bot.rt6.client.Widget in project powerbot by powerbot.

the class Component method text.

public String text() {
    final Widget component = getInternalComponent();
    String text = "";
    if (component != null && (text = component.getText()) == null) {
        text = "";
    }
    return text;
}
Also used : Widget(org.powerbot.bot.rt6.client.Widget)

Example 10 with Widget

use of org.powerbot.bot.rt6.client.Widget in project powerbot by powerbot.

the class Component method actions.

public String[] actions() {
    final Widget component = getInternalComponent();
    String[] actions = new String[0];
    if (component != null) {
        if ((actions = component.getActions()) == null) {
            actions = new String[0];
        }
    }
    return actions.clone();
}
Also used : Widget(org.powerbot.bot.rt6.client.Widget)

Aggregations

Widget (org.powerbot.bot.rt6.client.Widget)11 Point (java.awt.Point)5 Client (org.powerbot.bot.rt6.client.Client)4 Rectangle (java.awt.Rectangle)1 ArrayList (java.util.ArrayList)1 HashTable (org.powerbot.bot.rt6.HashTable)1 ComponentNode (org.powerbot.bot.rt6.client.ComponentNode)1