-
Notifications
You must be signed in to change notification settings - Fork 272
Adding an option to make drawer with horizontal text #1283
base: master
Are you sure you want to change the base?
Changes from 3 commits
c3a48f4
90c779b
20b7344
8f525d9
9899c11
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ import javafx.beans.value.ObservableValue | |
import javafx.collections.FXCollections | ||
import javafx.event.EventTarget | ||
import javafx.geometry.Orientation | ||
import javafx.geometry.Pos | ||
import javafx.geometry.Side | ||
import javafx.scene.Group | ||
import javafx.scene.Node | ||
|
@@ -23,7 +24,7 @@ fun EventTarget.drawer( | |
op: Drawer.() -> Unit | ||
) = Drawer(side, multiselect, floatingContent).attachTo(this, op) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the old constructor is not used here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. append default value |
||
|
||
class Drawer(side: Side, multiselect: Boolean, floatingContent: Boolean) : BorderPane() { | ||
class Drawer(side: Side, multiselect: Boolean, floatingContent: Boolean, horizontalItem: Boolean) : BorderPane() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it might be worth renaming. For example, by adding the prefix ʻis |
||
val dockingSideProperty: ObjectProperty<Side> = SimpleObjectProperty(side) | ||
var dockingSide by dockingSideProperty | ||
|
||
|
@@ -151,10 +152,14 @@ class Drawer(side: Side, multiselect: Boolean, floatingContent: Boolean) : Borde | |
} | ||
|
||
private fun configureRotation(button: ToggleButton) { | ||
button.rotate = when (dockingSide) { | ||
Side.LEFT -> -90.0 | ||
Side.RIGHT -> 90.0 | ||
else -> 0.0 | ||
button.rotate = if (this.horizontalItem) { | ||
when (dockingSide) { | ||
Side.LEFT -> -90.0 | ||
Side.RIGHT -> 90.0 | ||
else -> 0.0 | ||
} | ||
} else { | ||
0.0 | ||
} | ||
} | ||
|
||
|
@@ -321,7 +326,10 @@ class DrawerItem(val drawer: Drawer, title: ObservableValue<String?>? = null, ic | |
if (change.wasAdded()) { | ||
change.addedSubList.asSequence() | ||
.filter { VBox.getVgrow(it) == null } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no check HBox.getHgrow(it) == null |
||
.forEach { VBox.setVgrow(it, Priority.ALWAYS) } | ||
.forEach { | ||
VBox.setVgrow(it, Priority.ALWAYS) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is a potential increase in memory. You need to think about how to check which type of Panel is used There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should I add a check for horizontal item here? In that case, I think I need to add a parameter for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. might be worth redesigning ExpandedDrawerContentArea itself |
||
HBox.setHgrow(it, Priority.ALWAYS) | ||
} | ||
} | ||
} | ||
} | ||
|
@@ -334,6 +342,7 @@ class DrawerStyles : Stylesheet() { | |
val drawerItem by cssclass() | ||
val buttonArea by cssclass() | ||
val contentArea by cssclass() | ||
val horizontalDrawerItem by cssclass() | ||
} | ||
|
||
init { | ||
|
@@ -364,5 +373,9 @@ class DrawerStyles : Stylesheet() { | |
borderColor += box(Color.TRANSPARENT) | ||
} | ||
} | ||
horizontalDrawerItem { | ||
minWidth = 200.px | ||
alignment = Pos.CENTER_LEFT | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
append parameter
horizontalItem