package p.studio.workspaces.editor;

import javafx.geometry.Insets;
import javafx.scene.control.Button;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;

public final class EditorToolbar extends HBox {

    public EditorToolbar() {
        setPadding(new Insets(6, 10, 6, 10));
        setSpacing(8);
        getStyleClass().add("main-toolbar");

        Button newBtn = iconButton("📄", "New");
        Button openBtn = iconButton("📂", "Open");
        Button saveBtn = iconButton("💾", "Save");

        Button runBtn = iconButton("▶", "Run");
        runBtn.getStyleClass().remove("studio-button-secondary");
        runBtn.getStyleClass().add("studio-button-primary");

        Region spacer = new Region();
        HBox.setHgrow(spacer, javafx.scene.layout.Priority.ALWAYS);

        getChildren().addAll(
                newBtn,
                openBtn,
                saveBtn,
                spacer,
                runBtn
        );
    }

    private Button iconButton(String icon, String tooltip) {
        Button b = new Button(icon);
        b.setFocusTraversable(false);
        b.getStyleClass().addAll("studio-button", "studio-button-secondary", "studio-button-icon");
        return b;
    }
}
