Window -> Text -> Button -> Input Component # Properties coords: vec size: vec children: [Component] # Methods inbounds(x,y): -> boolean # Implemented by subclasses. onclick(x,y): -> halt | cont onkey(key): -> halt | cont Text extends Component # Properties content: string children: nil # Implementations onclick(_,_): -> cont onkey(_) -> cont Image extends Component # Properties data: binary children: nil # Implementations onclick(_,_): -> cont onkey(_): -> cont Button extends Component # Properties mousedown: function keydown: function children: [Text|Image] # Implementations onclick(x,y) -> inbounds(x,y) ? call mousedown; halt : cont onkey(key) -> call keydown ? halt : cont Input extends Component # Properties value: string focus: boolean children: nil # Implementations onclick(x,y): -> inbounds(x,y) ? focus = true; halt : cont onkey(key): -> focus ? value += key; halt : cont