Made GuiDropdown a subclass of GuiAdvancedTextfield, updating the Constructor and removing the now redundant GuiConstants entries

This commit is contained in:
CrushedPixel
2015-07-08 15:50:12 +02:00
parent e26e09a264
commit 80a47a61c8
6 changed files with 8 additions and 12 deletions

View File

@@ -17,8 +17,6 @@ public class GuiConstants {
public static final int CENTER_SEARCH_ACTION_BUTTON = 2013;
public static final int CENTER_SEARCH_GAMETYPE_TOGGLE = 2015;
public static final int CENTER_SEARCH_ORDER_TOGGLE = 2016;
public static final int CENTER_SEARCH_CATEGORY_DROPDOWN = 2017;
public static final int CENTER_SEARCH_VERSION_DROPDOWN = 2018;
public static final int UPLOAD_START_BUTTON = 3003;
public static final int UPLOAD_CANCEL_BUTTON = 3004;
@@ -74,7 +72,6 @@ public class GuiConstants {
public static final int PLAYER_OVERVIEW_SHOW_ALL = 101;
public static final int PLAYER_OVERVIEW_REMEMBER = -10;
public static final int RENDER_SETTINGS_RENDERER_DROPDOWN = 9001;
public static final int RENDER_SETTINGS_RENDER_BUTTON = 9002;
public static final int RENDER_SETTINGS_CANCEL_BUTTON = 9003;
public static final int RENDER_SETTINGS_RESOLUTION_CHECKBOX = 9004;

View File

@@ -54,8 +54,7 @@ public class GuiRenderSettings extends GuiScreen {
if(!initialized) {
Keyboard.enableRepeatEvents(true);
rendererDropdown = new GuiDropdown<RendererSettings>(GuiConstants.RENDER_SETTINGS_RENDERER_DROPDOWN,
fontRendererObj, 0, 0, 200, 5);
rendererDropdown = new GuiDropdown<RendererSettings>(fontRendererObj, 0, 0, 200, 5);
rendererDropdown.addSelectionListener(new RendererDropdownListener());
int i = 0;

View File

@@ -14,7 +14,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class GuiDropdown<T> extends GuiTextField {
public class GuiDropdown<T> extends GuiAdvancedTextField {
private final int visibleDropout;
private final int dropoutElementHeight = 14;
@@ -28,9 +28,9 @@ public class GuiDropdown<T> extends GuiTextField {
private List<T> elements = new ArrayList<T>();
private HashMap<Integer, String> hoverTexts = new HashMap<Integer, String>();
public GuiDropdown(int id, FontRenderer fontRenderer,
public GuiDropdown(FontRenderer fontRenderer,
int xPos, int yPos, int width, int visibleDropout) {
super(id, fontRenderer, xPos, yPos, width, 20);
super(fontRenderer, xPos, yPos, width, 20);
this.visibleDropout = visibleDropout;
this.maxDropoutHeight = dropoutElementHeight * visibleDropout;
}

View File

@@ -116,8 +116,8 @@ public class GuiReplayCenter extends GuiScreen implements GuiYesNoCallback {
new String[]{I18n.format("options.particles.all"), I18n.format("menu.singleplayer"), I18n.format("menu.multiplayer")});
searchSortToggle = new GuiToggleButton(GuiConstants.CENTER_SEARCH_ORDER_TOGGLE, 0, 0, I18n.format("replaymod.gui.center.search.order")+": ",
new String[]{I18n.format("replaymod.gui.center.search.order.best"), I18n.format("replaymod.gui.center.search.order.recent")});
searchCategoryDropdown = new GuiDropdown<String>(GuiConstants.CENTER_SEARCH_CATEGORY_DROPDOWN, fontRendererObj, 0, 0, 0, Category.values().length+1);
searchVersionDropdown = new GuiDropdown<String>(GuiConstants.CENTER_SEARCH_VERSION_DROPDOWN, fontRendererObj, 0, 0, 0, 5);
searchCategoryDropdown = new GuiDropdown<String>(fontRendererObj, 0, 0, 0, Category.values().length+1);
searchVersionDropdown = new GuiDropdown<String>(fontRendererObj, 0, 0, 0, 5);
searchNameInput = new GuiAdvancedTextField(fontRendererObj, 0, 0, 50, 20);
searchServerInput = new GuiAdvancedTextField(fontRendererObj, 0, 0, 50, 20);

View File

@@ -103,7 +103,7 @@ public class GuiConnectPart extends GuiStudioPart {
concatList.setSelectionIndex(0);
replayDropdown = new GuiDropdown<GuiEntryListStringEntry>(1, fontRendererObj, 250, yPos + 5, 0, 4);
replayDropdown = new GuiDropdown<GuiEntryListStringEntry>(fontRendererObj, 250, yPos + 5, 0, 4);
replayDropdown.clearElements();
replayFiles = ReplayFileIO.getAllReplayFiles();

View File

@@ -81,7 +81,7 @@ public class GuiReplayEditor extends GuiScreen {
int modeWidth = tabButtons.get(0).width;
if(!initialized) {
replayDropdown = new GuiDropdown<String>(1, fontRendererObj, 15 + 2 + 1 + 80, 60, this.width - 30 - 8 - 80 - modeWidth - 4, 5);
replayDropdown = new GuiDropdown<String>(fontRendererObj, 15 + 2 + 1 + 80, 60, this.width - 30 - 8 - 80 - modeWidth - 4, 5);
refreshReplayDropdown();
} else {
replayDropdown.width = this.width - 30 - 8 - 80 - modeWidth - 4;