--- /dev/null
+/*
+ * ISF(Input Service Framework)
+ *
+ * ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable.
+ * Copyright (c) 2012-2020 Samsung Electronics Co., Ltd.
+ *
+ * Contact: Jihoon Kim <jihoon48.kim@samsung.com>, Inhong Han <inhong1.han@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include <iostream>
+#include <map>
+#include <string>
+
+#include "isf_demo_efl.h"
+#include "isf_manual_test_efl.h"
+
+using namespace std;
+
+struct _menu_item {
+ const char *name;
+ const char *guide_text;
+ const char *test_name;
+};
+
+static struct _menu_item _menu_its[] = {
+ { N_("NORMAL"), N_("click to enter"), N_("NORMAL")},
+ { N_("MimeTypeSet"), N_("click to enter"), N_("MimeTypeSet")},
+ { N_("LanguageSet"), N_("click to enter"), N_("LanguageSet")},
+ { N_("DataSet"), N_("click to enter"), N_("DataSet")},
+ { N_("LayoutSet"), N_("click to enter"), N_("LayoutSet")},
+ { N_("ReturnKeySet"), N_("click to enter"), N_("ReturnKeySet")},
+ { N_("ReturnKeyStateSet"), N_("click to enter"), N_("ReturnKeyStateSet")},
+
+ /* do not delete below */
+ { NULL, NULL, NULL }
+};
+
+static map<Ecore_IMF_Context*, string> m_test_name;
+
+static void _rotate_cb (void *data, Evas_Object *obj, void *event_info)
+{
+ struct appdata *ad = (struct appdata *)data;
+
+ int angle = elm_win_rotation_get (ad->win_main);
+ if (angle == 0) {
+ elm_win_rotation_with_resize_set (ad->win_main, 270);
+ } else if (angle == 270) {
+ elm_win_rotation_with_resize_set (ad->win_main, 0);
+ }
+}
+
+static void _input_panel_state_cb (void *data, Ecore_IMF_Context *ctx, int value)
+{
+ map<Ecore_IMF_Context*, string>::iterator it = m_test_name.find (ctx);
+ string test = it->second;
+
+ if (value == ECORE_IMF_INPUT_PANEL_STATE_SHOW) {
+ if (test == "MimeTypeSet") {
+ const char *mime_type = "text/plain";
+ ecore_imf_context_mime_type_accept_set (ctx, mime_type);
+ } else if (test == "LanguageSet") {
+ ecore_imf_context_input_panel_language_set (ctx, ECORE_IMF_INPUT_PANEL_LANG_ALPHABET);
+ } else if (test == "DataSet") {
+ char buf[256] = "ur imdata";
+ ecore_imf_context_input_panel_imdata_set (ctx, buf, sizeof (buf));
+ } else if (test == "LayoutSet") {
+ ecore_imf_context_input_panel_layout_set (ctx, ECORE_IMF_INPUT_PANEL_LAYOUT_EMOTICON);
+ } else if (test == "ReturnKeySet") {
+ ecore_imf_context_input_panel_return_key_type_set (ctx, ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH);
+ } else if (test == "ReturnKeyStateSet") {
+ ecore_imf_context_input_panel_return_key_disabled_set (ctx, EINA_TRUE);
+ }
+ } else if (value == ECORE_IMF_INPUT_PANEL_STATE_HIDE) {
+ if (test == "LanguageSet") {
+ ecore_imf_context_input_panel_language_set (ctx, ECORE_IMF_INPUT_PANEL_LANG_AUTOMATIC);
+ } else if (test == "LayoutSet") {
+ ecore_imf_context_input_panel_layout_set (ctx, ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL);
+ } else if (test == "ReturnKeySet") {
+ ecore_imf_context_input_panel_return_key_type_set (ctx, ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT);
+ } else if (test == "ReturnKeyStateSet") {
+ ecore_imf_context_input_panel_return_key_disabled_set (ctx, EINA_FALSE);
+ }
+ }
+}
+
+static void _focus_out_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
+{
+ Ecore_IMF_Context *ctx = (Ecore_IMF_Context*) data;
+ map<Ecore_IMF_Context*, string>::iterator it = m_test_name.find (ctx);
+ string test = it->second;
+
+ if (test == "LanguageSet") {
+ ecore_imf_context_input_panel_language_set (ctx, ECORE_IMF_INPUT_PANEL_LANG_AUTOMATIC);
+ } else if (test == "LayoutSet") {
+ ecore_imf_context_input_panel_layout_set (ctx, ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL);
+ } else if (test == "ReturnKeySet") {
+ ecore_imf_context_input_panel_return_key_type_set (ctx, ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT);
+ } else if (test == "ReturnKeyStateSet") {
+ ecore_imf_context_input_panel_return_key_disabled_set (ctx, EINA_FALSE);
+ }
+}
+
+static Evas_Object *_create_ef_layout (Evas_Object *parent, const char *label, const char *guide_text, const char *test_name)
+{
+ Evas_Object *en;
+ Evas_Object *ef = create_ef (parent, label, guide_text, &en);
+ if (!ef || !en) return NULL;
+
+ Ecore_IMF_Context *ic = NULL;
+ ic = (Ecore_IMF_Context *)elm_entry_imf_context_get (en);
+
+ if (ic != NULL) {
+ m_test_name.insert (make_pair(ic, (string) test_name));
+ ecore_imf_context_input_panel_event_callback_add (ic, ECORE_IMF_INPUT_PANEL_STATE_EVENT, _input_panel_state_cb, NULL);
+ evas_object_smart_callback_add(en, "unfocused", _focus_out_cb, ic);
+ }
+
+ return ef;
+}
+
+static Evas_Object * create_inner_layout (void *data)
+{
+ struct appdata *ad = (struct appdata *)data;
+ Evas_Object *bx = NULL;
+ Evas_Object *ef = NULL;
+ Evas_Object *parent = ad->naviframe;
+ int idx = 0;
+
+ bx = elm_box_add (parent);
+ evas_object_size_hint_weight_set (bx, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set (bx, EVAS_HINT_FILL, 0.0);
+ evas_object_show (bx);
+
+ while (_menu_its[idx].name != NULL)
+ {
+ ef = _create_ef_layout (parent, _menu_its[idx].name, _menu_its[idx].guide_text, _menu_its[idx].test_name);
+ elm_box_pack_end (bx, ef);
+ ++idx;
+ }
+
+ Evas_Object *rotate_btn = create_button (parent, "rotate");
+ elm_object_focus_allow_set (rotate_btn, EINA_FALSE);
+ evas_object_smart_callback_add (rotate_btn, "clicked", _rotate_cb, (void *)ad);
+ elm_box_pack_end (bx, rotate_btn);
+
+ return bx;
+}
+
+void ise_manual_test_bt (void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *lay_inner = create_inner_layout (data);
+ add_layout_to_naviframe (data, lay_inner, _("InputMethod Manual Test"));
+}
+
+/*
+vi:ts=4:ai:nowrap:expandtab
+*/