static void _menu_call(Evas_Object *obj);
static void
-_selectall(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+_select_all(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
ELM_ENTRY_DATA_GET(data, sd);
+ if (!sd->sel_allow) return;
sd->sel_mode = EINA_TRUE;
edje_object_part_text_select_none(sd->entry_edje, "elm.text");
edje_object_signal_emit(sd->entry_edje, "elm,state,select,on", "elm");
}
static void
+_select_word(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ ELM_ENTRY_DATA_GET(data, sd);
+
+ if (!sd->sel_allow) return;
+ sd->sel_mode = EINA_TRUE;
+
+ if (!_elm_config->desktop_entry)
+ {
+ if (!sd->password)
+ edje_object_part_text_select_allow_set
+ (sd->entry_edje, "elm.text", EINA_TRUE);
+ }
+ edje_object_signal_emit(sd->entry_edje, "elm,state,select,on", "elm");
+ edje_object_part_text_select_word(sd->entry_edje, "elm.text");
+ elm_object_scroll_freeze_pop(data);
+}
+
+static void
_cnpinit(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
cnpwidgetdata = data;
{
ELM_ENTRY_DATA_GET(data, sd);
- evas_object_hide(sd->mgf_bg);
- evas_object_hide(sd->mgf_clip);
+ if (sd->magnifier_showing)
+ {
+ evas_object_hide(sd->mgf_bg);
+ evas_object_hide(sd->mgf_clip);
+ }
if (sd->scroll)
sd->s_iface->freeze_set(data, EINA_FALSE);
{
ELM_ENTRY_DATA_GET(data, sd);
- evas_object_show(sd->mgf_bg);
- evas_object_show(sd->mgf_clip);
+ if (!sd->magnifier_showing)
+ {
+ evas_object_show(sd->mgf_bg);
+ evas_object_show(sd->mgf_clip);
+ }
sd->magnifier_showing = EINA_TRUE;
}
evas_object_move(sd->mgf_proxy,
(1 - sd->mgf_scale) * cx + x + ox,
- (1 - sd->mgf_scale) * cy + y - sd->mgf_height/2 - ch/2 + sd->mgf_scale * oy);
+ (1 - sd->mgf_scale) * cy + y - sd->mgf_height/2 - ch/2 - sd->mgf_arrow_height + sd->mgf_scale * oy);
}
static void
if (key_data) sd->mgf_height = atoi(key_data);
key_data = edje_object_data_get(sd->mgf_bg, "scale");
if (key_data) sd->mgf_scale = atof(key_data);
+ key_data = edje_object_data_get(sd->mgf_bg, "arrow");
+ if (key_data)
+ sd->mgf_arrow_height = atoi(key_data);
+ else
+ sd->mgf_arrow_height = 0;
elm_scale = elm_config_scale_get();
sd->mgf_height = (int)((float)sd->mgf_height * elm_scale);
}
static void
-_signal_handler_move_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
+_signal_handler_move_start_cb(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
{
ELM_ENTRY_DATA_GET(data, sd);
}
static void
-_signal_handler_move_end(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
+_signal_handler_move_end_cb(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
{
- ELM_ENTRY_DATA_GET(data, sd);
-
elm_object_scroll_freeze_pop(data);
- if (sd->have_selection)
- {
- _magnifier_hide(data);
- _menu_call(data);
- }
+ _magnifier_hide(data);
+ _menu_call(data);
}
static void
-_signal_handler_moving(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
+_signal_handler_moving_cb(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
{
ELM_ENTRY_DATA_GET(data, sd);
}
}
+static void
+_signal_handler_click_cb(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
+{
+ _select_word(data, NULL, NULL);
+}
+
static Evas_Coord_Rectangle
_intersection_region_get(Evas_Coord_Rectangle rect1, Evas_Coord_Rectangle rect2)
{
}
}
+static void
+_elm_entry_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+{
+ Evas_Event_Key_Down *ev = event_info;
+ if (!ev->keyname) return;
+
+ ELM_ENTRY_DATA_GET(data, sd);
+ if (sd->sel_allow)
+ {
+ if (!_elm_config->desktop_entry)
+ edje_object_part_text_select_allow_set
+ (sd->entry_edje, "elm.text", EINA_TRUE);
+ }
+ if ((sd->api) && (sd->api->obj_hidemenu))
+ sd->api->obj_hidemenu(data);
+}
+
void elm_entry_extension_module_data_get(Evas_Object *obj, Elm_Entry_Extension_data *ext_mod)
{
ELM_ENTRY_DATA_GET(obj, sd);
ext_mod->copy = _copy_cb;
ext_mod->cut = _cut_cb;
ext_mod->paste = _paste_cb;
- ext_mod->select = _hover_selected_cb;
- ext_mod->selectall = _selectall;
+ ext_mod->select = _select_word;
+ ext_mod->selectall = _select_all;
ext_mod->ent = sd->entry_edje;
ext_mod->items = sd->items;
ext_mod->editable = sd->editable;
return ECORE_CALLBACK_CANCEL;
}
+// TIZEN ONLY - START
+static Eina_Bool
+_click_cb(void *data)
+{
+ ELM_ENTRY_DATA_GET(data, sd);
+
+ sd->click_timer = NULL;
+ if ((!_elm_config->desktop_entry) && sd->mouse_upped && sd->editable)
+ {
+ _menu_call(data);
+ }
+ return ECORE_CALLBACK_CANCEL;
+}
+// TIZEN ONLY - END
+
static void
_mouse_down_cb(void *data,
Evas *evas __UNUSED__,
if (sd->longpress_timer) ecore_timer_del(sd->longpress_timer);
sd->longpress_timer = ecore_timer_add
(_elm_config->longpress_timeout, _long_press_cb, data);
+
+ // TIZEN ONLY - START
+ if (sd->click_timer)
+ {
+ ecore_timer_del(sd->click_timer); // avoid double click
+ sd->click_timer = NULL;
+ }
+ else
+ {
+ if (!sd->have_selection)
+ sd->click_timer = ecore_timer_add (0.2, _click_cb, data); //FIXME: time out
+ }
+ sd->mouse_upped = EINA_FALSE;
+ // TIZEN ONLY - END
}
else if (ev->button == 3)
{
if (_elm_config->desktop_entry)
_menu_call(data);
}
+ if (!sd->editable)
+ {
+ edje_object_part_text_cursor_handler_disabled_set(sd->entry_edje, "elm.text", EINA_TRUE);
+ }
+ else if (!sd->cursor_handler_disabled)
+ {
+ edje_object_part_text_cursor_handler_disabled_set(sd->entry_edje, "elm.text", EINA_FALSE);
+ }
}
static void
elm_object_scroll_freeze_pop(data);
if (sd->long_pressed) _menu_call(data);
}
+ if (sd->click_timer)
+ {
+ if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
+ {
+ ecore_timer_del(sd->click_timer);
+ sd->click_timer = NULL;
+ }
+ }
+ sd->mouse_upped = EINA_TRUE;
/////
if (sd->longpress_timer)
{
const char *emission __UNUSED__,
const char *source __UNUSED__)
{
+ ELM_ENTRY_DATA_GET(data, sd); // TIZEN ONLY
+
elm_entry_select_none(data);
+
+ // TIZEN ONLY
+ if ((sd->api) && (sd->api->obj_hidemenu))
+ sd->api->obj_hidemenu(data);
+ /////
+
}
static void
ELM_ENTRY_DATA_GET(data, sd);
if (sd->disabled) return;
sd->double_clicked = EINA_TRUE;
+ if (!sd->sel_allow) return;
+
+ if (sd->click_timer)
+ {
+ ecore_timer_del(sd->click_timer);
+ sd->click_timer = NULL;
+ }
+
+ edje_object_part_text_select_word(sd->entry_edje, "elm.text");
+ if (!_elm_config->desktop_entry)
+ edje_object_part_text_select_allow_set
+ (sd->entry_edje, "elm.text", EINA_TRUE);
/////
evas_object_smart_callback_call(data, SIG_CLICKED_DOUBLE, NULL);
}
priv->input_panel_imdata = NULL;
//TIZEN ONLY
priv->magnifier_enabled = EINA_TRUE;
+ priv->mouse_upped = EINA_FALSE;
+ priv->sel_allow = EINA_TRUE;
+ priv->cursor_handler_disabled = EINA_FALSE;
//
elm_layout_theme_set(obj, "entry", "base", elm_widget_style_get(obj));
// TIZEN ONLY
edje_object_signal_callback_add
(priv->entry_edje, "handler,move,start", "elm.text",
- _signal_handler_move_start, obj);
+ _signal_handler_move_start_cb, obj);
edje_object_signal_callback_add
(priv->entry_edje, "handler,move,end", "elm.text",
- _signal_handler_move_end, obj);
+ _signal_handler_move_end_cb, obj);
edje_object_signal_callback_add
(priv->entry_edje, "handler,moving", "elm.text",
- _signal_handler_moving, obj);
+ _signal_handler_moving_cb, obj);
edje_object_signal_callback_add
(priv->entry_edje, "selection,end", "elm.text",
_signal_selection_end, obj);
edje_object_signal_callback_add
(priv->entry_edje, "magnifier,changed", "elm.text",
_signal_magnifier_changed, obj);
+ edje_object_signal_callback_add
+ (priv->entry_edje, "cursor,handler,move,start", "elm.text",
+ _signal_handler_move_start_cb, obj);
+ edje_object_signal_callback_add
+ (priv->entry_edje, "cursor,handler,move,end", "elm.text",
+ _signal_handler_move_end_cb, obj);
+ edje_object_signal_callback_add
+ (priv->entry_edje, "cursor,handler,moving", "elm.text",
+ _signal_handler_moving_cb, obj);
+ edje_object_signal_callback_add
+ (priv->entry_edje, "cursor,handler,clicked", "elm.text",
+ _signal_handler_click_cb, obj);
+ evas_object_event_callback_add(priv->entry_edje, EVAS_CALLBACK_KEY_DOWN,
+ _elm_entry_key_down_cb, obj);
/////////
elm_layout_text_set(obj, "elm.text", "");
else
{
// TIZEN ONLY
- edje_object_part_text_copy_paste_disabled_set(priv->entry_edje, "elm.text", EINA_FALSE);
+ edje_object_part_text_select_allow_set(priv->entry_edje, "elm.text", EINA_TRUE);
edje_object_part_text_viewport_region_set(priv->entry_edje, "elm.text", -1, -1, -1, -1);
edje_object_part_text_layout_region_set(priv->entry_edje, "elm.text", -1, -1, -1, -1);
////////
if (sd->mgf_proxy) evas_object_del(sd->mgf_proxy);
if (sd->mgf_bg) evas_object_del(sd->mgf_bg);
if (sd->mgf_clip) evas_object_del(sd->mgf_clip);
+ if (sd->click_timer) ecore_timer_del(sd->click_timer);
//
evas_event_thaw(evas_object_evas_get(obj));
evas_event_thaw_eval(evas_object_evas_get(obj));
if (sd->context_menu == !disabled) return;
sd->context_menu = !disabled;
-
- // TIZEN ONLY : SHOULD BE COMMITTED ?
- if (!_elm_config->desktop_entry)
- edje_object_part_text_copy_paste_disabled_set(sd->entry_edje, "elm.text", disabled);
- /////////////
}
EAPI Eina_Bool
return !sd->context_menu;
}
+// TIZEN ONLY - START
+EAPI void
+elm_entry_select_allow_set(Evas_Object *obj,
+ Eina_Bool allow)
+{
+ ELM_ENTRY_CHECK(obj);
+ ELM_ENTRY_DATA_GET(obj, sd);
+
+ if (sd->sel_allow == allow) return;
+ sd->sel_allow = allow;
+
+ edje_object_part_text_select_allow_set(sd->entry_edje, "elm.text", allow);
+}
+
+EAPI Eina_Bool
+elm_entry_select_allow_get(const Evas_Object *obj)
+{
+ ELM_ENTRY_CHECK(obj);
+ ELM_ENTRY_DATA_GET(obj, sd);
+
+ return sd->sel_allow;
+}
+
+EAPI void
+elm_entry_cursor_handler_disabled_set(Evas_Object *obj,
+ Eina_Bool disabled)
+{
+ ELM_ENTRY_CHECK(obj);
+ ELM_ENTRY_DATA_GET(obj, sd);
+
+ if (sd->cursor_handler_disabled == disabled) return;
+ sd->cursor_handler_disabled = disabled;
+
+ if (!_elm_config->desktop_entry)
+ edje_object_part_text_cursor_handler_disabled_set(sd->entry_edje, "elm.text", disabled);
+}
+
+EAPI Eina_Bool
+elm_entry_cursor_handler_disabled_get(const Evas_Object *obj)
+{
+ ELM_ENTRY_CHECK(obj);
+ ELM_ENTRY_DATA_GET(obj, sd);
+ return sd->cursor_handler_disabled;
+}
+// TIZEN ONLY - END
+
EAPI void
elm_entry_item_provider_append(Evas_Object *obj,
Elm_Entry_Item_Provider_Cb func,
#define S_CUT MULTI_(IDS_COM_BODY_CUT)
#define S_PASTE MULTI_(IDS_COM_BODY_PASTE)
#define S_CLIPBOARD MULTI_(IDS_COM_BODY_CLIPBOARD)
-
+#define S_COPIED MULTI_(IDS_COM_POP_COPIED_TO_CLIPBOARD)
Elm_Entry_Extension_data *ext_mod;
static int _mod_hook_count = 0;
}
static void
-_ctxpopup_position(Evas_Object *obj)
+_ctxpopup_position(Evas_Object *obj __UNUSED__)
{
if(!ext_mod) return;
- Evas_Coord cx, cy, cw, ch, x, y, w, h;
+ Evas_Coord ex, ey;
+ Evas_Coord sx, sy, sw, sh;
+ Evas_Coord x, y, w, h;
+ int gap = 22; //in GUI
+
+ evas_object_geometry_get(ext_mod->ent, &ex, &ey, NULL, NULL);
elm_ctxpopup_direction_priority_set(ext_mod->popup, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_DOWN, ELM_CTXPOPUP_DIRECTION_LEFT, ELM_CTXPOPUP_DIRECTION_RIGHT);
- if (!edje_object_part_text_selection_geometry_get(ext_mod->ent, "elm.text", &x, &y, &w, &h))
- {
- evas_object_geometry_get(ext_mod->ent, &x, &y, NULL, NULL);
+ if (!edje_object_part_text_selection_geometry_get(ext_mod->ent, "elm.text", &sx, &sy, &sw, &sh))
+ { //cannot get selection shape
+ Evas_Coord cx, cy, cw, ch;
+
edje_object_part_text_cursor_geometry_get(ext_mod->ent, "elm.text",
&cx, &cy, &cw, &ch);
- evas_object_size_hint_min_get(ext_mod->popup, &w, &h);
- if (cw < w)
- {
- cx += (cw - w) / 2;
- cw = w;
- }
- if (ch < h)
- {
- cy += (ch - h) / 2;
- ch = h;
- }
Elm_Ctxpopup_Direction dir = elm_ctxpopup_direction_get(ext_mod->popup);
if (dir == ELM_CTXPOPUP_DIRECTION_DOWN)
{
elm_ctxpopup_direction_priority_set(ext_mod->popup, ELM_CTXPOPUP_DIRECTION_DOWN, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_LEFT, ELM_CTXPOPUP_DIRECTION_RIGHT);
- x = x + cx;
- if (ext_mod->have_selection)
- y = y + cy + ch + 40; //+40: height of selection handler
- else
- y = y + cy + ch;
+ x = ex + cx;
+ y = ey + cy + ch;
}
else
{
- x = x + cx;
- y = y + cy;
+ x = ex + cx;
+ y = ey + cy;
}
evas_object_move(ext_mod->popup, x, y);
evas_object_resize(ext_mod->popup, cw, ch);
}
- else
+ else //get selection shape
{
+ Evas_Coord shx, shy, shw, shh;
+ Evas_Coord ehx, ehy, ehw, ehh;
+
+ edje_object_part_text_selection_handler_geometry_get(ext_mod->ent, "elm.text", EDJE_SELECTION_HANDLER_START, &shx, ­, &shw, &shh);
+ edje_object_part_text_selection_handler_geometry_get(ext_mod->ent, "elm.text", EDJE_SELECTION_HANDLER_END, &ehx, &ehy, &ehw, &ehh);
+
if (ext_mod->viewport_rect.x != -1 || ext_mod->viewport_rect.y != -1
|| ext_mod->viewport_rect.w != -1 || ext_mod->viewport_rect.h != -1)
{
Evas_Coord vx, vy, vw, vh, x2, y2;
- x2 = x + w;
- y2 = y + h;
+ x2 = sx + sw;
+ if ((ehh > 0) && (ey + ehy + ehh > sy + sh))
+ {
+ //y2 = ey + ehy + ehh;
+ y2 = ey + ehy + gap;
+ }
+ else
+ y2 = sy + sh;
vx = ext_mod->viewport_rect.x;
vy = ext_mod->viewport_rect.y;
vw = ext_mod->viewport_rect.w;
vh = ext_mod->viewport_rect.h;
- if (x < vx) x = vx;
- if (y < vy) y = vy;
+ //limit ctx in viewport
+ x = sx;
+ if (sx < vx) x = vx;
+ if (sy < vy)
+ {
+ y = vy; //case: start of selection is behind the viewport
+ }
+ else
+ {
+ if (ey + shy < sy) //case: start handler is upside
+ {
+ //y = ey + shy;
+ y = sy - gap;
+ }
+ else
+ y = sy;
+ }
if (x2 > vx + vw) x2 = vx + vw;
if (y2 > vy + vh) y2 = vy + vh;
w = x2 - x;
h = y2 - y;
}
- else
+ else //get selection & cannot get viewport
{
- Evas_Coord sw, sh, x2, y2;
- x2 = x + w;
- y2 = y + h;
- ecore_x_window_size_get(ecore_x_window_root_first_get(), &sw, &sh);
-
- if (x < 0) x = 0;
- if (y < 0) y = 0;
- if (x2 > sw) x2 = sw;
- if (y2 > sh) y2 = sh;
+ Evas_Coord ww, wh, x2, y2;
+ x2 = sx + sw;
+ if (ey + ehy + ehh > sy + sh)
+ y2 = ey + ehy + ehh; //end handler is downside
+ else
+ y2 = sy + sh;
+
+ ecore_x_window_size_get(ecore_x_window_root_first_get(), &ww, &wh);
+
+ x = sx;
+ if (sx < 0) x = 0;
+ if (sy < 0)
+ {
+ y = 0; //start of selection is negative
+ }
+ else
+ {
+ if (ey + shy < sy) //start handler is upside
+ {
+ //y = ey + shy;
+ y = sy - gap;
+ }
+ else
+ y = sy;
+ }
+ if (x2 > ww) x2 = ww;
+ if (y2 > wh) y2 = wh;
w = x2 - x;
h = y2 - y;
}
- cx = x + (w / 2);
- cy = y;
+ x = x + (w / 2);
Elm_Ctxpopup_Direction dir = elm_ctxpopup_direction_get(ext_mod->popup);
if (dir != ELM_CTXPOPUP_DIRECTION_UNKNOWN)
{
- if (dir == ELM_CTXPOPUP_DIRECTION_UP)
- cy = y;
- else if (dir == ELM_CTXPOPUP_DIRECTION_DOWN)
+ if (dir == ELM_CTXPOPUP_DIRECTION_DOWN)
{
elm_ctxpopup_direction_priority_set(ext_mod->popup, ELM_CTXPOPUP_DIRECTION_DOWN, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_LEFT, ELM_CTXPOPUP_DIRECTION_RIGHT);
- if (ext_mod->have_selection)
- cy = y + h + 40; //+40: height of selection handler
- else
- cy = y + h;
+ y = sy + sh;
+ if (y < ey + ehy + ehh)
+ {
+ //y = ey + ehy + ehh;
+ y = sy + sh + gap; //ey + ehy + 8 + 22;
+ }
}
}
- evas_object_move(ext_mod->popup, cx, cy);
+ evas_object_move(ext_mod->popup, x, y);
}
}
ext_mod->cut(data,obj,event_info);
_ctxpopup_hide(obj);
+
//elm_object_scroll_freeze_pop(ext_mod->popup);
}
ext_mod->copy(data,obj,event_info);
_ctxpopup_hide(obj);
+
//elm_object_scroll_freeze_pop(ext_mod->popup);
}