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() { class UITest: UIScreen() {
init { init {
val red = UIView().apply { val red = addView(UIView().apply {
backgroundColor = Color(0xff0000) backgroundColor = Color(0xff0000)
addView(this) })
} val green = addView(UIView().apply {
val green = UIView().apply {
backgroundColor = Color(0x00ff00) backgroundColor = Color(0x00ff00)
addView(this) })
} val blue = addView(UIView().apply {
val blue = UIView().apply {
backgroundColor = Color(0x0000ff) backgroundColor = Color(0x0000ff)
addView(this) })
} val purple = green.addSubview(UIView().apply {
val purple = UIView().apply {
backgroundColor = Color(0x800080) backgroundColor = Color(0x800080)
green.addSubview(this) })
}
solver.dsl { solver.dsl {
red.leftAnchor equalTo 0 red.leftAnchor equalTo 0

View File

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

View File

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