widget: expose itemQuantityMode (#6020)

This commit is contained in:
Ron Young
2018-10-16 06:00:42 -05:00
committed by Tomas Slusny
parent 4a0593c11b
commit 8480a7cb88
4 changed files with 66 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
/*
* Copyright (c) 2018, Ron Young <https://github.com/raiyni>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.api.widgets;
/**
* Utility class mapping Widget ItemQuantityMode values
*/
public class ItemQuantityMode
{
/**
* Never show item quantity number
*/
public static final int NEVER = 0;
/**
* Always show item quantity number
*/
public static final int ALWAYS = 1;
/**
* Only show item quantity number if it's greater than 1
*/
public static final int STACKABLE = 2;
}

View File

@@ -592,4 +592,14 @@ public interface Widget
* Sets the widget drag dead time
*/
void setDragDeadTime(int deadTime);
/**
* Returns widget {@link net.runelite.api.widgets.ItemQuantityMode}.
*/
int getItemQuantityMode();
/**
* Sets the widget {@link net.runelite.api.widgets.ItemQuantityMode}
*/
void setItemQuantityMode(int itemQuantityMode);
}

View File

@@ -153,6 +153,7 @@ public class WidgetInfoTableModel extends AbstractTableModel
out.add(new WidgetField<>("Name", w -> w.getName().trim(), Widget::setName, String.class));
out.add(new WidgetField<>("ItemId", Widget::getItemId, Widget::setItemId, Integer.class));
out.add(new WidgetField<>("ItemQuantity", Widget::getItemQuantity, Widget::setItemQuantity, Integer.class));
out.add(new WidgetField<>("ItemQuantityMode", Widget::getItemQuantityMode, Widget::setItemQuantityMode, Integer.class));
out.add(new WidgetField<>("ModelId", Widget::getModelId));
out.add(new WidgetField<>("SpriteId", Widget::getSpriteId, Widget::setSpriteId, Integer.class));
out.add(new WidgetField<>("Width", Widget::getWidth, Widget::setWidth, Integer.class));

View File

@@ -342,4 +342,12 @@ public interface RSWidget extends Widget
@Import("dragDeadTime")
@Override
void setDragDeadTime(int deadTime);
@Import("itemQuantityMode")
@Override
int getItemQuantityMode();
@Import("itemQuantityMode")
@Override
void setItemQuantityMode(int itemQuantityMode);
}