package p.studio.controls.shell;

import javafx.scene.control.Menu;
import javafx.scene.control.MenuItem;
import p.studio.Container;
import p.studio.controls.lifecycle.StudioControlLifecycle;
import p.studio.controls.lifecycle.StudioControlLifecycleSupport;
import p.studio.utilities.i18n.I18n;

public final class StudioShellMenuBarControl extends javafx.scene.control.MenuBar implements StudioControlLifecycle {
    public StudioShellMenuBarControl() {
        StudioControlLifecycleSupport.install(this, this);
        getStyleClass().add("studio-shell-menu-bar");

        final Menu fileMenu = new Menu();
        fileMenu.textProperty().bind(Container.i18n().bind(I18n.MENU_FILE));

        final MenuItem newProjectItem = new MenuItem();
        newProjectItem.textProperty().bind(Container.i18n().bind(I18n.MENU_FILE_NEWPROJECT));
        newProjectItem.setOnAction(ignored -> { });

        final MenuItem openItem = new MenuItem();
        openItem.textProperty().bind(Container.i18n().bind(I18n.MENU_FILE_OPEN));
        openItem.setOnAction(ignored -> { });

        final MenuItem saveItem = new MenuItem();
        saveItem.textProperty().bind(Container.i18n().bind(I18n.MENU_FILE_SAVE));
        saveItem.setOnAction(ignored -> { });

        fileMenu.getItems().addAll(newProjectItem, openItem, saveItem);

        final Menu editMenu = new Menu();
        editMenu.textProperty().bind(Container.i18n().bind(I18n.MENU_EDIT));

        final Menu viewMenu = new Menu();
        viewMenu.textProperty().bind(Container.i18n().bind(I18n.MENU_VIEW));

        final Menu helpMenu = new Menu();
        helpMenu.textProperty().bind(Container.i18n().bind(I18n.MENU_HELP));

        getMenus().setAll(fileMenu, editMenu, viewMenu, helpMenu);
    }
}
