mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-04-18 18:40:34 +08:00
Satisfy requirements metioned in #469
This commit is contained in:
parent
2dc956b357
commit
0e5250dfb3
@ -96,7 +96,8 @@ public final class MainPage extends StackPane implements DecoratorPage {
|
||||
btnLaunch.setClip(new Rectangle(-100, -100, 310, 200));
|
||||
btnMenu.setClip(new Rectangle(211, -100, 100, 200));
|
||||
menu.setMaxHeight(365);
|
||||
menu.setMinWidth(545);
|
||||
menu.setMaxWidth(545);
|
||||
menu.setAlwaysShowingVBar(true);
|
||||
|
||||
updatePane.visibleProperty().bind(UpdateChecker.outdatedProperty());
|
||||
closeUpdateButton.setGraphic(SVG.close(Theme.whiteFillBinding(), 10, 10));
|
||||
|
@ -18,6 +18,9 @@
|
||||
package org.jackhuang.hmcl.ui.construct;
|
||||
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.binding.When;
|
||||
import javafx.beans.property.BooleanProperty;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.scene.Node;
|
||||
@ -31,6 +34,7 @@ import org.jackhuang.hmcl.ui.FXUtils;
|
||||
public class PopupMenu extends Control {
|
||||
|
||||
private final ObservableList<Node> content = FXCollections.observableArrayList();
|
||||
private final BooleanProperty alwaysShowingVBar = new SimpleBooleanProperty();
|
||||
|
||||
public PopupMenu() {
|
||||
}
|
||||
@ -39,6 +43,18 @@ public class PopupMenu extends Control {
|
||||
return content;
|
||||
}
|
||||
|
||||
public boolean isAlwaysShowingVBar() {
|
||||
return alwaysShowingVBar.get();
|
||||
}
|
||||
|
||||
public BooleanProperty alwaysShowingVBarProperty() {
|
||||
return alwaysShowingVBar;
|
||||
}
|
||||
|
||||
public void setAlwaysShowingVBar(boolean alwaysShowingVBar) {
|
||||
this.alwaysShowingVBar.set(alwaysShowingVBar);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Skin<?> createDefaultSkin() {
|
||||
return new PopupMenuSkin();
|
||||
@ -52,6 +68,9 @@ public class PopupMenu extends Control {
|
||||
ScrollPane scrollPane = new ScrollPane();
|
||||
scrollPane.setFitToHeight(true);
|
||||
scrollPane.setFitToWidth(true);
|
||||
scrollPane.vbarPolicyProperty().bind(new When(alwaysShowingVBar)
|
||||
.then(ScrollPane.ScrollBarPolicy.ALWAYS)
|
||||
.otherwise(ScrollPane.ScrollBarPolicy.AS_NEEDED));
|
||||
|
||||
VBox content = new VBox();
|
||||
content.getStyleClass().add("menu");
|
||||
|
Loading…
x
Reference in New Issue
Block a user