[entry] add autoperiod API
authorJihoon Kim <jihoon48.kim@samsung.com>
Sun, 12 Sep 2010 23:44:09 +0000 (08:44 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Sun, 12 Sep 2010 23:44:09 +0000 (08:44 +0900)
src/lib/Elementary.h.in
src/lib/elc_scrolled_entry.c
src/lib/elm_config.c
src/lib/elm_entry.c
src/lib/elm_priv.h

index 396f8e0..5b4ba14 100644 (file)
@@ -830,7 +830,8 @@ extern "C" {
    EAPI void         elm_entry_background_color_set(Evas_Object *obj, unsigned int r, unsigned int g, unsigned int b, unsigned int a);
    EAPI void         elm_entry_ellipsis_set(Evas_Object *obj, Eina_Bool ellipsis);
 
-   EAPI void         elm_entry_autocapitalization_set(Evas_Object *obj, Eina_Bool on);
+   EAPI void         elm_entry_autocapitalization_set(Evas_Object *obj, Eina_Bool autocap);
+   EAPI void         elm_entry_autoperiod_set(Evas_Object *obj, Eina_Bool autoperiod);
    EAPI void         elm_entry_autoenable_returnkey_set(Evas_Object *obj, Eina_Bool on);
    EAPI void         elm_entry_input_panel_enabled_set(Evas_Object *obj, Eina_Bool enabled);
    EAPI void         elm_entry_input_panel_layout_set(Evas_Object *obj, Elm_Input_Panel_Layout layout);
@@ -1734,7 +1735,8 @@ extern "C" {
    EAPI void         elm_scrolled_entry_input_panel_enabled_set(Evas_Object *obj, Eina_Bool enabled);
    EAPI void         elm_scrolled_entry_input_panel_layout_set(Evas_Object *obj, Elm_Input_Panel_Layout layout);
    EAPI Ecore_IMF_Context *elm_scrolled_entry_imf_context_get(Evas_Object *obj);
-   EAPI void         elm_scrolled_entry_autocapitalization_set(Evas_Object *obj, Eina_Bool on);
+   EAPI void         elm_scrolled_entry_autocapitalization_set(Evas_Object *obj, Eina_Bool autocap);
+   EAPI void         elm_scrolled_entry_autoperiod_set(Evas_Object *obj, Eina_Bool autoperiod);
 
    EAPI Evas_Object *elm_conformant_add(Evas_Object *parent);
    EAPI void         elm_conformant_content_set(Evas_Object *obj, Evas_Object *content);
index ce0fa4e..cfc254a 100644 (file)
@@ -1063,12 +1063,30 @@ elm_scrolled_entry_input_panel_layout_set(Evas_Object *obj, Elm_Input_Panel_Layo
  * @ingroup Scrolled_Entry
  */
 EAPI void 
-elm_scrolled_entry_autocapitalization_set(Evas_Object *obj, Eina_Bool on)
+elm_scrolled_entry_autocapitalization_set(Evas_Object *obj, Eina_Bool autocap)
 {
    ELM_CHECK_WIDTYPE(obj, widtype);
    Widget_Data *wd = elm_widget_data_get(obj);
    if (!wd || !wd->entry) return;
 
-   elm_entry_autocapitalization_set(wd->entry, on);
+   elm_entry_autocapitalization_set(wd->entry, autocap);
+}
+
+/**
+ * Set whether scrolled entry should support auto period
+ *
+ * @param obj The entry object
+ * @param on If true, scrolled entry suports auto period.
+ *
+ * @ingroup Scrolled_Entry
+ */
+EAPI void 
+elm_scrolled_entry_autoperiod_set(Evas_Object *obj, Eina_Bool autoperiod)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd || !wd->entry) return;
+
+   elm_entry_autoperiod_set(wd->entry, autoperiod);
 }
 
index 7763cdd..466f05a 100644 (file)
@@ -35,7 +35,9 @@ static const char *_atom_names[ATOM_COUNT] =
      "ENLIGHTENMENT_THEME",
      "ENLIGHTENMENT_PROFILE",
      "ENLIGHTENMENT_CONFIG",
-     "ENLIGHTENMENT_INPUT_PANEL"
+     "ENLIGHTENMENT_INPUT_PANEL",
+     "ENLIGHTENMENT_AUTOCAPITAL",
+     "ENLIGHTENMENT_AUTOPERIOD",
 };
 #define ATOM_E_SCALE 0
 #define ATOM_E_FINGER_SIZE 1
@@ -43,6 +45,8 @@ static const char *_atom_names[ATOM_COUNT] =
 #define ATOM_E_PROFILE 3
 #define ATOM_E_CONFIG 4
 #define ATOM_E_INPUT_PANEL 5
+#define ATOM_E_AUTOCAPITAL 6
+#define ATOM_E_AUTOPERIOD 7
 
 static Eina_Bool _prop_config_get(void);
 static Eina_Bool _prop_change(void *data __UNUSED__, int ev_type __UNUSED__, void *ev);
@@ -168,11 +172,6 @@ _prop_change(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
                     }
               }
           }
-       else if (((_atom_config > 0) && (event->atom == _atom_config)) ||
-                 (event->atom == _atom[ATOM_E_CONFIG]))
-          {
-             _prop_config_get();
-          }
        else if (event->atom == _atom[ATOM_E_INPUT_PANEL])
          {
             unsigned int val = 0;
@@ -183,8 +182,36 @@ _prop_change(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
               {
                edje_input_panel_enabled_set(val);
               }
-         }
+          }
+        else if (event->atom == _atom[ATOM_E_AUTOCAPITAL])
+          {
+             unsigned int val = 0;
+
+             if (ecore_x_window_prop_card32_get(event->win,
+                                                event->atom,
+                                                &val, 1) > 0)
+               {
+                  edje_autocapitalization_set(val);
+               }
+          }
+        else if (event->atom == _atom[ATOM_E_AUTOPERIOD])
+          {
+             unsigned int val = 0;
+
+             if (ecore_x_window_prop_card32_get(event->win,
+                                                event->atom,
+                                                &val, 1) > 0)
+               {
+                  edje_autoperiod_set(val);
+               }
+          }
+       else if (((_atom_config > 0) && (event->atom == _atom_config)) ||
+                 (event->atom == _atom[ATOM_E_CONFIG]))
+          {
+             _prop_config_get();
+          }
      }
+
    return ECORE_CALLBACK_PASS_ON;
 }
 #endif
@@ -522,6 +549,12 @@ _env_get(void)
 
    s = getenv("ELM_INPUT_PANEL");
    if (s) _elm_config->input_panel_enable = atoi(s);
+
+   s = getenv("ELM_AUTOCAPITAL");
+   if (s) _elm_config->autocapital = atoi(s);
+
+   s = getenv("ELM_AUTOPERIOD");
+   if (s) _elm_config->autoperiod = atoi(s);
 }
 
 void
@@ -620,19 +653,42 @@ _elm_config_sub_init(void)
                   if (changed) _prop_config_get();
               }
          }
-       if (!getenv("ELM_INPUT_PANEL"))
-         {
-            if (ecore_x_window_prop_card32_get(_root_1st,
-                                               _atom[ATOM_E_INPUT_PANEL],
-                                               &val, 1) > 0)
-              {
-                 if (val > 0)
-                   {
-                      _elm_config->input_panel_enable = val;
-                   }
-              }
-         }
-       
+        if (!getenv("ELM_INPUT_PANEL"))
+          {
+             if (ecore_x_window_prop_card32_get(_root_1st,
+                                                _atom[ATOM_E_INPUT_PANEL],
+                                                &val, 1) > 0)
+               {
+                  if (val > 0)
+                    {
+                       _elm_config->input_panel_enable = val;
+                    }
+               }
+          }
+        if (!getenv("ELM_AUTOCAPITAL"))
+          {
+             if (ecore_x_window_prop_card32_get(_root_1st,
+                                                _atom[ATOM_E_AUTOCAPITAL],
+                                                &val, 1) > 0)
+               {
+                  if (val > 0)
+                    {
+                       _elm_config->autocapital = val;
+                    }
+               }
+          }
+        if (!getenv("ELM_AUTOPERIOD"))
+          {
+             if (ecore_x_window_prop_card32_get(_root_1st,
+                                                _atom[ATOM_E_AUTOPERIOD],
+                                                &val, 1) > 0)
+               {
+                  if (val > 0)
+                    {
+                       _elm_config->autoperiod = val;
+                    }
+               }
+          }
 #endif
       }
 }
@@ -663,3 +719,5 @@ _elm_config_shutdown(void)
      }
    _desc_shutdown();
 }
+
+/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/
index 13b6280..a70172e 100644 (file)
@@ -137,6 +137,7 @@ struct _Widget_Data
    Eina_Bool input_panel_enable : 1;
    Eina_Bool autocapitalize : 1;
    Elm_Input_Panel_Layout input_panel_layout;
+   Eina_Bool autoperiod : 1;
 };
 
 struct _Elm_Entry_Item_Provider
@@ -284,6 +285,7 @@ _theme_hook(Evas_Object *obj)
    eina_stringshare_del(t);
    edje_object_scale_set(wd->ent, elm_widget_scale_get(obj) * _elm_config->scale);
    edje_object_part_text_autocapitalization_set(wd->ent, "elm.text", wd->autocapitalize);
+//   edje_object_part_text_autoperiod_set(wd->ent, "elm.text", wd->autoperiod);
    edje_object_part_text_input_panel_enabled_set(wd->ent, "elm.text", wd->input_panel_enable);
 
    ic = edje_object_part_text_imf_context_get(wd->ent, "elm.text");
@@ -1938,6 +1940,8 @@ elm_entry_single_line_set(Evas_Object *obj, Eina_Bool single_line)
    t = eina_stringshare_add(elm_entry_entry_get(obj));
    _elm_theme_object_set(obj, wd->ent, "entry", _getbase(obj), elm_widget_style_get(obj));
    elm_entry_entry_set(obj, t);
+   edje_object_part_text_autocapitalization_set(wd->ent, "elm.text", wd->autocapitalize);
+//   edje_object_part_text_autoperiod_set(wd->ent, "elm.text", wd->autoperiod);
    ic = elm_entry_imf_context_get(obj);
    if (ic)
      {
@@ -2865,7 +2869,7 @@ elm_entry_autoenable_returnkey_set(Evas_Object *obj, Eina_Bool on)
  * @ingroup Entry
  */
 EAPI void 
-elm_entry_autocapitalization_set(Evas_Object *obj, Eina_Bool on)
+elm_entry_autocapitalization_set(Evas_Object *obj, Eina_Bool autocap)
 {
    ELM_CHECK_WIDTYPE(obj, widtype);
    Widget_Data *wd = elm_widget_data_get(obj);
@@ -2874,12 +2878,35 @@ elm_entry_autocapitalization_set(Evas_Object *obj, Eina_Bool on)
    if (wd->password)
        wd->autocapitalize = EINA_FALSE;
    else
-       wd->autocapitalize = on;
+       wd->autocapitalize = autocap;
 
    edje_object_part_text_autocapitalization_set(wd->ent, "elm.text", wd->autocapitalize);
 }
 
 /**
+ * Set whether entry should support auto period
+ *
+ * @param obj The entry object
+ * @param on If true, entry suports auto period.
+ *
+ * @ingroup Entry
+ */
+EAPI void 
+elm_entry_autoperiod_set(Evas_Object *obj, Eina_Bool autoperiod)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+
+   if (wd->password)
+       wd->autoperiod = EINA_FALSE;
+   else
+       wd->autoperiod = autoperiod;
+
+//   edje_object_part_text_autoperiod_set(wd->ent, "elm.text", wd->autoperiod);
+}
+
+/**
  * Set the font size on the entry object
  *
  * @param obj The entry object
index 6eaf759..02fa57f 100644 (file)
@@ -78,6 +78,8 @@ struct _Elm_Config
    const char *theme;
    const char *modules;
    int input_panel_enable;
+   int autocapital;
+   int autoperiod;   
 };
 
 typedef struct _Elm_Module Elm_Module;