Search in sources :

Example 1 with ITitledWidget

use of binnie.core.api.gui.ITitledWidget in project Binnie by ForestryMC.

the class WindowAnalyst method updatePages.

@SideOnly(Side.CLIENT)
public void updatePages(boolean systemChange) {
    int oldLeft = -1;
    int oldRight = -1;
    if (!systemChange) {
        oldLeft = analystPages.indexOf(leftPage.getContent());
        oldRight = analystPages.indexOf(rightPage.getContent());
    }
    ITitledWidget databasePage = null;
    if (isDatabase && !systemChange) {
        databasePage = ((analystPages.size() > 0) ? analystPages.get(0) : null);
    }
    analystPages.clear();
    setPage(leftPage, null);
    setPage(rightPage, null);
    createPages(databasePage);
    tabBar.deleteAllChildren();
    if (analystPages.size() > 0) {
        int width = tabBar.getWidth() / analystPages.size();
        int x = 0;
        for (ITitledWidget page : analystPages) {
            new ControlAnalystButton(tabBar, x, 0, width, tabBar.getHeight(), this, page);
            x += width;
        }
        setPage(leftPage, analystPages.get((oldLeft >= 0) ? oldLeft : 0));
        if (analystPages.size() > 1) {
            setPage(rightPage, analystPages.get((oldRight >= 0) ? oldRight : 1));
        }
    }
}
Also used : ITitledWidget(binnie.core.api.gui.ITitledWidget) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 2 with ITitledWidget

use of binnie.core.api.gui.ITitledWidget in project Binnie by ForestryMC.

the class WindowAnalyst method createPages.

@SideOnly(Side.CLIENT)
private void createPages(@Nullable ITitledWidget databasePage) {
    if (isDatabase) {
        analystPages.add((databasePage != null) ? databasePage : new AnalystPageDatabase(analystPanel, analystPageSize, currentSystem, isMaster));
    }
    if (current != null) {
        analystPages.add(new AnalystPageDescription(analystPanel, analystPageSize, current));
        analystPages.add(new AnalystPageGenome(analystPanel, analystPageSize, true, current));
        if (!isDatabase) {
            analystPages.add(new AnalystPageGenome(analystPanel, analystPageSize, false, current));
            analystPages.add(new AnalystPageKaryogram(analystPanel, analystPageSize, current));
        }
        createPages(current, analystPanel, analystPageSize, analystPages);
        analystPages.add(new AnalystPageMutations(analystPanel, analystPageSize, current, isMaster));
    }
    for (ITitledWidget page : analystPages) {
        page.hide();
    }
}
Also used : ITitledWidget(binnie.core.api.gui.ITitledWidget) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

ITitledWidget (binnie.core.api.gui.ITitledWidget)2 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)2