use of net.runelite.api.widgets.Widget in project runelite by runelite.
the class RSWidgetMixin method broadcastHidden.
@Inject
@Override
public void broadcastHidden(boolean hidden) {
WidgetHiddenChanged event = new WidgetHiddenChanged();
event.setWidget(this);
event.setHidden(hidden);
eventBus.post(event);
RSWidget[] children = getChildren();
if (children != null) {
// recursive through children
for (RSWidget child : children) {
// if the widget is hidden it will not magically unhide from its parent changing
if (child == null || child.isSelfHidden())
continue;
child.broadcastHidden(hidden);
}
}
// make sure we iterate nested children as well
// cannot be null
Widget[] nestedChildren = getNestedChildren();
for (Widget nestedChild : nestedChildren) {
if (nestedChild == null || nestedChild.isSelfHidden())
continue;
((RSWidget) nestedChild).broadcastHidden(hidden);
}
}
use of net.runelite.api.widgets.Widget in project runelite by runelite.
the class RSWidgetMixin method getNestedChildren.
@Inject
@Override
public Widget[] getNestedChildren() {
RSHashTable componentTable = client.getComponentTable();
int group = -1;
// iteration here...
for (Node node : componentTable.getNodes()) {
WidgetNode wn = (WidgetNode) node;
if (wn.getHash() == getId()) {
group = wn.getId();
break;
}
}
if (group == -1) {
return new Widget[0];
}
List<Widget> widgets = new ArrayList<Widget>();
for (Widget widget : client.getGroup(group)) {
if (widget != null && widget.getParentId() == getId()) {
widgets.add(widget);
}
}
return widgets.toArray(new Widget[widgets.size()]);
}
use of net.runelite.api.widgets.Widget in project runelite by runelite.
the class RSWidgetMixin method onHiddenChanged.
@FieldHook("isHidden")
@Inject
public void onHiddenChanged(int idx) {
int id = getId();
if (id == -1) {
return;
}
Widget parent = getParent();
// so ignore them
if (parent != null) {
if (parent.isHidden()) {
return;
}
} else if (TO_GROUP(id) != client.getWidgetRoot()) {
return;
}
broadcastHidden(isSelfHidden());
}
use of net.runelite.api.widgets.Widget in project runelite by runelite.
the class RegenMeterOverlay method renderRegen.
private void renderRegen(Graphics2D g, WidgetInfo widgetInfo, double percent, Color color) {
Widget widget = client.getWidget(widgetInfo);
if (widget == null) {
return;
}
Rectangle bounds = widget.getBounds();
Arc2D.Double arc = new Arc2D.Double(bounds.x + 26d, bounds.y + 3.d, 27d, 27d, 90.d, -360.d * percent, Arc2D.OPEN);
final Stroke STROKE = new BasicStroke(2f);
g.setStroke(STROKE);
g.setColor(color);
g.draw(arc);
}
use of net.runelite.api.widgets.Widget in project runelite by runelite.
the class PyramidPlunderOverlay method render.
@Override
public Dimension render(Graphics2D graphics) {
Widget pyramidPlunderInfo = client.getWidget(WidgetInfo.PYRAMID_PLUNDER_DATA);
if (pyramidPlunderInfo == null) {
timer = null;
return null;
}
panelComponent.getLines().clear();
pyramidPlunderInfo.setHidden(true);
if (timer == null) {
startTimer();
}
panelComponent.getLines().add(new PanelComponent.Line("Time left: ", Color.WHITE, timer.getText(), timer.getTextColor()));
panelComponent.getLines().add(new PanelComponent.Line("Room: ", String.valueOf(client.getSetting(Varbits.PYRAMID_PLUNDER_ROOM)) + "/8"));
return panelComponent.render(graphics);
}
Aggregations