add tick and on_tick event, fix unsaved document prompt, implement TextInput blinking cursor

This commit is contained in:
2018-10-08 01:00:49 +02:00
parent e2069fadca
commit c9c7b9f1c4
19 changed files with 226 additions and 46 deletions

View File

@@ -21,5 +21,26 @@ void NodeMessageBox::init()
btn_ok = m_template->find<NodeButton>("btn-ok");
btn_ok->on_click = [&](Node*) { destroy(); };
btn_cancel = m_template->find<NodeButton>("btn-cancel");
btn_cancel->on_click = [&](Node*) { destroy(); };
on_submit = btn_cancel->on_click = [&](Node*) { destroy(); };
}
kEventResult NodeMessageBox::handle_event(Event* e)
{
Node::handle_event(e);
auto ke = (KeyEvent*)e;
switch (e->m_type)
{
case kEventType::KeyDown:
break;
case kEventType::KeyUp:
if (ke->m_key == kKey::KeyEnter && on_submit)
on_submit(this);
break;
case kEventType::KeyChar:
break;
default:
return kEventResult::Available;
break;
}
return kEventResult::Consumed;
}