!26 remove clone & core_include/widgets_include; support keyboard input

This commit is contained in:
idea4good
2019-12-30 18:14:23 +08:00
parent 22772768c1
commit 2ceb913448
21 changed files with 356 additions and 826 deletions

View File

@@ -84,10 +84,34 @@ void c_list_box::on_paint()
}
}
bool c_list_box::on_touch(int x, int y, TOUCH_ACTION action)
void c_list_box::on_key(KEY_TYPE key)
{
switch (key)
{
case KEY_ENTER:
on_touch(m_wnd_rect.m_left, m_wnd_rect.m_top, TOUCH_DOWN);
on_touch(m_wnd_rect.m_left, m_wnd_rect.m_top, TOUCH_UP);
return;
case KEY_BACKWARD:
if (m_status != STATUS_PUSHED)
{
return c_wnd::on_key(key);
}
m_selected_item = (m_selected_item > 0) ? (m_selected_item - 1) : m_selected_item;
return show_list();
case KEY_FORWARD:
if (m_status != STATUS_PUSHED)
{
return c_wnd::on_key(key);
}
m_selected_item = (m_selected_item < (m_item_total - 1)) ? (m_selected_item + 1) : m_selected_item;
return show_list();
}
}
void c_list_box::on_touch(int x, int y, TOUCH_ACTION action)
{
(action == TOUCH_DOWN) ? on_touch_down(x, y) : on_touch_up(x, y);
return true;
}
void c_list_box::on_touch_down(int x, int y)