Add 'drop' callback when objects are dropped.

SVN revision: 51977
This commit is contained in:
Brett Nash 2010-09-08 06:20:05 +00:00
parent d342ca5976
commit 9640443824
5 changed files with 20 additions and 13 deletions

View File

@ -43,10 +43,13 @@ test_photo(void *data, Evas_Object *obj, void *event_info)
if (n >= 9) n = 0;
elm_photo_file_set(ph, buf);
elm_photo_editable_set(ph, 1);
evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND,
evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND,
EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(ph, EVAS_HINT_FILL,
evas_object_size_hint_align_set(ph, EVAS_HINT_FILL,
EVAS_HINT_FILL);
evas_object_smart_callback_add(ph, "drop",
(void*)printf,
"Drop on object %p: %s\n");
elm_photo_size_set(ph, 80);
if(n == 2 || n == 3) {
elm_photo_fill_inside_set(ph, EINA_TRUE);
@ -64,8 +67,10 @@ test_photo(void *data, Evas_Object *obj, void *event_info)
elm_scroller_content_set(sc, tb);
evas_object_show(tb);
evas_object_show(sc);
evas_object_resize(win, 300, 300);
evas_object_show(win);
}
/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/
#endif

View File

@ -11,8 +11,8 @@
*
* Signals that you can add callbacks for are:
*
* clicked - This is called when a user has clicked the image
*
* - clicked: This is called when a user has clicked the image
* - drop: Something has been dropped on the image
*/
typedef struct _Widget_Data Widget_Data;
@ -329,7 +329,7 @@ elm_image_editable_set(Evas_Object *obj, Eina_Bool set)
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;;
_els_smart_icon_edit_set(wd->img, set);
_els_smart_icon_edit_set(wd->img, set, obj);
}

View File

@ -9,7 +9,8 @@
*
* Signals that you can add callbacks for are:
*
* clicked - This is called when a user has clicked the photo
* - clicked: This is called when a user has clicked the photo
* - drop: Something was dropped on the widget
*
*/
@ -234,6 +235,6 @@ elm_photo_editable_set(Evas_Object *obj, Eina_Bool set)
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;;
_els_smart_icon_edit_set(wd->img, set);
_els_smart_icon_edit_set(wd->img, set, obj);
}

View File

@ -277,7 +277,7 @@ _els_smart_icon_orient_set(Evas_Object *obj, Elm_Image_Orient orient)
* Turns on editing through drag and drop and copy and paste.
*/
void
_els_smart_icon_edit_set(Evas_Object *obj, Eina_Bool edit)
_els_smart_icon_edit_set(Evas_Object *obj, Eina_Bool edit, Evas_Object *parent)
{
Smart_Data *sd;
@ -301,7 +301,7 @@ _els_smart_icon_edit_set(Evas_Object *obj, Eina_Bool edit)
if (sd->edit)
{
elm_drop_target_add(obj, ELM_SEL_FORMAT_IMAGE, _els_smart_icon_dropcb,
NULL);
parent);
}
else
{
@ -622,10 +622,11 @@ _els_smart_icon_rotate_180(Smart_Data *sd)
}
static Eina_Bool
_els_smart_icon_dropcb(void *unsued __UNUSED__,Evas_Object *obj,
Elm_Drop_Data *drop)
_els_smart_icon_dropcb(void *elmobj,Evas_Object *obj, Elm_Drop_Data *drop)
{
_els_smart_icon_file_key_set(obj, drop->data, NULL);
evas_object_smart_callback_call(elmobj, "drop", drop->data);
return EINA_TRUE;
}
/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/

View File

@ -11,4 +11,4 @@ void _els_smart_icon_scale_size_set (Evas_Object *obj, int size);
void _els_smart_icon_scale_set (Evas_Object *obj, double scale);
void _els_smart_icon_orient_set (Evas_Object *obj, Elm_Image_Orient orient);
void _els_smart_icon_edit_set (Evas_Object *obj, Eina_Bool);
void _els_smart_icon_edit_set (Evas_Object *obj, Eina_Bool, Evas_Object *parent);