Example #1
0
int ScrollLoading_Update( ScrollLoading ctx )
{
	LCUI_Widget w;
	LinkedListNode *node;
	LCUI_WidgetEventRec e;
	int count = 0, top, bottom;
	e.type = ctx->event_id;
	e.cancel_bubble = TRUE;
	bottom = top = ctx->top;
	bottom += ctx->container->box.padding.height;
	if( !ctx->top_child ) {
		node = ctx->container->children_show.head.next;
		ctx->top_child = node->data;
	}
	if( !ctx->top_child ) {
		return 0;
	}
	if( ctx->top_child->box.border.top > bottom ) {
		node = Widget_GetNode( ctx->top_child );
		ctx->top_child = NULL;
		while( node ) {
			w = node->data;
			if( w->box.border.y < bottom ) {
				ctx->top_child = w;
				break;
			}
			node = node->prev;
		}
		if( !ctx->top_child ) {
			return 0;
		}
	}
	node = Widget_GetNode( ctx->top_child );
	while( node ) {
		w = node->data;
		if( w->box.border.y > bottom ) {
			break;
		}
		if( w->box.border.y + w->box.border.height >= top ) {
			Widget_PostEvent( w, &e, NULL, NULL );
			++count;
		}
		node = node->next;
	}
	return count;
}
Example #2
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 );
}