| 5 | namespace recompui { |
| 6 | |
| 7 | void TextInput::process_event(const Event &e) { |
| 8 | switch (e.type) { |
| 9 | case EventType::Text: { |
| 10 | const EventText &event = std::get<EventText>(e.variant); |
| 11 | text = event.text; |
| 12 | |
| 13 | for (const auto &function : text_changed_callbacks) { |
| 14 | function(text); |
| 15 | } |
| 16 | |
| 17 | break; |
| 18 | } |
| 19 | case EventType::Focus: { |
| 20 | const EventFocus &event = std::get<EventFocus>(e.variant); |
| 21 | if (focus_callback != nullptr) { |
| 22 | focus_callback(event.active); |
| 23 | } |
| 24 | break; |
| 25 | } |
| 26 | default: |
| 27 | break; |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | TextInput::TextInput(Element *parent, bool text_visible) : Element(parent, Events(EventType::Text, EventType::Focus), "input") { |
| 32 | if (!text_visible) { |
nothing calls this directly
no outgoing calls
no test coverage detected