com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle Java Examples

The following examples show how to use com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle. 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: ProjectToolbar.java    From bladecoder-adventure-engine with Apache License 2.0 6 votes vote down vote up
private void addToolBarButton(Skin skin, ImageButton button, String icon, String text, String tooltip) {
	ImageButtonStyle style = new ImageButtonStyle(skin.get(ButtonStyle.class));
	TextureRegion image = Ctx.assetManager.getIcon(icon);
	style.imageUp = new TextureRegionDrawable(image);

	try {
		TextureRegion imageDisabled = Ctx.assetManager.getIcon(icon + "_disabled");

		if (imageDisabled != null)
			style.imageDisabled = new TextureRegionDrawable(imageDisabled);
	} catch (Exception e) {

	}

	button.setStyle(style);
	// button.row();
	// button.add(new Label(text, skin));

	add(button);
	button.setDisabled(true);
	TextTooltip t = new TextTooltip(tooltip, skin);
	button.addListener(t);
}
 
Example #2
Source File: EditToolbar.java    From bladecoder-adventure-engine with Apache License 2.0 6 votes vote down vote up
public void addToolBarButton(ImageButton button, String icon, String text, String tooltip) {
	
	TextureRegion image = Ctx.assetManager.getIcon(icon);
	TextureRegion imageDisabled = Ctx.assetManager.getIcon(icon + "_disabled");
	
	ImageButtonStyle style = new ImageButtonStyle(skin.get("plain", ButtonStyle.class));
	style.imageUp = new TextureRegionDrawable(image);
	
	if(imageDisabled != null)
		style.imageDisabled = new TextureRegionDrawable(imageDisabled);
	button.setStyle(style);
	button.pad(6,3,6,3);
       addActor(button);
       button.setDisabled(true);
       TextTooltip t = new TextTooltip(tooltip, skin);
	button.addListener(t);
}
 
Example #3
Source File: ButtonCheckedImageLmlAttribute.java    From gdx-vfx with Apache License 2.0 5 votes vote down vote up
@Override
public void process(final LmlParser parser, final LmlTag tag, final ImageButton actor,
                    final String rawAttributeData) {
    final ImageButtonStyle style = new ImageButtonStyle(actor.getStyle());
    style.imageChecked = parser.getData().getDefaultSkin().getDrawable(parser.parseString(rawAttributeData, actor));
    actor.setStyle(style);
}
 
Example #4
Source File: ActionUIButton.java    From Norii with Apache License 2.0 5 votes vote down vote up
public ActionUIButton(String imageFileName) {
	Utility.loadTextureAsset(imageFileName);
	tr = new TextureRegion(Utility.getTextureAsset(imageFileName));
	buttonImage = new TextureRegionDrawable(tr);
	btnStyle = new ImageButtonStyle();
	btnStyle.up = buttonImage;
	button = new ImageButton(btnStyle);
}
 
Example #5
Source File: WidgetsBar.java    From gdx-skineditor with Apache License 2.0 5 votes vote down vote up
/**
 * 
 */
public void initializeButtons() {
	
	group = new ButtonGroup();

	Tooltips.TooltipStyle styleTooltip = new Tooltips.TooltipStyle(game.skin.getFont("default-font"), game.skin.getDrawable("default-round"), game.skin.getColor("white"));		

	String[] widgets = SkinEditorGame.widgets;
	for (String widget : widgets) {

		ImageButtonStyle style = new ImageButtonStyle();
		style.checked = game.skin.getDrawable("default-round-down");
		style.down = game.skin.getDrawable("default-round-down");
		style.up = game.skin.getDrawable("default-round");
		style.imageUp = game.skin.getDrawable("widgets/" + widget);
		ImageButton button = new ImageButton(style);
		button.setUserObject(widget);

		Tooltips tooltip = new Tooltips(styleTooltip, getStage());
		tooltip.registerTooltip(button, (String) button.getUserObject()); 
		
		button.addListener(new ClickListener() {

			@Override
			public void clicked(InputEvent event, float x, float y) {
				game.screenMain.panePreview.refresh();
				game.screenMain.paneOptions.refresh();

			}

		});

		group.add(button);
		add(button).pad(5);
	}
	
	
}
 
Example #6
Source File: StyleData.java    From skin-composer with MIT License 4 votes vote down vote up
public void resetProperties() {
    properties.clear();
    parent = null;
    
    if (clazz.equals(Button.class)) {
        newStyleProperties(ButtonStyle.class);
    } else if (clazz.equals(CheckBox.class)) {
        newStyleProperties(CheckBoxStyle.class);
        properties.get("checkboxOn").optional = false;
        properties.get("checkboxOff").optional = false;
        properties.get("font").optional = false;
    } else if (clazz.equals(ImageButton.class)) {
        newStyleProperties(ImageButtonStyle.class);
    } else if (clazz.equals(ImageTextButton.class)) {
        newStyleProperties(ImageTextButtonStyle.class);
        properties.get("font").optional = false;
    } else if (clazz.equals(Label.class)) {
        newStyleProperties(LabelStyle.class);
        properties.get("font").optional = false;
    } else if (clazz.equals(List.class)) {
        newStyleProperties(ListStyle.class);
        properties.get("font").optional = false;
        properties.get("fontColorSelected").optional = false;
        properties.get("fontColorUnselected").optional = false;
        properties.get("selection").optional = false;
    } else if (clazz.equals(ProgressBar.class)) {
        newStyleProperties(ProgressBarStyle.class);
        
        //Though specified as optional in the doc, there are bugs without "background" being mandatory
        properties.get("background").optional = false;
    } else if (clazz.equals(ScrollPane.class)) {
        newStyleProperties(ScrollPaneStyle.class);
    } else if (clazz.equals(SelectBox.class)) {
        newStyleProperties(SelectBoxStyle.class);
        properties.get("font").optional = false;
        properties.get("fontColor").optional = false;
        properties.get("scrollStyle").optional = false;
        properties.get("scrollStyle").value = "default";
        properties.get("listStyle").optional = false;
        properties.get("listStyle").value = "default";
    } else if (clazz.equals(Slider.class)) {
        newStyleProperties(SliderStyle.class);
        
        //Though specified as optional in the doc, there are bugs without "background" being mandatory
        properties.get("background").optional = false;
    } else if (clazz.equals(SplitPane.class)) {
        newStyleProperties(SplitPaneStyle.class);
        properties.get("handle").optional = false;
    } else if (clazz.equals(TextButton.class)) {
        newStyleProperties(TextButtonStyle.class);
        properties.get("font").optional = false;
    } else if (clazz.equals(TextField.class)) {
        newStyleProperties(TextFieldStyle.class);
        properties.get("font").optional = false;
        properties.get("fontColor").optional = false;
    } else if (clazz.equals(TextTooltip.class)) {
        newStyleProperties(TextTooltipStyle.class);
        properties.get("label").optional = false;
        properties.get("label").value = "default";
    } else if (clazz.equals(Touchpad.class)) {
        newStyleProperties(TouchpadStyle.class);
    } else if (clazz.equals(Tree.class)) {
        newStyleProperties(TreeStyle.class);
        properties.get("plus").optional = false;
        properties.get("minus").optional = false;
    } else if (clazz.equals(Window.class)) {
        newStyleProperties(WindowStyle.class);
        properties.get("titleFont").optional = false;
    }
}
 
Example #7
Source File: BrowseField.java    From skin-composer with MIT License 4 votes vote down vote up
public BrowseFieldStyle(ImageButtonStyle imageButtonStyle, TextButtonStyle textButtonStyle, LabelStyle labelStyle) {
    this.mainButtonStyle = textButtonStyle;
    this.rightButtonStyle = imageButtonStyle;
    this.labelStyle = labelStyle;
}