mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-12-25 16:57:20 +00:00
sync with RTGUI c074ff2898b9e
Full log is in GitHub. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2222 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
@@ -301,12 +301,16 @@ void rtgui_notebook_set_current_by_index(struct rtgui_notebook* notebook, rt_uin
|
||||
|
||||
if ((index < notebook->count) && (notebook->current != index))
|
||||
{
|
||||
struct rtgui_widget *widget;
|
||||
|
||||
if (notebook->current != RTGUI_NOT_FOUND)
|
||||
rtgui_widget_hide(notebook->childs[notebook->current].widget);
|
||||
|
||||
notebook->current = index;
|
||||
rtgui_widget_show(notebook->childs[notebook->current].widget);
|
||||
rtgui_widget_update(notebook->childs[notebook->current].widget);
|
||||
widget = notebook->childs[notebook->current].widget;
|
||||
rtgui_widget_show(widget);
|
||||
rtgui_widget_update(widget);
|
||||
rtgui_widget_focus(widget);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -319,6 +323,16 @@ struct rtgui_widget* rtgui_notebook_get_widget_at(struct rtgui_notebook* noteboo
|
||||
return RT_NULL;
|
||||
}
|
||||
|
||||
static rt_bool_t _rtgui_notebook_current_widget_handle(struct rtgui_notebook *notebook,
|
||||
struct rtgui_event *event)
|
||||
{
|
||||
struct rtgui_widget *widget = rtgui_notebook_get_current(notebook);
|
||||
if (widget && widget != RTGUI_WIDGET(notebook))
|
||||
return RTGUI_OBJECT(widget)->event_handler(RTGUI_OBJECT(widget), event);
|
||||
else
|
||||
return RT_FALSE;
|
||||
}
|
||||
|
||||
rt_bool_t rtgui_notebook_event_handler(struct rtgui_object* object, struct rtgui_event* event)
|
||||
{
|
||||
struct rtgui_notebook* notebook;
|
||||
@@ -336,17 +350,18 @@ rt_bool_t rtgui_notebook_event_handler(struct rtgui_object* object, struct rtgui
|
||||
case RTGUI_EVENT_MOUSE_BUTTON:
|
||||
_rtgui_notebook_onmouse(notebook, (struct rtgui_event_mouse*)event);
|
||||
break;
|
||||
case RTGUI_EVENT_SHOW:
|
||||
/* show myself */
|
||||
rtgui_widget_onshow(object, event);
|
||||
/* show the tab widget */
|
||||
return _rtgui_notebook_current_widget_handle(notebook, event);
|
||||
case RTGUI_EVENT_HIDE:
|
||||
/* hide myself */
|
||||
rtgui_widget_onhide(object, event);
|
||||
/* hide the tab widget */
|
||||
return _rtgui_notebook_current_widget_handle(notebook, event);
|
||||
case RTGUI_EVENT_KBD:
|
||||
if (notebook->current != RTGUI_NOT_FOUND)
|
||||
{
|
||||
if (RTGUI_OBJECT(notebook->childs[notebook->current].widget
|
||||
)->event_handler != RT_NULL)
|
||||
return RTGUI_OBJECT(notebook->childs[notebook->current].widget
|
||||
)->event_handler(
|
||||
RTGUI_OBJECT(notebook->childs[notebook->current].widget),
|
||||
event);
|
||||
}
|
||||
break;
|
||||
return _rtgui_notebook_current_widget_handle(notebook, event);
|
||||
default:
|
||||
/* use parent event handler */
|
||||
return rtgui_widget_event_handler(object, event);
|
||||
|
||||
Reference in New Issue
Block a user