package cn.forevermc.launcher.view.pages;

import cn.forevermc.launcher.bean.ComponentSize;
import cn.forevermc.launcher.view.components.AbstractListPane;
import cn.forevermc.launcher.view.components.control.MCButton;
import cn.forevermc.launcher.view.components.control.MCLabel;
import javafx.geometry.HPos;
import javafx.scene.layout.GridPane;
import com.imyeyu.fx.ui.TimiFXUI;
import com.imyeyu.fx.ui.components.EnumListCell;
import com.imyeyu.java.bean.Language;

/**
 * 语言选择面板
 *
 *
 * @author 夜雨
 * @since 2022-12-02 00:09
 */
public abstract class LangSelectPane extends AbstractListPane<Language> {

	protected final MCButton confirm, cancel;

	public LangSelectPane() {
		setLoading(false);

		// 列表
		list.setCellFactory(cell -> new EnumListCell<>());

		// 提示
		MCLabel tips = new MCLabel(TimiFXUI.MULTILINGUAL.text("fmc.launcher.lang_Select.tips"));
		tips.setTextFill(Colorful.LIGHT_GRAY);

		// 确认
		confirm = new MCButton(TimiFXUI.MULTILINGUAL.text("confirm"));
		confirm.setPrefWidth(ComponentSize.MEDIUM);

		// 取消
		cancel = new MCButton(TimiFXUI.MULTILINGUAL.text("cancel"));
		cancel.setPrefWidth(ComponentSize.MEDIUM);

		GridPane.setHalignment(tips, HPos.CENTER);
		setTitle(TimiFXUI.MULTILINGUAL.text("fmc.launcher.lang_select"));
		addBottomPaneValue(tips, 0, 0, 2, 1);
		addBottomPaneValue(1, confirm, cancel);
	}
}
