mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-24 05:04:10 +08:00
sync with github bd3351e572
As always, full log is in GitHub. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2234 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
@@ -231,6 +231,8 @@ void rtgui_notebook_add(struct rtgui_notebook* notebook, const char* label, stru
|
||||
void rtgui_notebook_remove(struct rtgui_notebook* notebook, rt_uint16_t index)
|
||||
{
|
||||
struct rtgui_notebook_tab tab;
|
||||
rt_bool_t need_update = RT_FALSE;
|
||||
|
||||
RT_ASSERT(notebook != RT_NULL);
|
||||
|
||||
if (index < notebook->count)
|
||||
@@ -244,8 +246,11 @@ void rtgui_notebook_remove(struct rtgui_notebook* notebook, rt_uint16_t index)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (notebook->current == index)
|
||||
need_update = RT_TRUE;
|
||||
|
||||
tab = notebook->childs[index];
|
||||
for (;index < notebook->count - 1; index ++)
|
||||
for (;index < notebook->count - 1; index++)
|
||||
{
|
||||
notebook->childs[index] = notebook->childs[index + 1];
|
||||
}
|
||||
@@ -255,16 +260,17 @@ void rtgui_notebook_remove(struct rtgui_notebook* notebook, rt_uint16_t index)
|
||||
sizeof(struct rtgui_notebook_tab) * notebook->count);
|
||||
}
|
||||
|
||||
// FIXME: do we really want to destroy it?
|
||||
rtgui_widget_destroy(tab.widget);
|
||||
rtgui_free(tab.title);
|
||||
|
||||
if (notebook->current == index)
|
||||
if (need_update)
|
||||
{
|
||||
/* update tab */
|
||||
if (notebook->current > notebook->count - 1)
|
||||
notebook->current = notebook->count - 1;
|
||||
|
||||
rtgui_widget_hide(tab.widget);
|
||||
rtgui_widget_show(notebook->childs[notebook->current].widget);
|
||||
rtgui_widget_update(RTGUI_WIDGET(notebook));
|
||||
rtgui_widget_set_parent(tab.widget, RT_NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ static void _rtgui_widget_destructor(rtgui_widget_t *widget)
|
||||
{
|
||||
if (widget == RT_NULL) return;
|
||||
|
||||
if (widget->parent != RT_NULL)
|
||||
if (widget->parent != RT_NULL && RTGUI_IS_CONTAINER(widget->parent))
|
||||
{
|
||||
/* remove widget from parent's children list */
|
||||
rtgui_list_remove(&(RTGUI_CONTAINER(widget->parent)->children), &(widget->sibling));
|
||||
@@ -413,8 +413,7 @@ rt_bool_t rtgui_widget_onupdate_toplvl(struct rtgui_object *object, struct rtgui
|
||||
|
||||
rt_bool_t rtgui_widget_event_handler(struct rtgui_object* object, rtgui_event_t* event)
|
||||
{
|
||||
RT_ASSERT(object != RT_NULL);
|
||||
RT_ASSERT(event != RT_NULL);
|
||||
RTGUI_WIDGET_EVENT_HANDLER_PREPARE;
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
@@ -538,9 +537,10 @@ rt_bool_t rtgui_widget_onshow(struct rtgui_object *object, struct rtgui_event *e
|
||||
{
|
||||
struct rtgui_widget *widget = RTGUI_WIDGET(object);
|
||||
|
||||
/* update the clip info of widget */
|
||||
if (!RTGUI_WIDGET_IS_HIDE(RTGUI_WIDGET(object)))
|
||||
return RT_FALSE;
|
||||
|
||||
RTGUI_WIDGET_UNHIDE(widget);
|
||||
rtgui_widget_update_clip(widget);
|
||||
|
||||
if (widget->on_show != RT_NULL)
|
||||
widget->on_show(RTGUI_OBJECT(widget), RT_NULL);
|
||||
@@ -552,6 +552,9 @@ rt_bool_t rtgui_widget_onhide(struct rtgui_object *object, struct rtgui_event *e
|
||||
{
|
||||
struct rtgui_widget *widget = RTGUI_WIDGET(object);
|
||||
|
||||
if (RTGUI_WIDGET_IS_HIDE(RTGUI_WIDGET(object)))
|
||||
return RT_FALSE;
|
||||
|
||||
/* hide this widget */
|
||||
RTGUI_WIDGET_HIDE(widget);
|
||||
|
||||
|
||||
@@ -594,16 +594,6 @@ void rtgui_win_set_rect(rtgui_win_t* win, rtgui_rect_t* rect)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef RTGUI_USING_SMALL_SIZE
|
||||
void rtgui_win_set_box(rtgui_win_t* win, rtgui_box_t* box)
|
||||
{
|
||||
if (win == RT_NULL || box == RT_NULL) return;
|
||||
|
||||
rtgui_container_add_child(RTGUI_CONTAINER(win), RTGUI_WIDGET(box));
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(box), &(RTGUI_WIDGET(win)->extent));
|
||||
}
|
||||
#endif
|
||||
|
||||
void rtgui_win_set_onactivate(rtgui_win_t* win, rtgui_event_handler_ptr handler)
|
||||
{
|
||||
if (win != RT_NULL)
|
||||
|
||||
Reference in New Issue
Block a user