Add support for normal outlined buttons

This commit is contained in:
mkpaz 2023-05-27 07:37:20 +04:00
parent cf2f46a4e0
commit d4d0526df0
4 changed files with 52 additions and 7 deletions

@ -12,7 +12,6 @@ import javafx.scene.control.Button;
import javafx.scene.control.ContentDisplay;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.shape.Circle;
import org.kordamp.ikonli.feather.Feather;
import org.kordamp.ikonli.javafx.FontIcon;
import org.kordamp.ikonli.material2.Material2AL;
@ -61,9 +60,7 @@ public final class ButtonPage extends OutlinePage {
defaultBtn.setMnemonicParsing(true);
var outlinedBtn = new Button("Out_lined");
outlinedBtn.getStyleClass().addAll(
Styles.BUTTON_OUTLINED, Styles.ACCENT
);
outlinedBtn.getStyleClass().addAll(Styles.BUTTON_OUTLINED);
outlinedBtn.setMnemonicParsing(true);
var flatBtn = new Button("_Flat");

@ -59,6 +59,14 @@ public final class MenuButtonPage extends OutlinePage {
normalSplitBtn.setText("_Split Menu Button");
normalSplitBtn.setMnemonicParsing(true);
var outlinedMenuBtn = new MenuButton("Outlined");
outlinedMenuBtn.getItems().setAll(createItems(5));
outlinedMenuBtn.getStyleClass().add(Styles.BUTTON_OUTLINED);
var outlinedSplitBtn = new SplitMenuButton(createItems(5));
outlinedSplitBtn.setText("Outlined");
outlinedSplitBtn.getStyleClass().add(Styles.BUTTON_OUTLINED);
var flatMenuBtn = new MenuButton("Flat");
flatMenuBtn.getItems().setAll(createItems(5));
flatMenuBtn.getStyleClass().add(Styles.FLAT);
@ -70,7 +78,9 @@ public final class MenuButtonPage extends OutlinePage {
var box = new FlowPane(
HGAP_20, VGAP_10,
normalMenuBtn, normalSplitBtn, flatMenuBtn, flatSplitBtn
normalMenuBtn, normalSplitBtn,
outlinedMenuBtn, outlinedSplitBtn,
flatMenuBtn, flatSplitBtn
);
var description = BBCodeParser.createFormattedText("""
@ -184,6 +194,19 @@ public final class MenuButtonPage extends OutlinePage {
normalSplitBtn.setGraphic(new FontIcon(Feather.MORE_HORIZONTAL));
normalSplitBtn.getStyleClass().addAll(Styles.BUTTON_ICON);
var outlinedMenuBtn = new MenuButton();
outlinedMenuBtn.setGraphic(new FontIcon(Feather.MORE_HORIZONTAL));
outlinedMenuBtn.getItems().setAll(createItems(5));
outlinedMenuBtn.getStyleClass().addAll(
Styles.BUTTON_ICON, Styles.BUTTON_OUTLINED
);
var outlinedSplitBtn = new SplitMenuButton(createItems(5));
outlinedSplitBtn.setGraphic(new FontIcon(Feather.MORE_HORIZONTAL));
outlinedSplitBtn.getStyleClass().addAll(
Styles.BUTTON_ICON, Styles.BUTTON_OUTLINED
);
var accentMenuBtn = new MenuButton();
accentMenuBtn.setGraphic(new FontIcon(Feather.MENU));
accentMenuBtn.getItems().setAll(createItems(5));
@ -200,7 +223,9 @@ public final class MenuButtonPage extends OutlinePage {
var box = new FlowPane(
HGAP_20, VGAP_10,
normalMenuBtn, normalSplitBtn, accentMenuBtn, accentSplitBtn
normalMenuBtn, normalSplitBtn,
outlinedMenuBtn, outlinedSplitBtn,
accentMenuBtn, accentSplitBtn
);
var description = BBCodeParser.createFormattedText("""
You can hide the [i]MenuButton[/i] text by applying [code]Styles.BUTTON_ICON[/code] \

@ -361,6 +361,13 @@ $color-shadow: -color-shadow-default !default;
}
}
&.button-outlined {
-color-button-bg: -color-bg-default;
-color-button-fg: $color-fg;
-color-button-bg-hover: $color-bg-hover;
-color-button-fg-hover: $color-fg-hover;
}
&:default,
&.accent {
@include accent();

@ -111,6 +111,13 @@ $separator-width: 0.75px !default;
}
}
&.button-outlined {
-color-button-bg: -color-bg-default;
-color-button-fg: button.$color-fg;
-color-button-bg-hover: button.$color-bg-hover;
-color-button-fg-hover: button.$color-fg-hover;
}
&.accent {
@include button.accent();
}
@ -188,10 +195,19 @@ $separator-width: 0.75px !default;
&.button-outlined:hover,
&.button-outlined:focused {
>.arrow-button {
-color-button-fg: -color-fg-default;
}
&:default,
&.accent,
&.success,
&.danger {
>.arrow-button {
-color-button-fg: -color-fg-emphasis;
}
}
}
>.arrow-button {
-fx-padding: cfg.$padding-y cfg.$padding-x cfg.$padding-y cfg.$padding-x;