Remove UI prefix

This commit is contained in:
Shadowfacts 2019-06-21 19:02:08 -04:00
parent 215949eabe
commit 12b6886da8
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
4 changed files with 15 additions and 15 deletions

View File

@ -8,23 +8,18 @@ import net.shadowfacts.shadowui.util.Color
class UITest: UIScreen() {
init {
val red = UIView().apply {
val red = addView(UIView().apply {
backgroundColor = Color(0xff0000)
addView(this)
}
val green = UIView().apply {
})
val green = addView(UIView().apply {
backgroundColor = Color(0x00ff00)
addView(this)
}
val blue = UIView().apply {
})
val blue = addView(UIView().apply {
backgroundColor = Color(0x0000ff)
addView(this)
}
val purple = UIView().apply {
})
val purple = green.addSubview(UIView().apply {
backgroundColor = Color(0x800080)
green.addSubview(this)
}
})
solver.dsl {
red.leftAnchor equalTo 0

View File

@ -10,10 +10,13 @@ open class UIScreen: Screen(TextComponent("UIScreen")) {
val views = mutableListOf<UIView>()
fun addView(view: UIView) {
fun addView(view: UIView): UIView {
views.add(view)
view.solver = solver
view.wasAdded()
return view
}
fun layout() {

View File

@ -31,12 +31,14 @@ class UIView {
var parent: UIView? = null
val subviews = mutableListOf<UIView>()
fun addSubview(view: UIView) {
fun addSubview(view: UIView): UIView {
subviews.add(view)
view.parent = this
view.solver = solver
view.wasAdded()
return view
}
fun wasAdded() {