2008-09-29 23:58:56 -07:00
|
|
|
#include <Elementary.h>
|
|
|
|
#include "elm_priv.h"
|
|
|
|
|
2009-02-14 18:53:56 -08:00
|
|
|
#define SMART_NAME "elm_widget"
|
2009-02-02 21:09:03 -08:00
|
|
|
#define API_ENTRY \
|
|
|
|
Smart_Data *sd = evas_object_smart_data_get(obj); \
|
|
|
|
if ((!obj) || (!sd) || \
|
2009-07-06 23:46:51 -07:00
|
|
|
(evas_object_type_get(obj) && \
|
|
|
|
strcmp(evas_object_type_get(obj), SMART_NAME)))
|
2009-02-02 21:09:03 -08:00
|
|
|
#define INTERNAL_ENTRY \
|
|
|
|
Smart_Data *sd = evas_object_smart_data_get(obj); \
|
|
|
|
if (!sd) return;
|
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
typedef struct _Smart_Data Smart_Data;
|
2008-09-29 23:58:56 -07:00
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
struct _Smart_Data
|
2009-07-06 23:46:51 -07:00
|
|
|
{
|
2008-10-22 01:58:56 -07:00
|
|
|
Evas_Object *obj;
|
2009-05-13 05:21:52 -07:00
|
|
|
const char *type;
|
2008-10-06 18:23:49 -07:00
|
|
|
Evas_Object *parent_obj;
|
|
|
|
Evas_Coord x, y, w, h;
|
2008-10-22 07:11:59 -07:00
|
|
|
Eina_List *subobjs;
|
2008-10-06 18:23:49 -07:00
|
|
|
Evas_Object *resize_obj;
|
2008-10-07 23:38:20 -07:00
|
|
|
Evas_Object *hover_obj;
|
2008-10-06 18:23:49 -07:00
|
|
|
void (*del_func) (Evas_Object *obj);
|
2008-10-24 19:11:06 -07:00
|
|
|
void (*del_pre_func) (Evas_Object *obj);
|
2008-10-06 18:23:49 -07:00
|
|
|
void (*focus_func) (Evas_Object *obj);
|
|
|
|
void (*activate_func) (Evas_Object *obj);
|
|
|
|
void (*disable_func) (Evas_Object *obj);
|
2008-11-14 22:09:04 -08:00
|
|
|
void (*theme_func) (Evas_Object *obj);
|
2008-10-06 18:23:49 -07:00
|
|
|
void (*on_focus_func) (void *data, Evas_Object *obj);
|
|
|
|
void *on_focus_data;
|
|
|
|
void (*on_change_func) (void *data, Evas_Object *obj);
|
|
|
|
void *on_change_data;
|
2008-10-17 07:40:54 -07:00
|
|
|
void (*on_show_region_func) (void *data, Evas_Object *obj);
|
|
|
|
void *on_show_region_data;
|
2008-10-06 18:23:49 -07:00
|
|
|
void *data;
|
2008-10-17 07:40:54 -07:00
|
|
|
Evas_Coord rx, ry, rw, rh;
|
2008-11-18 02:11:57 -08:00
|
|
|
int scroll_hold;
|
2009-03-20 08:08:33 -07:00
|
|
|
int scroll_freeze;
|
2009-02-02 21:09:03 -08:00
|
|
|
double scale;
|
2009-04-22 21:03:27 -07:00
|
|
|
const char *style;
|
2008-10-06 18:23:49 -07:00
|
|
|
unsigned char can_focus : 1;
|
|
|
|
unsigned char child_can_focus : 1;
|
|
|
|
unsigned char focused : 1;
|
|
|
|
unsigned char disabled : 1;
|
2009-07-06 23:46:51 -07:00
|
|
|
};
|
2008-10-06 18:23:49 -07:00
|
|
|
|
|
|
|
/* local subsystem functions */
|
|
|
|
static void _smart_reconfigure(Smart_Data *sd);
|
|
|
|
static void _smart_add(Evas_Object *obj);
|
|
|
|
static void _smart_del(Evas_Object *obj);
|
|
|
|
static void _smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
|
|
|
|
static void _smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
|
|
|
|
static void _smart_show(Evas_Object *obj);
|
|
|
|
static void _smart_hide(Evas_Object *obj);
|
|
|
|
static void _smart_color_set(Evas_Object *obj, int r, int g, int b, int a);
|
|
|
|
static void _smart_clip_set(Evas_Object *obj, Evas_Object * clip);
|
|
|
|
static void _smart_clip_unset(Evas_Object *obj);
|
|
|
|
static void _smart_init(void);
|
|
|
|
|
|
|
|
/* local subsystem globals */
|
|
|
|
static Evas_Smart *_e_smart = NULL;
|
|
|
|
|
2008-10-07 23:38:20 -07:00
|
|
|
static void
|
|
|
|
_sub_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|
|
|
{
|
|
|
|
Smart_Data *sd = data;
|
2008-11-26 21:41:13 -08:00
|
|
|
if (obj == sd->resize_obj)
|
|
|
|
{
|
2009-07-06 23:46:51 -07:00
|
|
|
sd->resize_obj = NULL;
|
2008-11-26 21:41:13 -08:00
|
|
|
}
|
2008-10-07 23:38:20 -07:00
|
|
|
else if (obj == sd->hover_obj) sd->hover_obj = NULL;
|
2008-11-26 21:41:13 -08:00
|
|
|
else
|
|
|
|
{
|
2009-07-06 23:46:51 -07:00
|
|
|
sd->subobjs = eina_list_remove(sd->subobjs, obj);
|
2008-11-26 21:41:13 -08:00
|
|
|
}
|
2008-12-23 21:04:33 -08:00
|
|
|
evas_object_smart_callback_call(sd->obj, "sub-object-del", obj);
|
2008-10-07 23:38:20 -07:00
|
|
|
}
|
|
|
|
|
2008-10-22 01:58:56 -07:00
|
|
|
static void
|
|
|
|
_sub_obj_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|
|
|
{
|
|
|
|
Smart_Data *sd = data;
|
2008-10-22 05:00:16 -07:00
|
|
|
Evas_Object *op, *op2;
|
2008-10-22 05:08:39 -07:00
|
|
|
|
|
|
|
elm_widget_focus_steal(sd->obj);
|
2008-10-22 01:58:56 -07:00
|
|
|
}
|
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
/* externally accessible functions */
|
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_widget_add(Evas *evas)
|
|
|
|
{
|
|
|
|
_smart_init();
|
|
|
|
return evas_object_smart_add(evas, _e_smart);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_widget_del_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj))
|
|
|
|
{
|
|
|
|
API_ENTRY return;
|
|
|
|
sd->del_func = func;
|
|
|
|
}
|
|
|
|
|
2008-10-24 19:11:06 -07:00
|
|
|
EAPI void
|
|
|
|
elm_widget_del_pre_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj))
|
|
|
|
{
|
|
|
|
API_ENTRY return;
|
|
|
|
sd->del_pre_func = func;
|
|
|
|
}
|
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
EAPI void
|
|
|
|
elm_widget_focus_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj))
|
|
|
|
{
|
|
|
|
API_ENTRY return;
|
|
|
|
sd->focus_func = func;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_widget_activate_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj))
|
|
|
|
{
|
|
|
|
API_ENTRY return;
|
|
|
|
sd->activate_func = func;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_widget_disable_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj))
|
|
|
|
{
|
|
|
|
API_ENTRY return;
|
|
|
|
sd->disable_func = func;
|
|
|
|
}
|
|
|
|
|
2008-11-14 22:09:04 -08:00
|
|
|
EAPI void
|
|
|
|
elm_widget_theme_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj))
|
|
|
|
{
|
|
|
|
API_ENTRY return;
|
|
|
|
sd->theme_func = func;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_widget_theme(Evas_Object *obj)
|
|
|
|
{
|
2009-02-25 11:50:45 -08:00
|
|
|
const Eina_List *l;
|
|
|
|
Evas_Object *child;
|
|
|
|
|
2008-11-14 22:09:04 -08:00
|
|
|
API_ENTRY return;
|
2009-02-25 11:50:45 -08:00
|
|
|
EINA_LIST_FOREACH(sd->subobjs, l, child)
|
|
|
|
elm_widget_theme(child);
|
2008-11-14 22:09:04 -08:00
|
|
|
if (sd->resize_obj) elm_widget_theme(sd->resize_obj);
|
|
|
|
if (sd->hover_obj) elm_widget_theme(sd->hover_obj);
|
2008-11-15 05:58:50 -08:00
|
|
|
if (sd->theme_func) sd->theme_func(obj);
|
2008-11-14 22:09:04 -08:00
|
|
|
}
|
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
EAPI void
|
|
|
|
elm_widget_on_focus_hook_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj), void *data)
|
|
|
|
{
|
|
|
|
API_ENTRY return;
|
|
|
|
sd->on_focus_func = func;
|
|
|
|
sd->on_focus_data = data;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_widget_on_change_hook_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj), void *data)
|
|
|
|
{
|
|
|
|
API_ENTRY return;
|
|
|
|
sd->on_change_func = func;
|
|
|
|
sd->on_change_data = data;
|
|
|
|
}
|
|
|
|
|
2008-10-17 07:40:54 -07:00
|
|
|
EAPI void
|
|
|
|
elm_widget_on_show_region_hook_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj), void *data)
|
|
|
|
{
|
|
|
|
API_ENTRY return;
|
|
|
|
sd->on_show_region_func = func;
|
|
|
|
sd->on_show_region_data = data;
|
|
|
|
}
|
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
EAPI void
|
|
|
|
elm_widget_data_set(Evas_Object *obj, void *data)
|
|
|
|
{
|
|
|
|
API_ENTRY return;
|
|
|
|
sd->data = data;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void *
|
2009-02-25 07:54:26 -08:00
|
|
|
elm_widget_data_get(const Evas_Object *obj)
|
2008-10-06 18:23:49 -07:00
|
|
|
{
|
|
|
|
API_ENTRY return NULL;
|
|
|
|
return sd->data;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_widget_sub_object_add(Evas_Object *obj, Evas_Object *sobj)
|
2008-09-29 23:58:56 -07:00
|
|
|
{
|
2008-10-06 18:23:49 -07:00
|
|
|
API_ENTRY return;
|
2009-02-02 21:09:03 -08:00
|
|
|
double scale, pscale = elm_widget_scale_get(sobj);
|
2008-10-22 07:11:59 -07:00
|
|
|
sd->subobjs = eina_list_append(sd->subobjs, sobj);
|
2008-10-06 18:23:49 -07:00
|
|
|
if (!sd->child_can_focus)
|
2008-09-29 23:58:56 -07:00
|
|
|
{
|
2008-10-06 18:23:49 -07:00
|
|
|
if (elm_widget_can_focus_get(sobj)) sd->child_can_focus = 1;
|
2008-09-29 23:58:56 -07:00
|
|
|
}
|
2008-10-06 18:23:49 -07:00
|
|
|
if (!strcmp(evas_object_type_get(sobj), SMART_NAME))
|
2008-09-29 23:58:56 -07:00
|
|
|
{
|
2008-11-26 21:41:13 -08:00
|
|
|
Smart_Data *sd2 = evas_object_smart_data_get(sobj);
|
|
|
|
if (sd2)
|
2008-10-06 18:23:49 -07:00
|
|
|
{
|
2008-11-26 21:41:13 -08:00
|
|
|
if (sd2->parent_obj) elm_widget_sub_object_del(sd2->parent_obj, sobj);
|
|
|
|
sd2->parent_obj = obj;
|
2008-10-06 18:23:49 -07:00
|
|
|
}
|
2008-09-29 23:58:56 -07:00
|
|
|
}
|
2008-11-26 21:41:13 -08:00
|
|
|
evas_object_event_callback_add(sobj, EVAS_CALLBACK_DEL, _sub_obj_del, sd);
|
2008-10-06 23:55:11 -07:00
|
|
|
evas_object_smart_callback_call(obj, "sub-object-add", sobj);
|
2009-02-02 21:09:03 -08:00
|
|
|
scale = elm_widget_scale_get(sobj);
|
|
|
|
if (scale != pscale) elm_widget_theme(sobj);
|
2008-09-29 23:58:56 -07:00
|
|
|
}
|
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
EAPI void
|
|
|
|
elm_widget_sub_object_del(Evas_Object *obj, Evas_Object *sobj)
|
2008-09-29 23:58:56 -07:00
|
|
|
{
|
2008-10-06 18:23:49 -07:00
|
|
|
API_ENTRY return;
|
2008-10-22 07:11:59 -07:00
|
|
|
sd->subobjs = eina_list_remove(sd->subobjs, sobj);
|
2008-10-06 18:23:49 -07:00
|
|
|
if (!sd->child_can_focus)
|
|
|
|
{
|
|
|
|
if (elm_widget_can_focus_get(sobj)) sd->child_can_focus = 0;
|
|
|
|
}
|
2008-10-24 19:11:06 -07:00
|
|
|
if (!strcmp(evas_object_type_get(sobj), SMART_NAME))
|
|
|
|
{
|
2008-11-26 21:41:13 -08:00
|
|
|
Smart_Data *sd2 = evas_object_smart_data_get(sobj);
|
2009-03-16 17:37:02 -07:00
|
|
|
if (sd2) sd2->parent_obj = NULL;
|
2008-10-24 19:11:06 -07:00
|
|
|
}
|
2008-11-26 21:41:13 -08:00
|
|
|
evas_object_event_callback_del(sobj, EVAS_CALLBACK_DEL, _sub_obj_del);
|
2008-10-06 23:55:11 -07:00
|
|
|
evas_object_smart_callback_call(obj, "sub-object-del", sobj);
|
2008-09-29 23:58:56 -07:00
|
|
|
}
|
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
EAPI void
|
|
|
|
elm_widget_resize_object_set(Evas_Object *obj, Evas_Object *sobj)
|
2008-09-29 23:58:56 -07:00
|
|
|
{
|
2008-10-06 18:23:49 -07:00
|
|
|
API_ENTRY return;
|
2008-10-07 23:38:20 -07:00
|
|
|
if (sd->resize_obj)
|
|
|
|
{
|
2009-07-06 23:46:51 -07:00
|
|
|
if (!strcmp(evas_object_type_get(sd->resize_obj), SMART_NAME))
|
|
|
|
{
|
|
|
|
Smart_Data *sd2 = evas_object_smart_data_get(sd->resize_obj);
|
|
|
|
if (sd2) sd2->parent_obj = NULL;
|
|
|
|
}
|
2008-10-07 23:38:20 -07:00
|
|
|
evas_object_event_callback_del(sd->resize_obj, EVAS_CALLBACK_DEL, _sub_obj_del);
|
2008-10-22 01:58:56 -07:00
|
|
|
evas_object_event_callback_del(sd->resize_obj, EVAS_CALLBACK_MOUSE_DOWN, _sub_obj_mouse_down);
|
2008-10-07 23:38:20 -07:00
|
|
|
evas_object_smart_member_del(sd->resize_obj);
|
|
|
|
}
|
2008-10-06 18:23:49 -07:00
|
|
|
sd->resize_obj = sobj;
|
2008-10-07 23:38:20 -07:00
|
|
|
if (sd->resize_obj)
|
|
|
|
{
|
2009-07-06 23:46:51 -07:00
|
|
|
if (!strcmp(evas_object_type_get(sd->resize_obj), SMART_NAME))
|
|
|
|
{
|
|
|
|
Smart_Data *sd2 = evas_object_smart_data_get(sd->resize_obj);
|
|
|
|
if (sd2) sd2->parent_obj = obj;
|
|
|
|
}
|
2008-10-24 19:11:06 -07:00
|
|
|
evas_object_clip_set(sobj, evas_object_clip_get(obj));
|
2008-10-07 23:38:20 -07:00
|
|
|
evas_object_smart_member_add(sobj, obj);
|
|
|
|
evas_object_event_callback_add(sobj, EVAS_CALLBACK_DEL, _sub_obj_del, sd);
|
2008-10-22 01:58:56 -07:00
|
|
|
evas_object_event_callback_add(sobj, EVAS_CALLBACK_MOUSE_DOWN, _sub_obj_mouse_down, sd);
|
2008-10-07 23:38:20 -07:00
|
|
|
_smart_reconfigure(sd);
|
|
|
|
evas_object_smart_callback_call(obj, "sub-object-add", sobj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_widget_hover_object_set(Evas_Object *obj, Evas_Object *sobj)
|
|
|
|
{
|
|
|
|
API_ENTRY return;
|
|
|
|
if (sd->hover_obj)
|
|
|
|
{
|
|
|
|
evas_object_event_callback_del(sd->hover_obj, EVAS_CALLBACK_DEL, _sub_obj_del);
|
|
|
|
}
|
|
|
|
sd->hover_obj = sobj;
|
|
|
|
if (sd->hover_obj)
|
|
|
|
{
|
|
|
|
evas_object_event_callback_add(sobj, EVAS_CALLBACK_DEL, _sub_obj_del, sd);
|
|
|
|
_smart_reconfigure(sd);
|
|
|
|
}
|
2008-10-06 18:23:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_widget_can_focus_set(Evas_Object *obj, int can_focus)
|
|
|
|
{
|
|
|
|
API_ENTRY return;
|
|
|
|
sd->can_focus = can_focus;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI int
|
2009-02-25 07:54:26 -08:00
|
|
|
elm_widget_can_focus_get(const Evas_Object *obj)
|
2008-10-06 18:23:49 -07:00
|
|
|
{
|
|
|
|
API_ENTRY return 0;
|
|
|
|
if (sd->can_focus) return 1;
|
|
|
|
if (sd->child_can_focus) return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI int
|
2009-02-25 07:54:26 -08:00
|
|
|
elm_widget_focus_get(const Evas_Object *obj)
|
2008-10-06 18:23:49 -07:00
|
|
|
{
|
|
|
|
API_ENTRY return 0;
|
|
|
|
return sd->focused;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Evas_Object *
|
2009-02-25 07:54:26 -08:00
|
|
|
elm_widget_focused_object_get(const Evas_Object *obj)
|
2008-10-06 18:23:49 -07:00
|
|
|
{
|
2009-02-25 07:54:26 -08:00
|
|
|
const Evas_Object *subobj;
|
|
|
|
const Eina_List *l;
|
2008-10-06 18:23:49 -07:00
|
|
|
API_ENTRY return NULL;
|
|
|
|
if (!sd->focused) return NULL;
|
2009-02-25 07:54:26 -08:00
|
|
|
EINA_LIST_FOREACH(sd->subobjs, l, subobj)
|
|
|
|
{
|
|
|
|
Evas_Object *fobj = elm_widget_focused_object_get(subobj);
|
2008-10-06 18:23:49 -07:00
|
|
|
if (fobj) return fobj;
|
|
|
|
}
|
2009-02-25 07:54:26 -08:00
|
|
|
return (Evas_Object *)obj;
|
2008-10-06 18:23:49 -07:00
|
|
|
}
|
|
|
|
|
2008-11-18 02:11:57 -08:00
|
|
|
EAPI Evas_Object *
|
2009-02-25 07:54:26 -08:00
|
|
|
elm_widget_top_get(const Evas_Object *obj)
|
2008-11-18 02:11:57 -08:00
|
|
|
{
|
|
|
|
API_ENTRY return NULL;
|
|
|
|
if (sd->parent_obj) return elm_widget_top_get(sd->parent_obj);
|
2009-02-25 07:54:26 -08:00
|
|
|
return (Evas_Object *)obj;
|
2008-11-18 02:11:57 -08:00
|
|
|
}
|
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
EAPI int
|
|
|
|
elm_widget_focus_jump(Evas_Object *obj, int forward)
|
|
|
|
{
|
|
|
|
API_ENTRY return 0;
|
|
|
|
if (!elm_widget_can_focus_get(obj)) return 0;
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
/* if it has a focus func its an end-point widget like a button */
|
|
|
|
if (sd->focus_func)
|
|
|
|
{
|
|
|
|
if (!sd->focused) sd->focused = 1;
|
|
|
|
else sd->focused = 0;
|
|
|
|
if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj);
|
2008-12-30 08:19:46 -08:00
|
|
|
sd->focus_func(obj);
|
2008-10-06 18:23:49 -07:00
|
|
|
return sd->focused;
|
|
|
|
}
|
|
|
|
/* its some container */
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int focus_next;
|
2009-07-06 23:46:51 -07:00
|
|
|
int noloop = 0;
|
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
focus_next = 0;
|
|
|
|
if (!sd->focused)
|
|
|
|
{
|
|
|
|
elm_widget_focus_set(obj, forward);
|
|
|
|
sd->focused = 1;
|
|
|
|
if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (forward)
|
|
|
|
{
|
2009-07-06 23:46:51 -07:00
|
|
|
if (elm_widget_can_focus_get(sd->resize_obj))
|
|
|
|
{
|
|
|
|
if ((focus_next) &&
|
|
|
|
(!elm_widget_disabled_get(sd->resize_obj)))
|
|
|
|
{
|
|
|
|
/* the previous focused item was unfocused - so focus
|
|
|
|
* the next one (that can be focused) */
|
|
|
|
if (elm_widget_focus_jump(sd->resize_obj, forward)) return 1;
|
|
|
|
else noloop = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (elm_widget_focus_get(sd->resize_obj))
|
|
|
|
{
|
|
|
|
/* jump to the next focused item or focus this item */
|
|
|
|
if (elm_widget_focus_jump(sd->resize_obj, forward)) return 1;
|
|
|
|
/* it returned 0 - it got to the last item and is past it */
|
|
|
|
focus_next = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!noloop)
|
|
|
|
{
|
2009-02-25 11:50:45 -08:00
|
|
|
const Eina_List *l;
|
|
|
|
Evas_Object *child;
|
|
|
|
EINA_LIST_FOREACH(sd->subobjs, l, child)
|
2009-07-06 23:46:51 -07:00
|
|
|
{
|
|
|
|
if (elm_widget_can_focus_get(child))
|
|
|
|
{
|
|
|
|
if ((focus_next) &&
|
|
|
|
(!elm_widget_disabled_get(child)))
|
|
|
|
{
|
|
|
|
/* the previous focused item was unfocused - so focus
|
|
|
|
* the next one (that can be focused) */
|
|
|
|
if (elm_widget_focus_jump(child, forward)) return 1;
|
|
|
|
else break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (elm_widget_focus_get(child))
|
|
|
|
{
|
|
|
|
/* jump to the next focused item or focus this item */
|
|
|
|
if (elm_widget_focus_jump(child, forward)) return 1;
|
|
|
|
/* it returned 0 - it got to the last item and is past it */
|
|
|
|
focus_next = 1;
|
|
|
|
}
|
|
|
|
}
|
2008-12-30 16:43:06 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-02-25 11:50:45 -08:00
|
|
|
const Eina_List *l;
|
|
|
|
Evas_Object *child;
|
|
|
|
|
|
|
|
EINA_LIST_REVERSE_FOREACH(sd->subobjs, l, child)
|
2008-10-06 18:23:49 -07:00
|
|
|
{
|
2009-02-25 11:50:45 -08:00
|
|
|
if (elm_widget_can_focus_get(child))
|
2008-10-06 18:23:49 -07:00
|
|
|
{
|
|
|
|
if ((focus_next) &&
|
2009-02-25 11:50:45 -08:00
|
|
|
(!elm_widget_disabled_get(child)))
|
2008-10-06 18:23:49 -07:00
|
|
|
{
|
|
|
|
/* the previous focused item was unfocused - so focus
|
|
|
|
* the next one (that can be focused) */
|
2009-02-25 11:50:45 -08:00
|
|
|
if (elm_widget_focus_jump(child, forward)) return 1;
|
2008-10-06 18:23:49 -07:00
|
|
|
else break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-02-25 11:50:45 -08:00
|
|
|
if (elm_widget_focus_get(child))
|
2008-10-06 18:23:49 -07:00
|
|
|
{
|
|
|
|
/* jump to the next focused item or focus this item */
|
2009-02-25 11:50:45 -08:00
|
|
|
if (elm_widget_focus_jump(child, forward)) return 1;
|
2008-10-06 18:23:49 -07:00
|
|
|
/* it returned 0 - it got to the last item and is past it */
|
|
|
|
focus_next = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-07-06 23:46:51 -07:00
|
|
|
if (!l)
|
|
|
|
{
|
2008-12-30 16:43:06 -08:00
|
|
|
if (elm_widget_can_focus_get(sd->resize_obj))
|
2008-10-06 18:23:49 -07:00
|
|
|
{
|
|
|
|
if ((focus_next) &&
|
2008-12-30 16:43:06 -08:00
|
|
|
(!elm_widget_disabled_get(sd->resize_obj)))
|
2008-10-06 18:23:49 -07:00
|
|
|
{
|
|
|
|
/* the previous focused item was unfocused - so focus
|
|
|
|
* the next one (that can be focused) */
|
2008-12-30 16:43:06 -08:00
|
|
|
if (elm_widget_focus_jump(sd->resize_obj, forward)) return 1;
|
2008-10-06 18:23:49 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-12-30 16:43:06 -08:00
|
|
|
if (elm_widget_focus_get(sd->resize_obj))
|
2008-10-06 18:23:49 -07:00
|
|
|
{
|
|
|
|
/* jump to the next focused item or focus this item */
|
2008-12-30 16:43:06 -08:00
|
|
|
if (elm_widget_focus_jump(sd->resize_obj, forward)) return 1;
|
2008-10-06 18:23:49 -07:00
|
|
|
/* it returned 0 - it got to the last item and is past it */
|
|
|
|
focus_next = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-07-06 23:46:51 -07:00
|
|
|
}
|
2008-10-06 18:23:49 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* no next item can be focused */
|
2008-12-30 08:19:46 -08:00
|
|
|
if (sd->focused)
|
|
|
|
{
|
2009-07-06 23:46:51 -07:00
|
|
|
sd->focused = 0;
|
|
|
|
if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj);
|
2008-12-30 08:19:46 -08:00
|
|
|
}
|
2008-10-06 18:23:49 -07:00
|
|
|
return 0;
|
2008-09-29 23:58:56 -07:00
|
|
|
}
|
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
EAPI void
|
|
|
|
elm_widget_focus_set(Evas_Object *obj, int first)
|
|
|
|
{
|
|
|
|
API_ENTRY return;
|
|
|
|
if (!sd->focused)
|
|
|
|
{
|
|
|
|
sd->focused = 1;
|
|
|
|
if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj);
|
|
|
|
}
|
|
|
|
if (sd->focus_func)
|
|
|
|
{
|
|
|
|
sd->focus_func(obj);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (first)
|
|
|
|
{
|
2009-07-06 23:46:51 -07:00
|
|
|
if ((elm_widget_can_focus_get(sd->resize_obj)) &&
|
|
|
|
(!elm_widget_disabled_get(sd->resize_obj)))
|
|
|
|
{
|
|
|
|
elm_widget_focus_set(sd->resize_obj, first);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-02-25 11:50:45 -08:00
|
|
|
const Eina_List *l;
|
|
|
|
Evas_Object *child;
|
|
|
|
EINA_LIST_FOREACH(sd->subobjs, l, child)
|
2009-07-06 23:46:51 -07:00
|
|
|
{
|
|
|
|
if ((elm_widget_can_focus_get(child)) &&
|
|
|
|
(!elm_widget_disabled_get(child)))
|
|
|
|
{
|
|
|
|
elm_widget_focus_set(child, first);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-10-06 18:23:49 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-02-25 11:50:45 -08:00
|
|
|
const Eina_List *l;
|
|
|
|
Evas_Object *child;
|
|
|
|
EINA_LIST_REVERSE_FOREACH(sd->subobjs, l, child)
|
2008-10-06 18:23:49 -07:00
|
|
|
{
|
2009-02-25 11:50:45 -08:00
|
|
|
if ((elm_widget_can_focus_get(child)) &&
|
|
|
|
(!elm_widget_disabled_get(child)))
|
2008-10-06 18:23:49 -07:00
|
|
|
{
|
2009-02-25 11:50:45 -08:00
|
|
|
elm_widget_focus_set(child, first);
|
2008-10-06 18:23:49 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2009-07-06 23:46:51 -07:00
|
|
|
if (!l)
|
|
|
|
{
|
|
|
|
if ((elm_widget_can_focus_get(sd->resize_obj)) &&
|
|
|
|
(!elm_widget_disabled_get(sd->resize_obj)))
|
|
|
|
{
|
|
|
|
elm_widget_focus_set(sd->resize_obj, first);
|
|
|
|
}
|
|
|
|
}
|
2008-10-06 18:23:49 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Evas_Object *
|
2009-02-25 07:54:26 -08:00
|
|
|
elm_widget_parent_get(const Evas_Object *obj)
|
2008-10-06 18:23:49 -07:00
|
|
|
{
|
|
|
|
API_ENTRY return NULL;
|
|
|
|
return sd->parent_obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_widget_focused_object_clear(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
API_ENTRY return;
|
|
|
|
if (!sd->focused) return;
|
2008-12-30 08:19:46 -08:00
|
|
|
if (elm_widget_focus_get(sd->resize_obj))
|
|
|
|
{
|
2009-07-06 23:46:51 -07:00
|
|
|
elm_widget_focused_object_clear(sd->resize_obj);
|
2008-12-30 08:19:46 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-02-25 11:50:45 -08:00
|
|
|
const Eina_List *l;
|
|
|
|
Evas_Object *child;
|
|
|
|
EINA_LIST_FOREACH(sd->subobjs, l, child)
|
2009-07-06 23:46:51 -07:00
|
|
|
{
|
|
|
|
if (elm_widget_focus_get(child))
|
|
|
|
{
|
|
|
|
elm_widget_focused_object_clear(child);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2008-10-06 18:23:49 -07:00
|
|
|
}
|
2008-12-30 08:19:46 -08:00
|
|
|
sd->focused = 0;
|
|
|
|
if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj);
|
2008-10-06 18:23:49 -07:00
|
|
|
if (sd->focus_func) sd->focus_func(obj);
|
2008-12-30 08:19:46 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_elm_widget_parent_focus(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
API_ENTRY return;
|
|
|
|
Evas_Object *o = elm_widget_parent_get(obj);
|
2008-12-30 16:43:06 -08:00
|
|
|
if (sd->focused) return;
|
2008-12-30 08:19:46 -08:00
|
|
|
if (o) _elm_widget_parent_focus(o);
|
|
|
|
sd->focused = 1;
|
2008-11-16 21:58:21 -08:00
|
|
|
if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj);
|
2008-12-30 08:19:46 -08:00
|
|
|
if (sd->focus_func) sd->focus_func(obj);
|
2008-10-06 18:23:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_widget_focus_steal(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Evas_Object *parent, *o;
|
|
|
|
API_ENTRY return;
|
|
|
|
if (sd->focused) return;
|
|
|
|
if (sd->disabled) return;
|
|
|
|
parent = obj;
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
o = elm_widget_parent_get(parent);
|
|
|
|
if (!o) break;
|
2009-07-06 23:46:51 -07:00
|
|
|
sd = evas_object_smart_data_get(o);
|
|
|
|
if (sd->focused) break;
|
2008-10-06 18:23:49 -07:00
|
|
|
parent = o;
|
|
|
|
}
|
2008-12-30 08:19:46 -08:00
|
|
|
if (!elm_widget_parent_get(parent))
|
|
|
|
elm_widget_focused_object_clear(parent);
|
|
|
|
else
|
2008-10-06 18:23:49 -07:00
|
|
|
{
|
2009-07-06 23:46:51 -07:00
|
|
|
parent = elm_widget_parent_get(parent);
|
|
|
|
sd = evas_object_smart_data_get(parent);
|
|
|
|
if (elm_widget_focus_get(sd->resize_obj))
|
|
|
|
elm_widget_focused_object_clear(sd->resize_obj);
|
|
|
|
else
|
|
|
|
{
|
2009-02-25 11:50:45 -08:00
|
|
|
const Eina_List *l;
|
|
|
|
Evas_Object *child;
|
|
|
|
EINA_LIST_FOREACH(sd->subobjs, l, child)
|
2009-07-06 23:46:51 -07:00
|
|
|
{
|
|
|
|
if (elm_widget_focus_get(child))
|
|
|
|
{
|
|
|
|
elm_widget_focused_object_clear(child);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-10-06 18:23:49 -07:00
|
|
|
}
|
2008-12-30 08:19:46 -08:00
|
|
|
_elm_widget_parent_focus(obj);
|
2008-10-06 18:23:49 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_widget_activate(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
API_ENTRY return;
|
|
|
|
elm_widget_change(obj);
|
|
|
|
if (sd->activate_func) sd->activate_func(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_widget_change(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
API_ENTRY return;
|
|
|
|
elm_widget_change(elm_widget_parent_get(obj));
|
|
|
|
if (sd->on_change_func) sd->on_change_func(sd->on_change_data, obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_widget_disabled_set(Evas_Object *obj, int disabled)
|
|
|
|
{
|
|
|
|
API_ENTRY return;
|
2009-08-26 09:52:53 -07:00
|
|
|
if (sd->disabled == disabled) return;
|
2008-10-06 18:23:49 -07:00
|
|
|
sd->disabled = disabled;
|
|
|
|
if (sd->focused)
|
|
|
|
{
|
|
|
|
Evas_Object *o, *parent;
|
|
|
|
|
|
|
|
parent = obj;
|
2009-07-06 23:46:51 -07:00
|
|
|
for (;;)
|
|
|
|
{
|
2008-10-06 18:23:49 -07:00
|
|
|
o = elm_widget_parent_get(parent);
|
|
|
|
if (!o) break;
|
|
|
|
parent = o;
|
|
|
|
}
|
|
|
|
elm_widget_focus_jump(parent, 1);
|
|
|
|
}
|
|
|
|
if (sd->disable_func) sd->disable_func(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI int
|
2009-02-25 07:54:26 -08:00
|
|
|
elm_widget_disabled_get(const Evas_Object *obj)
|
2008-10-06 18:23:49 -07:00
|
|
|
{
|
|
|
|
API_ENTRY return 0;
|
|
|
|
return sd->disabled;
|
|
|
|
}
|
|
|
|
|
2008-10-17 07:40:54 -07:00
|
|
|
EAPI void
|
|
|
|
elm_widget_show_region_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
|
|
|
|
{
|
|
|
|
API_ENTRY return;
|
|
|
|
if ((x == sd->rx) && (y == sd->ry) && (w == sd->rw) && (h == sd->rh)) return;
|
|
|
|
sd->rx = x;
|
|
|
|
sd->ry = y;
|
|
|
|
sd->rw = w;
|
|
|
|
sd->rh = h;
|
|
|
|
if (sd->on_show_region_func) sd->on_show_region_func(sd->on_show_region_data, obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2009-02-25 07:54:26 -08:00
|
|
|
elm_widget_show_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
|
2008-10-17 07:40:54 -07:00
|
|
|
{
|
|
|
|
API_ENTRY return;
|
|
|
|
if (x) *x = sd->rx;
|
|
|
|
if (y) *y = sd->ry;
|
|
|
|
if (w) *w = sd->rw;
|
|
|
|
if (h) *h = sd->rh;
|
|
|
|
}
|
|
|
|
|
2008-11-18 02:11:57 -08:00
|
|
|
EAPI void
|
|
|
|
elm_widget_scroll_hold_push(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
API_ENTRY return;
|
|
|
|
sd->scroll_hold++;
|
2009-03-20 08:08:33 -07:00
|
|
|
if (sd->scroll_hold == 1)
|
|
|
|
evas_object_smart_callback_call(obj, "scroll-hold-on", obj);
|
2008-11-18 02:11:57 -08:00
|
|
|
if (sd->parent_obj) elm_widget_scroll_hold_push(sd->parent_obj);
|
2009-09-07 21:41:36 -07:00
|
|
|
// FIXME: on delete/reparent hold pop
|
2008-11-18 02:11:57 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_widget_scroll_hold_pop(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
API_ENTRY return;
|
|
|
|
sd->scroll_hold--;
|
2009-03-20 08:08:33 -07:00
|
|
|
if (sd->scroll_hold < 0) sd->scroll_hold = 0;
|
|
|
|
if (sd->scroll_hold == 0)
|
|
|
|
evas_object_smart_callback_call(obj, "scroll-hold-off", obj);
|
2008-11-18 02:11:57 -08:00
|
|
|
if (sd->parent_obj) elm_widget_scroll_hold_pop(sd->parent_obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI int
|
2009-02-25 07:54:26 -08:00
|
|
|
elm_widget_scroll_hold_get(const Evas_Object *obj)
|
2008-11-18 02:11:57 -08:00
|
|
|
{
|
|
|
|
API_ENTRY return 0;
|
|
|
|
return sd->scroll_hold;
|
|
|
|
}
|
|
|
|
|
2009-03-20 08:08:33 -07:00
|
|
|
EAPI void
|
|
|
|
elm_widget_scroll_freeze_push(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
API_ENTRY return;
|
|
|
|
sd->scroll_freeze++;
|
|
|
|
if (sd->scroll_freeze == 1)
|
|
|
|
evas_object_smart_callback_call(obj, "scroll-freeze-on", obj);
|
|
|
|
if (sd->parent_obj) elm_widget_scroll_freeze_push(sd->parent_obj);
|
2009-09-07 21:41:36 -07:00
|
|
|
// FIXME: on delete/reparent freeze pop
|
2009-03-20 08:08:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_widget_scroll_freeze_pop(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
API_ENTRY return;
|
|
|
|
sd->scroll_freeze--;
|
|
|
|
if (sd->scroll_freeze < 0) sd->scroll_freeze = 0;
|
|
|
|
if (sd->scroll_freeze == 0)
|
|
|
|
evas_object_smart_callback_call(obj, "scroll-freeze-off", obj);
|
|
|
|
if (sd->parent_obj) elm_widget_scroll_freeze_pop(sd->parent_obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI int
|
|
|
|
elm_widget_scroll_freeze_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
API_ENTRY return 0;
|
|
|
|
return sd->scroll_freeze;
|
|
|
|
}
|
|
|
|
|
2009-02-02 21:09:03 -08:00
|
|
|
EAPI void
|
|
|
|
elm_widget_scale_set(Evas_Object *obj, double scale)
|
|
|
|
{
|
|
|
|
API_ENTRY return;
|
|
|
|
if (scale <= 0.0) scale = 0.0;
|
|
|
|
if (sd->scale != scale)
|
|
|
|
{
|
2009-07-06 23:46:51 -07:00
|
|
|
sd->scale = scale;
|
|
|
|
elm_widget_theme(obj);
|
2009-02-02 21:09:03 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI double
|
2009-02-25 07:54:26 -08:00
|
|
|
elm_widget_scale_get(const Evas_Object *obj)
|
2009-02-02 21:09:03 -08:00
|
|
|
{
|
|
|
|
API_ENTRY return 1.0;
|
2009-06-12 15:55:06 -07:00
|
|
|
if (sd->scale == 0.0)
|
|
|
|
{
|
|
|
|
if (sd->parent_obj)
|
|
|
|
return elm_widget_scale_get(sd->parent_obj);
|
|
|
|
else
|
2009-10-10 22:43:42 -07:00
|
|
|
return 1.0;
|
2009-06-12 15:55:06 -07:00
|
|
|
}
|
2009-02-02 21:09:03 -08:00
|
|
|
return sd->scale;
|
|
|
|
}
|
|
|
|
|
2009-04-22 21:03:27 -07:00
|
|
|
EAPI void
|
|
|
|
elm_widget_style_set(Evas_Object *obj, const char *style)
|
|
|
|
{
|
|
|
|
const char *old;
|
|
|
|
API_ENTRY return;
|
|
|
|
old = sd->style;
|
|
|
|
sd->style = eina_stringshare_add(style);
|
2009-04-22 21:10:43 -07:00
|
|
|
if (old) eina_stringshare_del(old);
|
|
|
|
if (old != sd->style) elm_widget_theme(obj);
|
2009-04-22 21:03:27 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI const char *
|
|
|
|
elm_widget_style_get(const Evas_Object *obj)
|
|
|
|
{
|
2009-04-22 21:10:43 -07:00
|
|
|
API_ENTRY return "";
|
2009-04-22 21:03:27 -07:00
|
|
|
if (sd->style) return sd->style;
|
|
|
|
return "default";
|
|
|
|
}
|
|
|
|
|
2009-05-13 05:21:52 -07:00
|
|
|
EAPI void
|
|
|
|
elm_widget_type_set(Evas_Object *obj, const char *type)
|
|
|
|
{
|
|
|
|
const char *old;
|
|
|
|
API_ENTRY return;
|
|
|
|
old = sd->type;
|
|
|
|
sd->type = eina_stringshare_add(type);
|
|
|
|
if (old) eina_stringshare_del(old);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI const char *
|
|
|
|
elm_widget_type_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
API_ENTRY return "";
|
|
|
|
if (sd->type) return sd->type;
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
/* local subsystem functions */
|
2008-09-29 23:58:56 -07:00
|
|
|
static void
|
2008-10-06 18:23:49 -07:00
|
|
|
_smart_reconfigure(Smart_Data *sd)
|
2008-09-29 23:58:56 -07:00
|
|
|
{
|
2008-10-06 18:23:49 -07:00
|
|
|
if (sd->resize_obj)
|
|
|
|
{
|
|
|
|
evas_object_move(sd->resize_obj, sd->x, sd->y);
|
|
|
|
evas_object_resize(sd->resize_obj, sd->w, sd->h);
|
2008-10-07 23:38:20 -07:00
|
|
|
}
|
|
|
|
if (sd->hover_obj)
|
|
|
|
{
|
|
|
|
evas_object_move(sd->hover_obj, sd->x, sd->y);
|
|
|
|
evas_object_resize(sd->hover_obj, sd->w, sd->h);
|
|
|
|
}
|
2008-09-29 23:58:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-10-06 18:23:49 -07:00
|
|
|
_smart_add(Evas_Object *obj)
|
2008-09-29 23:58:56 -07:00
|
|
|
{
|
2008-10-06 18:23:49 -07:00
|
|
|
Smart_Data *sd;
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
sd = calloc(1, sizeof(Smart_Data));
|
|
|
|
if (!sd) return;
|
2008-10-22 01:58:56 -07:00
|
|
|
sd->obj = obj;
|
2008-10-06 18:23:49 -07:00
|
|
|
sd->x = 0;
|
|
|
|
sd->y = 0;
|
|
|
|
sd->w = 0;
|
|
|
|
sd->h = 0;
|
|
|
|
sd->can_focus = 1;
|
|
|
|
evas_object_smart_data_set(obj, sd);
|
2008-09-29 23:58:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-10-06 18:23:49 -07:00
|
|
|
_smart_del(Evas_Object *obj)
|
2008-09-29 23:58:56 -07:00
|
|
|
{
|
2008-10-06 18:23:49 -07:00
|
|
|
Evas_Object *sobj;
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
INTERNAL_ENTRY;
|
2008-10-24 19:11:06 -07:00
|
|
|
if (sd->del_pre_func) sd->del_pre_func(obj);
|
2008-10-07 23:38:20 -07:00
|
|
|
if (sd->resize_obj)
|
|
|
|
{
|
2009-07-06 23:46:51 -07:00
|
|
|
sobj = sd->resize_obj;
|
2008-10-07 23:38:20 -07:00
|
|
|
sd->resize_obj = NULL;
|
2009-02-14 18:53:56 -08:00
|
|
|
evas_object_event_callback_del(sobj, EVAS_CALLBACK_DEL, _sub_obj_del);
|
2009-07-06 23:46:51 -07:00
|
|
|
evas_object_smart_callback_call(sd->obj, "sub-object-del", sd->resize_obj);
|
2009-02-14 18:53:56 -08:00
|
|
|
evas_object_del(sobj);
|
2008-10-07 23:38:20 -07:00
|
|
|
}
|
|
|
|
if (sd->hover_obj)
|
|
|
|
{
|
2009-07-06 23:46:51 -07:00
|
|
|
sobj = sd->resize_obj;
|
2008-10-07 23:38:20 -07:00
|
|
|
sd->hover_obj = NULL;
|
2009-02-14 18:53:56 -08:00
|
|
|
evas_object_event_callback_del(sobj, EVAS_CALLBACK_DEL, _sub_obj_del);
|
2009-07-06 23:46:51 -07:00
|
|
|
evas_object_smart_callback_call(sd->obj, "sub-object-del", sobj);
|
2009-02-14 18:53:56 -08:00
|
|
|
evas_object_del(sobj);
|
2008-10-07 23:38:20 -07:00
|
|
|
}
|
2009-02-25 12:18:38 -08:00
|
|
|
EINA_LIST_FREE(sd->subobjs, sobj)
|
2008-10-06 18:23:49 -07:00
|
|
|
{
|
2008-10-07 23:38:20 -07:00
|
|
|
evas_object_event_callback_del(sobj, EVAS_CALLBACK_DEL, _sub_obj_del);
|
2009-07-06 23:46:51 -07:00
|
|
|
evas_object_smart_callback_call(sd->obj, "sub-object-del", sobj);
|
2008-10-06 18:23:49 -07:00
|
|
|
evas_object_del(sobj);
|
|
|
|
}
|
2008-10-24 19:11:06 -07:00
|
|
|
if (sd->del_func) sd->del_func(obj);
|
2009-05-13 05:21:52 -07:00
|
|
|
if (sd->style) eina_stringshare_del(sd->style);
|
|
|
|
if (sd->type) eina_stringshare_del(sd->type);
|
2008-10-06 18:23:49 -07:00
|
|
|
free(sd);
|
2008-09-29 23:58:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-10-06 18:23:49 -07:00
|
|
|
_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
|
2008-09-29 23:58:56 -07:00
|
|
|
{
|
2008-10-06 18:23:49 -07:00
|
|
|
INTERNAL_ENTRY;
|
|
|
|
sd->x = x;
|
|
|
|
sd->y = y;
|
|
|
|
_smart_reconfigure(sd);
|
2008-09-29 23:58:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-10-06 18:23:49 -07:00
|
|
|
_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
|
|
|
|
{
|
|
|
|
INTERNAL_ENTRY;
|
|
|
|
sd->w = w;
|
|
|
|
sd->h = h;
|
|
|
|
_smart_reconfigure(sd);
|
2008-09-29 23:58:56 -07:00
|
|
|
}
|
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
static void
|
|
|
|
_smart_show(Evas_Object *obj)
|
2008-09-29 23:58:56 -07:00
|
|
|
{
|
2008-10-06 18:23:49 -07:00
|
|
|
INTERNAL_ENTRY;
|
|
|
|
evas_object_show(sd->resize_obj);
|
|
|
|
}
|
2008-09-29 23:58:56 -07:00
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
static void
|
|
|
|
_smart_hide(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
INTERNAL_ENTRY;
|
|
|
|
evas_object_hide(sd->resize_obj);
|
|
|
|
}
|
2008-09-29 23:58:56 -07:00
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
static void
|
|
|
|
_smart_color_set(Evas_Object *obj, int r, int g, int b, int a)
|
|
|
|
{
|
|
|
|
INTERNAL_ENTRY;
|
|
|
|
evas_object_color_set(sd->resize_obj, r, g, b, a);
|
2008-09-29 23:58:56 -07:00
|
|
|
}
|
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
static void
|
|
|
|
_smart_clip_set(Evas_Object *obj, Evas_Object *clip)
|
2008-09-29 23:58:56 -07:00
|
|
|
{
|
2008-10-06 18:23:49 -07:00
|
|
|
INTERNAL_ENTRY;
|
|
|
|
evas_object_clip_set(sd->resize_obj, clip);
|
2008-09-29 23:58:56 -07:00
|
|
|
}
|
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
static void
|
|
|
|
_smart_clip_unset(Evas_Object *obj)
|
2008-09-29 23:58:56 -07:00
|
|
|
{
|
2008-10-06 18:23:49 -07:00
|
|
|
INTERNAL_ENTRY;
|
|
|
|
evas_object_clip_unset(sd->resize_obj);
|
2009-07-06 23:46:51 -07:00
|
|
|
}
|
2008-10-06 18:23:49 -07:00
|
|
|
|
|
|
|
/* never need to touch this */
|
|
|
|
|
|
|
|
static void
|
|
|
|
_smart_init(void)
|
|
|
|
{
|
|
|
|
if (_e_smart) return;
|
|
|
|
{
|
|
|
|
static const Evas_Smart_Class sc =
|
|
|
|
{
|
|
|
|
SMART_NAME,
|
|
|
|
EVAS_SMART_CLASS_VERSION,
|
|
|
|
_smart_add,
|
2009-07-06 23:46:51 -07:00
|
|
|
_smart_del,
|
2008-10-06 18:23:49 -07:00
|
|
|
_smart_move,
|
|
|
|
_smart_resize,
|
|
|
|
_smart_show,
|
|
|
|
_smart_hide,
|
|
|
|
_smart_color_set,
|
|
|
|
_smart_clip_set,
|
|
|
|
_smart_clip_unset,
|
|
|
|
NULL,
|
2008-10-24 19:57:03 -07:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2008-10-06 18:23:49 -07:00
|
|
|
NULL
|
|
|
|
};
|
2009-07-06 23:46:51 -07:00
|
|
|
_e_smart = evas_smart_class_new(&sc);
|
2008-10-06 18:23:49 -07:00
|
|
|
}
|
2008-09-29 23:58:56 -07:00
|
|
|
}
|
2009-09-23 15:56:47 -07:00
|
|
|
|
|
|
|
|
|
|
|
Eina_List *
|
|
|
|
_stringlist_get(const char *str)
|
|
|
|
{
|
|
|
|
Eina_List *list = NULL;
|
|
|
|
const char *s, *b;
|
|
|
|
if (!str) return NULL;
|
|
|
|
for (b = s = str; 1; s++)
|
|
|
|
{
|
|
|
|
if ((*s == ' ') || (*s == 0))
|
|
|
|
{
|
|
|
|
char *t = malloc(s - b + 1);
|
|
|
|
if (t)
|
|
|
|
{
|
|
|
|
strncpy(t, b, s - b);
|
|
|
|
t[s - b] = 0;
|
|
|
|
list = eina_list_append(list, eina_stringshare_add(t));
|
|
|
|
free(t);
|
|
|
|
}
|
|
|
|
b = s + 1;
|
|
|
|
}
|
|
|
|
if (*s == 0) break;
|
|
|
|
}
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_stringlist_free(Eina_List *list)
|
|
|
|
{
|
|
|
|
const char *s;
|
|
|
|
EINA_LIST_FREE(list, s)
|
|
|
|
eina_stringshare_del(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
|