示例#1
0
void Widget_Destroy(LCUI_Widget w)
{
	LCUI_Widget root = w;

	assert(w->state != LCUI_WSTATE_DELETED);
	while (root->parent) {
		root = root->parent;
	}
	/* If this widget is not mounted in the root widget tree */
	if (root != LCUIWidget.root) {
		w->state = LCUI_WSTATE_DELETED;
		Widget_ExecDestroy(w);
		return;
	}
	if (w->parent) {
		LCUI_Widget child;
		LinkedListNode *node;

		/* Update the index of the siblings behind it */
		node = w->node.next;
		while (node) {
			child = node->data;
			child->index -= 1;
			node = node->next;
		}
		if (w->computed_style.position != SV_ABSOLUTE) {
			Widget_UpdateLayout(w->parent);
		}
		Widget_InvalidateArea(w, NULL, SV_GRAPH_BOX);
		Widget_AddToTrash(w);
	}
}
示例#2
0
static void LCUIWidget_ClearTrash( void )
{
	LinkedListNode *node;
	node = self.trash.head.next;
	while( node ) {
		LinkedListNode *next = node->next;
		LinkedList_Unlink( &self.trash, node );
		Widget_ExecDestroy( node->data );
		node = next;
	}
}
示例#3
0
void LCUIWidget_StepTask( void )
{
    LinkedListNode *node;
    self.is_timeout = FALSE;
    self.timeout = LCUI_GetTime() + 20;
    Widget_UpdateEx( LCUIWidget_GetRoot(), TRUE );
    /* 删除无用部件 */
    node = self.trash.head.next;
    while( node ) {
        LinkedListNode *next = node->next;
        LinkedList_Unlink( &self.trash, node );
        Widget_ExecDestroy( node->data );
        node = next;
    }
}
示例#4
0
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;
}
示例#5
0
void LCUIWidget_FreeRoot(void)
{
	Widget_ExecDestroy(LCUIWidget.root);
}