@@ -16,6 +16,8 @@ import javafx.scene.Node
16
16
import javafx.scene.layout.*
17
17
import javafx.scene.paint.Color
18
18
import javafx.scene.shape.Line
19
+
import javafx.scene.shape.Rectangle
20
+
import javafx.scene.text.Font
19
21
import javafx.scene.text.Text
20
22
import javafx.scene.text.TextFlow
21
23
import javafx.util.Duration
@@ -69,28 +71,19 @@ open class MDIWindow
69
71
val pane = Pane()
70
72
pane.translateY = 1.0
71
73
72
-
val size = 20.0
73
-
val offset = 3.0
74
+
val box = makeButtonBox()
74
75
75
-
val line1 = Line(offset, size / 2 + 1, size, size / 2 + 1)
76
-
val line2 = Line(size, offset, offset, size)
76
+
val offset = 6.0
77
77
78
+
val line1 = Line(offset, 14.0 / 2 + 1, box.width - offset, 14.0 / 2 + 1)
78
79
line1.strokeWidth = 2.0
79
-
line2.strokeWidth = 2.0
80
-
81
-
val stroke = Bindings.`when`(pane.hoverProperty()).then(Color.BLUE).otherwise(Color.WHITE)
82
-
83
-
line1.strokeProperty().bind(
84
-
stroke
85
-
)
80
+
line1.stroke = Color.WHITE
86
81
87
-
line2.strokeProperty().bind(
88
-
stroke
82
+
box.opacityProperty().bind(
83
+
Bindings.`when`(pane.hoverProperty()).then(0.95).otherwise(0.0)
89
84
)
90
85
91
-
line2.isVisible = false
92
-
93
-
pane.children.addAll(line1, line2)
86
+
pane.children.addAll(box, line1)
94
87
95
88
return pane
96
89
}
@@ -99,30 +92,32 @@ open class MDIWindow
99
92
val pane = Pane()
100
93
pane.translateY = 1.0
101
94
102
-
val size = 22.0
95
+
val box = makeButtonBox()
96
+
97
+
val size = 14.0
103
98
val offset = 3.0
104
99
105
-
val line1 = Line(offset, offset, size, size)
106
-
val line2 = Line(size, offset, offset, size)
100
+
val line1 = Line(3.0 + offset, offset - 1, 3.0 + size, size - 1)
101
+
val line2 = Line(3.0 + size, offset - 1, 3.0 + offset, size - 1)
107
102
108
103
line1.strokeWidth = 2.0
109
104
line2.strokeWidth = 2.0
105
+
line1.stroke = Color.WHITE
106
+
line2.stroke = Color.WHITE
110
107
111
-
val stroke = Bindings.`when`(pane.hoverProperty()).then(Color.RED).otherwise(Color.WHITE)
112
-
113
-
line1.strokeProperty().bind(
114
-
stroke
108
+
box.opacityProperty().bind(
109
+
Bindings.`when`(pane.hoverProperty()).then(0.95).otherwise(0.0)
115
110
)
116
111
117
-
line2.strokeProperty().bind(
118
-
stroke
119
-
)
120
-
121
-
pane.children.addAll(line1, line2)
112
+
pane.children.addAll(box, line1, line2)
122
113
123
114
return pane
124
115
}
125
116
117
+
private fun makeButtonBox(): Rectangle {
118
+
return Rectangle(24.0, 15.0, Color.GRAY)
119
+
}
120
+
126
121
private val root = Pane()
127
122
var contentPane: Pane = StackPane()
128
123
set(value) {
@@ -159,8 +154,13 @@ open class MDIWindow
159
154
}
160
155
161
156
private fun updateTitle() {
157
+
val titleText = Text(title).also {
158
+
it.font = Font.font(14.0)
159
+
it.fill = Color.WHITE
160
+
}
161
+
162
162
header.children.clear()
163
-
header.children.add(Text(title).also { it.fill = Color.WHITE })
163
+
header.children.add(titleText)
164
164
}
165
165
166
166
init {
@@ -187,10 +187,11 @@ open class MDIWindow
187
187
}
188
188
189
189
private fun initMinimizeButton(box: HBox) {
190
+
minWidth = 160.0
190
191
minHeight = 28.0
191
192
192
-
minimizeButton.translateXProperty().bind(box.prefWidthProperty().subtract(54.0))
193
-
minimizeButton.translateY = -20.0
193
+
minimizeButton.translateXProperty().bind(box.prefWidthProperty().subtract(56.0))
194
+
minimizeButton.translateY = -22.0
194
195
195
196
minimizeButton.setOnMouseClicked {
196
197
if (!isAnimationFinished)
@@ -224,14 +225,14 @@ open class MDIWindow
224
225
}
225
226
226
227
private fun initCloseButton(box: HBox) {
227
-
closeButton.translateXProperty().bind(box.prefWidthProperty().subtract(27.0))
228
+
closeButton.translateXProperty().bind(box.prefWidthProperty().subtract(30.0))
228
229
closeButton.translateY = -22.0
229
230
230
231
closeButton.setOnMouseClicked {
231
232
if (parent is Group) {
232
233
(parent as Group).children -= this
233
-
} else {
234
-
// TODO:
234
+
} else if (parent is Pane) {
235
+
(parent as Pane).children -= this
235
236
}
236
237
}
237
238
}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4