package com.imyeyu.fx.ui.examples.view.pages.component;

import com.imyeyu.fx.icon.TimiFXIcon;
import com.imyeyu.fx.icon.TimiIcon;
import com.imyeyu.fx.ui.TimiFXUI;
import com.imyeyu.fx.ui.components.IconButton;
import com.imyeyu.fx.ui.examples.component.AbstractDemoPane;
import com.imyeyu.fx.ui.examples.component.sidebar.SidebarItem;
import com.imyeyu.inject.annotation.Component;
import javafx.geometry.Insets;
import javafx.scene.control.Button;
import javafx.scene.layout.Border;
import javafx.scene.layout.GridPane;

/**
 * 图标按钮
 *
 * @author 夜雨
 * @since 2022-08-29 21:48
 */
@Component
public class IconButtonDemo extends AbstractDemoPane {

	public IconButtonDemo() {
		title.setText(SidebarItem.ICON_BUTTON.getText());
		document.sync("https://doc.imyeyu.net/timi-fx/net/imyeyu/timifx/component/IconButton.html");
		source.sync("https://git.imyeyu.net/Timi/timi-fx/src/master/src/main/java/net/imyeyu/timifx/component/IconButton.java");

		// 一般
		IconButton commonly = new IconButton(TimiFXUI.MULTILINGUAL.text("fx.example.icon_button"), TimiFXIcon.get(TimiIcon.HAMMER));

		// 按钮背景
		IconButton commonlyWithBG = new IconButton(TimiFXUI.MULTILINGUAL.text("fx.example.icon_button"), TimiFXIcon.get(TimiIcon.HAMMER)).withBackground();

		// 无文本
		IconButton notText = new IconButton(TimiFXIcon.get(TimiIcon.HAMMER));

		// 无文本按钮背景
		IconButton notTextWithBG = new IconButton(TimiFXIcon.get(TimiIcon.HAMMER)).withBackground();

		setCenter(new GridPane() {{
			setVgap(4);
			setHgap(6);
			setPadding(new Insets(20));

			int row = 0;
			addRow(row++, TimiFXUI.label(TimiFXUI.MULTILINGUAL.text("commonly")), commonly);
			addRow(row++, TimiFXUI.label(TimiFXUI.MULTILINGUAL.text("fx.example.icon_button.with_bg")), commonlyWithBG);
			addRow(row++, TimiFXUI.label(TimiFXUI.MULTILINGUAL.text("fx.example.icon_button.not_text")), notText);
			addRow(row, TimiFXUI.label(TimiFXUI.MULTILINGUAL.text("fx.example.icon_button.not_text_with_bg")), notTextWithBG);
		}});
	}
}
