Elm List Item: Migrate to Eo

This commit is contained in:
Daniel Zaoui 2014-09-28 08:15:48 +03:00
parent ae4c43d2ee
commit fffa035895
5 changed files with 534 additions and 402 deletions

View File

@ -617,7 +617,8 @@ elm_index_item.eo \
elm_multibuttonentry_item.eo \
elm_naviframe_item.eo \
elm_genlist_item.eo \
elm_gengrid_item.eo
elm_gengrid_item.eo \
elm_list_item.eo
elm_eolian_c = $(elm_eolian_files:%.eo=%.eo.c)
elm_eolian_h = $(elm_eolian_files:%.eo=%.eo.h)
@ -742,7 +743,8 @@ elementaryeolianfiles_DATA = \
elm_multibuttonentry_item.eo \
elm_naviframe_item.eo \
elm_genlist_item.eo \
elm_gengrid_item.eo
elm_gengrid_item.eo \
elm_list_item.eo
EXTRA_DIST += ${elementaryeolianfiles_DATA}

File diff suppressed because it is too large Load Diff

View File

@ -21,143 +21,21 @@ typedef enum
ELM_LIST_LAST /**< Indicates error if returned by elm_list_mode_get() */
} Elm_List_Mode;
/**
* Set the selected state of an item.
*
* @param it The list item
* @param selected The selected state
*
* This sets the selected state of the given item @p it.
* @c EINA_TRUE for selected, @c EINA_FALSE for not selected.
*
* If a new item is selected the previously selected will be unselected,
* unless multiple selection is enabled with elm_list_multi_select_set().
* Previously selected item can be get with function
* elm_list_selected_item_get().
*
* Selected items will be highlighted.
*
* @see elm_list_item_selected_get()
* @see elm_list_selected_item_get()
* @see elm_list_multi_select_set()
*
* @ingroup List
*/
EAPI void elm_list_item_selected_set(Elm_Object_Item *it, Eina_Bool selected);
/*
* Get whether the @p item is selected or not.
*
* @param it The list item.
* @return @c EINA_TRUE means item is selected. @c EINA_FALSE indicates
* it's not. If @p obj is @c NULL, @c EINA_FALSE is returned.
*
* @see elm_list_selected_item_set() for details.
* @see elm_list_item_selected_get()
*
* @ingroup List
*/
EAPI Eina_Bool elm_list_item_selected_get(const Elm_Object_Item *it);
/**
* Set or unset item as a separator.
*
* @param it The list item.
* @param setting @c EINA_TRUE to set item @p it as separator or
* @c EINA_FALSE to unset, i.e., item will be used as a regular item.
*
* Items aren't set as separator by default.
*
* If set as separator it will display separator theme, so won't display
* icons or label.
*
* @see elm_list_item_separator_get()
*
* @ingroup List
*/
EAPI void elm_list_item_separator_set(Elm_Object_Item *it, Eina_Bool setting);
/**
* Get a value whether item is a separator or not.
*
* @see elm_list_item_separator_set() for details.
*
* @param it The list item.
* @return @c EINA_TRUE means item @p it is a separator. @c EINA_FALSE
* indicates it's not. If @p it is @c NULL, @c EINA_FALSE is returned.
*
* @ingroup List
*/
EAPI Eina_Bool elm_list_item_separator_get(const Elm_Object_Item *it);
/**
* Show @p item in the list view.
*
* @param it The list item to be shown.
*
* It won't animate list until item is visible. If such behavior is wanted,
* use elm_list_bring_in() instead.
*
* @ingroup List
*/
EAPI void elm_list_item_show(Elm_Object_Item *it);
/**
* Bring in the given item to list view.
*
* @param it The item.
*
* This causes list to jump to the given item @p item and show it
* (by scrolling), if it is not fully visible.
*
* This may use animation to do so and take a period of time.
*
* If animation isn't wanted, elm_list_item_show() can be used.
*
* @ingroup List
*/
EAPI void elm_list_item_bring_in(Elm_Object_Item *it);
/**
* Get the real Evas(Edje) object created to implement the view of a given
* list @p item.
*
* @param it The list item
* @return The base Edje object associated with @p it.
*
* Base object is the @c Evas_Object that represents that item.
*
* @ingroup List
*/
EAPI Evas_Object *elm_list_item_object_get(const Elm_Object_Item *it);
/**
* Get the item before @p it in list.
*
* @param it The list item.
* @return The item before @p it, or @c NULL if none or on failure.
*
* @note If it is the first item, @c NULL will be returned.
*
* @see elm_list_item_append()
* @see elm_list_items_get()
*
* @ingroup List
*/
EAPI Elm_Object_Item *elm_list_item_prev(const Elm_Object_Item *it);
/**
* Get the item after @p it in list.
*
* @param it The list item.
* @return The item after @p it, or @c NULL if none or on failure.
*
* @note If it is the last item, @c NULL will be returned.
*
* @see elm_list_item_append()
* @see elm_list_items_get()
*
* @ingroup List
*/
EAPI Elm_Object_Item *elm_list_item_next(const Elm_Object_Item *it);

View File

@ -0,0 +1,170 @@
class Elm_List_Item(Elm_Widget_Item)
{
legacy_prefix: null;
eo_prefix: elm_obj_list_item;
properties {
separator {
get {
/*@
Get a value whether item is a separator or not.
@see elm_list_item_separator_set() for details.
@ingroup List
*/
}
set {
/*@
Set or unset item as a separator.
Items aren't set as separator by default.
If set as separator it will display separator theme, so won't display
icons or label.
@see elm_list_item_separator_get()
@ingroup List
*/
}
values {
Eina_Bool setting; /*@ @c EINA_TRUE means item @p it is a separator. @c EINA_FALSE
indicates it's not. */
}
}
selected {
get {
/*
Get whether the @p item is selected or not.
@see elm_list_selected_item_set() for details.
@see elm_list_item_selected_get()
@ingroup List
*/
}
set {
/*@
Set the selected state of an item.
This sets the selected state of the given item @p it.
@c EINA_TRUE for selected, @c EINA_FALSE for not selected.
If a new item is selected the previously selected will be unselected,
unless multiple selection is enabled with elm_list_multi_select_set().
Previously selected item can be get with function
elm_list_selected_item_get().
Selected items will be highlighted.
@see elm_list_item_selected_get()
@see elm_list_selected_item_get()
@see elm_list_multi_select_set()
@ingroup List
*/
}
values {
Eina_Bool selected; /*@ the selected state (@c EINA_TRUE selected, @c EINA_FALSE not selected) */
}
}
object {
get {
/*@
Get the real Evas(Edje) object created to implement the view of a given
list @p item.
Base object is the @c Evas_Object that represents that item.
@ingroup List
*/
}
values {
Evas_Object *obj; /*@ The base Edje object associated with @p it. */
}
}
prev {
get {
/*@
Get the item before @p it in list.
@note If it is the first item, @c NULL will be returned.
@see elm_list_item_append()
@see elm_list_items_get()
@ingroup List
*/
/*legacy: elm_list_item_prev;*/
}
values {
Elm_Object_Item *item; /*@ The item before @p it, or @c NULL if none or on failure. */
}
}
next {
get {
/*@
Get the item after @p it in list.
@note If it is the last item, @c NULL will be returned.
@see elm_list_item_append()
@see elm_list_items_get()
@ingroup List
*/
/*legacy: elm_list_item_next;*/
}
values {
Elm_Object_Item *item; /*@ The item after @p it, or @c NULL if none or on failure. */
}
}
}
methods {
/* init { FIXME
params {
Evas_Smart_Cb func;
const(void)* data;
}
}*/
show {
/*@
Show @p item in the list view.
It won't animate list until item is visible. If such behavior is wanted,
use elm_list_bring_in() instead.
@ingroup List
*/
}
bring_in {
/*@
Bring in the given item to list view.
This causes list to jump to the given item @p item and show it
(by scrolling), if it is not fully visible.
This may use animation to do so and take a period of time.
If animation isn't wanted, elm_list_item_show() can be used.
@ingroup List
*/
}
}
implements {
Eo.Base.constructor;
Elm_Widget_Item.disable;
Elm_Widget_Item.del_pre;
Elm_Widget_Item.signal_emit;
Elm_Widget_Item.focus.set;
Elm_Widget_Item.focus.get;
Elm_Widget_Item.part_text.get;
Elm_Widget_Item.part_text.set;
Elm_Widget_Item.part_content.get;
Elm_Widget_Item.part_content.set;
Elm_Widget_Item.part_content_unset;
}
}

View File

@ -10,6 +10,7 @@
* IT AT RUNTIME.
*/
#include "elm_object_item_migration_temp.h"
/**
* @addtogroup Widget
* @{
@ -23,6 +24,7 @@
#define ELM_LIST_SWIPE_MOVES 12
typedef struct _Elm_List_Item_Data Elm_List_Item_Data;
/**
* Base widget smart data extended with list instance data.
*/
@ -63,10 +65,9 @@ struct _Elm_List_Data
Eina_Bool item_looping_on : 1;
};
typedef struct _Elm_List_Item Elm_List_Item;
struct _Elm_List_Item
struct _Elm_List_Item_Data
{
ELM_WIDGET_ITEM;
Elm_Widget_Item_Data *base;
Ecore_Timer *swipe_timer;
Ecore_Timer *long_timer;
@ -120,21 +121,24 @@ struct _Elm_List_Item
return
#define ELM_LIST_ITEM_CHECK(it) \
ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item_Data *)it, ); \
ELM_LIST_CHECK(it->base.widget); \
if (((Elm_List_Item *)it)->deleted) \
ELM_WIDGET_ITEM_CHECK_OR_RETURN(it->base, ); \
ELM_LIST_CHECK(it->base->widget); \
if (((Elm_List_Item_Data *)it)->deleted) \
{ \
ERR("ERROR: " #it " has been DELETED.\n"); \
return; \
}
#define ELM_LIST_ITEM_CHECK_OR_RETURN(it, ...) \
ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item_Data *)it, __VA_ARGS__); \
ELM_LIST_CHECK(it->base.widget) __VA_ARGS__; \
if (((Elm_List_Item *)it)->deleted) \
ELM_WIDGET_ITEM_CHECK_OR_RETURN(it->base, __VA_ARGS__); \
ELM_LIST_CHECK(it->base->widget) __VA_ARGS__; \
if (((Elm_List_Item_Data *)it)->deleted) \
{ \
ERR("ERROR: " #it " has been DELETED.\n"); \
return __VA_ARGS__; \
}
#define ELM_LIST_ITEM_DATA_GET(o, sd) \
Elm_List_Item_Data* sd = eo_data_scope_get((Eo *)o, ELM_LIST_ITEM_CLASS)
#endif