Add ChatboxPanelManager to allow for more advanced chatbox inputs

This commit is contained in:
Max Weber
2018-10-08 01:36:29 -06:00
parent 33dec14a38
commit 2434557e1a
24 changed files with 1831 additions and 25 deletions

View File

@@ -0,0 +1,57 @@
/*
* Copyright (c) 2018 Abex
* 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;
/**
* IDs of fonts in the cache
*/
public final class FontID
{
public static final int PLAIN_11 = 494;
public static final int PLAIN_12 = 495;
public static final int BOLD_12 = 496;
public static final int QUILL_8 = 497;
public static final int QUILL_MEDIUM = 645;
public static final int QUILL_CAPS_LARGE = 646;
public static final int FAIRY_SMALL = 647;
public static final int FAIRY_LARGE = 648;
public static final int BARBARIAN = 764;
public static final int SUROK = 819;
public static final int VERDANA_11 = 1442;
public static final int VERDANA_11_BOLD = 1443;
public static final int TAHOMA_11 = 1444;
public static final int VERDANA_13 = 1445;
public static final int VERDANA_13_BOLD = 1446;
public static final int VERDANA_15 = 1447;
}

View File

@@ -0,0 +1,35 @@
/*
* Copyright (c) 2018 Abex
* 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;
/**
* A bitmap Font in Jagex's format
*/
public interface FontTypeFace
{
int getTextWidth(String text);
int getBaseline();
}

View File

@@ -56,10 +56,16 @@ public final class ScriptID
* Closes the chatbox input
* <ul>
* <li> int (boolean) Clear the current text </li>
* <li> int (boolean) Unknown; set to 1 </li>
* <li> int (boolean) Restore to chat view </li>
* </ul>
*/
public static final int CLOSE_CHATBOX_INPUT = 299;
public static final int RESET_CHATBOX_INPUT = 299;
/**
* Readies the chatbox panel for things like the chatbox input
* Inverse of RESET_CHATBOX_INPUT
*/
public static final int CLEAR_CHATBOX_PANEL = 677;
/**
* Updates the Diary/Quest interface's scrollbar

View File

@@ -35,6 +35,7 @@ import net.runelite.api.VarClientInt;
@RequiredArgsConstructor
public enum InputType
{
RUNELITE_CHATBOX_PANEL(-3),
RUNELITE(-2),
NONE(0),
SEARCH(11);

View File

@@ -26,6 +26,7 @@ package net.runelite.api.widgets;
import java.awt.Rectangle;
import java.util.Collection;
import net.runelite.api.FontTypeFace;
import net.runelite.api.Point;
/**
@@ -201,13 +202,22 @@ public interface Widget
int getTextColor();
/**
* Sets the RGB color of the displayed text.
* Sets the RGB color of the displayed text or rectangle.
*
* @param textColor the new text color
* @see java.awt.Color#getRGB()
*/
void setTextColor(int textColor);
/**
* Sets the opacity of the rectangle
*/
int getOpacity();
/**
* Gets the opacity of the rectangle
*/
void setOpacity(int opacity);
/**
* Gets the name of the widget.
* <p>
@@ -489,6 +499,11 @@ public interface Widget
*/
Widget createChild(int index, int type);
/**
* Removes all of this widget's dynamic children
*/
void deleteAllChildren();
/**
* Creates a menu action on the widget
*
@@ -505,6 +520,41 @@ public interface Widget
*/
void setOnOpListener(Object... args);
/**
* Sets a script to be ran when the dialog is canceled
*
* @param args A ScriptID, then the args for the script
*/
void setOnDialogAbortListener(Object... args);
/**
* Sets a script to be ran on key input
*
* @param args A ScriptID, then the args for the script
*/
void setOnKeyListener(Object... args);
/**
* Sets a script to be ran when the mouse enters the widget bounds
*
* @param args A ScriptID, then the args for the script
*/
void setOnMouseOverListener(Object... args);
/**
* Sets a script to be ran when the mouse leaves the widget bounds
*
* @param args A ScriptID, then the args for the script
*/
void setOnMouseLeaveListener(Object... args);
/**
* Sets a script to be ran every frame
*
* @param args A ScriptID, then the args for the script
*/
void setOnTimerListener(Object... args);
/**
* If this widget has any listeners on it
*/
@@ -602,4 +652,103 @@ public interface Widget
* Sets the widget {@link net.runelite.api.widgets.ItemQuantityMode}
*/
void setItemQuantityMode(int itemQuantityMode);
/**
* Gets the mode that the X position is calculated from the original X position
*
* @see WidgetPositionMode
*/
int getXPositionMode();
/**
* Sets the mode that the X position is calculated from the original X position
*
* @see WidgetPositionMode
*/
void setXPositionMode(int xpm);
/**
* Gets the mode that the Y position is calculated from the original Y position
*
* @see WidgetPositionMode
*/
int getYPositionMode();
/**
* Sets the mode that the Y position is calculated from the original Y position
*
* @see WidgetPositionMode
*/
void setYPositionMode(int ypm);
/**
* Gets the X axis text position mode
*
* @see WidgetTextAlignment
*/
int getXTextAlignment();
/**
* Sets the X axis text position mode
*
* @see WidgetTextAlignment
*/
void setXTextAlignment(int xta);
/**
* Gets the Y axis text position mode
*
* @see WidgetTextAlignment
*/
int getYTextAlignment();
/**
* Sets the Y axis text position mode
*
* @see WidgetTextAlignment
*/
void setYTextAlignment(int yta);
/**
* Gets the mode controlling widget width
*
* @see WidgetSizeMode
*/
int getWidthMode();
/**
* Sets the mode controlling widget width
*
* @see WidgetSizeMode
*/
void setWidthMode(int widthMode);
/**
* Gets the mode controlling widget width
*
* @see WidgetSizeMode
*/
int getHeightMode();
/**
* Sets the mode controlling widget width
*
* @see WidgetSizeMode
*/
void setHeightMode(int heightMode);
/**
* Gets the font that this widget uses
*/
FontTypeFace getFont();
/**
* Gets if the rectangle is filled or just stroked
*/
boolean isFilled();
/**
* Sets if the rectangle is filled or just stroked
*/
void setFilled(boolean filled);
}

View File

@@ -410,12 +410,15 @@ public class WidgetID
static class Chatbox
{
static final int CHATBOX_PARENT = 0;
static final int CHATBOX_BUTTONS = 1;
static final int CHATBOX_REPORT_TEXT = 36;
static final int CHATBOX_FRAME = 37;
static final int CHATBOX_MESSAGES = 55;
static final int CHATBOX_INPUT = 57;
static final int PARENT = 0;
static final int BUTTONS = 1;
static final int REPORT_TEXT = 36;
static final int FRAME = 37;
static final int CONTAINER = 40;
static final int TITLE = 44;
static final int FULL_INPUT = 45;
static final int MESSAGES = 55;
static final int INPUT = 57;
}
static class Prayer

View File

@@ -322,12 +322,15 @@ public enum WidgetInfo
SLAYER_REWARDS_TOPBAR(WidgetID.SLAYER_REWARDS_GROUP_ID, WidgetID.SlayerRewards.TOP_BAR),
CHATBOX_PARENT(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.CHATBOX_PARENT),
CHATBOX(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.CHATBOX_FRAME),
CHATBOX_MESSAGES(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.CHATBOX_MESSAGES),
CHATBOX_BUTTONS(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.CHATBOX_BUTTONS),
CHATBOX_REPORT_TEXT(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.CHATBOX_REPORT_TEXT),
CHATBOX_INPUT(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.CHATBOX_INPUT),
CHATBOX_PARENT(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.PARENT),
CHATBOX(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.FRAME),
CHATBOX_MESSAGES(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.MESSAGES),
CHATBOX_BUTTONS(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.BUTTONS),
CHATBOX_TITLE(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.TITLE),
CHATBOX_FULL_INPUT(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.FULL_INPUT),
CHATBOX_CONTAINER(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.CONTAINER),
CHATBOX_REPORT_TEXT(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.REPORT_TEXT),
CHATBOX_INPUT(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.INPUT),
BA_HEAL_WAVE_TEXT(WidgetID.BA_HEALER_GROUP_ID, WidgetID.BarbarianAssault.CURRENT_WAVE),
BA_HEAL_CALL_TEXT(WidgetID.BA_HEALER_GROUP_ID, WidgetID.BarbarianAssault.TO_CALL),

View File

@@ -0,0 +1,39 @@
/*
* Copyright (c) 2018 Abex
* 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;
public final class WidgetPositionMode
{
public static final int ABSOLUTE_LEFT = 0;
public static final int ABSOLUTE_TOP = 0;
public static final int ABSOLUTE_CENTER = 1;
public static final int ABSOLUTE_RIGHT = 2;
public static final int ABSOLUTE_BOTTOM = 2;
public static final int LEFT_16384THS = 3;
public static final int TOP_16384THS = 3;
public static final int CENTER_16384THS = 4;
public static final int RIGHT_16384THS = 5;
public static final int BOTTOM_16384THS = 5;
}

View File

@@ -0,0 +1,43 @@
/*
* Copyright (c) 2018 Abex
* 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;
public final class WidgetSizeMode
{
/**
* dim = originalDim
*/
public static final int ABSOLUTE = 0;
/**
* dim = parentDim - originalDim
*/
public static final int MINUS = 1;
/**
* dim = parentDim * (originalDim / 16384)
*/
public static final int ABSOLUTE_16384THS = 2;
}

View File

@@ -0,0 +1,34 @@
/*
* Copyright (c) 2018 Abex
* 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;
public final class WidgetTextAlignment
{
public static final int LEFT = 0;
public static final int TOP = 0;
public static final int CENTER = 1;
public static final int RIGHT = 2;
public static final int BOTTOM = 2;
}