diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ButtonBuilder.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ButtonBuilder.kt index 9da19aed55..798659d061 100644 --- a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ButtonBuilder.kt +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ButtonBuilder.kt @@ -3,12 +3,14 @@ package org.hexworks.zircon.api.builder.component import org.hexworks.zircon.api.ComponentDecorations.side import org.hexworks.zircon.api.component.Button import org.hexworks.zircon.api.component.builder.base.BaseComponentBuilder +import org.hexworks.zircon.internal.dsl.ZirconDsl import org.hexworks.zircon.internal.component.impl.DefaultButton import org.hexworks.zircon.internal.component.renderer.DefaultButtonRenderer import kotlin.jvm.JvmStatic import kotlin.math.max @Suppress("UNCHECKED_CAST") +@ZirconDsl class ButtonBuilder( private var text: String = "" ) : BaseComponentBuilder(DefaultButtonRenderer()) { diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/CheckBoxBuilder.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/CheckBoxBuilder.kt index 235a4d614f..6846e9f36d 100644 --- a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/CheckBoxBuilder.kt +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/CheckBoxBuilder.kt @@ -3,6 +3,7 @@ package org.hexworks.zircon.api.builder.component import org.hexworks.zircon.api.component.CheckBox import org.hexworks.zircon.api.component.builder.base.BaseComponentBuilder import org.hexworks.zircon.api.data.Size +import org.hexworks.zircon.internal.dsl.ZirconDsl import org.hexworks.zircon.internal.component.impl.DefaultCheckBox import org.hexworks.zircon.internal.component.impl.DefaultCheckBox.CheckBoxAlignment import org.hexworks.zircon.internal.component.renderer.DefaultCheckBoxRenderer @@ -10,6 +11,7 @@ import kotlin.jvm.JvmStatic import kotlin.math.max @Suppress("UNCHECKED_CAST") +@ZirconDsl class CheckBoxBuilder( private var text: String = "", private var labelAlignment: CheckBoxAlignment = CheckBoxAlignment.RIGHT diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ColorThemeBuilder.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ColorThemeBuilder.kt index 768cf13101..befd69c456 100644 --- a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ColorThemeBuilder.kt +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ColorThemeBuilder.kt @@ -3,8 +3,10 @@ package org.hexworks.zircon.api.builder.component import org.hexworks.zircon.api.builder.Builder import org.hexworks.zircon.api.color.TileColor import org.hexworks.zircon.api.component.ColorTheme +import org.hexworks.zircon.internal.dsl.ZirconDsl import org.hexworks.zircon.internal.component.impl.DefaultColorTheme +@ZirconDsl data class ColorThemeBuilder( private var name: String = "anonymous", private var primaryForegroundColor: TileColor = TileColor.defaultForegroundColor(), diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ComponentStyleSetBuilder.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ComponentStyleSetBuilder.kt index 97c679c9ba..aaf369b874 100644 --- a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ComponentStyleSetBuilder.kt +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ComponentStyleSetBuilder.kt @@ -3,6 +3,7 @@ package org.hexworks.zircon.api.builder.component import org.hexworks.zircon.api.builder.Builder import org.hexworks.zircon.api.component.ComponentStyleSet import org.hexworks.zircon.api.component.data.ComponentState +import org.hexworks.zircon.internal.dsl.ZirconDsl import org.hexworks.zircon.api.graphics.StyleSet import org.hexworks.zircon.internal.component.impl.DefaultComponentStyleSet @@ -10,6 +11,7 @@ import org.hexworks.zircon.internal.component.impl.DefaultComponentStyleSet * Use this to build [StyleSet]s for your [org.hexworks.zircon.api.component.Component]s. * They will be used accordingly when the component's state changes. */ +@ZirconDsl data class ComponentStyleSetBuilder( private val styles: MutableMap = mutableMapOf() ) : Builder { diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/GroupBuilder.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/GroupBuilder.kt index ae9099299c..7a555b8efb 100644 --- a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/GroupBuilder.kt +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/GroupBuilder.kt @@ -4,11 +4,13 @@ import org.hexworks.zircon.api.builder.Builder import org.hexworks.zircon.api.component.ColorTheme import org.hexworks.zircon.api.component.Component import org.hexworks.zircon.api.component.Group +import org.hexworks.zircon.internal.dsl.ZirconDsl import org.hexworks.zircon.api.resource.TilesetResource import org.hexworks.zircon.internal.component.impl.DefaultGroup import org.hexworks.zircon.internal.config.RuntimeConfig import kotlin.jvm.JvmStatic +@ZirconDsl class GroupBuilder( private var isDisabled: Boolean = false, private var isHidden: Boolean = false, diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/HBoxBuilder.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/HBoxBuilder.kt index 2eab888e48..9d293564b0 100644 --- a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/HBoxBuilder.kt +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/HBoxBuilder.kt @@ -2,11 +2,13 @@ package org.hexworks.zircon.api.builder.component import org.hexworks.zircon.api.component.HBox import org.hexworks.zircon.api.component.builder.base.BaseComponentBuilder +import org.hexworks.zircon.internal.dsl.ZirconDsl import org.hexworks.zircon.internal.component.impl.DefaultHBox import org.hexworks.zircon.internal.component.renderer.DefaultHBoxRenderer import kotlin.jvm.JvmStatic @Suppress("UNCHECKED_CAST") +@ZirconDsl class HBoxBuilder( private var spacing: Int = 0 ) : BaseComponentBuilder(DefaultHBoxRenderer()) { diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/HeaderBuilder.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/HeaderBuilder.kt index 551850bd0a..9c306b7a9c 100644 --- a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/HeaderBuilder.kt +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/HeaderBuilder.kt @@ -2,12 +2,14 @@ package org.hexworks.zircon.api.builder.component import org.hexworks.zircon.api.component.Header import org.hexworks.zircon.api.component.builder.base.BaseComponentBuilder +import org.hexworks.zircon.internal.dsl.ZirconDsl import org.hexworks.zircon.internal.component.impl.DefaultHeader import org.hexworks.zircon.internal.component.renderer.DefaultHeaderRenderer import kotlin.jvm.JvmStatic import kotlin.math.max @Suppress("UNCHECKED_CAST") +@ZirconDsl class HeaderBuilder( private var text: String = "" ) : BaseComponentBuilder(DefaultHeaderRenderer()) { diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/HorizontalNumberInputBuilder.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/HorizontalNumberInputBuilder.kt index 9e7c3834cc..fa7fd08fb1 100644 --- a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/HorizontalNumberInputBuilder.kt +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/HorizontalNumberInputBuilder.kt @@ -2,12 +2,14 @@ package org.hexworks.zircon.api.builder.component import org.hexworks.zircon.api.component.NumberInput import org.hexworks.zircon.api.component.builder.base.BaseComponentBuilder +import org.hexworks.zircon.internal.dsl.ZirconDsl import org.hexworks.zircon.internal.component.impl.DefaultHorizontalNumberInput import org.hexworks.zircon.internal.component.renderer.DefaultNumberInputRenderer import kotlin.jvm.JvmStatic import kotlin.math.max @Suppress("UNCHECKED_CAST") +@ZirconDsl class HorizontalNumberInputBuilder( val width: Int, private var initialValue: Int = 0, diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/HorizontalScrollBarBuilder.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/HorizontalScrollBarBuilder.kt index 823f02e0d9..0dc19c564f 100644 --- a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/HorizontalScrollBarBuilder.kt +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/HorizontalScrollBarBuilder.kt @@ -2,6 +2,7 @@ package org.hexworks.zircon.api.builder.component import org.hexworks.zircon.api.component.ScrollBar import org.hexworks.zircon.api.component.builder.base.BaseComponentBuilder +import org.hexworks.zircon.internal.dsl.ZirconDsl import org.hexworks.zircon.internal.component.impl.DefaultHorizontalScrollBar import org.hexworks.zircon.internal.component.renderer.HorizontalScrollBarRenderer import kotlin.jvm.JvmStatic @@ -10,6 +11,7 @@ import kotlin.jvm.JvmStatic /** * Builder for the scrollbar. By default, it creates a scrollbar with a number of items of 100. */ +@ZirconDsl class HorizontalScrollBarBuilder( private var minValue: Int = 0, private var maxValue: Int = 100 diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/HorizontalSliderBuilder.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/HorizontalSliderBuilder.kt index 2a5feab1a6..921c91a0db 100644 --- a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/HorizontalSliderBuilder.kt +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/HorizontalSliderBuilder.kt @@ -2,6 +2,7 @@ package org.hexworks.zircon.api.builder.component import org.hexworks.zircon.api.component.Slider import org.hexworks.zircon.api.component.builder.base.BaseComponentBuilder +import org.hexworks.zircon.internal.dsl.ZirconDsl import org.hexworks.zircon.internal.component.impl.DefaultHorizontalSlider import org.hexworks.zircon.internal.component.renderer.HorizontalSliderRenderer import kotlin.jvm.JvmStatic @@ -11,6 +12,7 @@ import kotlin.math.max /** * Builder for the slider. By default, it creates a slider with a maxValue of 100 and 10 steps. */ +@ZirconDsl class HorizontalSliderBuilder( private var minValue: Int = 0, private var maxValue: Int = 100, diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/IconBuilder.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/IconBuilder.kt index dc01509d6c..387df7b1ac 100644 --- a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/IconBuilder.kt +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/IconBuilder.kt @@ -5,12 +5,14 @@ import org.hexworks.zircon.api.component.Icon import org.hexworks.zircon.api.component.builder.base.BaseComponentBuilder import org.hexworks.zircon.api.data.Size import org.hexworks.zircon.api.data.Tile +import org.hexworks.zircon.internal.dsl.ZirconDsl import org.hexworks.zircon.internal.component.impl.DefaultIcon import org.hexworks.zircon.internal.component.renderer.DefaultIconRenderer import org.hexworks.zircon.internal.config.RuntimeConfig import kotlin.jvm.JvmStatic @Suppress("UNCHECKED_CAST") +@ZirconDsl class IconBuilder : BaseComponentBuilder(DefaultIconRenderer()) { private var icon = Maybe.empty() diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/LabelBuilder.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/LabelBuilder.kt index 3b49d8f85f..46bf9a0257 100644 --- a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/LabelBuilder.kt +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/LabelBuilder.kt @@ -2,6 +2,7 @@ package org.hexworks.zircon.api.builder.component import org.hexworks.zircon.api.component.Label import org.hexworks.zircon.api.component.builder.base.BaseComponentBuilder +import org.hexworks.zircon.internal.dsl.ZirconDsl import org.hexworks.zircon.internal.component.impl.DefaultLabel import org.hexworks.zircon.internal.component.renderer.DefaultLabelRenderer import org.hexworks.zircon.platform.util.SystemUtils @@ -9,6 +10,7 @@ import kotlin.jvm.JvmStatic import kotlin.math.max @Suppress("UNCHECKED_CAST") +@ZirconDsl class LabelBuilder( private var text: String = "" ) : BaseComponentBuilder(DefaultLabelRenderer()) { diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ListItemBuilder.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ListItemBuilder.kt index 82cd280935..819aff1719 100644 --- a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ListItemBuilder.kt +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ListItemBuilder.kt @@ -2,12 +2,14 @@ package org.hexworks.zircon.api.builder.component import org.hexworks.zircon.api.component.ListItem import org.hexworks.zircon.api.component.builder.base.BaseComponentBuilder +import org.hexworks.zircon.internal.dsl.ZirconDsl import org.hexworks.zircon.internal.component.impl.DefaultListItem import org.hexworks.zircon.internal.component.renderer.DefaultListItemRenderer import org.hexworks.zircon.internal.component.withNewLinesStripped import kotlin.math.max @Suppress("UNCHECKED_CAST") +@ZirconDsl class ListItemBuilder( private var text: String = "" ) : BaseComponentBuilder(DefaultListItemRenderer()) { diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/LogAreaBuilder.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/LogAreaBuilder.kt index dc25d26c95..066cedcdae 100644 --- a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/LogAreaBuilder.kt +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/LogAreaBuilder.kt @@ -2,11 +2,13 @@ package org.hexworks.zircon.api.builder.component import org.hexworks.zircon.api.component.LogArea import org.hexworks.zircon.api.component.builder.base.BaseComponentBuilder +import org.hexworks.zircon.internal.dsl.ZirconDsl import org.hexworks.zircon.internal.component.impl.DefaultLogArea import org.hexworks.zircon.internal.component.renderer.DefaultLogAreaRenderer import kotlin.jvm.JvmStatic @Suppress("UNCHECKED_CAST") +@ZirconDsl class LogAreaBuilder( private var logRowHistorySize: Int = 100 ) : BaseComponentBuilder(DefaultLogAreaRenderer()) { diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ModalBuilder.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ModalBuilder.kt index 3145b6cd76..ac45c6686b 100644 --- a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ModalBuilder.kt +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ModalBuilder.kt @@ -8,6 +8,7 @@ import org.hexworks.zircon.api.component.modal.ModalResult import org.hexworks.zircon.api.component.renderer.ComponentRenderer import org.hexworks.zircon.api.data.Position import org.hexworks.zircon.api.data.Size +import org.hexworks.zircon.internal.dsl.ZirconDsl import org.hexworks.zircon.internal.component.modal.DefaultModal import org.hexworks.zircon.internal.component.renderer.DefaultComponentRenderingStrategy import org.hexworks.zircon.internal.component.renderer.DefaultModalRenderer @@ -15,6 +16,7 @@ import kotlin.jvm.JvmOverloads import kotlin.jvm.JvmStatic @Suppress("UNCHECKED_CAST") +@ZirconDsl class ModalBuilder( private var darkenPercent: Double = 0.0, private var centeredDialog: Boolean = false, diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/PanelBuilder.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/PanelBuilder.kt index 950441f013..625782ba50 100644 --- a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/PanelBuilder.kt +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/PanelBuilder.kt @@ -2,11 +2,13 @@ package org.hexworks.zircon.api.builder.component import org.hexworks.zircon.api.component.Panel import org.hexworks.zircon.api.component.builder.base.BaseComponentBuilder +import org.hexworks.zircon.internal.dsl.ZirconDsl import org.hexworks.zircon.internal.component.impl.DefaultPanel import org.hexworks.zircon.internal.component.renderer.DefaultPanelRenderer import kotlin.jvm.JvmStatic @Suppress("UNCHECKED_CAST") +@ZirconDsl class PanelBuilder : BaseComponentBuilder(DefaultPanelRenderer()) { diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ParagraphBuilder.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ParagraphBuilder.kt index 72fb26617d..b81a236ab2 100644 --- a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ParagraphBuilder.kt +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ParagraphBuilder.kt @@ -2,6 +2,7 @@ package org.hexworks.zircon.api.builder.component import org.hexworks.zircon.api.component.Paragraph import org.hexworks.zircon.api.component.builder.base.BaseComponentBuilder +import org.hexworks.zircon.internal.dsl.ZirconDsl import org.hexworks.zircon.internal.component.impl.DefaultParagraph import org.hexworks.zircon.internal.component.renderer.DefaultParagraphRenderer import org.hexworks.zircon.internal.component.renderer.TypingEffectPostProcessor @@ -10,6 +11,7 @@ import kotlin.jvm.JvmStatic import kotlin.math.max @Suppress("UNCHECKED_CAST") +@ZirconDsl class ParagraphBuilder( internal var text: String = "", private var typingEffectSpeedInMs: Long = 0 diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ProgressBarBuilder.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ProgressBarBuilder.kt index 027f03e664..fa6bd7923d 100644 --- a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ProgressBarBuilder.kt +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ProgressBarBuilder.kt @@ -2,6 +2,7 @@ package org.hexworks.zircon.api.builder.component import org.hexworks.zircon.api.component.ProgressBar import org.hexworks.zircon.api.component.builder.base.BaseComponentBuilder +import org.hexworks.zircon.internal.dsl.ZirconDsl import org.hexworks.zircon.internal.component.impl.DefaultProgressBar import org.hexworks.zircon.internal.component.renderer.DefaultProgressBarRenderer import kotlin.jvm.JvmStatic @@ -11,6 +12,7 @@ import kotlin.math.max /** * Builder for the progress bar. By default, it creates a progress bar with a maxValue of 100 and 10 steps. */ +@ZirconDsl class ProgressBarBuilder( private var range: Int = 100, private var numberOfSteps: Int = 10, diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/RadioButtonBuilder.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/RadioButtonBuilder.kt index 2dfb0286ca..92fd5b753b 100644 --- a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/RadioButtonBuilder.kt +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/RadioButtonBuilder.kt @@ -3,12 +3,14 @@ package org.hexworks.zircon.api.builder.component import org.hexworks.cobalt.datatypes.Maybe import org.hexworks.zircon.api.component.RadioButton import org.hexworks.zircon.api.component.builder.base.BaseComponentBuilder +import org.hexworks.zircon.internal.dsl.ZirconDsl import org.hexworks.zircon.internal.component.impl.DefaultRadioButton import org.hexworks.zircon.internal.component.renderer.DefaultRadioButtonRenderer import kotlin.jvm.JvmStatic import kotlin.math.max @Suppress("UNCHECKED_CAST") +@ZirconDsl class RadioButtonBuilder( private var text: String = "", private var key: Maybe = Maybe.empty() diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/RadioButtonGroupBuilder.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/RadioButtonGroupBuilder.kt index fafd658e61..955a6c5ad1 100644 --- a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/RadioButtonGroupBuilder.kt +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/RadioButtonGroupBuilder.kt @@ -3,12 +3,14 @@ package org.hexworks.zircon.api.builder.component import org.hexworks.zircon.api.builder.Builder import org.hexworks.zircon.api.component.ColorTheme import org.hexworks.zircon.api.component.RadioButtonGroup +import org.hexworks.zircon.internal.dsl.ZirconDsl import org.hexworks.zircon.api.resource.TilesetResource import org.hexworks.zircon.internal.component.impl.DefaultRadioButtonGroup import org.hexworks.zircon.internal.config.RuntimeConfig import kotlin.jvm.JvmStatic @Suppress("UNCHECKED_CAST") +@ZirconDsl class RadioButtonGroupBuilder( private var isDisabled: Boolean = false, private var isHidden: Boolean = false, diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/TextAreaBuilder.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/TextAreaBuilder.kt index 63c7eb521c..19b2793d16 100644 --- a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/TextAreaBuilder.kt +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/TextAreaBuilder.kt @@ -2,6 +2,7 @@ package org.hexworks.zircon.api.builder.component import org.hexworks.zircon.api.component.TextArea import org.hexworks.zircon.api.component.builder.base.BaseComponentBuilder +import org.hexworks.zircon.internal.dsl.ZirconDsl import org.hexworks.zircon.internal.component.impl.DefaultTextArea import org.hexworks.zircon.internal.component.renderer.DefaultTextAreaRenderer import org.hexworks.zircon.internal.component.withNewLinesStripped @@ -9,6 +10,7 @@ import kotlin.jvm.JvmStatic import kotlin.math.max @Suppress("UNCHECKED_CAST") +@ZirconDsl class TextAreaBuilder( private var text: String = "" ) : BaseComponentBuilder( diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/TextBoxBuilder.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/TextBoxBuilder.kt index 3221e8f706..1ecf98f1c2 100644 --- a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/TextBoxBuilder.kt +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/TextBoxBuilder.kt @@ -7,12 +7,14 @@ import org.hexworks.zircon.api.component.TextBox import org.hexworks.zircon.api.component.builder.base.BaseComponentBuilder import org.hexworks.zircon.api.data.Position import org.hexworks.zircon.api.data.Size +import org.hexworks.zircon.internal.dsl.ZirconDsl import org.hexworks.zircon.internal.component.impl.DefaultTextBox import org.hexworks.zircon.internal.component.renderer.DefaultTextBoxRenderer import kotlin.jvm.JvmOverloads import kotlin.jvm.JvmStatic @Suppress("UNCHECKED_CAST") +@ZirconDsl class TextBoxBuilder( private val initialContentWidth: Int, private var nextPosition: Position = Position.defaultPosition(), diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ToggleButtonBuilder.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ToggleButtonBuilder.kt index e3ca942fb6..82f6cee41c 100644 --- a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ToggleButtonBuilder.kt +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/ToggleButtonBuilder.kt @@ -2,6 +2,7 @@ package org.hexworks.zircon.api.builder.component import org.hexworks.zircon.api.component.ToggleButton import org.hexworks.zircon.api.component.builder.base.BaseComponentBuilder +import org.hexworks.zircon.internal.dsl.ZirconDsl import org.hexworks.zircon.internal.component.impl.DefaultToggleButton import org.hexworks.zircon.internal.component.renderer.DefaultToggleButtonRenderer import org.hexworks.zircon.internal.component.withNewLinesStripped @@ -9,6 +10,7 @@ import kotlin.jvm.JvmStatic import kotlin.math.max @Suppress("UNCHECKED_CAST") +@ZirconDsl class ToggleButtonBuilder( private var text: String = "", private var isSelected: Boolean = false diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/VBoxBuilder.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/VBoxBuilder.kt index a5c264afd4..c849c9391d 100644 --- a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/VBoxBuilder.kt +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/VBoxBuilder.kt @@ -2,11 +2,13 @@ package org.hexworks.zircon.api.builder.component import org.hexworks.zircon.api.component.VBox import org.hexworks.zircon.api.component.builder.base.BaseComponentBuilder +import org.hexworks.zircon.internal.dsl.ZirconDsl import org.hexworks.zircon.internal.component.impl.DefaultVBox import org.hexworks.zircon.internal.component.renderer.DefaultVBoxRenderer import kotlin.jvm.JvmStatic @Suppress("UNCHECKED_CAST") +@ZirconDsl class VBoxBuilder( private var spacing: Int = 0 ) : BaseComponentBuilder( diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/VerticalNumberInputBuilder.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/VerticalNumberInputBuilder.kt index a584cbf715..01b2196422 100644 --- a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/VerticalNumberInputBuilder.kt +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/VerticalNumberInputBuilder.kt @@ -3,12 +3,14 @@ package org.hexworks.zircon.api.builder.component import org.hexworks.zircon.api.component.NumberInput import org.hexworks.zircon.api.component.builder.base.BaseComponentBuilder import org.hexworks.zircon.api.component.renderer.ComponentRenderer +import org.hexworks.zircon.internal.dsl.ZirconDsl import org.hexworks.zircon.internal.component.impl.DefaultVerticalNumberInput import org.hexworks.zircon.internal.component.renderer.DefaultVerticalNumberInputRenderer import kotlin.jvm.JvmStatic import kotlin.math.max @Suppress("UNCHECKED_CAST") +@ZirconDsl class VerticalNumberInputBuilder( val height: Int, private var initialValue: Int = 0, diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/VerticalScrollBarBuilder.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/VerticalScrollBarBuilder.kt index 769b5c3b4b..a4a31706f8 100644 --- a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/VerticalScrollBarBuilder.kt +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/VerticalScrollBarBuilder.kt @@ -2,6 +2,7 @@ package org.hexworks.zircon.api.builder.component import org.hexworks.zircon.api.component.ScrollBar import org.hexworks.zircon.api.component.builder.base.BaseComponentBuilder +import org.hexworks.zircon.internal.dsl.ZirconDsl import org.hexworks.zircon.internal.component.impl.DefaultVerticalScrollBar import org.hexworks.zircon.internal.component.renderer.VerticalScrollBarRenderer import kotlin.jvm.JvmStatic @@ -12,6 +13,7 @@ import kotlin.jvm.JvmStatic * - [minValue]: `0` * - [maxValue]: `100` */ +@ZirconDsl class VerticalScrollBarBuilder( private var minValue: Int = 0, private var maxValue: Int = 100 diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/VerticalSliderBuilder.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/VerticalSliderBuilder.kt index cf46324a08..7c88849db7 100644 --- a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/VerticalSliderBuilder.kt +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/builder/component/VerticalSliderBuilder.kt @@ -2,6 +2,7 @@ package org.hexworks.zircon.api.builder.component import org.hexworks.zircon.api.component.Slider import org.hexworks.zircon.api.component.builder.base.BaseComponentBuilder +import org.hexworks.zircon.internal.dsl.ZirconDsl import org.hexworks.zircon.internal.component.impl.DefaultVerticalSlider import org.hexworks.zircon.internal.component.renderer.VerticalSliderRenderer import kotlin.jvm.JvmStatic @@ -14,6 +15,7 @@ import kotlin.math.max * - [maxValue]: `100` * - [numberOfSteps]: `10` */ +@ZirconDsl class VerticalSliderBuilder( private var minValue: Int = 0, private var maxValue: Int = 100, diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/ButtonDsl.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/ButtonDsl.kt new file mode 100644 index 0000000000..0bf0360426 --- /dev/null +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/ButtonDsl.kt @@ -0,0 +1,7 @@ +package org.hexworks.zircon.api.dsl.component + +import org.hexworks.zircon.api.builder.component.ButtonBuilder +import org.hexworks.zircon.api.component.Button + +fun button(init: ButtonBuilder.() -> Unit): Button = + ButtonBuilder().apply(init).build() diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/CheckBoxDsl.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/CheckBoxDsl.kt new file mode 100644 index 0000000000..4970fa5f3c --- /dev/null +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/CheckBoxDsl.kt @@ -0,0 +1,11 @@ +package org.hexworks.zircon.api.dsl.component + +import org.hexworks.zircon.api.builder.component.CheckBoxBuilder +import org.hexworks.zircon.api.component.CheckBox +import org.hexworks.zircon.internal.component.impl.DefaultCheckBox + +fun checkBox( + labelAlignment: DefaultCheckBox.CheckBoxAlignment = DefaultCheckBox.CheckBoxAlignment.RIGHT, + init: CheckBoxBuilder.() -> Unit +): CheckBox = + CheckBoxBuilder(labelAlignment = labelAlignment).apply(init).build() \ No newline at end of file diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/ColorThemeDsl.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/ColorThemeDsl.kt new file mode 100644 index 0000000000..06c458693d --- /dev/null +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/ColorThemeDsl.kt @@ -0,0 +1,7 @@ +package org.hexworks.zircon.api.dsl.component + +import org.hexworks.zircon.api.builder.component.ColorThemeBuilder +import org.hexworks.zircon.api.component.ColorTheme + +fun colorTheme(init: ColorThemeBuilder.() -> Unit): ColorTheme = + ColorThemeBuilder().apply(init).build() \ No newline at end of file diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/ComponentStyleSetDsl.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/ComponentStyleSetDsl.kt new file mode 100644 index 0000000000..3dd1b4fbcd --- /dev/null +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/ComponentStyleSetDsl.kt @@ -0,0 +1,7 @@ +package org.hexworks.zircon.api.dsl.component + +import org.hexworks.zircon.api.builder.component.ComponentStyleSetBuilder +import org.hexworks.zircon.api.component.ComponentStyleSet + +fun componentStyleSet(init: ComponentStyleSetBuilder.() -> Unit): ComponentStyleSet = + ComponentStyleSetBuilder().apply(init).build() diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/GroupDsl.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/GroupDsl.kt new file mode 100644 index 0000000000..602d2770db --- /dev/null +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/GroupDsl.kt @@ -0,0 +1,8 @@ +package org.hexworks.zircon.api.dsl.component + +import org.hexworks.zircon.api.builder.component.GroupBuilder +import org.hexworks.zircon.api.component.Component +import org.hexworks.zircon.api.component.Group + +fun group(init: GroupBuilder.() -> Unit): Group = + GroupBuilder().apply(init).build() diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/HBoxDsl.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/HBoxDsl.kt new file mode 100644 index 0000000000..ab5aba1f07 --- /dev/null +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/HBoxDsl.kt @@ -0,0 +1,7 @@ +package org.hexworks.zircon.api.dsl.component + +import org.hexworks.zircon.api.builder.component.HBoxBuilder +import org.hexworks.zircon.api.component.HBox + +fun hBox(init: HBoxBuilder.() -> Unit): HBox = + HBoxBuilder().apply(init).build() \ No newline at end of file diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/HeaderDsl.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/HeaderDsl.kt new file mode 100644 index 0000000000..e449ec939e --- /dev/null +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/HeaderDsl.kt @@ -0,0 +1,7 @@ +package org.hexworks.zircon.api.dsl.component + +import org.hexworks.zircon.api.builder.component.HeaderBuilder +import org.hexworks.zircon.api.component.Header + +fun header(init: HeaderBuilder.() -> Unit): Header = + HeaderBuilder().apply(init).build() \ No newline at end of file diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/HorizontalNumberInputDsl.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/HorizontalNumberInputDsl.kt new file mode 100644 index 0000000000..d79cc15b0a --- /dev/null +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/HorizontalNumberInputDsl.kt @@ -0,0 +1,10 @@ +package org.hexworks.zircon.api.dsl.component + +import org.hexworks.zircon.api.builder.component.HorizontalNumberInputBuilder +import org.hexworks.zircon.api.component.NumberInput + +fun horizontalNumberInput( + width: Int, + init: HorizontalNumberInputBuilder.() -> Unit +): NumberInput = + HorizontalNumberInputBuilder(width).apply(init).build() diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/HorizontalScrollBarDsl.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/HorizontalScrollBarDsl.kt new file mode 100644 index 0000000000..b073925e5c --- /dev/null +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/HorizontalScrollBarDsl.kt @@ -0,0 +1,11 @@ +package org.hexworks.zircon.api.dsl.component + +import org.hexworks.zircon.api.builder.component.HorizontalScrollBarBuilder +import org.hexworks.zircon.api.component.ScrollBar + +fun horizontalScrollBar( + minValue: Int = 0, + maxValue: Int = 100, + init: HorizontalScrollBarBuilder.() -> Unit +): ScrollBar = + HorizontalScrollBarBuilder(minValue, maxValue).apply(init).build() \ No newline at end of file diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/HorizontalSliderDsl.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/HorizontalSliderDsl.kt new file mode 100644 index 0000000000..861530757f --- /dev/null +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/HorizontalSliderDsl.kt @@ -0,0 +1,7 @@ +package org.hexworks.zircon.api.dsl.component + +import org.hexworks.zircon.api.builder.component.HorizontalSliderBuilder +import org.hexworks.zircon.api.component.Slider + +fun horizontalSlider(init: HorizontalSliderBuilder.() -> Unit): Slider = + HorizontalSliderBuilder().apply(init).build() \ No newline at end of file diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/IconDsl.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/IconDsl.kt new file mode 100644 index 0000000000..369d77ccdb --- /dev/null +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/IconDsl.kt @@ -0,0 +1,13 @@ +package org.hexworks.zircon.api.dsl.component + +import org.hexworks.zircon.api.builder.component.IconBuilder +import org.hexworks.zircon.api.builder.data.TileBuilder +import org.hexworks.zircon.api.component.Icon + +fun icon(init: IconBuilder.() -> Unit): Icon = + IconBuilder().apply(init).build() + +fun IconBuilder.iconTile(init: TileBuilder.() -> Unit) = + withIcon( + TileBuilder().apply(init).build() + ) \ No newline at end of file diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/LabelDsl.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/LabelDsl.kt new file mode 100644 index 0000000000..be0dd837c5 --- /dev/null +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/LabelDsl.kt @@ -0,0 +1,7 @@ +package org.hexworks.zircon.api.dsl.component + +import org.hexworks.zircon.api.builder.component.LabelBuilder +import org.hexworks.zircon.api.component.Label + +fun label(init: LabelBuilder.() -> Unit): Label = + LabelBuilder().apply(init).build() \ No newline at end of file diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/ListItemDsl.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/ListItemDsl.kt new file mode 100644 index 0000000000..918a00d5f1 --- /dev/null +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/ListItemDsl.kt @@ -0,0 +1,7 @@ +package org.hexworks.zircon.api.dsl.component + +import org.hexworks.zircon.api.builder.component.ListItemBuilder +import org.hexworks.zircon.api.component.ListItem + +fun listItem(init: ListItemBuilder.() -> Unit): ListItem = + ListItemBuilder().apply(init).build() \ No newline at end of file diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/LogAreaDsl.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/LogAreaDsl.kt new file mode 100644 index 0000000000..a62bbb4e10 --- /dev/null +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/LogAreaDsl.kt @@ -0,0 +1,7 @@ +package org.hexworks.zircon.api.dsl.component + +import org.hexworks.zircon.api.builder.component.LogAreaBuilder +import org.hexworks.zircon.api.component.LogArea + +fun logArea(init: LogAreaBuilder.() -> Unit): LogArea = + LogAreaBuilder().apply(init).build() \ No newline at end of file diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/ModalDsl.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/ModalDsl.kt new file mode 100644 index 0000000000..b58738a6b3 --- /dev/null +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/ModalDsl.kt @@ -0,0 +1,15 @@ +package org.hexworks.zircon.api.dsl.component + +import org.hexworks.zircon.api.builder.component.ModalBuilder +import org.hexworks.zircon.api.component.Component +import org.hexworks.zircon.api.component.modal.Modal +import org.hexworks.zircon.api.component.modal.ModalResult + +fun modal(init: ModalBuilder.() -> Unit): Modal = + ModalBuilder().apply(init).build() + +fun ModalBuilder.component(init: () -> Component) { + withComponent( + init() + ) +} \ No newline at end of file diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/PanelDsl.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/PanelDsl.kt new file mode 100644 index 0000000000..e54be01216 --- /dev/null +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/PanelDsl.kt @@ -0,0 +1,8 @@ +package org.hexworks.zircon.api.dsl.component + +import org.hexworks.zircon.api.builder.component.PanelBuilder +import org.hexworks.zircon.api.component.Panel + +fun panel(): Panel = + PanelBuilder().build() + diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/ParagraphDsl.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/ParagraphDsl.kt new file mode 100644 index 0000000000..3f3813a3e8 --- /dev/null +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/ParagraphDsl.kt @@ -0,0 +1,7 @@ +package org.hexworks.zircon.api.dsl.component + +import org.hexworks.zircon.api.builder.component.ParagraphBuilder +import org.hexworks.zircon.api.component.Paragraph + +fun paragraph(init: ParagraphBuilder.() -> Unit): Paragraph = + ParagraphBuilder().apply(init).build() \ No newline at end of file diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/ProgressBarDsl.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/ProgressBarDsl.kt new file mode 100644 index 0000000000..3100c3337d --- /dev/null +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/ProgressBarDsl.kt @@ -0,0 +1,7 @@ +package org.hexworks.zircon.api.dsl.component + +import org.hexworks.zircon.api.builder.component.ProgressBarBuilder +import org.hexworks.zircon.api.component.ProgressBar + +fun progressBar(init: ProgressBarBuilder.() -> Unit): ProgressBar = + ProgressBarBuilder().apply(init).build() diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/RadioButtonDsl.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/RadioButtonDsl.kt new file mode 100644 index 0000000000..a3239991d0 --- /dev/null +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/RadioButtonDsl.kt @@ -0,0 +1,7 @@ +package org.hexworks.zircon.api.dsl.component + +import org.hexworks.zircon.api.builder.component.RadioButtonBuilder +import org.hexworks.zircon.api.component.RadioButton + +fun radioButton(init: RadioButtonBuilder.() -> Unit): RadioButton = + RadioButtonBuilder().apply(init).build() \ No newline at end of file diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/RadioButtonGroupDsl.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/RadioButtonGroupDsl.kt new file mode 100644 index 0000000000..25e589d870 --- /dev/null +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/RadioButtonGroupDsl.kt @@ -0,0 +1,7 @@ +package org.hexworks.zircon.api.dsl.component + +import org.hexworks.zircon.api.builder.component.RadioButtonGroupBuilder +import org.hexworks.zircon.api.component.RadioButtonGroup + +fun radioButtonGroup(init: RadioButtonGroupBuilder.() -> Unit): RadioButtonGroup = + RadioButtonGroupBuilder().apply(init).build() \ No newline at end of file diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/TextAreaDsl.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/TextAreaDsl.kt new file mode 100644 index 0000000000..c9971f4702 --- /dev/null +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/TextAreaDsl.kt @@ -0,0 +1,7 @@ +package org.hexworks.zircon.api.dsl.component + +import org.hexworks.zircon.api.builder.component.TextAreaBuilder +import org.hexworks.zircon.api.component.TextArea + +fun textArea(init: TextAreaBuilder.() -> Unit): TextArea = + TextAreaBuilder().apply(init).build() \ No newline at end of file diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/TextBoxDsl.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/TextBoxDsl.kt new file mode 100644 index 0000000000..8b0fc36327 --- /dev/null +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/TextBoxDsl.kt @@ -0,0 +1,21 @@ +package org.hexworks.zircon.api.dsl.component + +import org.hexworks.zircon.api.builder.component.ParagraphBuilder +import org.hexworks.zircon.api.builder.component.TextBoxBuilder +import org.hexworks.zircon.api.component.Component +import org.hexworks.zircon.api.component.TextBox +import org.hexworks.zircon.api.data.Position + +fun textBox( + initialContentWidth: Int, + nextPosition: Position = Position.defaultPosition(), + components: MutableList = mutableListOf(), + init: TextBoxBuilder.() -> Unit +): TextBox = + TextBoxBuilder(initialContentWidth, nextPosition, components).apply(init).build() + +fun TextBoxBuilder.paragraph(withNewLine: Boolean = true, init: ParagraphBuilder.() -> Unit) = + addParagraph(ParagraphBuilder().apply(init).build(), withNewLine) + +fun TextBoxBuilder.inlineComponent(init: () -> Component) = + addInlineComponent(init()) diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/ToggleButtonDsl.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/ToggleButtonDsl.kt new file mode 100644 index 0000000000..84f5c45296 --- /dev/null +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/ToggleButtonDsl.kt @@ -0,0 +1,7 @@ +package org.hexworks.zircon.api.dsl.component + +import org.hexworks.zircon.api.builder.component.ToggleButtonBuilder +import org.hexworks.zircon.api.component.ToggleButton + +fun toggleButton(init: ToggleButtonBuilder.() -> Unit): ToggleButton = + ToggleButtonBuilder().apply(init).build() \ No newline at end of file diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/VBoxDsl.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/VBoxDsl.kt new file mode 100644 index 0000000000..6720a0da4a --- /dev/null +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/VBoxDsl.kt @@ -0,0 +1,7 @@ +package org.hexworks.zircon.api.dsl.component + +import org.hexworks.zircon.api.builder.component.VBoxBuilder +import org.hexworks.zircon.api.component.VBox + +fun vBox(init: VBoxBuilder.() -> Unit): VBox = + VBoxBuilder().apply(init).build() \ No newline at end of file diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/VerticalNumberInputDsl.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/VerticalNumberInputDsl.kt new file mode 100644 index 0000000000..c186fd9194 --- /dev/null +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/VerticalNumberInputDsl.kt @@ -0,0 +1,7 @@ +package org.hexworks.zircon.api.dsl.component + +import org.hexworks.zircon.api.builder.component.VerticalNumberInputBuilder +import org.hexworks.zircon.api.component.NumberInput + +fun verticalNumberInput(height: Int, init: VerticalNumberInputBuilder.() -> Unit): NumberInput = + VerticalNumberInputBuilder(height).apply(init).build() \ No newline at end of file diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/VerticalScrollBarDsl.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/VerticalScrollBarDsl.kt new file mode 100644 index 0000000000..dd046ac1aa --- /dev/null +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/VerticalScrollBarDsl.kt @@ -0,0 +1,11 @@ +package org.hexworks.zircon.api.dsl.component + +import org.hexworks.zircon.api.builder.component.VerticalScrollBarBuilder +import org.hexworks.zircon.api.component.ScrollBar + +fun verticalScrollBar( + minValue: Int = 0, + maxValue: Int = 100, + init: VerticalScrollBarBuilder.() -> Unit +): ScrollBar = + VerticalScrollBarBuilder(minValue, maxValue).apply(init).build() \ No newline at end of file diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/VerticalSliderDsl.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/VerticalSliderDsl.kt new file mode 100644 index 0000000000..1955c894d3 --- /dev/null +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/api/dsl/component/VerticalSliderDsl.kt @@ -0,0 +1,7 @@ +package org.hexworks.zircon.api.dsl.component + +import org.hexworks.zircon.api.builder.component.VerticalSliderBuilder +import org.hexworks.zircon.api.component.Slider + +fun verticalSlider(init: VerticalSliderBuilder.() -> Unit): Slider = + VerticalSliderBuilder().apply(init).build() \ No newline at end of file diff --git a/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/internal/dsl/ZirconDsl.kt b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/internal/dsl/ZirconDsl.kt new file mode 100644 index 0000000000..e07331d037 --- /dev/null +++ b/zircon.core/src/commonMain/kotlin/org/hexworks/zircon/internal/dsl/ZirconDsl.kt @@ -0,0 +1,4 @@ +package org.hexworks.zircon.internal.dsl + +@DslMarker +annotation class ZirconDsl \ No newline at end of file