elementary: add a filled state to gengrid. auto fill the first line if not

SVN revision: 66869
This commit is contained in:
Michael BOUCHAUD 2012-01-04 14:33:39 +00:00
parent 302124b296
commit 772d3daba0
3 changed files with 72 additions and 2 deletions

View File

@ -171,6 +171,7 @@ struct _Widget_Data
Eina_Bool horizontal : 1;
Eina_Bool move_effect_enabled : 1;
Eina_Bool reorder_item_changed : 1;
Eina_Bool filled : 1;
};
Elm_Gen_Item *_elm_genlist_item_new(Widget_Data *wd, const Elm_Gen_Item_Class *itc, const void *data, Elm_Gen_Item *parent, Evas_Smart_Cb func, const void *func_data);

View File

@ -799,6 +799,7 @@ _mouse_down(void *data,
it->wd->longpressed = EINA_FALSE;
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
else it->wd->on_hold = EINA_FALSE;
if (it->wd->on_hold) return;
it->wd->wasselected = it->selected;
_item_highlight(it);
if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
@ -1195,7 +1196,11 @@ _item_place(Elm_Gen_Item *it,
items_row = items_visible;
if (items_row > it->wd->count)
items_row = it->wd->count;
tch = items_row * it->wd->item_height;
if (it->wd->filled
&& (unsigned int)it->wd->nmax > (unsigned int)it->wd->count)
tch = it->wd->nmax * it->wd->item_height;
else
tch = items_row * it->wd->item_height;
alignh = (vh - tch) * it->wd->align_y;
}
else
@ -1217,7 +1222,11 @@ _item_place(Elm_Gen_Item *it,
items_col = items_visible;
if (items_col > it->wd->count)
items_col = it->wd->count;
tcw = items_col * it->wd->item_width;
if (it->wd->filled
&& (unsigned int)it->wd->nmax > (unsigned int)it->wd->count)
tcw = it->wd->nmax * it->wd->item_width;
else
tcw = items_col * it->wd->item_width;
alignw = (vw - tcw) * it->wd->align_x;
}
@ -2716,3 +2725,24 @@ elm_gengrid_item_bring_in(Elm_Gen_Item *it)
it->wd->item_width,
it->wd->item_height);
}
EAPI void
elm_gengrid_filled_set(Evas_Object *obj, Eina_Bool fill)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
fill = !!fill;
if (wd->filled != fill)
wd->filled = fill;
}
EAPI Eina_Bool
elm_gengrid_filled_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return EINA_FALSE;
return wd->filled;
}

View File

@ -1510,6 +1510,45 @@ EAPI Elm_Gengrid_Item *elm_gengrid_selected_item_get(const Evas_Obje
*/
EAPI const Eina_List *elm_gengrid_selected_items_get(const Evas_Object *obj);
/**
* Set how the items grid's filled within a given gengrid widget
*
* @param obj The gengrid object.
* @param fill Filled if True
*
* This sets the fill state of the whole grid of items of a gengrid
* within its given viewport. By default, this value is False, meaning
* that if the first line of items grid's aren't filled
*
* Set how the items grid's filled within a given gengrid widget.
* This sets the fill state of the whole grid of items of a gengrid
* within its given viewport. By default, this value is false, meaning
* that if the first line of items grid's isn't filled, the items are
* centered with the alignment
*
* @see elm_gengrid_filled_get()
*
* @ingroup Gengrid
*/
EAPI void elm_gengrid_filled_set(Evas_Object *obj, Eina_Bool fill);
/**
* Get how the items grid's filled within a given gengrid widget
*
* @param obj The gengrid object.
* @return @c EINA_TRUE, if filled is on, @c EINA_FALSE if it's
* off
*
* @note Use @c NULL pointers on the alignment values you're not
* interested in: they'll be ignored by the function.
*
* @see elm_gengrid_align_set() for more details
*
* @ingroup Gengrid
*/
EAPI Eina_Bool elm_gengrid_filled_get(const Evas_Object *obj);
/**
* @}
*/