Evas.Draggable_Interface: move editable_set/get to lecacy API

Elm_XXX_editable_set/get is related with drag and drop.

Elm_entry, Elm_image, Elm_photo, Elm_thumb has editable API.
If user call elm_entry_editable_set(obj, EINA_TRUE),
elm entry's content(text) can be changed into dragging text.
elm_image(photo,thumb also) is same. its content(image) also
can be changed into dragging image.

so changed for these widget to use drag_target property in evas_draggable_interface
This commit is contained in:
Ji-Youn Park 2016-03-19 10:00:19 +08:30
parent 1adb1962de
commit 07fa35da20
12 changed files with 172 additions and 85 deletions

View File

@ -4107,7 +4107,7 @@ _elm_entry_line_wrap_get(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
}
EOLIAN static void
_elm_entry_editable_set(Eo *obj, Elm_Entry_Data *sd, Eina_Bool editable)
_elm_entry_evas_draggable_interface_drag_target_set(Eo *obj, Elm_Entry_Data *sd, Eina_Bool editable)
{
if (sd->editable == editable) return;
sd->editable = editable;
@ -4130,7 +4130,7 @@ _elm_entry_editable_set(Eo *obj, Elm_Entry_Data *sd, Eina_Bool editable)
}
EOLIAN static Eina_Bool
_elm_entry_editable_get(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
_elm_entry_evas_draggable_interface_drag_target_get(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
{
return sd->editable;
}
@ -5855,4 +5855,17 @@ _elm_entry_elm_interface_atspi_accessible_name_get(Eo *obj, Elm_Entry_Data *sd)
return ret ? strdup(ret) : NULL;
}
/* Legacy deprecated functions */
EAPI void
elm_entry_editable_set(Evas_Object *obj, Eina_Bool edit)
{
evas_draggable_interface_drag_target_set(obj, edit);
}
EAPI Eina_Bool
elm_entry_editable_get(const Evas_Object *obj)
{
return evas_draggable_interface_drag_target_get(obj);
}
#include "elm_entry.eo.c"

View File

@ -112,7 +112,8 @@ enum Elm.Cnp_Mode
class Elm.Entry (Elm.Layout, Elm.Interface_Scrollable, Evas.Clickable_Interface,
Elm.Interface_Atspi_Text, Elm.Interface_Atspi_Editable_Text, Efl.File,
Evas.Selectable_Interface, Evas.Scrollable_Interface)
Evas.Selectable_Interface, Evas.Scrollable_Interface,
Evas.Draggable_Interface)
{
eo_prefix: elm_obj_entry;
methods {
@ -261,28 +262,6 @@ class Elm.Entry (Elm.Layout, Elm.Interface_Scrollable, Evas.Clickable_Interface,
autocapital_type: Elm.Autocapital.Type; [[The type of autocapitalization.]]
}
}
@property editable {
set {
[[Sets if the entry is to be editable or not.
By default, entries are editable and when focused, any text input by the
user will be inserted at the current cursor position. But calling this
function with $editable as $false will prevent the user from
inputting text into the entry.
The only way to change the text of a non-editable entry is to use
\@ref elm_object_text_set, \@ref elm_entry_entry_insert and other related
functions.
]]
}
get {
[[Get whether the entry is editable or not.]]
}
values {
editable: bool; [[If $true, user input will be inserted in the entry,
if not, the entry is read-only and no user input is allowed.]]
}
}
@property anchor_hover_style {
set {
[[Set the style that the hover should use
@ -925,6 +904,8 @@ class Elm.Entry (Elm.Layout, Elm.Interface_Scrollable, Evas.Clickable_Interface,
Evas.Object_Smart.del;
Evas.Object_Smart.show;
Evas.Object_Smart.hide;
Evas.Draggable_Interface.drag_target.set;
Evas.Draggable_Interface.drag_target.get;
Elm.Widget.activate;
Elm.Widget.focus_direction_manager_is;
Elm.Widget.theme_apply;

View File

@ -71,3 +71,32 @@ EAPI Eina_Bool elm_entry_file_set(Evas_Object *obj, const char *file, E
* @param[out] format The file format
*/
EAPI void elm_entry_file_get(const Evas_Object *obj, const char **file, Elm_Text_Format *format);
/**
* @brief Sets if the entry is to be editable or not.
*
* By default, entries are editable and when focused, any text input by the
* user will be inserted at the current cursor position. But calling this
* function with @c editable as @c false will prevent the user from inputting
* text into the entry.
*
* The only way to change the text of a non-editable entry is to use @ref
* elm_object_text_set, @ref elm_entry_entry_insert and other related
* functions.
*
* @param[in] editable If @c true, user input will be inserted in the entry, if
* not, the entry is read-only and no user input is allowed.
*
* @ingroup Elm_Entry
*/
EAPI void elm_entry_editable_set(Evas_Object *obj, Eina_Bool editable);
/**
* @brief Get whether the entry is editable or not.
*
* @return If @c true, user input will be inserted in the entry, if not, the
* entry is read-only and no user input is allowed.
*
* @ingroup Elm_Entry
*/
EAPI Eina_Bool elm_entry_editable_get(const Evas_Object *obj);

View File

@ -1399,7 +1399,7 @@ _elm_image_orient_get(Eo *obj EINA_UNUSED, Elm_Image_Data *sd)
* Turns on editing through drag and drop and copy and paste.
*/
EOLIAN static void
_elm_image_editable_set(Eo *obj, Elm_Image_Data *sd, Eina_Bool edit)
_elm_image_evas_draggable_interface_drag_target_set(Eo *obj, Elm_Image_Data *sd, Eina_Bool edit)
{
if (sd->edje)
{
@ -1430,7 +1430,7 @@ _elm_image_editable_set(Eo *obj, Elm_Image_Data *sd, Eina_Bool edit)
}
EOLIAN static Eina_Bool
_elm_image_editable_get(Eo *obj EINA_UNUSED, Elm_Image_Data *sd)
_elm_image_evas_draggable_interface_drag_target_get(Eo *obj EINA_UNUSED, Elm_Image_Data *sd)
{
return sd->edit;
}
@ -1645,4 +1645,17 @@ elm_image_smooth_get(const Evas_Object *obj)
// A11Y - END
/* Legacy deprecated functions */
EAPI void
elm_image_editable_set(Evas_Object *obj, Eina_Bool edit)
{
evas_draggable_interface_drag_target_set(obj, edit);
}
EAPI Eina_Bool
elm_image_editable_get(const Evas_Object *obj)
{
return evas_draggable_interface_drag_target_get(obj);
}
#include "elm_image.eo.c"

View File

@ -42,25 +42,12 @@ struct Elm.Image.Error
}
class Elm.Image (Elm.Widget, Efl.File, Efl.Image_Load, Evas.Clickable_Interface,
Edje.Object, Efl.Image,
Edje.Object, Efl.Image, Evas.Draggable_Interface,
Elm.Interface_Atspi_Image, Elm.Interface_Atspi_Widget_Action,
Efl.Player)
{
eo_prefix: elm_obj_image;
methods {
@property editable {
[[Contrtol if thhe image is 'editable'.
This means the image is a valid drag target for drag and drop, and can be
cut or pasted too.]]
set {
}
get {
}
values {
set: bool; [[Turn on or off editability. Default is $false.]]
}
}
@property resize_down {
[[Control whether the object's image can be resized to a size smaller than the original one.
@ -321,6 +308,8 @@ class Elm.Image (Elm.Widget, Efl.File, Efl.Image_Load, Evas.Clickable_Interface,
Evas.Object_Smart.del;
Evas.Object_Smart.member_add;
Evas.Object_Smart.resize;
Evas.Draggable_Interface.drag_target.set;
Evas.Draggable_Interface.drag_target.get;
Elm.Widget.theme_apply;
Elm.Widget.event;
Elm.Interface_Atspi_Image.extents.get;

View File

@ -249,4 +249,27 @@ EAPI Eina_Bool elm_image_animated_get(const Evas_Object *obj);
*/
EAPI Eina_Bool elm_image_animated_available_get(const Evas_Object *obj);
/**
* @brief Contrtol if the image is 'editable'.
*
* This means the image is a valid drag target for drag and drop, and can be
* cut or pasted too.
*
* @param[in] set Turn on or off editability. Default is @c false.
*
* @ingroup Elm_Image
*/
EAPI void elm_image_editable_set(Evas_Object *obj, Eina_Bool set);
/**
* @brief Contrtol if the image is 'editable'.
*
* This means the image is a valid drag target for drag and drop, and can be
* cut or pasted too.
*
* @return Turn on or off editability. Default is @c false.
*
* @ingroup Elm_Image
*/
EAPI Eina_Bool elm_image_editable_get(const Evas_Object *obj);
#include "elm_image.eo.legacy.h"

View File

@ -360,13 +360,13 @@ _elm_photo_fill_inside_get(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd)
}
EOLIAN static void
_elm_photo_editable_set(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd, Eina_Bool set)
_elm_photo_evas_draggable_interface_drag_target_set(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd, Eina_Bool set)
{
elm_image_editable_set(sd->icon, set);
}
EOLIAN static Eina_Bool
_elm_photo_editable_get(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd)
_elm_photo_evas_draggable_interface_drag_target_get(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd)
{
return elm_image_editable_get(sd->icon);
}
@ -404,4 +404,17 @@ elm_photo_file_set(Eo *obj, const char *file)
return efl_file_set((Eo *) obj, file, NULL);
}
/* Legacy deprecated functions */
EAPI void
elm_photo_editable_set(Evas_Object *obj, Eina_Bool edit)
{
evas_draggable_interface_drag_target_set(obj, edit);
}
EAPI Eina_Bool
elm_photo_editable_get(const Evas_Object *obj)
{
return evas_draggable_interface_drag_target_get(obj);
}
#include "elm_photo.eo.c"

View File

@ -2,22 +2,6 @@ class Elm.Photo (Elm.Widget, Efl.File, Evas.Clickable_Interface, Evas.Draggable_
{
eo_prefix: elm_obj_photo;
methods {
@property editable {
set {
[[Set editability of the photo.
An editable photo can be dragged to or from, and can be cut or
pasted too. Note that pasting an image or dropping an item on
the image will delete the existing content.
]]
}
get {
[[Get editability of the photo.]]
}
values {
set: bool; [[To set of clear editability.]]
}
}
@property fill_inside {
set {
[[Set if the photo should be completely visible or not.]]
@ -77,6 +61,8 @@ class Elm.Photo (Elm.Widget, Efl.File, Evas.Clickable_Interface, Evas.Draggable_
Efl.File.file.set;
Evas.Object_Smart.add;
Evas.Object_Smart.del;
Evas.Draggable_Interface.drag_target.set;
Evas.Draggable_Interface.drag_target.get;
Elm.Widget.theme_apply;
}

View File

@ -23,4 +23,25 @@ EAPI Evas_Object *elm_photo_add(Evas_Object *parent);
*/
EAPI Eina_Bool elm_photo_file_set(Eo *obj, const char *file);
/**
* Set editability of the photo.
*
* An editable photo can be dragged to or from, and can be cut or pasted too.
* Note that pasting an image or dropping an item on the image will delete the
* existing content.
*
* @param[in] set To set of clear editability.
*
* @ingroup Elm_Photo
*/
EAPI void elm_photo_editable_set(Evas_Object *obj, Eina_Bool set);
/**
* Get editability of the photo.
*
* @return To set of clear editability.
*
* @ingroup Elm_Photo
*/
EAPI Eina_Bool elm_photo_editable_get(const Evas_Object *obj);
#include "elm_photo.eo.legacy.h"

View File

@ -814,11 +814,11 @@ elm_thumb_ethumb_client_connected_get(void)
return _elm_ethumb_connected;
}
EOLIAN static Eina_Bool
_elm_thumb_editable_set(Eo *obj, Elm_Thumb_Data *sd, Eina_Bool edit)
EOLIAN static void
_elm_thumb_evas_draggable_interface_drag_target_set(Eo *obj, Elm_Thumb_Data *sd, Eina_Bool edit)
{
edit = !!edit;
if (sd->edit == edit) return EINA_TRUE;
if (sd->edit == edit) return;
sd->edit = edit;
if (sd->edit)
@ -834,11 +834,11 @@ _elm_thumb_editable_set(Eo *obj, Elm_Thumb_Data *sd, Eina_Bool edit)
NULL, NULL,
_elm_thumb_dnd_cb, obj);
return EINA_TRUE;
return;
}
EOLIAN static Eina_Bool
_elm_thumb_editable_get(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd)
_elm_thumb_evas_draggable_interface_drag_target_get(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd)
{
return sd->edit;
}
@ -861,5 +861,18 @@ elm_thumb_file_get(const Eo *obj, const char **file, const char **key)
efl_file_get((Eo *) obj, file, key);
}
/* Legacy deprecated functions */
EAPI Eina_Bool
elm_thumb_editable_set(Evas_Object *obj, Eina_Bool edit)
{
evas_draggable_interface_drag_target_set(obj, edit);
return EINA_TRUE;
}
EAPI Eina_Bool
elm_thumb_editable_get(const Evas_Object *obj)
{
return evas_draggable_interface_drag_target_get(obj);
}
#include "elm_thumb.eo.c"

View File

@ -8,7 +8,8 @@ enum Elm.Thumb.Animation_Setting
last
}
class Elm.Thumb (Elm.Layout, Efl.File, Evas.Clickable_Interface)
class Elm.Thumb (Elm.Layout, Efl.File, Evas.Clickable_Interface,
Evas.Draggable_Interface)
{
eo_prefix: elm_obj_thumb;
methods {
@ -98,26 +99,6 @@ class Elm.Thumb (Elm.Layout, Efl.File, Evas.Clickable_Interface)
orient: Ethumb_Thumb_Orientation; [[The orientation setting.]]
}
}
@property editable {
set {
[[Make the thumbnail 'editable'.
This means the thumbnail is a valid drag target for drag and
drop, and can be cut or pasted too.
]]
return: bool;
}
get {
[[Get whether the thumbnail is editable.
This means the thumbnail is a valid drag target for drag and
drop, and can be cut or pasted too.
]]
}
values {
edit: bool; [[The editable state, default is $false.]]
}
}
@property aspect {
set {
[[Set the aspect for the thumb object.
@ -226,6 +207,8 @@ class Elm.Thumb (Elm.Layout, Efl.File, Evas.Clickable_Interface)
Evas.Object_Smart.add;
Evas.Object_Smart.del;
Evas.Object_Smart.show;
Evas.Draggable_Interface.drag_target.set;
Evas.Draggable_Interface.drag_target.get;
}
events {
generate,error;

View File

@ -44,4 +44,27 @@ EAPI void elm_thumb_file_set(Eo *obj, const char *file, const char *key);
*/
EAPI void elm_thumb_file_get(const Eo *obj, const char **file, const char **key);
/**
* @brief Make the thumbnail 'editable'.
*
* This means the thumbnail is a valid drag target for drag and drop, and can
* be cut or pasted too.
*
* @param[in] edit The editable state, default is @c false.
*
* @ingroup Elm_Thumb
*/
EAPI Eina_Bool elm_thumb_editable_set(Evas_Object *obj, Eina_Bool edit);
/**
* @brief Get whether the thumbnail is editable.
*
* This means the thumbnail is a valid drag target for drag and drop, and can
* be cut or pasted too.
*
* @return The editable state, default is @c false.
*
* @ingroup Elm_Thumb
*/
EAPI Eina_Bool elm_thumb_editable_get(const Evas_Object *obj);
#include "elm_thumb.eo.legacy.h"