| 208 | } |
| 209 | |
| 210 | struct AsyncTextField : TextField { |
| 211 | AsyncTextInput* dialog; |
| 212 | std::function<void(char*)> action; |
| 213 | void onSelectKey(const SelectKeyEvent& e) override { |
| 214 | if (e.key == GLFW_KEY_ENTER || e.key == GLFW_KEY_KP_ENTER) |
| 215 | { |
| 216 | e.consume(this); |
| 217 | action(strdup(text.c_str())); |
| 218 | dialog->getParent()->requestDelete(); |
| 219 | return; |
| 220 | } |
| 221 | TextField::onSelectKey(e); |
| 222 | } |
| 223 | void step() override { |
| 224 | APP->event->setSelectedWidget(this); |
| 225 | TextField::step(); |
| 226 | } |
| 227 | }; |
| 228 | AsyncTextField* const textField = new AsyncTextField; |
| 229 | textField->box.size.x = contentLayout->box.size.x - (label != nullptr ? label->box.size.x + margin : 0); |
| 230 | textField->box.size.y = 24; |
nothing calls this directly
no outgoing calls
no test coverage detected