예제 #1
0
static void a3d_listbox_layout(a3d_widget_t* widget,
                               int dragx, int dragy)
{
	assert(widget);
	LOGD("debug dragx=%i, dragy=%i", dragx, dragy);

	a3d_listbox_t* self = (a3d_listbox_t*) widget;
	if(a3d_list_empty(self->list))
	{
		return;
	}

	if(self->orientation == A3D_LISTBOX_ORIENTATION_VERTICAL)
	{
		if(widget->wrapy == A3D_WIDGET_WRAP_SHRINK)
		{
			a3d_listbox_layoutVerticalShrink(self, dragx, dragy);
		}
		else
		{
			a3d_listbox_layoutVerticalStretch(self, dragx, dragy);
		}
	}
	else
	{
		if(widget->wrapx == A3D_WIDGET_WRAP_SHRINK)
		{
			a3d_listbox_layoutHorizontalShrink(self, dragx, dragy);
		}
		else
		{
			a3d_listbox_layoutHorizontalStretch(self, dragx, dragy);
		}
	}
}
예제 #2
0
const void* a3d_multimap_remove(a3d_multimap_t* self,
                                a3d_multimapIter_t** _iter)
{
	assert(self);
	assert(_iter);
	assert(*_iter);

	a3d_multimapIter_t* iter = *_iter;

	// remove item from list;
	a3d_list_t* list;
	list = (a3d_list_t*)
	       a3d_hashmap_val(iter->hiter);
	const void* data = a3d_list_remove(list,
	                                   &iter->item);

	// check if list is empty
	// or if next item is NULL
	if(a3d_list_empty(list))
	{
		a3d_hashmap_remove(self->hash, &iter->hiter);
		a3d_list_delete(&list);
		if(iter->hiter)
		{
			list = (a3d_list_t*)
			       a3d_hashmap_val(iter->hiter);
			iter->item = a3d_list_head(list);
		}
	}
	else if(iter->item == NULL)
	{
		iter->hiter = a3d_hashmap_next(iter->hiter);
		if(iter->hiter)
		{
			list = (a3d_list_t*)
			       a3d_hashmap_val(iter->hiter);
			iter->item = a3d_list_head(list);
		}
	}

	// check for iteration end
	if(iter->hiter == NULL)
	{
		*_iter = NULL;
	}

	return data;
}