remove mode_item_style from item class, use genlist_mode_item_style_set() instead

SVN revision: 64228
This commit is contained in:
Mike Blumenkrantz 2011-10-21 03:31:26 +00:00
parent 5f5dd5f9e1
commit 6026896d03
4 changed files with 71 additions and 21 deletions

View File

@ -1767,7 +1767,7 @@ test_genlist10(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_i
itc10.func.icon_get = gl10_icon_get;
itc10.func.state_get = gl_state_get;
itc10.func.del = gl_del;
itc10.mode_item_style = "mode";
elm_genlist_mode_item_style_set(gl, "mode");
for (i = 0; i < 50; i++)
elm_genlist_item_append(gl,

View File

@ -17795,10 +17795,6 @@ extern "C" {
* - @c item_style - This is a constant string and simply defines the name
* of the item style. It @b must be specified and the default should be @c
* "default".
* - @c mode_item_style - This is a constant string and simply defines the
* name of the style that will be used for mode animations. It can be left
* as @c NULL if you don't plan to use Genlist mode. See
* elm_genlist_item_mode_set() for more info.
*
* - @c func - A struct with pointers to functions that will be called when
* an item is going to be actually created. All of them receive a @c data
@ -18140,7 +18136,6 @@ extern "C" {
Elm_Genlist_Item_State_Get_Cb state_get; /**< State fetching class function for genlist item classes. */
Elm_Genlist_Item_Del_Cb del; /**< Deletion class function for genlist item classes. */
} func;
const char *mode_item_style;
};
/**
@ -18627,6 +18622,32 @@ extern "C" {
* @ingroup Genlist
*/
EAPI const Eina_List *elm_genlist_selected_items_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* Get the mode item style of items in the genlist
* @param obj The genlist object
* @return The mode item style string, or NULL if none is specified
*
* This is a constant string and simply defines the name of the
* style that will be used for mode animations. It can be
* @c NULL if you don't plan to use Genlist mode. See
* elm_genlist_item_mode_set() for more info.
*
* @ingroup Genlist
*/
EAPI const char *elm_genlist_mode_item_style_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* Set the mode item style of items in the genlist
* @param obj The genlist object
* @param style The mode item style string, or NULL if none is desired
*
* This is a constant string and simply defines the name of the
* style that will be used for mode animations. It can be
* @c NULL if you don't plan to use Genlist mode. See
* elm_genlist_item_mode_set() for more info.
*
* @ingroup Genlist
*/
EAPI void elm_genlist_mode_item_style_set(Evas_Object *obj, const char *style) EINA_ARG_NONNULL(1);
/**
* Get a list of realized items in genlist
*

View File

@ -79,9 +79,9 @@ typedef enum {
} Elm_Fileselector_Type;
static Elm_Genlist_Item_Class list_itc[ELM_FILE_LAST] = {
{ "default", { NULL, NULL, NULL, NULL }, NULL },
{ "default", { NULL, NULL, NULL, NULL }, NULL },
{ "default", { NULL, NULL, NULL, NULL }, NULL }
{ "default", { NULL, NULL, NULL, NULL } },
{ "default", { NULL, NULL, NULL, NULL } },
{ "default", { NULL, NULL, NULL, NULL } }
};
static Elm_Gengrid_Item_Class grid_itc[ELM_FILE_LAST] = {
{ "default", { NULL, NULL, NULL, NULL } },

View File

@ -107,6 +107,7 @@ struct _Widget_Data
Ecore_Timer *multi_timer, *scr_hold_timer;
Ecore_Animator *reorder_move_animator;
const char *mode_type;
const char *mode_item_style;
unsigned int start_time;
Evas_Coord prev_x, prev_y, prev_mx, prev_my;
Evas_Coord cur_x, cur_y, cur_mx, cur_my;
@ -2916,10 +2917,25 @@ _edge_bottom(void *data,
}
static void
_mode_item_realize(Elm_Genlist_Item *it)
_mode_item_realize_theme(Elm_Genlist_Item *it)
{
char buf[1024];
strncpy(buf, "item", sizeof(buf));
if (it->wd->compress)
strncat(buf, "_compress", sizeof(buf) - strlen(buf));
if (it->order_num_in & 0x1) strncat(buf, "_odd", sizeof(buf) - strlen(buf));
strncat(buf, "/", sizeof(buf) - strlen(buf));
strncat(buf, it->wd->mode_item_style, sizeof(buf) - strlen(buf));
_elm_theme_object_set(WIDGET(it), it->mode_view, "genlist", buf,
elm_widget_style_get(WIDGET(it)));
}
static void
_mode_item_realize(Elm_Genlist_Item *it)
{
if ((it->mode_view) || (it->delete_me)) return;
evas_event_freeze(evas_object_evas_get(it->wd->obj));
@ -2930,16 +2946,7 @@ _mode_item_realize(Elm_Genlist_Item *it)
evas_object_smart_member_add(it->mode_view, it->wd->pan_smart);
elm_widget_sub_object_add(WIDGET(it), it->mode_view);
strncpy(buf, "item", sizeof(buf));
if (it->wd->compress)
strncat(buf, "_compress", sizeof(buf) - strlen(buf));
if (it->order_num_in & 0x1) strncat(buf, "_odd", sizeof(buf) - strlen(buf));
strncat(buf, "/", sizeof(buf) - strlen(buf));
strncat(buf, it->itc->mode_item_style, sizeof(buf) - strlen(buf));
_elm_theme_object_set(WIDGET(it), it->mode_view, "genlist", buf,
elm_widget_style_get(WIDGET(it)));
_mode_item_realize_theme(it);
edje_object_mirrored_set(it->mode_view,
elm_widget_mirrored_get(WIDGET(it)));
@ -4874,7 +4881,7 @@ elm_genlist_item_mode_set(Elm_Genlist_Item *it,
(!strcmp(mode_type, wd->mode_type)) &&
(mode_set))
return;
if (!it->itc->mode_item_style) return;
if (!wd->mode_item_style) return;
if (wd->multi)
{
@ -4898,6 +4905,28 @@ elm_genlist_item_mode_set(Elm_Genlist_Item *it,
if (mode_set) _item_mode_set(it);
}
EAPI const char *
elm_genlist_mode_item_style_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return NULL;
return wd->mode_item_style;
}
EAPI void
elm_genlist_mode_item_style_set(Evas_Object *obj, const char *style)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if ((style == wd->mode_item_style) || (style && wd->mode_item_style &&
(!strcmp(style, wd->mode_item_style))))
return;
eina_stringshare_replace(&wd->mode_item_style, style);
elm_genlist_realized_items_update(obj);
}
EAPI const char *
elm_genlist_mode_get(const Evas_Object *obj)
{