List of usage examples for com.badlogic.gdx.scenes.scene2d Stage getScrollFocus
public Actor getScrollFocus()
From source file:com.aia.hichef.ui.n.MyDialog.java
License:Apache License
/** {@link #pack() Packs} the dialog and adds it to the stage, centered. */ public MyDialog show(Stage stage) { clearActions();/*from www. j a v a2s. c o m*/ removeCaptureListener(ignoreTouchDown); previousKeyboardFocus = null; Actor actor = stage.getKeyboardFocus(); if (actor != null && !actor.isDescendantOf(this)) previousKeyboardFocus = actor; previousScrollFocus = null; actor = stage.getScrollFocus(); if (actor != null && !actor.isDescendantOf(this)) previousScrollFocus = actor; pack(); setPosition(Math.round((stage.getWidth() - getWidth()) / 2), Math.round((stage.getHeight() - getHeight()) / 2)); stage.addActor(this); stage.setKeyboardFocus(this); stage.setScrollFocus(this); if (fadeDuration > 0) { getColor().a = 0; addAction(Actions.fadeIn(fadeDuration, Interpolation.fade)); } return this; }
From source file:com.aia.hichef.ui.n.MyDialog.java
License:Apache License
/** * Hides the dialog. Called automatically when a button is clicked. The * default implementation fades out the dialog over {@link #fadeDuration} * seconds and then removes it from the stage. *//*from w w w . ja v a 2 s . c o m*/ public void hide() { Stage stage = getStage(); if (stage != null) { if (previousKeyboardFocus != null && previousKeyboardFocus.getStage() == null) previousKeyboardFocus = null; Actor actor = stage.getKeyboardFocus(); if (actor == null || actor.isDescendantOf(this)) stage.setKeyboardFocus(previousKeyboardFocus); if (previousScrollFocus != null && previousScrollFocus.getStage() == null) previousScrollFocus = null; actor = stage.getScrollFocus(); if (actor == null || actor.isDescendantOf(this)) stage.setScrollFocus(previousScrollFocus); } if (fadeDuration > 0) { addCaptureListener(ignoreTouchDown); addAction(sequence(fadeOut(fadeDuration, Interpolation.fade), Actions.removeListener(ignoreTouchDown, true), Actions.removeActor())); } else remove(); }
From source file:es.eucm.ead.editor.view.widgets.Dialog.java
License:Open Source License
/** * Shows the dialog in the stage//from w ww. ja va2 s . c o m */ public void show(Stage stage) { previousKeyboardFocus = null; Actor actor = stage.getKeyboardFocus(); if (actor != null && !actor.isDescendantOf(this)) previousKeyboardFocus = actor; previousScrollFocus = null; actor = stage.getScrollFocus(); if (actor != null && !actor.isDescendantOf(this)) previousScrollFocus = actor; stage.addActor(this); stage.setKeyboardFocus(this); stage.setScrollFocus(this); }
From source file:es.eucm.ead.editor.view.widgets.Dialog.java
License:Open Source License
/** * Hides the dialog//from w ww . ja va 2s . c o m */ public void hide() { Stage stage = getStage(); if (stage != null) { if (previousKeyboardFocus != null && previousKeyboardFocus.getStage() == null) previousKeyboardFocus = null; Actor actor = stage.getKeyboardFocus(); if (actor == null || actor.isDescendantOf(this)) stage.setKeyboardFocus(previousKeyboardFocus); if (previousScrollFocus != null && previousScrollFocus.getStage() == null) previousScrollFocus = null; actor = stage.getScrollFocus(); if (actor == null || actor.isDescendantOf(this)) stage.setScrollFocus(previousScrollFocus); } remove(); }