Skip to content

Instantly share code, notes, and snippets.

@dragoncodes
Last active September 27, 2019 10:40
Show Gist options
  • Save dragoncodes/eb044c5718ce5016bfe12a91be0fe146 to your computer and use it in GitHub Desktop.
Save dragoncodes/eb044c5718ce5016bfe12a91be0fe146 to your computer and use it in GitHub Desktop.
@DslMarker annotation class MenuConfigurationPart
@Suppress("unused")
fun menuConfig(builder: MenuConfiguration.() -> Unit) = MenuConfiguration(builder)
@MenuConfigurationPart
class MenuConfiguration(
inline val builder: MenuConfiguration.() -> Unit
)
{
lateinit var header: MenuHeader
lateinit var content: MenuContent
init
{
builder()
}
inline fun header(builder: MenuHeader.() -> Unit)
{
this.header = MenuHeader().apply(builder)
}
inline fun content(builder: MenuContent.() -> Unit)
{
this.content = MenuContent().apply(builder)
}
override fun equals(other: Any?): Boolean = TODO()
override fun hashCode(): Int = TODO()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment