Example usage for com.badlogic.gdx.scenes.scene2d.ui WidgetGroup WidgetGroup

List of usage examples for com.badlogic.gdx.scenes.scene2d.ui WidgetGroup WidgetGroup

Introduction

In this page you can find the example usage for com.badlogic.gdx.scenes.scene2d.ui WidgetGroup WidgetGroup.

Prototype

WidgetGroup

Source Link

Usage

From source file:com.crashinvaders.common.scene2d.visui.ToastManager.java

License:Apache License

public ToastManager(Stage stage) {
    WidgetGroup widgetGroup = new WidgetGroup();
    widgetGroup.setFillParent(true);
    stage.addActor(widgetGroup);
    this.root = widgetGroup;
}

From source file:com.mangecailloux.pebble.menu.Menu.java

License:Apache License

public Menu() {
    root = new WidgetGroup();
    root.setTouchable(Touchable.childrenOnly);
    inputListener = new InputListener();

    setCatchBackKey(true);/* w  w w . ja va  2s  .com*/

    pages = new ObjectMap<Class<? extends Page>, Page>(4);

    layers = new Array<MenuLayer>(true, 2);

    defaultPageBackground = null;

    root.setFillParent(true);
}

From source file:com.mangecailloux.pebble.menu.Page.java

License:Apache License

public Page(boolean _fillStage) {
    super();/*from www . j a v a 2  s.c  om*/

    hasBeenActivatedOnce = false;
    canUseDefaultBackground = true;

    backDescriptor = null;
    nextDescriptor = null;

    animations = new ObjectMap<String, PageAnimation>(4);

    pooledAnimations = new Array<KeyPageAnimationPair>(true, 2);
    currentAnimation = null;

    group = new WidgetGroup();
    background = new Table();
    table = new Table();

    table.setFillParent(_fillStage);
    background.setFillParent(_fillStage);

    group.setFillParent(true);
    group.addActor(background);
    group.addActor(table);

    group.setTouchable(Touchable.childrenOnly);
}

From source file:com.teotigraphix.gdx.app.Scene.java

License:Apache License

@Override
public void create() {
    Gdx.app.log(LOG, ">Creating scene: " + getName());
    root = new WidgetGroup();
    root.setBounds(0f, 0f, application.getWidth(), application.getHeight());
    stage.addActor(root);/*w w  w . ja va  2s. c  om*/

    createUI();
    // all behaviors create their user interface components
    for (ISceneBehavior behavior : behaviors) {
        behavior.onStart();
    }
    Gdx.app.log(LOG, "<Behaviors started");
}

From source file:de.longri.cachebox3.gui.activities.Settings_Activity.java

License:Open Source License

private void showListView(ListView listView, String name, boolean animate) {

    float y = btnOk.getY() + btnOk.getHeight() + CB.scaledSizes.MARGIN;

    WidgetGroup widgetGroup = new WidgetGroup();
    widgetGroup.setBounds(CB.scaledSizes.MARGIN, y, Gdx.graphics.getWidth() - CB.scaledSizes.MARGINx2,
            Gdx.graphics.getHeight() - (y + CB.scaledSizes.MARGIN));

    // title/* w  ww.  j  ava  2 s .c  o m*/
    WidgetGroup titleGroup = new WidgetGroup();

    float topY = widgetGroup.getHeight() - CB.scaledSizes.MARGIN_HALF;
    float xPos = 0;

    ClickListener backClickListener = new ClickListener() {
        public void clicked(InputEvent event, float x, float y) {
            backClick();
        }
    };

    // add the titleLabel on top
    if (style.backIcon != null && listViewsNames.size > 0) {
        Image backImage = new Image(style.backIcon);
        backImage.setPosition(xPos, 0);
        xPos += backImage.getWidth() + CB.scaledSizes.MARGIN;
        titleGroup.addActor(backImage);
    }

    VisLabel titleLabel = new VisLabel(name, "menu_title_act");

    if (listViewsNames.size > 0) {
        VisLabel parentTitleLabel = new VisLabel(listViewsNames.get(listViewsNames.size - 1),
                "menu_title_parent");
        parentTitleLabel.setPosition(xPos, 0);
        xPos += parentTitleLabel.getWidth() + CB.scaledSizes.MARGINx2;
        titleGroup.addActor(parentTitleLabel);
    } else {
        //center titleLabel
        xPos = (Gdx.graphics.getWidth() - titleLabel.getWidth()) / 2;
    }

    titleLabel.setPosition(xPos, 0);
    titleGroup.addActor(titleLabel);

    float titleHeight = titleLabel.getHeight() + CB.scaledSizes.MARGIN;
    titleGroup.setBounds(0, Gdx.graphics.getHeight() - (y + titleHeight), Gdx.graphics.getWidth(), titleHeight);
    titleGroup.addListener(backClickListener);
    widgetGroup.addActor(titleGroup);

    listView.setBounds(0, 0, widgetGroup.getWidth(), titleGroup.getY() - CB.scaledSizes.MARGIN);
    listView.layout();
    listView.setBackground(null); // remove default background
    widgetGroup.addActor(listView);

    if (listViews.size > 0) {
        // animate
        float nextXPos = Gdx.graphics.getWidth() + CB.scaledSizes.MARGIN;
        if (animate) {
            listViews.get(listViews.size - 1)
                    .addAction(Actions.moveTo(0 - nextXPos, y, Menu.MORE_MENU_ANIMATION_TIME));
            widgetGroup.setPosition(nextXPos, y);
            widgetGroup.addAction(Actions.moveTo(CB.scaledSizes.MARGIN, y, Menu.MORE_MENU_ANIMATION_TIME));
        } else {
            widgetGroup.setPosition(CB.scaledSizes.MARGIN, y);
        }
    }
    listViews.add(widgetGroup);
    listViewsNames.add(name);
    this.addActor(widgetGroup);
}

From source file:de.longri.cachebox3.gui.menu.Menu.java

License:Open Source License

private void showWidgetGroup() {
    clearActions();//ww w  .j av  a  2 s  .  c o m
    pack();

    mainMenuWidgetGroup = new WidgetGroup();
    mainMenuWidgetGroup.setName(this.name);
    mainMenuWidgetGroup.setBounds(this.getX(), this.getY(), this.getWidth(), this.getHeight());
    mainMenuWidgetGroup.addActor(this);

    if (this.parentMenu == null) {
        StageManager.showOnNewStage(mainMenuWidgetGroup);
    } else {
        StageManager.showOnActStage(mainMenuWidgetGroup);
    }

    if (this.parentMenu == null)
        addAction(sequence(Actions.alpha(0), Actions.fadeIn(CB.WINDOW_FADE_TIME, Interpolation.fade)));
}

From source file:de.longri.cachebox3.gui.menu.Menu.java

License:Open Source License

private void initialLayout() {

    //remove all child's
    this.clear();

    float topY = Gdx.graphics.getHeight() - CB.scaledSizes.MARGIN_HALF;
    float xPos = CB.scaledSizes.MARGIN_HALF;

    // add the titleLabel on top
    titleGroup = new WidgetGroup();
    ClickListener backClickListener = new ClickListener() {
        public void clicked(InputEvent event, float x, float y) {
            hide(false);//w w  w  .j av a2s . c o m
        }
    };

    if (style.menu_back != null) {
        Image backImage = new Image(style.menu_back);
        backImage.setPosition(xPos, 0);
        xPos += backImage.getWidth() + CB.scaledSizes.MARGIN;
        titleGroup.addActor(backImage);
    }

    titleLabel = new VisLabel(this.name, "menu_title_act");

    if (parentMenu != null) {
        parentTitleLabel = new VisLabel(parentMenu.name, "menu_title_parent");
        parentTitleLabel.setPosition(xPos, 0);
        xPos += parentTitleLabel.getWidth() + CB.scaledSizes.MARGINx2;
        titleGroup.addActor(parentTitleLabel);
    } else {
        //center titleLabel
        xPos = (Gdx.graphics.getWidth() - titleLabel.getWidth()) / 2;
    }

    titleLabel.setPosition(xPos, 0);
    titleGroup.addActor(titleLabel);

    float titleHeight = titleLabel.getHeight() + CB.scaledSizes.MARGIN;
    titleGroup.setBounds(0, Gdx.graphics.getHeight() - (titleHeight), Gdx.graphics.getWidth(), titleHeight);
    titleGroup.addListener(backClickListener);

    this.addActor(titleGroup);

    final OnItemClickListener clickListener = new OnItemClickListener() {
        @Override
        public boolean onItemClick(final MenuItem item) {

            // have the clicked item a moreMenu, just show it
            if (item.hasMoreMenu()) {
                item.getMoreMenu(Menu.this).show();
                return true;
            }
            //close Menu with sub menu's
            hide(ALL);
            return onItemClickListener.onItemClick(item);
        }
    };

    Adapter listViewAdapter = new Adapter() {
        @Override
        public int getCount() {
            return mItems.size();
        }

        @Override
        public ListViewItem getView(int index) {
            MenuItem item = (MenuItem) mItems.get(index);
            item.setOnItemClickListener(clickListener);
            return item;
        }

        @Override
        public void update(ListViewItem view) {

        }

        @Override
        public float getItemSize(int index) {
            return mItems.get(index).getHeight();
        }
    };
    listView = new ListView(listViewAdapter);
    listView.setBackground(this.style.background);
    this.addActor(listView);
}

From source file:es.eucm.ead.editor.MokapApplicationListener.java

License:Open Source License

protected Controller buildController() {
    WidgetGroup modalContainer = new WidgetGroup();
    modalContainer.setFillParent(true);//from  ww w  .  j  a  v  a 2  s  . c  om

    WidgetGroup viewContainer = new WidgetGroup();
    viewContainer.setFillParent(true);

    stage.addActor(viewContainer);
    stage.addActor(modalContainer);

    return new MokapController(this.platform, Gdx.files, viewContainer, modalContainer);
}

From source file:es.eucm.ead.engine.LoadingIndicatorDemo.java

License:Open Source License

@Override
public void create() {
    Gdx.app.setLogLevel(Application.LOG_DEBUG);
    Gdx.gl.glClearColor(0f, 0f, 0f, 0f);
    stage = new Stage(new ScreenViewport());
    WidgetGroup modalContainer = new WidgetGroup();
    modalContainer.setFillParent(true);/*from   w  ww  .j a  v a  2  s  . co  m*/

    WidgetGroup viewContainer = new WidgetGroup();
    viewContainer.setFillParent(true);

    stage.getRoot().addActor(viewContainer);
    stage.getRoot().addActor(modalContainer);
    Gdx.input.setInputProcessor(stage);
    actor = new LoadingIndicator();
    if (actor instanceof WidgetGroup) {
        ((WidgetGroup) actor).setFillParent(true);
    }
    viewContainer.addActor(actor);
}

From source file:jp.gr.java_conf.kgd.example.blog.crossgenerics.WidgetExample.java

License:Open Source License

public static void main(String[] args) {
    Widget widget = new Widget();

    WidgetGroup widgetGroup = new WidgetGroup();

    // ?????/*from  www . j  av a  2s.c o  m*/
    doSomething1(widget);
    doSomething1(widgetGroup);

    // ??????????????????
    doSomething2(widget, widget);
    doSomething2(widgetGroup, widgetGroup);
    // ??????????
}