Пример #1
0
void Widget_AddToTrash( LCUI_Widget w )
{
    LinkedListNode *snode, *node;

    w->state = WSTATE_DELETED;
    if( !w->parent ) {
        return;
    }
    node = Widget_GetNode( w );
    snode = Widget_GetShowNode( w );
    LinkedList_Unlink( &w->parent->children, node );
    LinkedList_Unlink( &w->parent->children_show, snode );
    LinkedList_AppendNode( &self.trash, node );
}
Пример #2
0
void Widget_AddToTrash( LCUI_Widget w )
{
	LCUI_WidgetEventRec e = { 0 };
	e.type = WET_REMOVE;
	w->state = WSTATE_DELETED;
	Widget_TriggerEvent( w, &e, NULL );
	if( !w->parent ) {
		return;
	}
	LinkedList_Unlink( &w->parent->children, &w->node );
	LinkedList_Unlink( &w->parent->children_show, &w->node_show );
	LinkedList_AppendNode( &self.trash, &w->node );
	Widget_PostSurfaceEvent( w, WET_REMOVE, TRUE );
}
Пример #3
0
void LinkedList_DeleteNode( LinkedList *list, LinkedListNode *node )
{
	LinkedList_Unlink( list, node );
	node->data = NULL;
	free( node );
	node = NULL;
}
Пример #4
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;
	}
}
Пример #5
0
void Widget_ExecUpdateZIndex(LCUI_Widget w)
{
	int z_index;
	LinkedList *list;
	LinkedListNode *cnode, *csnode, *snode;
	LCUI_Style s = &w->style->sheet[key_z_index];
	if (s->is_valid && s->type == LCUI_STYPE_VALUE) {
		z_index = s->val_int;
	} else {
		z_index = 0;
	}
	if (!w->parent) {
		return;
	}
	if (w->state == LCUI_WSTATE_NORMAL) {
		if (w->computed_style.z_index == z_index) {
			return;
		}
	}
	w->computed_style.z_index = z_index;
	snode = &w->node_show;
	list = &w->parent->children_show;
	LinkedList_Unlink(list, snode);
	for (LinkedList_Each(cnode, list)) {
		LCUI_Widget child = cnode->data;
		LCUI_WidgetStyle *ccs = &child->computed_style;

		csnode = &child->node_show;
		if (w->computed_style.z_index < ccs->z_index) {
			continue;
		} else if (w->computed_style.z_index == ccs->z_index) {
			if (w->computed_style.position == ccs->position) {
				if (w->index < child->index) {
					continue;
				}
			} else if (w->computed_style.position < ccs->position) {
				continue;
			}
		}
		LinkedList_Link(list, csnode->prev, snode);
		break;
	}
	if (!cnode) {
		LinkedList_AppendNode(list, snode);
	}
	if (w->computed_style.position != SV_STATIC) {
		Widget_AddTask(w, LCUI_WTASK_REFRESH);
	}
}
Пример #6
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;
    }
}
Пример #7
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;
}
Пример #8
0
LCUI_BOOL LCUIWorker_RunTask( LCUI_Worker worker )
{
	LCUI_Task task;
	LinkedListNode *node;
	LCUIMutex_Lock( &worker->mutex );
	node = LinkedList_GetNode( &worker->tasks, 0 );
	if( node ) {
		task = node->data;
		LinkedList_Unlink( &worker->tasks, node );
		LCUIMutex_Unlock( &worker->mutex );
		LCUITask_Run( task );
		LCUITask_Destroy( task );
		free( task );
		free( node );
		return TRUE;
	}
	LCUIMutex_Unlock( &worker->mutex );
	return FALSE;
}