com.badlogic.gdx.scenes.scene2d.ui.Widget Java Examples

The following examples show how to use com.badlogic.gdx.scenes.scene2d.ui.Widget. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PrefHeightIfVisibleValue.java    From vis-ui with Apache License 2.0 5 votes vote down vote up
@Override
public float get (Actor actor) {
	if (actor instanceof Widget) {
		Widget widget = (Widget) actor;
		return widget.isVisible() ? widget.getPrefHeight() : 0;
	}

	if (actor instanceof Table) {
		Table table = (Table) actor;
		return table.isVisible() ? table.getPrefHeight() : 0;
	}

	throw new IllegalStateException("Unsupported actor type for PrefHeightIfVisibleValue: " + actor.getClass());
}
 
Example #2
Source File: PrefWidthIfVisibleValue.java    From vis-ui with Apache License 2.0 5 votes vote down vote up
@Override
public float get (Actor actor) {
	if (actor instanceof Widget) {
		Widget widget = (Widget) actor;
		return widget.isVisible() ? widget.getPrefWidth() : 0;
	}

	if (actor instanceof Table) {
		Table table = (Table) actor;
		return table.isVisible() ? table.getPrefWidth() : 0;
	}

	throw new IllegalStateException("Unsupported actor type for PrefWidthIfVisibleValue: " + actor.getClass());
}
 
Example #3
Source File: EditDialog.java    From bladecoder-adventure-engine with Apache License 2.0 5 votes vote down vote up
public EditDialog(String title, Skin skin) {
		super(title, skin);

		this.skin = skin;

		setResizable(false);
		setKeepWithinStage(false);

		infoLbl = new Label("", skin);
		infoLbl.setWrap(true);
		centerPanel = new Table(skin);
		infoCell = getContentTable().add((Widget) infoLbl).prefWidth(200).height(Gdx.graphics.getHeight() * 0.5f);
		getContentTable().add(new ScrollPane(centerPanel, skin)).maxHeight(Gdx.graphics.getHeight() * 0.8f)
				.maxWidth(Gdx.graphics.getWidth() * 0.7f).minHeight(Gdx.graphics.getHeight() * 0.5f)
				.minWidth(Gdx.graphics.getWidth() * 0.5f);

		getContentTable().setHeight(Gdx.graphics.getHeight() * 0.7f);

		centerPanel.addListener(new InputListener() {
			@Override
			public void enter(InputEvent event, float x, float y, int pointer,
					com.badlogic.gdx.scenes.scene2d.Actor fromActor) {
//				EditorLogger.debug("ENTER - X: " + x + " Y: " + y);
				getStage().setScrollFocus(centerPanel);
			}
		});

		button("OK", true);
		button("Cancel", false);
		// DISABLE the enter key because conflicts when newline in TextFields
//		key(Keys.ENTER, true);
		key(Keys.ESCAPE, false);

		padBottom(10);
		padLeft(10);
		padRight(10);
	}
 
Example #4
Source File: VisWidgetValue.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
@Override
public float get (Actor context) {
	return getter.get((Widget) context);
}
 
Example #5
Source File: VisWidgetValue.java    From vis-ui with Apache License 2.0 votes vote down vote up
float get (Widget context);