editiable flags to allow drag dests for photso and images.

SVN revision: 51973
This commit is contained in:
Brett Nash 2010-09-08 04:55:20 +00:00
parent b2c68b6c74
commit 308e09effd
5 changed files with 73 additions and 0 deletions

View File

@ -42,6 +42,7 @@ test_photo(void *data, Evas_Object *obj, void *event_info)
n++;
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_HINT_EXPAND);
evas_object_size_hint_align_set(ph, EVAS_HINT_FILL,

View File

@ -312,3 +312,16 @@ elm_image_orient_set(Evas_Object *obj, Elm_Image_Orient orient)
if (!wd) return;
_els_smart_icon_orient_set(wd->img, orient);
}
EAPI void
elm_image_editable_set(Evas_Object *obj, Eina_Bool set)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;;
_els_smart_icon_edit_set(wd->img, set);
}
/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/

View File

@ -217,3 +217,13 @@ elm_photo_fill_inside_set(Evas_Object *obj, Eina_Bool fill)
_sizing_eval(obj);
}
EAPI void
elm_photo_editable_set(Evas_Object *obj, Eina_Bool set)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;;
_els_smart_icon_edit_set(wd->img, set);
}

View File

@ -14,6 +14,7 @@ struct _Smart_Data
unsigned char scale_down : 1;
unsigned char preloading : 1;
unsigned char show : 1;
unsigned char edit : 1;
};
/* local subsystem functions */
@ -32,6 +33,7 @@ static void _smart_clip_unset(Evas_Object *obj);
static void _els_smart_icon_flip_horizontal(Smart_Data *sd);
static void _els_smart_icon_flip_vertical(Smart_Data *sd);
static void _els_smart_icon_rotate_180(Smart_Data *sd);
static Eina_Bool _els_smart_icon_dropcb(void *,Evas_Object *, Elm_Drop_Data *);
/* local subsystem globals */
static Evas_Smart *_e_smart = NULL;
@ -271,6 +273,43 @@ _els_smart_icon_orient_set(Evas_Object *obj, Elm_Image_Orient orient)
_smart_reconfigure(sd);
}
/**
* Turns on editing through drag and drop and copy and paste.
*/
void
_els_smart_icon_edit_set(Evas_Object *obj, Eina_Bool edit)
{
Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
if (!sd) return;
if (strcmp(evas_object_type_get(sd->obj), "edje")== 0)
{
printf("No editing edje objects yet (ever)\n");
return;
}
printf("FIXME: Implement editing in els_icon\n");
printf("%s +%d\n",__FILE__,__LINE__);
/* Unfortunately eina bool is not a bool, but a char */
edit = !!edit;
if (edit == sd->edit) return;
sd->edit = edit;
if (sd->edit)
{
elm_drop_target_add(obj, ELM_SEL_FORMAT_IMAGE, _els_smart_icon_dropcb,
NULL);
}
else
{
elm_drop_target_del(obj);
}
}
/* local subsystem globals */
static void
_smart_reconfigure(Smart_Data *sd)
@ -582,3 +621,11 @@ _els_smart_icon_rotate_180(Smart_Data *sd)
_smart_reconfigure(sd);
}
static Eina_Bool
_els_smart_icon_dropcb(void *unsued __UNUSED__,Evas_Object *obj,
Elm_Drop_Data *drop)
{
_els_smart_icon_file_key_set(obj, drop->data, NULL);
return EINA_TRUE;
}
/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/

View File

@ -10,3 +10,5 @@ void _els_smart_icon_scale_down_set (Evas_Object *obj, int scale_down)
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);