Example #1
0
void LinkedList_InsertNode( LinkedList *list, size_t pos, LinkedListNode *node )
{
	LinkedListNode *target;
	target = LinkedList_GetNode( list, pos );
	if( target ) {
		LinkedList_Link( list, target->prev, node );
	} else {
		LinkedList_AppendNode( list, node );
	}
}
Example #2
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);
	}
}