MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / AsyncTextField

Class AsyncTextField

src/AsyncDialog.cpp:210–227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected