use of gaiasky.util.scene2d.OwnScrollPane in project gaiasky by langurmonkey.
the class GenericDialog method buildSuper.
public void buildSuper() {
// BUTTONS
buttonGroup = new HorizontalGroup();
buttonGroup.space(pad5);
if (acceptText != null) {
acceptButton = new OwnTextButton(acceptText, skin, "default");
acceptButton.setName("accept");
acceptButton.addListener((event) -> {
if (event instanceof ChangeEvent) {
accept();
if (acceptRunnable != null)
acceptRunnable.run();
me.hide();
return true;
}
return false;
});
buttonGroup.addActor(acceptButton);
}
if (cancelText != null) {
cancelButton = new OwnTextButton(cancelText, skin, "default");
cancelButton.setName("cancel");
cancelButton.addListener((event) -> {
if (event instanceof ChangeEvent) {
cancel();
if (cancelRunnable != null)
cancelRunnable.run();
me.hide();
return true;
}
return false;
});
buttonGroup.addActor(cancelButton);
}
recalculateButtonSize();
add(content).left().pad(pad10).row();
add(bottom).expandY().bottom().right().padRight(pad10).row();
add(buttonGroup).pad(pad10).bottom().right();
getTitleTable().align(Align.left);
// Align top left
align(Align.top | Align.left);
pack();
// Add keys for ESC, ENTER and TAB
me.addListener(event -> {
if (event instanceof InputEvent) {
InputEvent ievent = (InputEvent) event;
if (ievent.getType() == Type.keyUp) {
int key = ievent.getKeyCode();
switch(key) {
case Keys.ESCAPE:
if (escExit) {
// Exit
cancel();
if (cancelRunnable != null)
cancelRunnable.run();
me.hide();
}
// Do not propagate to parents
event.stop();
return true;
case Keys.ENTER:
if (enterExit) {
// Exit
accept();
if (acceptRunnable != null)
acceptRunnable.run();
me.hide();
}
// Do not propagate to parents
event.stop();
return true;
case Keys.TAB:
return true;
default:
// Nothing
break;
}
}
}
return false;
});
// CAPTURE SCROLL FOCUS
stage.addListener(event -> {
if (event instanceof InputEvent) {
InputEvent ie = (InputEvent) event;
if (ie.getType() == Type.mouseMoved) {
for (OwnScrollPane scroll : scrolls) {
if (ie.getTarget().isDescendantOf(scroll)) {
stage.setScrollFocus(scroll);
}
}
}
}
return false;
});
// Build actual content
build();
// Modal
setModal(this.modal);
}
use of gaiasky.util.scene2d.OwnScrollPane in project gaiasky by langurmonkey.
the class ArchiveViewWindow method build.
@Override
protected void build() {
this.pad = 8f;
/**
* TABLE and SCROLL *
*/
table = new Table(skin);
table.pad(pad);
scroll = new OwnScrollPane(table, skin, "minimalist-nobg");
scroll.setFadeScrollBars(false);
scroll.setScrollingDisabled(true, false);
scroll.setOverscroll(false, false);
scroll.setSmoothScrolling(true);
content.add(scroll);
getTitleTable().align(Align.left);
pack();
}
Aggregations