use of eidolons.libgdx.gui.panels.ScrollPanel in project Eidolons by IDemiurge.
the class EditorPalette method init.
public void init() {
clearChildren();
clearListeners();
addListener(new ClickListener() {
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
// updateRequired=true;
return super.touchDown(event, x, y, pointer, button);
}
});
setSize(GdxMaster.getWidth() / 3 * 2, 256);
int columns = (int) (getWidth() / 64);
for (EDITOR_PALETTE sub : EDITOR_PALETTE.values()) {
OBJ_TYPE TYPE = ContentManager.getOBJ_TYPE(sub.name());
if (TYPE == null) {
addCustomTab(sub);
continue;
}
TabbedPanel tabbedPanel = new TabbedPanel();
TablePanel<Actor> table;
if (TYPE == null)
continue;
List<String> list = DataManager.getTabsGroup(TYPE);
if (list.isEmpty())
list.add("");
for (String group : list) {
table = new TablePanel<>();
table.defaults().width(64).height(64);
table.top().left().padLeft(64).padTop(64);
table.setFillParent(true);
ArrayList<ObjType> types = new ArrayList<>(DataManager.getTypesGroup(TYPE, group));
int i = 0;
int rows = 0;
for (ObjType type : types) {
TextureRegion texture = TextureCache.getOrCreateR(type.getImagePath());
ValueContainer item = new ValueContainer(texture);
item.setBackground(new NinePatchDrawable(NinePatchFactory.getTooltip()));
item.overrideImageSize(64, 64);
item.addListener(new ValueTooltip(type.getName()).getController());
item.addListener(getItemListener(item));
table.add(item).left();
item.setUserObject(type);
i++;
if (i >= columns) {
i = 0;
table.row();
rows++;
}
}
table.pack();
if (rows > 3) {
ScrollPanel scrollPanel = new ScrollPanel();
scrollPanel.addElement(table);
tabbedPanel.addTab(scrollPanel, group);
} else {
tabbedPanel.addTab(table, group);
}
}
addTab(tabbedPanel, sub.name());
}
// scrollable?
}
Aggregations