Skip to content

Commit

Permalink
feat(gui): LCUIWidget_ClearTrash() will return count
Browse files Browse the repository at this point in the history
  • Loading branch information
lc-soft committed Nov 18, 2018
1 parent d13b554 commit 6262f20
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/LCUI/gui/widget_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ LCUI_API int Widget_RemoveStatus(LCUI_Widget w, const char *status_name);
/** 打印部件树 */
LCUI_API void Widget_PrintTree(LCUI_Widget w);

LCUI_API void LCUIWidget_ClearTrash(void);
LCUI_API size_t LCUIWidget_ClearTrash(void);

LCUI_API void LCUIWidget_InitBase(void);

Expand Down
6 changes: 5 additions & 1 deletion src/gui/widget_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,20 @@ static void Widget_UpdateStatus(LCUI_Widget widget)
}
}

void LCUIWidget_ClearTrash(void)
size_t LCUIWidget_ClearTrash(void)
{
size_t count;
LinkedListNode *node;

node = LCUIWidget.trash.head.next;
count = LCUIWidget.trash.length;
while (node) {
LinkedListNode *next = node->next;
LinkedList_Unlink(&LCUIWidget.trash, node);
Widget_ExecDestroy(node->data);
node = next;
}
return count;
}

static void Widget_AddToTrash(LCUI_Widget w)
Expand Down

0 comments on commit 6262f20

Please sign in to comment.