Newer
Older
DTRAMServer / models / sample.model

init {
screen := {
    "widgets": {
        "0dbaeeb89bf349748ef4f7fc1388fe19": {
            "type": "button",
            "text": "ボタン",
            "state": 0,
            "x": 193.1903429031372,
            "y": 73,
            "width": 96.875,
            "height": 37.79829406738281
        },
        "b92b875fe3e442118e512e854fdf6dad": {
            "type": "textInput",
            "text": "入力欄",
            "state": 0,
            "x": 178.1903429031372,
            "y": 175.79261016845703,
            "width": 96.875,
            "height": 37.79829406738281
        },
        "47b39829ea8d4949940695f019439711": {
            "type": "label",
            "text": "テキストラベル",
            "state": 0,
            "x": 276.1903429031372,
            "y": 338.5852279663086,
            "width": 96.875,
            "height": 57.79829406738281
        }
    },
    "layout": true
}
}

native channel ScreenUpdate {
	in screen(curSc: Json, update(curSc, nextSc)) = nextSc
}

native channel SetLayout {
	in screen.layout(curLayout: Bool, setLayout(nextLayout)) = nextLayout
}

native channel SetVisible(wid: Str) {
	in screen.widgets.{wid}.visible(curVisible: Bool, setVisible(nextVisible)) = nextVisible
}

native channel SetText(wid: Str) {
	in screen.widgets.{wid}.text(curText: Str, setText(nextText)) = nextText
}

native channel MouseEvent(wid: Str) {
	out screen.widgets.{wid}.state(curState: Int, mouseEvent(nextState)) = nextState
}

native channel TextEvent(wid: Str) {
	out screen.widgets.{wid}.text(curText: Str, textEvent(nextText)) = nextText
}

channel AddTextInput {
	out screen.widgets(widgets: Map, addTextInput(wid: Str)) = insert(widgets, wid, {"type": "textInput", "text": "", "state": 0})
}