pioneerspacesim/pioneer — pull request #1634 by robn (2012-10-26 04:17:40+00:00)
Title: New UI: Text entry widget

A nice little single-line text entry widget. Has support for basic text entry and simple control keys (backspace/enter/left/right/home/end/^W/^U). Change (for per-character changes) and Enter (for text entered) events are exposed. Of course the whole thing is available from Lua.

There's a few infrastructure bits required to make this work:

* Concept of "selectable" widgets. There can be zero or one selected widget at any given time. Clicking a selectable widget selects it and deselects the previous one. `Keypress` events are sent to the selected widget.
* `KeyPress` event. This was actually already listed in `Widget.h`, but never implemented. `KeyPress` fires alongside `KeyDown`, but it goes to the selected widget and the event repeats if the key is held down.
* Bugfix in `Context::DrawWidget` that was breaking draw offsets when the widget had a non-zero position.