forked from enlightenment/enlightenment
parent
7058a7d2dc
commit
f1cf500e9c
|
@ -1,8 +1,8 @@
|
|||
#include "e.h"
|
||||
|
||||
#define SMART_NAME "e_ilist"
|
||||
#define API_ENTRY E_Smart_Data *sd; sd = evas_object_smart_data_get(obj); if ((!obj) || (!sd) || (evas_object_type_get(obj) && strcmp(evas_object_type_get(obj), SMART_NAME)))
|
||||
#define INTERNAL_ENTRY E_Smart_Data *sd; sd = evas_object_smart_data_get(obj); if (!sd) return;
|
||||
#define API_ENTRY E_Smart_Data * sd; sd = evas_object_smart_data_get(obj); if ((!obj) || (!sd) || (evas_object_type_get(obj) && strcmp(evas_object_type_get(obj), SMART_NAME)))
|
||||
#define INTERNAL_ENTRY E_Smart_Data * sd; sd = evas_object_smart_data_get(obj); if (!sd) return;
|
||||
|
||||
typedef struct _E_Smart_Data E_Smart_Data;
|
||||
struct _E_Smart_Data
|
||||
|
@ -24,30 +24,30 @@ struct _E_Smart_Data
|
|||
typebuf;
|
||||
};
|
||||
|
||||
static void _e_smart_init (void);
|
||||
static void _e_smart_add (Evas_Object *obj);
|
||||
static void _e_smart_del (Evas_Object *obj);
|
||||
static void _e_smart_show (Evas_Object *obj);
|
||||
static void _e_smart_hide (Evas_Object *obj);
|
||||
static void _e_smart_move (Evas_Object *obj, Evas_Coord x, Evas_Coord y);
|
||||
static void _e_smart_resize (Evas_Object *obj, Evas_Coord w, Evas_Coord h);
|
||||
static void _e_smart_color_set (Evas_Object *obj, int r, int g, int b, int a);
|
||||
static void _e_smart_clip_set (Evas_Object *obj, Evas_Object *clip);
|
||||
static void _e_smart_clip_unset (Evas_Object *obj);
|
||||
static void _e_smart_reconfigure (E_Smart_Data *sd);
|
||||
static void _e_smart_event_mouse_down (void *data, Evas *evas, Evas_Object *obj, void *event_info);
|
||||
static void _e_smart_event_mouse_up (void *data, Evas *evas, Evas_Object *obj, void *event_info);
|
||||
static void _e_smart_event_key_down (void *data, Evas *evas, Evas_Object *obj, void *event_info);
|
||||
static void _e_smart_init(void);
|
||||
static void _e_smart_add(Evas_Object *obj);
|
||||
static void _e_smart_del(Evas_Object *obj);
|
||||
static void _e_smart_show(Evas_Object *obj);
|
||||
static void _e_smart_hide(Evas_Object *obj);
|
||||
static void _e_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
|
||||
static void _e_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
|
||||
static void _e_smart_color_set(Evas_Object *obj, int r, int g, int b, int a);
|
||||
static void _e_smart_clip_set(Evas_Object *obj, Evas_Object *clip);
|
||||
static void _e_smart_clip_unset(Evas_Object *obj);
|
||||
static void _e_smart_reconfigure(E_Smart_Data *sd);
|
||||
static void _e_smart_event_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info);
|
||||
static void _e_smart_event_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info);
|
||||
static void _e_smart_event_key_down(void *data, Evas *evas, Evas_Object *obj, void *event_info);
|
||||
|
||||
static void _e_typebuf_add (Evas_Object *obj, const char *s);
|
||||
static void _e_typebuf_match (Evas_Object *obj);
|
||||
static void _e_typebuf_add(Evas_Object *obj, const char *s);
|
||||
static void _e_typebuf_match(Evas_Object *obj);
|
||||
static Eina_Bool _e_typebuf_timer_cb(void *data);
|
||||
static void _e_typebuf_timer_update (Evas_Object *obj);
|
||||
static void _e_typebuf_timer_delete (Evas_Object *obj);
|
||||
static void _e_typebuf_clean (Evas_Object *obj);
|
||||
static void _e_typebuf_timer_update(Evas_Object *obj);
|
||||
static void _e_typebuf_timer_delete(Evas_Object *obj);
|
||||
static void _e_typebuf_clean(Evas_Object *obj);
|
||||
|
||||
static void _item_select (E_Ilist_Item *si);
|
||||
static void _item_unselect (E_Ilist_Item *si);
|
||||
static void _item_select(E_Ilist_Item *si);
|
||||
static void _item_unselect(E_Ilist_Item *si);
|
||||
|
||||
static Evas_Smart *_e_smart = NULL;
|
||||
|
||||
|
@ -59,7 +59,7 @@ e_ilist_add(Evas *evas)
|
|||
}
|
||||
|
||||
EAPI void
|
||||
e_ilist_append(Evas_Object *obj, Evas_Object *icon, Evas_Object *end, const char *label, int header, void (*func) (void *data, void *data2), void (*func_hilight) (void *data, void *data2), void *data, void *data2)
|
||||
e_ilist_append(Evas_Object *obj, Evas_Object *icon, Evas_Object *end, const char *label, int header, void (*func)(void *data, void *data2), void (*func_hilight)(void *data, void *data2), void *data, void *data2)
|
||||
{
|
||||
E_Ilist_Item *si;
|
||||
Evas_Coord mw = 0, mh = 0;
|
||||
|
@ -139,7 +139,8 @@ e_ilist_append(Evas_Object *obj, Evas_Object *icon, Evas_Object *end, const char
|
|||
if (stacking)
|
||||
{
|
||||
if (!strcmp(stacking, "below")) evas_object_lower(si->o_base);
|
||||
else if (!strcmp(stacking, "above")) evas_object_raise(si->o_base);
|
||||
else if (!strcmp(stacking, "above"))
|
||||
evas_object_raise(si->o_base);
|
||||
}
|
||||
e_box_thaw(sd->o_box);
|
||||
|
||||
|
@ -152,7 +153,7 @@ e_ilist_append(Evas_Object *obj, Evas_Object *icon, Evas_Object *end, const char
|
|||
}
|
||||
|
||||
EAPI void
|
||||
e_ilist_append_relative(Evas_Object *obj, Evas_Object *icon, Evas_Object *end, const char *label, int header, void (*func) (void *data, void *data2), void (*func_hilight) (void *data, void *data2), void *data, void *data2, int relative)
|
||||
e_ilist_append_relative(Evas_Object *obj, Evas_Object *icon, Evas_Object *end, const char *label, int header, void (*func)(void *data, void *data2), void (*func_hilight)(void *data, void *data2), void *data, void *data2, int relative)
|
||||
{
|
||||
E_Ilist_Item *si, *ri;
|
||||
Evas_Coord mw = 0, mh = 0;
|
||||
|
@ -238,7 +239,8 @@ e_ilist_append_relative(Evas_Object *obj, Evas_Object *icon, Evas_Object *end, c
|
|||
if (stacking)
|
||||
{
|
||||
if (!strcmp(stacking, "below")) evas_object_lower(si->o_base);
|
||||
else if (!strcmp(stacking, "above")) evas_object_raise(si->o_base);
|
||||
else if (!strcmp(stacking, "above"))
|
||||
evas_object_raise(si->o_base);
|
||||
}
|
||||
e_box_thaw(sd->o_box);
|
||||
|
||||
|
@ -251,7 +253,7 @@ e_ilist_append_relative(Evas_Object *obj, Evas_Object *icon, Evas_Object *end, c
|
|||
}
|
||||
|
||||
EAPI void
|
||||
e_ilist_prepend(Evas_Object *obj, Evas_Object *icon, Evas_Object *end, const char *label, int header, void (*func) (void *data, void *data2), void (*func_hilight) (void *data, void *data2), void *data, void *data2)
|
||||
e_ilist_prepend(Evas_Object *obj, Evas_Object *icon, Evas_Object *end, const char *label, int header, void (*func)(void *data, void *data2), void (*func_hilight)(void *data, void *data2), void *data, void *data2)
|
||||
{
|
||||
E_Ilist_Item *si;
|
||||
Evas_Coord mw = 0, mh = 0;
|
||||
|
@ -320,7 +322,7 @@ e_ilist_prepend(Evas_Object *obj, Evas_Object *icon, Evas_Object *end, const cha
|
|||
}
|
||||
|
||||
EAPI void
|
||||
e_ilist_prepend_relative(Evas_Object *obj, Evas_Object *icon, Evas_Object *end, const char *label, int header, void (*func) (void *data, void *data2), void (*func_hilight) (void *data, void *data2), void *data, void *data2, int relative)
|
||||
e_ilist_prepend_relative(Evas_Object *obj, Evas_Object *icon, Evas_Object *end, const char *label, int header, void (*func)(void *data, void *data2), void (*func_hilight)(void *data, void *data2), void *data, void *data2, int relative)
|
||||
{
|
||||
E_Ilist_Item *si, *ri;
|
||||
Evas_Coord mw = 0, mh = 0;
|
||||
|
@ -505,7 +507,8 @@ e_ilist_selected_set(Evas_Object *obj, int n)
|
|||
|
||||
i = eina_list_count(sd->items);
|
||||
if (n >= i) n = i - 1;
|
||||
else if (n < 0) n = 0;
|
||||
else if (n < 0)
|
||||
n = 0;
|
||||
|
||||
EINA_LIST_FOREACH(sd->items, l, si)
|
||||
{
|
||||
|
@ -517,9 +520,9 @@ e_ilist_selected_set(Evas_Object *obj, int n)
|
|||
if (!(si = eina_list_nth(sd->items, n))) return;
|
||||
|
||||
/* NB: Remove this if headers ever become selectable */
|
||||
while (si->header && ((++ n) < i))
|
||||
while (si->header && ((++n) < i))
|
||||
if (!(si = eina_list_nth(sd->items, n))) return;
|
||||
while (si->header && ((-- n) >= 0))
|
||||
while (si->header && ((--n) >= 0))
|
||||
if (!(si = eina_list_nth(sd->items, n))) return;
|
||||
if (si->header) return;
|
||||
|
||||
|
@ -877,7 +880,8 @@ e_ilist_multi_select(Evas_Object *obj, int n)
|
|||
|
||||
i = eina_list_count(sd->items);
|
||||
if (n >= i) n = i - 1;
|
||||
else if (n < 0) n = 0;
|
||||
else if (n < 0)
|
||||
n = 0;
|
||||
|
||||
if (!(si = eina_list_nth(sd->items, n))) return;
|
||||
if (si->header) return;
|
||||
|
@ -912,7 +916,8 @@ e_ilist_range_select(Evas_Object *obj, int n)
|
|||
|
||||
i = eina_list_count(sd->items);
|
||||
if (n >= i) n = i - 1;
|
||||
else if (n < 0) n = 0;
|
||||
else if (n < 0)
|
||||
n = 0;
|
||||
|
||||
if (n < sd->selected) dir = 0;
|
||||
else dir = 1;
|
||||
|
@ -1124,7 +1129,7 @@ _e_smart_event_mouse_up(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UN
|
|||
i++;
|
||||
}
|
||||
|
||||
if(!sd->selector) return;
|
||||
if (!sd->selector) return;
|
||||
if (!(si = eina_list_nth(sd->items, sd->selected))) return;
|
||||
if (si->func) si->func(si->data, si->data2);
|
||||
}
|
||||
|
@ -1432,3 +1437,4 @@ _item_unselect(E_Ilist_Item *si)
|
|||
evas_object_lower(si->o_base);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue