textbox {
    background_color = rgb(200, 200, 200),
    border_width = border_width(2.0, 2.0),
    border = border(bside("#000000", "solid")),
    can_focus = true,
    layout = "center",

    on_mouse_up = "ui.textbox#node:focus()",
    on_focus = "ui.textbox#focused(node)",
    on_unfocus = "ui.textbox#unfocused(node)",
    on_update = "ui.textbox#update(node, evt.delta)",
    on_char_input = "ui.textbox#
        local txt = node:query():text():matches()(nil, nil)

        local c = string.char(evt.input);

        local match = node:get_property_string('filter')
        if match ~= nil then
            local found = string.find(c, match)
            if found == nil then
                return true
            end
        end

        txt.text = txt.text .. c
        return true
    ",
    on_key_up = "ui.textbox#return key_up(node, evt)",
    on_key_down = "ui.textbox#return key_down(node, evt)",
}

textbox(focused=true) {
    background_color = rgb(255, 255, 255),
    border = border(bside("#CCCC00", "solid")),
    shadow = shadow(0.0, 0.0, rgba(255, 255, 0, 0.5), 16.0, 0.0, "outset"),
}

textbox > content {
    layout = "lined",
    line_height = 36,
}

textbox > content > @text {
    font_size = 30,
    font_color = rgb(0, 0, 0),
}

textbox > content > cursor {
    width = 2,
    height = 20,
    background_color = rgb(0, 0, 0),
}
