// Path: app/src/main/java/es/danirod/rectball/Constants.java
// public class Constants {
// 
//     /**
//      * The width of the Scene2D stage. The bigger this value is, the greater
//      * the space is going to be for child elements of this screen. However,
//      * the smallest everything is going to be seen, specially in small screen.s
//      */
//     public static final int VIEWPORT_WIDTH = 480;
// 
//     /**
//      * The height of the Scene2D stage. The bigger this value is, the greater
//      * the space is going to be for child elements of this screen. However,
//      * the smallest everything is going to be seen, specially in small screens.
//      */
//     public static final int VIEWPORT_HEIGHT = 768;
// 
//     /**
//      * The padding for the table in every stage.
//      */
//     public static final int STAGE_PADDING = 20;
// 
//     public static final int SECONDS = 30;
// }


import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import com.badlogic.gdx.scenes.scene2d.ui.*;
import com.badlogic.gdx.utils.Align;
import es.danirod.rectball.Constants;
/*
 * This file is part of Rectball
 * Copyright (C) 2015 Dani Rodríguez
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package es.danirod.rectball.scene2d.ui;


/**
 * Common dialog for Rectball. This common dialog is a tweak over Scene2D's
 * dialog to allow things such as full width dialogs or full width buttons.
 *
 * @since 0.3.0
 */
class CommonDialog extends Dialog {

    CommonDialog(Skin skin, String text) {
        super("", skin);

        // Put the table on center and don't let it move.
        setMovable(false);
        setResizable(false);
        pad(20);

        // Make the table use the full width.
        getCell(getContentTable()).fillX().expandX();
        getCell(getButtonTable()).fillX().expandX().padTop(20);

        // Make the child items use the max width.
        getContentTable().defaults().expandX().fillX();
        getButtonTable().defaults().expandX().fillX();

        // Add text to the center.
        Label textLabel = new Label(text, skin);
        textLabel.setWrap(true);
        textLabel.setAlignment(Align.center);
// Path: app/src/main/java/es/danirod/rectball/Constants.java
// public class Constants {
// 
//     /**
//      * The width of the Scene2D stage. The bigger this value is, the greater
//      * the space is going to be for child elements of this screen. However,
//      * the smallest everything is going to be seen, specially in small screen.s
//      */
//     public static final int VIEWPORT_WIDTH = 480;
// 
//     /**
//      * The height of the Scene2D stage. The bigger this value is, the greater
//      * the space is going to be for child elements of this screen. However,
//      * the smallest everything is going to be seen, specially in small screens.
//      */
//     public static final int VIEWPORT_HEIGHT = 768;
// 
//     /**
//      * The padding for the table in every stage.
//      */
//     public static final int STAGE_PADDING = 20;
// 
//     public static final int SECONDS = 30;
// }


// Path: app/src/main/java/es/danirod/rectball/scene2d/ui/CommonDialog.java
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import com.badlogic.gdx.scenes.scene2d.ui.*;
import com.badlogic.gdx.utils.Align;
import es.danirod.rectball.Constants;

/*
 * This file is part of Rectball
 * Copyright (C) 2015 Dani Rodríguez
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package es.danirod.rectball.scene2d.ui;


/**
 * Common dialog for Rectball. This common dialog is a tweak over Scene2D's
 * dialog to allow things such as full width dialogs or full width buttons.
 *
 * @since 0.3.0
 */
class CommonDialog extends Dialog {

    CommonDialog(Skin skin, String text) {
        super("", skin);

        // Put the table on center and don't let it move.
        setMovable(false);
        setResizable(false);
        pad(20);

        // Make the table use the full width.
        getCell(getContentTable()).fillX().expandX();
        getCell(getButtonTable()).fillX().expandX().padTop(20);

        // Make the child items use the max width.
        getContentTable().defaults().expandX().fillX();
        getButtonTable().defaults().expandX().fillX();

        // Add text to the center.
        Label textLabel = new Label(text, skin);
        textLabel.setWrap(true);
        textLabel.setAlignment(Align.center);
        getContentTable().add(textLabel).width(Constants.VIEWPORT_WIDTH - 80);