termio: add external API to set selection
This commit is contained in:
parent
880489ced2
commit
9f96788e0a
|
@ -1011,11 +1011,10 @@ _lost_selection(void *data, Elm_Sel_Type selection)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Set the @type selection to @text.
|
/* Set the @type selection to @text.
|
||||||
* This does not modify the widget itself */
|
* This does not modify the widget itself */
|
||||||
void
|
void
|
||||||
termio_set_selection_text(Termio *sd, Elm_Sel_Type type, const char *text)
|
_termio_set_selection_text(Termio *sd, Elm_Sel_Type type, const char *text)
|
||||||
{
|
{
|
||||||
EINA_SAFETY_ON_NULL_RETURN(sd);
|
EINA_SAFETY_ON_NULL_RETURN(sd);
|
||||||
|
|
||||||
|
@ -1037,6 +1036,15 @@ termio_set_selection_text(Termio *sd, Elm_Sel_Type type, const char *text)
|
||||||
sd->sel_str = eina_stringshare_add(text);
|
sd->sel_str = eina_stringshare_add(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
termio_set_selection_text(Evas_Object *obj, Elm_Sel_Type type, const char *text)
|
||||||
|
{
|
||||||
|
Termio *sd = termio_get_from_obj(obj);
|
||||||
|
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN(sd);
|
||||||
|
_termio_set_selection_text(sd, type, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Eina_Bool
|
Eina_Bool
|
||||||
termio_take_selection(Evas_Object *obj, Elm_Sel_Type type)
|
termio_take_selection(Evas_Object *obj, Elm_Sel_Type type)
|
||||||
|
@ -1051,7 +1059,7 @@ termio_take_selection(Evas_Object *obj, Elm_Sel_Type type)
|
||||||
if (s)
|
if (s)
|
||||||
{
|
{
|
||||||
if ((sd->win) && (len > 0))
|
if ((sd->win) && (len > 0))
|
||||||
termio_set_selection_text(sd, type, s);
|
_termio_set_selection_text(sd, type, s);
|
||||||
eina_stringshare_del(s);
|
eina_stringshare_del(s);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1073,7 +1081,7 @@ _cb_ctxp_link_content_copy(void *data,
|
||||||
|
|
||||||
if (!hl->url)
|
if (!hl->url)
|
||||||
return;
|
return;
|
||||||
termio_set_selection_text(sd, ELM_SEL_TYPE_CLIPBOARD, hl->url);
|
_termio_set_selection_text(sd, ELM_SEL_TYPE_CLIPBOARD, hl->url);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1085,7 +1093,7 @@ _cb_ctxp_link_content_copy(void *data,
|
||||||
sd->link.x2, sd->link.y2,
|
sd->link.x2, sd->link.y2,
|
||||||
&sb, EINA_FALSE);
|
&sb, EINA_FALSE);
|
||||||
raw_link = ty_sb_steal_buf(&sb);
|
raw_link = ty_sb_steal_buf(&sb);
|
||||||
termio_set_selection_text(sd, ELM_SEL_TYPE_CLIPBOARD, raw_link);
|
_termio_set_selection_text(sd, ELM_SEL_TYPE_CLIPBOARD, raw_link);
|
||||||
free(raw_link);
|
free(raw_link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1102,7 +1110,7 @@ _cb_ctxp_link_copy(void *data,
|
||||||
Termio *sd = evas_object_smart_data_get(term);
|
Termio *sd = evas_object_smart_data_get(term);
|
||||||
EINA_SAFETY_ON_NULL_RETURN(sd);
|
EINA_SAFETY_ON_NULL_RETURN(sd);
|
||||||
EINA_SAFETY_ON_NULL_RETURN(sd->link.string);
|
EINA_SAFETY_ON_NULL_RETURN(sd->link.string);
|
||||||
termio_set_selection_text(sd, ELM_SEL_TYPE_CLIPBOARD, sd->link.string);
|
_termio_set_selection_text(sd, ELM_SEL_TYPE_CLIPBOARD, sd->link.string);
|
||||||
|
|
||||||
sd->ctxpopup = NULL;
|
sd->ctxpopup = NULL;
|
||||||
evas_object_del(obj);
|
evas_object_del(obj);
|
||||||
|
@ -1260,7 +1268,7 @@ _cb_ctxp_color_copy(void *data,
|
||||||
txt = _color_to_txt(sd);
|
txt = _color_to_txt(sd);
|
||||||
if (!txt) return;
|
if (!txt) return;
|
||||||
|
|
||||||
termio_set_selection_text(sd, ELM_SEL_TYPE_CLIPBOARD, txt);
|
_termio_set_selection_text(sd, ELM_SEL_TYPE_CLIPBOARD, txt);
|
||||||
|
|
||||||
eina_stringshare_del(txt);
|
eina_stringshare_del(txt);
|
||||||
sd->ctxpopup = NULL;
|
sd->ctxpopup = NULL;
|
||||||
|
|
|
@ -17,7 +17,7 @@ Termio *termio_get_from_obj(Evas_Object *obj);
|
||||||
void termio_win_set(Evas_Object *obj, Evas_Object *win);
|
void termio_win_set(Evas_Object *obj, Evas_Object *win);
|
||||||
void termio_theme_set(Evas_Object *obj, Evas_Object *theme);
|
void termio_theme_set(Evas_Object *obj, Evas_Object *theme);
|
||||||
Eina_Bool termio_selection_exists(const Evas_Object *obj);
|
Eina_Bool termio_selection_exists(const Evas_Object *obj);
|
||||||
void termio_set_selection_text(Termio *sd, Elm_Sel_Type type, const char *text);
|
void termio_set_selection_text(Evas_Object *obj, Elm_Sel_Type type, const char *text);
|
||||||
void termio_scroll_top_backlog(Evas_Object *obj);
|
void termio_scroll_top_backlog(Evas_Object *obj);
|
||||||
void termio_scroll_delta(Evas_Object *obj, int delta, int by_page);
|
void termio_scroll_delta(Evas_Object *obj, int delta, int by_page);
|
||||||
void termio_scroll_set(Evas_Object *obj, int scroll);
|
void termio_scroll_set(Evas_Object *obj, int scroll);
|
||||||
|
|
Loading…
Reference in New Issue