Java 类com.badlogic.gdx.scenes.scene2d.ui.List.ListStyle 实例源码

项目:skin-composer    文件:MainListener.java   
@Override
public void stylePropertyChanged(StyleProperty styleProperty,
        Actor styleActor) {
    if (styleProperty.type == Drawable.class) {
        dialogFactory.showDialogDrawables(styleProperty);
    } else if (styleProperty.type == Color.class) {
        dialogFactory.showDialogColors(styleProperty);
    } else if (styleProperty.type == BitmapFont.class) {
        dialogFactory.showDialogFonts(styleProperty);
    } else if (styleProperty.type == Float.TYPE) {
        main.getUndoableManager().addUndoable(new UndoableManager.DoubleUndoable(main, styleProperty, ((Spinner) styleActor).getValue()), false);
    } else if (styleProperty.type == ScrollPaneStyle.class) {
        main.getUndoableManager().addUndoable(new UndoableManager.SelectBoxUndoable(root, styleProperty, (SelectBox) styleActor), true);
    } else if (styleProperty.type == LabelStyle.class) {
        main.getUndoableManager().addUndoable(new UndoableManager.SelectBoxUndoable(root, styleProperty, (SelectBox) styleActor), true);
    } else if (styleProperty.type == ListStyle.class) {
        main.getUndoableManager().addUndoable(new UndoableManager.SelectBoxUndoable(root, styleProperty, (SelectBox) styleActor), true);
    }
}
项目:libgdxcn    文件:SelectBox.java   
@Override
public void layout () {
    Drawable bg = style.background;
    BitmapFont font = style.font;

    if (bg != null) {
        prefHeight = Math.max(bg.getTopHeight() + bg.getBottomHeight() + font.getCapHeight() - font.getDescent() * 2,
            bg.getMinHeight());
    } else
        prefHeight = font.getCapHeight() - font.getDescent() * 2;

    float maxItemWidth = 0;
    for (int i = 0; i < items.size; i++)
        maxItemWidth = Math.max(font.getBounds(items.get(i).toString()).width, maxItemWidth);

    prefWidth = maxItemWidth;
    if (bg != null) prefWidth += bg.getLeftWidth() + bg.getRightWidth();

    ListStyle listStyle = style.listStyle;
    ScrollPaneStyle scrollStyle = style.scrollStyle;
    prefWidth = Math.max(
        prefWidth,
        maxItemWidth
            + (scrollStyle.background == null ? 0 : scrollStyle.background.getLeftWidth()
                + scrollStyle.background.getRightWidth())
            + listStyle.selection.getLeftWidth()
            + listStyle.selection.getRightWidth()
            + Math.max(style.scrollStyle.vScroll != null ? style.scrollStyle.vScroll.getMinWidth() : 0,
                style.scrollStyle.vScrollKnob != null ? style.scrollStyle.vScrollKnob.getMinWidth() : 0));
}
项目:libgdxcn    文件:SelectBox.java   
public SelectBoxStyle (BitmapFont font, Color fontColor, Drawable background, ScrollPaneStyle scrollStyle,
    ListStyle listStyle) {
    this.font = font;
    this.fontColor.set(fontColor);
    this.background = background;
    this.scrollStyle = scrollStyle;
    this.listStyle = listStyle;
}
项目:libgdxcn    文件:SelectBox.java   
public SelectBoxStyle (SelectBoxStyle style) {
    this.font = style.font;
    this.fontColor.set(style.fontColor);
    if (style.disabledFontColor != null) this.disabledFontColor = new Color(style.disabledFontColor);
    this.background = style.background;
    this.backgroundOver = style.backgroundOver;
    this.backgroundOpen = style.backgroundOpen;
    this.backgroundDisabled = style.backgroundDisabled;
    this.scrollStyle = new ScrollPaneStyle(style.scrollStyle);
    this.listStyle = new ListStyle(style.listStyle);
}
项目:zesp2013    文件:ScrollList.java   
public ScrollList (ListStyle liststyle,ScrollPaneStyle scrollpanestyle ) {
    super();
    list = new List (new String[]{""},liststyle);
    scrollpane = new ScrollPane (list,scrollpanestyle);
    scrollpane.setFadeScrollBars(false);
    addActor(scrollpane);
}
项目:tafl    文件:TaflGraphicsService.java   
@Override
public void onFinishLoading() {
    Skin skin = getSkin(Assets.Skin.UI_SKIN);
    BitmapFont menuFont = getFont(game.deviceSettings.menuFont);
    BitmapFont screenTitle = getFont(game.deviceSettings.screenTitleFont);
    BitmapFont hudFont = getFont(game.deviceSettings.hudFont);
    BitmapFont rulesFont = getFont(game.deviceSettings.rulesFont);

    skin.get(Assets.Skin.SKIN_STYLE_MENU, TextButtonStyle.class).font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_GAME, TextButtonStyle.class).font = hudFont;
    skin.get(Assets.Skin.SKIN_STYLE_DIALOG, TextButtonStyle.class).font = hudFont;

    skin.get(Assets.Skin.SKIN_STYLE_MENU, ImageTextButtonStyle.class).font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_GAME, ImageTextButtonStyle.class).font = hudFont;

    skin.get(Assets.Skin.SKIN_STYLE_MENU, SelectBoxStyle.class).font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_MENU, SelectBoxStyle.class).listStyle.font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_GAME, SelectBoxStyle.class).font = hudFont;
    skin.get(Assets.Skin.SKIN_STYLE_GAME, SelectBoxStyle.class).listStyle.font = hudFont;

    skin.get(Assets.Skin.SKIN_STYLE_DIALOG, WindowStyle.class).titleFont = hudFont;

    skin.get(Assets.Skin.SKIN_STYLE_MENU, LabelStyle.class).font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_SCREEN_TITLE, LabelStyle.class).font = screenTitle;

    skin.get(Assets.Skin.SKIN_STYLE_GAME, LabelStyle.class).font = hudFont;
    skin.get(Assets.Skin.SKIN_STYLE_DIALOG, LabelStyle.class).font = hudFont;
    skin.get(Assets.Skin.SKIN_STYLE_PLAYER_TAG, LabelStyle.class).font = hudFont;
    skin.get(Assets.Skin.SKIN_STYLE_RULES, LabelStyle.class).font = rulesFont;

    skin.get(Assets.Skin.SKIN_STYLE_MENU, TextFieldStyle.class).font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_GAME, TextFieldStyle.class).font = hudFont;

    skin.get(Assets.Skin.SKIN_STYLE_MENU, CheckBoxStyle.class).font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_GAME, CheckBoxStyle.class).font = hudFont;

    skin.get(Assets.Skin.SKIN_STYLE_MENU, ListStyle.class).font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_GAME, ListStyle.class).font = hudFont;
}
项目:JavityEngine    文件:JList.java   
private void createList() {
    Skin skin = getGameObject().getComponentInParent(JCanvas.class).getSkin();
    ListStyle style = new ListStyle(skin.get("default", ListStyle.class));

    int realSize = (int) (((getTransform().getScale().x + getTransform().getScale().y) / 2) * fontSize);
    Gdx.app.log("JLabel", "font size: " + realSize);

    SmartFontGenerator fontGen = new SmartFontGenerator();
    FileHandle exoFile = Gdx.files.internal(fontResource.getResourcePath());
    BitmapFont fontBitmap = fontGen.createFont(exoFile, fontResource.getResourcePath() + realSize, realSize);

    if (fontBitmap != null) {
        style.font = fontBitmap;
    }
    if (fontColorSelected != null) {
        style.fontColorSelected = fontColorSelected;
    }
    if (fontColorSelected != null) {
        style.fontColorUnselected = fontColorUnselected;
    }

    if (selection != null) {
        style.selection = DrawableHelper.getDrawableFromAsset(selection.getResourcePath());
    }
    if (background != null) {
        style.background = DrawableHelper.getDrawableFromAsset(background.getResourcePath());
    }

    list = new List<T>(style);
    list.setItems(tempItems);
    list.getSelection().setMultiple(false);
    list.getSelection().setRequired(true);
    if (list.getItems().size > 0) {
        list.setSelectedIndex(1);
    }

    list.addListener(new EventListener() {

        @Override
        public boolean handle(Event event) {
            Gdx.app.log("JList", "event: " + event);
            ;

            return false;
        }
    });

    scrollPane = new ScrollPane(list, skin);
    scrollPane.setFlickScroll(false);
}
项目:skin-composer    文件:StyleData.java   
public void resetProperties() {
    properties.clear();

    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;
    }
}
项目:zesp2013    文件:ScrollList.java   
public ScrollList (Skin skin) {
    this(skin.get(ListStyle.class), skin.get(ScrollPaneStyle.class));
}
项目:Missing_Words    文件:CategoryStatsScreen.java   
public CategoryStatsScreen(MissingWords missingWords) {
    super(missingWords);

    font = new BitmapFont(Gdx.files.internal("fonts/title.fnt"), Gdx.files.internal("fonts/title.png"), false); 
    fontList = new BitmapFont(Gdx.files.internal("fonts/listFont.fnt"), Gdx.files.internal("fonts/listFont.png"), false);

    /* Creamos el fondo de pantalla */
    background = new Background(MissingWords.myManager.get("background.png", Texture.class));
    stage.addActor(background);

    /* Creamos el bot�n de vuelta atr�s */
    backButton = new BackButton();
    backButton.addListener(new BackButtonListener(missingWords));

    /* Creamos la tabla que ocupar� todo el stage (pantalla) */
    stageTable = new Table();
    stageTable.setFillParent(true);

    /* Creamos la etiqueta de la categor�a */
    title = new Label(null, new LabelStyle(font, font.getColor()));

    /* Creamos el progreso de la categor�a */
    progress = new Label(null, new LabelStyle(font, font.getColor()));

    /* Creamos la lista de palabras de la categor�a */
    list = new List<String>(new ListStyle(
            fontList, 
            fontList.getColor(), 
            fontList.getColor(), 
            new TextureRegionDrawable(
                new TextureRegion(MissingWords.myManager.get("selection.png", Texture.class)))));

    /* Creamos el scroll para la lista de palabras */
    ScrollPane scroll = new ScrollPane(list, new ScrollPaneStyle(new TextureRegionDrawable(
            new TextureRegion(MissingWords.myManager.get("background.png", Texture.class))), 
                null, 
                null, 
                new TextureRegionDrawable(
                    new TextureRegion(MissingWords.myManager.get("verticalScroll.png", Texture.class))), 
                new TextureRegionDrawable(
                    new TextureRegion(MissingWords.myManager.get("squareBlue.png", Texture.class)))));

    /* Creamos la tabla izquierda del SplitPane */
    left = new Table();
    left.add(title).expand();
    left.row();
    left.add(progress).expand();
    left.row();
    left.add(backButton).align(Align.left).pad(10);

    /* Creamos la tabla derecha del SplitPane */
    right = new Table();
    right.add(scroll).fill().expand();

    /* Creamos el SplitPane */
    SplitPane split = new SplitPane(left, right, false, new SplitPaneStyle(
            new TextureRegionDrawable(
                    new TextureRegion(MissingWords.myManager.get("split.png", Texture.class)))));

    stageTable.add(split).fill().expand(); // A�adimos el SplitPane a la stageTable

    stage.addActor(stageTable); // A�adimos la stageTable al stage
}