From 6cf01f93a6bc0425755ef39b0ec5457baa326537 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Thu, 24 Feb 2011 09:24:26 +0000 Subject: [PATCH] Elementary scrolled_entry: Added *_entry_cnp_textonly_[set/get] Same as the simple entry textonly mode setting. Patch by Hyoyoung Chang. SVN revision: 57298 --- legacy/elementary/src/lib/Elementary.h.in | 2 + .../elementary/src/lib/elc_scrolled_entry.c | 43 +++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/legacy/elementary/src/lib/Elementary.h.in b/legacy/elementary/src/lib/Elementary.h.in index c3354e6fc1..9fe165912d 100644 --- a/legacy/elementary/src/lib/Elementary.h.in +++ b/legacy/elementary/src/lib/Elementary.h.in @@ -2269,6 +2269,8 @@ extern "C" { EAPI void elm_scrolled_entry_file_save(Evas_Object *obj) EINA_ARG_NONNULL(1); EAPI void elm_scrolled_entry_autosave_set(Evas_Object *obj, Eina_Bool autosave) EINA_ARG_NONNULL(1); EAPI Eina_Bool elm_scrolled_entry_autosave_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); + EAPI void elm_scrolled_entry_cnp_textonly_set(Evas_Object *obj, Eina_Bool textonly) EINA_ARG_NONNULL(1); + EAPI Eina_Bool elm_scrolled_entry_cnp_textonly_get(Evas_Object *obj) EINA_ARG_NONNULL(1); /* conformant */ EAPI Evas_Object *elm_conformant_add(Evas_Object *parent) EINA_ARG_NONNULL(1); diff --git a/legacy/elementary/src/lib/elc_scrolled_entry.c b/legacy/elementary/src/lib/elc_scrolled_entry.c index f7d4433a88..09151fe6ce 100644 --- a/legacy/elementary/src/lib/elc_scrolled_entry.c +++ b/legacy/elementary/src/lib/elc_scrolled_entry.c @@ -1609,3 +1609,46 @@ elm_scrolled_entry_autosave_get(const Evas_Object *obj) if (!wd) return EINA_FALSE; return elm_entry_autosave_get(wd->entry); } + +/** + * Control pasting of text and images for the widget. + * + * Normally the scrolled entry allows both text and images to be pasted. + * By setting textonly to be true, this prevents images from being pasted. + * + * Note this only changes the behaviour of text. + * + * @param obj The scrolled entry object + * @param textonly paste mode - EINA_TRUE is text only, EINA_FALSE is text+image+other. + * + * @see elm_entry_cnp_textonly_set + * @ingroup Scrolled_Entry + */ +EAPI void +elm_scrolled_entry_cnp_textonly_set(Evas_Object *obj, Eina_Bool textonly) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + elm_entry_cnp_textonly_set(wd->entry, textonly); +} + +/** + * Getting elm_scrolled_entry text paste/drop mode. + * + * In textonly mode, only text may be pasted or dropped into the widget. + * + * @param obj The scrolled entry object + * @return If the widget only accepts text from pastes. + * + * @see elm_entry_cnp_textonly_get + * @ingroup Scrolled_Entry + */ +EAPI Eina_Bool +elm_scrolled_entry_cnp_textonly_get(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return elm_entry_cnp_textonly_get(wd->entry); +}