public TabBase addTab(TabBase tab, int index) { int yOffset = 4; for (TabBase tab1 : tabs) { if (tab1.side == tab.side && tab1.isVisible()) { yOffset += tab1.currentHeight; } } tab.setPosition(tab.side == TabBase.LEFT ? 0 : xSize, yOffset); tabs.add(index, tab); if (TabTracker.getOpenedLeftTab() != null && tab.getClass().equals(TabTracker.getOpenedLeftTab())) { tab.setFullyOpen(); } else if (TabTracker.getOpenedRightTab() != null && tab.getClass().equals(TabTracker.getOpenedRightTab())) { tab.setFullyOpen(); } return tab; }
protected TabBase getTabAtPosition(int mX, int mY) { int xShift = 0; int yShift = 4; for (TabBase tab : tabs) { if (!tab.isVisible() || tab.side == TabBase.RIGHT) { continue; } tab.setCurrentShift(xShift, yShift); if (tab.intersectsWith(mX, mY, xShift, yShift)) { return tab; } yShift += tab.currentHeight; } xShift = xSize; yShift = 4; for (TabBase tab : tabs) { if (!tab.isVisible() || tab.side == TabBase.LEFT) { continue; } tab.setCurrentShift(xShift, yShift); if (tab.intersectsWith(mX, mY, xShift, yShift)) { return tab; } yShift += tab.currentHeight; } return null; }
public TabBase addTab(TabBase tab) { int yOffset = 4; for (TabBase tab1 : tabs) { if (tab1.side == tab.side && tab1.isVisible()) { yOffset += tab1.currentHeight; } } tab.setPosition(tab.side == TabBase.LEFT ? 0 : xSize, yOffset); tabs.add(tab); if (TabTracker.getOpenedLeftTab() != null && tab.getClass().equals(TabTracker.getOpenedLeftTab())) { tab.setFullyOpen(); } else if (TabTracker.getOpenedRightTab() != null && tab.getClass().equals(TabTracker.getOpenedRightTab())) { tab.setFullyOpen(); } return tab; }
public Rectangle4i getBounds() { if (isVisible()) { return new Rectangle4i(posX() + gui.getGuiLeft(), posY + gui.getGuiTop(), currentWidth, currentHeight); } else { return new Rectangle4i(posX() + gui.getGuiLeft(), posY + gui.getGuiTop(), 0, 0); } }