mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-15 06:45:42 -04:00
alt: title style
This commit is contained in:
parent
0b0118446f
commit
f3424e0796
@ -40,6 +40,7 @@ import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.shape.Rectangle;
|
||||
import javafx.util.Duration;
|
||||
import org.jackhuang.hmcl.Metadata;
|
||||
import org.jackhuang.hmcl.setting.Profile;
|
||||
import org.jackhuang.hmcl.setting.Profiles;
|
||||
import org.jackhuang.hmcl.setting.Theme;
|
||||
@ -55,7 +56,7 @@ import static org.jackhuang.hmcl.ui.FXUtils.SINE;
|
||||
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
|
||||
|
||||
public final class MainPage extends StackPane implements DecoratorPage {
|
||||
private final ReadOnlyStringWrapper title = new ReadOnlyStringWrapper(this, "title", i18n("main_page"));
|
||||
private final ReadOnlyStringWrapper title = new ReadOnlyStringWrapper(this, "title", "Hello Minecraft! Launcher " + Metadata.VERSION);
|
||||
|
||||
private final PopupMenu menu = new PopupMenu();
|
||||
private final JFXPopup popup = new JFXPopup(menu);
|
||||
|
@ -82,7 +82,6 @@ public class DecoratorController {
|
||||
this.mainPage = mainPage;
|
||||
|
||||
decorator = new Decorator(stage);
|
||||
decorator.titleProperty().set(Metadata.TITLE);
|
||||
decorator.setOnCloseButtonAction(Launcher::stopApplication);
|
||||
|
||||
navigator = new Navigator();
|
||||
|
@ -154,28 +154,9 @@ public class DecoratorSkin extends SkinBase<Decorator> {
|
||||
|
||||
Rectangle rectangle = new Rectangle(0, 0, 0, 0);
|
||||
rectangle.widthProperty().bind(titleContainer.widthProperty());
|
||||
rectangle.heightProperty().bind(Bindings.createDoubleBinding(() -> titleContainer.getHeight() + 100, titleContainer.heightProperty()));
|
||||
rectangle.heightProperty().bind(titleContainer.heightProperty().add(100));
|
||||
titleContainer.setClip(rectangle);
|
||||
{
|
||||
BorderPane titleWrapper = new BorderPane();
|
||||
FXUtils.setLimitWidth(titleWrapper, 200);
|
||||
{
|
||||
Label lblTitle = new Label();
|
||||
BorderPane.setMargin(lblTitle, new Insets(0, 0, 0, 3));
|
||||
lblTitle.setStyle("-fx-background-color: transparent; -fx-text-fill: -fx-base-text-fill; -fx-font-size: 15px;");
|
||||
lblTitle.setMouseTransparent(true);
|
||||
lblTitle.textProperty().bind(skinnable.titleProperty());
|
||||
BorderPane.setAlignment(lblTitle, Pos.CENTER);
|
||||
titleWrapper.setCenter(lblTitle);
|
||||
|
||||
Rectangle separator = new Rectangle();
|
||||
separator.getStyleClass().add("separator");
|
||||
separator.heightProperty().bind(titleWrapper.heightProperty());
|
||||
separator.setWidth(1);
|
||||
titleWrapper.setRight(separator);
|
||||
}
|
||||
titleContainer.setLeft(titleWrapper);
|
||||
|
||||
BorderPane navBar = new BorderPane();
|
||||
{
|
||||
navLeft = new HBox();
|
||||
@ -195,11 +176,13 @@ public class DecoratorSkin extends SkinBase<Decorator> {
|
||||
closeNavButton.ripplerFillProperty().bind(Theme.whiteFillBinding());
|
||||
closeNavButton.onActionProperty().bind(skinnable.onCloseNavButtonActionProperty());
|
||||
|
||||
navLeft.getChildren().setAll(backNavButton);
|
||||
|
||||
skinnable.canCloseProperty().addListener((a, b, newValue) -> {
|
||||
if (newValue) navLeft.getChildren().setAll(backNavButton, closeNavButton);
|
||||
else navLeft.getChildren().setAll(backNavButton);
|
||||
FXUtils.onChangeAndOperate(skinnable.canBackProperty(), (newValue) -> {
|
||||
navLeft.getChildren().remove(backNavButton);
|
||||
if (newValue) navLeft.getChildren().add(0, backNavButton);
|
||||
});
|
||||
FXUtils.onChangeAndOperate(skinnable.canCloseProperty(), (newValue) -> {
|
||||
navLeft.getChildren().remove(closeNavButton);
|
||||
if (newValue) navLeft.getChildren().add(closeNavButton);
|
||||
});
|
||||
|
||||
FXUtils.onChangeAndOperate(skinnable.showCloseAsHomeProperty(), (newValue) -> {
|
||||
|
@ -1004,7 +1004,7 @@
|
||||
|
||||
.jfx-decorator-title {
|
||||
-fx-text-fill: -fx-base-text-fill;
|
||||
-fx-font-size: 15;
|
||||
-fx-font-size: 14;
|
||||
}
|
||||
|
||||
.resize-border {
|
||||
|
Loading…
x
Reference in New Issue
Block a user