init {
screen := {"widgets": {"001": {"type": "button", "text": "OK", "state": 0},
"002": {"type": "textInput", "text": "", "state": 0}},
"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 SetX(wid: Str) {
in screen.widgets.{wid}.x(curX: Int, setX(nextX)) = nextX
}
native channel SetY(wid: Str) {
in screen.widgets.{wid}.y(curY: Int, setY(nextY)) = nextY
}
native channel SetWidth(wid: Str) {
in screen.widgets.{wid}.width(curWidth: Int, setWidth(nextWidth)) = nextWidth
}
native channel SetHeight(wid: Str) {
in screen.widgets.{wid}.height(curHeight: Int, setHeight(nextHeight)) = nextHeight
}
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 ChangeLayout {
out screen.layout(curLayout: Bool, changeLayout(layout)) = layout
}
channel ChangeX(wid: Str) {
out screen.widgets.{wid}.x(curX: Int, changeX(x)) = x
}
channel ChangeY(wid: Str) {
out screen.widgets.{wid}.y(curY: Int, changeY(y)) = y
}
channel AddButton {
out screen.widgets(widgets: Map, addButton(wid: Str, text: Str)) = insert(widgets, wid, {"type": "button", "text": text, "state": 0})
}
channel AddLabel {
out screen.widgets(widgets: Map, addLabel(wid: Str, text: Str)) = insert(widgets, wid, {"type": "label", "text": text, "state": 0})
}
channel AddTextInput {
out screen.widgets(widgets: Map, addTextInput(wid: Str)) = insert(widgets, wid, {"type": "textInput", "text": "", "state": 0})
}
channel AddMovableButton {
out screen.widgets(widgets: Map, addMovableButton(wid: Str, text: Str, x: Int, y: Int, width: Int, height: Int)) = insert(widgets, wid, {"type": "button", "text": text, "x": x, "y": y, "width": width, "height": height, "state": 0})
}
channel AddMovableLabel {
out screen.widgets(widgets: Map, addMovableLabel(wid: Str, text: Str, x: Int, y: Int, width: Int, height: Int)) = insert(widgets, wid, {"type": "label", "text": text, "x": x, "y": y, "width": width, "height": height, "state": 0})
}
channel AddMovableTextInput {
out screen.widgets(widgets: Map, addMovableTextInput(wid: Str, x: Int, y: Int, width: Int, height: Int)) = insert(widgets, wid, {"type": "textInput", "text": "", "x": x, "y": y, "width": width, "height": height, "state": 0})
}