elementary - removed deprecated widgets & APIs.
[framework/uifw/elementary.git] / src / lib / elm_datefield.c
index 333e530..36ebbe9 100644 (file)
@@ -1,3 +1,4 @@
+#include <locale.h>
 #include <Elementary.h>
 #include "elm_priv.h"
 
  * @defgroup Datefield Datefield
  * @ingroup Elementary
  *
- * This is a date editfield. it is used to input date and time using keypad
+ * This is a date edit field. it is used to input date and time using
+ * diskselector integrated ctxpopup.
+ *
+ * Datefield Format can be like "%b %d, %Y %I : %M %p".
+ * Maximum allowed format length is 32 chars.
+ * Format can include separators for each individual datefield item.
+ * Each separator can be a maximum of 6 UTF-8 bytes.
+ * Space is also taken as a separator.
+ * Following are the allowed set of format specifiers for each datefield item.
+ * These specifiers can be arranged at any order as per user requirement and
+ * their value will be replaced in the format as mentioned below.
+ * %Y : The year as a decimal number including the century.
+ * %y : The year as a decimal number without a century (range 00 to 99)
+ * %m : The month as a decimal number (range 01 to 12).
+ * %b : The abbreviated month name according to the current locale.
+ * %B : The full month name according to the current locale.
+ * %d : The day of the month as a decimal number (range 01 to 31).
+ * %I : The hour as a decimal number using a 12-hour clock (range 01 to 12).
+ * %H : The hour as a decimal number using a 24-hour clock (range 00 to 23).
+ * %k : The hour (24-hour clock) as a decimal number (range 0 to 23). single
+ *      digits are preceded by a blank.
+ * %l : The hour (12-hour clock) as a decimal number (range 1 to 12); single
+ *      digits are preceded by a blank.
+ * %M : The minute as a decimal number (range 00 to 59).
+ * %p : Either 'AM' or 'PM' according to the given time value, or the
+ *      corresponding strings for the current locale. Noon is treated as 'PM'
+ *      and midnight as 'AM'
+ * %P : Like %p but in lowercase: 'am' or 'pm' or a corresponding string for
+ *      the current locale.
+ * For more reference, see the below link:
+ * http://www.gnu.org/s/hello/manual/libc.html#Formatting-Calendar-Time
+ * Default format is taken as per the system display language and Region format.
+ *
  */
 
 typedef struct _Widget_Data Widget_Data;
 
-enum {
-       DATE_YEAR,
-       DATE_MON,
-       DATE_DAY,
-       DATE_MAX
-};
-
-enum {
-       TIME_HOUR,
-       TIME_MIN,
-       TIME_MAX
+#define DATEFIELD_TYPE_COUNT        6
+#define BUFFER_SIZE                 64
+#define MAX_FORMAT_LEN              32
+#define MAX_SEPARATOR_LEN           6
+#define MAX_ITEM_FORMAT_LEN         3
+#define DISKSELECTOR_ITEMS_NUM_MIN  4
+
+// Interface between EDC & C code. Item names & signal names.
+// Values 0 to 6 are valid range, can be substituted for %d.
+#define EDC_DATEFIELD_ENABLE_SIG_STR        "elm,state,enabled"
+#define EDC_DATEFIELD_DISABLE_SIG_STR       "elm,state,disabled"
+#define EDC_DATEFIELD_FOCUSIN_SIG_STR       "elm,action,focus"
+#define EDC_DATEFIELD_FOCUSOUT_SIG_STR      "elm,action,unfocus"
+#define EDC_PART_ITEM_STR                   "item%d"
+#define EDC_PART_SEPARATOR_STR              "separator%d"
+#define EDC_PART_ITEM_OVER_STR              "item%d.over"
+#define EDC_PART_ITEM_ENABLE_SIG_STR        "item%d,enable"
+#define EDC_PART_ITEM_DISABLE_SIG_STR       "item%d,disable"
+#define EDC_PART_ITEM_FOCUSIN_SIG_STR       "item%d,focus,in"
+#define EDC_PART_ITEM_FOCUSOUT_SIG_STR      "item%d,focus,out"
+#define EDC_PART_ITEM_STYLE_DEFAULT_SIG_STR "item%d,style,default"
+#define EDC_PART_ITEM_STYLE_AMPM_SIG_STR    "item%d,style,ampm"
+
+#define DEFAULT_FORMAT "%b %d, %Y %I : %M %p"
+
+typedef struct _Format_Map
+{
+   Elm_Datefield_ItemType type;
+   char fmt_char[5];
+   int def_min;
+   int def_max;
+}Format_Map;
+
+static const Format_Map mapping[DATEFIELD_TYPE_COUNT] = {
+   { ELM_DATEFIELD_YEAR,   "Yy",    70, 137 },
+   { ELM_DATEFIELD_MONTH,  "mbB",   0,  11  },
+   { ELM_DATEFIELD_DATE,   "d",     1,  31  },
+   { ELM_DATEFIELD_HOUR,   "IHkl",  0,  23  },
+   { ELM_DATEFIELD_MINUTE, "M",     0,  59  },
+   { ELM_DATEFIELD_AMPM,   "pP",    0,  1   }
 };
 
-enum {
-       DATE_FORMAT_YYMMDD,
-       DATE_FORMAT_YYDDMM,
-       DATE_FORMAT_MMYYDD,
-       DATE_FORMAT_MMDDYY,
-       DATE_FORMAT_DDYYMM,
-       DATE_FORMAT_DDMMYY,
-       DATE_FORMAT_MAX
-};
+static int _days_in_month[12] = { 31, 28, 31, 30, 31, 30,
+                                  31, 31, 30, 31, 30, 31 };
 
-#define YEAR_MAX_LENGTH        4
-#define MONTH_MAX_LENGTH       3
-#define DAY_MAX_LENGTH         2
-#define TIME_MAX_LENGTH        2
+typedef enum _Elm_Datefield_HourType
+  {
+     ELM_DATEFIELD_HOUR_12 = 1000,
+     ELM_DATEFIELD_HOUR_24,
+     ELM_DATEFIELD_HOUR_NA
+  } Elm_Datefield_HourType;
 
-#define MONTH_MAXIMUM          12
-#define HOUR_24H_MAXIMUM       23
-#define HOUR_12H_MAXIMUM       12
-#define MIN_MAXIMUM            59
 
-static char month_label[12][4] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
+typedef struct _Datefield_Item
+{
+   char fmt[MAX_ITEM_FORMAT_LEN];
+   Elm_Datefield_ItemType type;
+   Elm_Datefield_HourType hour_type;
+   const char *content; //string to be displayed
+   const char *separator;
+   int location; //location of the item as per the current format
+   int *value;
+   int min, max;
+   int default_min, default_max;
+   Eina_Bool fmt_exist:1; //if item format is present or not
+   Eina_Bool enabled:1; //if item is to be shown or not
+   Eina_Bool abs_min:1;
+   Eina_Bool abs_max:1;
+} Datefield_Item;
 
 struct _Widget_Data
 {
-       Evas_Object *base;      
-       Evas_Object *date[DATE_MAX];
-       Evas_Object *time[TIME_MAX];
-       Ecore_Event_Handler *handler;
-       Ecore_Idler *idler;
-       int layout;
-
-       int year, month, day, hour, min;
-       int y_max, m_max, d_max;
-       int y_min, m_min, d_min;
-       int date_format;
-       Eina_Bool pm:1;
-       Eina_Bool time_mode:1;
-       Eina_Bool editing:1;
-
-       void (*func)(void *data, Evas_Object *obj, int value);
-       void *func_data;
+   Evas_Object *base;
+   struct tm *time;
+   int ampm;
+   Datefield_Item *item_list; //Fixed set of items, so no Eina list.
+   Evas_Object *ctxpopup;
+   Datefield_Item *selected_it;
+   char format[MAX_FORMAT_LEN];
+   Eina_Bool user_format:1; //whether user set format or the default format.
 };
 
+typedef struct _DiskItem_Data
+{
+   Evas_Object *datefield;
+   unsigned int sel_item_value;
+} DiskItem_Data;
+
 static const char *widtype = NULL;
 
 static void _del_hook(Evas_Object *obj);
-static void _theme_hook(Evas_Object *obj);
+static void _on_focus_hook(void *data __UNUSED__, Evas_Object *obj);
+static void _disable_hook(Evas_Object *obj);
+static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
 static void _sizing_eval(Evas_Object *obj);
-static void _on_focus_hook(void *data, Evas_Object *obj);
-
-static void _signal_rect_mouse_down(void *data, Evas_Object *obj, const char *emission, const char *source);
-static void _signal_ampm_mouse_down(void *data, Evas_Object *obj, const char *emission, const char *source);
-static void _signal_ampm_clicked(void *data, Evas_Object *obj, const char *emission, const char *source);
-static void _entry_focused_cb(void *data, Evas_Object *obj, void *event_info);
-static void _entry_unfocused_cb(void *data, Evas_Object *obj, void *event_info);
-static void _entry_key_up_cb(void *data, Evas *e , Evas_Object *obj , void *event_info);
-static Eina_Bool _imf_event_commit_cb(void *data, int type, void *event);
-static void _input_panel_event_callback(void *data, Ecore_IMF_Context *ctx, int value);
-
-static void _date_entry_add(Evas_Object *obj);
-static void _time_entry_add(Evas_Object *obj);
-static void _date_update(Evas_Object *obj);
-static Eina_Bool _focus_idler_cb(void *obj);
-static void _entry_focus_move(Evas_Object *obj, Evas_Object *focus_obj);
-static Eina_Bool _check_input_done(Evas_Object *obj, Evas_Object *focus_obj, int strlen);
-static int _maximum_day_get(int year, int month);
-static int _check_date_boundary(Evas_Object *obj, int num, int flag);
+static void _theme_hook(Evas_Object *obj);
+static void _ctxpopup_dismissed_cb(void *data, Evas_Object *obj __UNUSED__,
+                                   void *event_info __UNUSED__);
+static void _datefield_resize_cb(void *data, Evas *e __UNUSED__,Evas_Object *obj
+                                 __UNUSED__, void *event_info __UNUSED__);
+static void _datefield_move_cb(void *data, Evas *e __UNUSED__,Evas_Object *obj
+                                 __UNUSED__, void *event_info __UNUSED__);
+
+static void _update_items(Evas_Object *obj);
+static void _field_value_set(Evas_Object * obj, Elm_Datefield_ItemType type,
+                             int value, Eina_Bool adjust_time);
+static void _diskselector_cb(void *data, Evas_Object *obj __UNUSED__,
+                             void *event_info __UNUSED__);
+static void _ampm_clicked (void *data);
+static void _diskselector_item_free_cb(void *data, Evas_Object *obj __UNUSED__,
+                                       void *event_info __UNUSED__);
+static void _load_field_options(Evas_Object * data, Evas_Object *diskselector,
+                                Datefield_Item *it);
+static void _datefield_clicked_cb(void *data, Evas_Object *obj __UNUSED__,
+                     const char *emission __UNUSED__, const char *source);
+static void _format_reload(Evas_Object *obj);
+static void _item_list_init(Evas_Object *obj);
+
+static const char SIG_CHANGED[] = "changed";
+static const Evas_Smart_Cb_Description _signals[] = {
+       {SIG_CHANGED, ""},
+       {NULL, NULL}
+};
 
 static void
 _del_hook(Evas_Object *obj)
 {
-       Widget_Data *wd = elm_widget_data_get(obj);
-       if (!wd) return ;       
-
-       ecore_event_handler_del(wd->handler);
-               
-       free(wd);
+   Widget_Data *wd;
+   Datefield_Item *tmp;
+   unsigned int idx;
+
+   wd = elm_widget_data_get(obj);
+   if (!wd) return;
+   if (wd->time) free(wd->time);
+   for (idx = 0; idx < DATEFIELD_TYPE_COUNT; idx++ )
+     {
+        tmp = wd->item_list + idx;
+        eina_stringshare_replace(&tmp->content, NULL);
+        eina_stringshare_replace(&tmp->separator, NULL);
+     }
+   if (wd->item_list) free(wd->item_list);
+   evas_object_del(wd->ctxpopup);
+
+   free(wd);
 }
 
 static void
-_on_focus_hook(void *data, Evas_Object *obj)
+_disable_hook(Evas_Object *obj)
 {
-       Widget_Data *wd = elm_widget_data_get(obj);
-       if (!wd || !wd->base) return ;
-
-       if (elm_widget_focus_get(obj)) wd->idler = ecore_idler_add(_focus_idler_cb, obj);
+   Widget_Data *wd;
+
+   wd = elm_widget_data_get(obj);
+   if (!wd || !wd->base) return;
+   if (elm_widget_disabled_get(obj))
+     {
+        evas_object_hide(wd->ctxpopup);
+        edje_object_signal_emit(wd->base, EDC_DATEFIELD_DISABLE_SIG_STR,"elm");
+     }
+   else
+     edje_object_signal_emit(wd->base, EDC_DATEFIELD_ENABLE_SIG_STR, "elm");
 }
 
 static void
-_theme_hook(Evas_Object *obj)
+_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
 {
-       Widget_Data *wd = elm_widget_data_get(obj);
-       int i;
-       if (!wd || !wd->base) return;
-
-       if (wd->layout == ELM_DATEFIELD_LAYOUT_DATEANDTIME)
-       {
-               _elm_theme_object_set(obj, wd->base, "datefield", "dateandtime", elm_widget_style_get(obj));
-
-               for (i = 0; i < DATE_MAX; i++)
-                       elm_object_style_set(wd->date[i], "datefield/hybrid");
-               for (i = 0; i < TIME_MAX; i++)
-                       elm_object_style_set(wd->time[i], "datefield/hybrid");
-       }
-       else if (wd->layout == ELM_DATEFIELD_LAYOUT_DATE)
-       {
-               _elm_theme_object_set(obj, wd->base, "datefield", "date", elm_widget_style_get(obj));
-
-               for (i = 0; i < DATE_MAX; i++)
-                       elm_object_style_set(wd->date[i], "datefield");
-
-               for (i = 0; i < TIME_MAX; i++)
-                       evas_object_hide(wd->time[i]);
-       }
-       else if (wd->layout == ELM_DATEFIELD_LAYOUT_TIME)
-       {
-               _elm_theme_object_set(obj, wd->base, "datefield", "time", elm_widget_style_get(obj));
-
-               for (i = 0; i < TIME_MAX; i++)
-                       elm_object_style_set(wd->time[i], "datefield");
-
-               for (i = 0; i < DATE_MAX; i++)
-                       evas_object_hide(wd->date[i]);
-       }
-
-       if (wd->layout == ELM_DATEFIELD_LAYOUT_DATEANDTIME || wd->layout == ELM_DATEFIELD_LAYOUT_DATE)
-       {
-               edje_object_part_swallow(wd->base, "elm.swallow.date.year", wd->date[DATE_YEAR]);
-               edje_object_part_swallow(wd->base, "elm.swallow.date.month", wd->date[DATE_MON]);
-               edje_object_part_swallow(wd->base, "elm.swallow.date.day", wd->date[DATE_DAY]);
-               edje_object_part_text_set(wd->base, "elm.text.date.comma", ",");        
-       }
-       
-       if (wd->layout == ELM_DATEFIELD_LAYOUT_DATEANDTIME || wd->layout == ELM_DATEFIELD_LAYOUT_TIME)
-       {
-               edje_object_part_swallow(wd->base, "elm.swallow.time.hour", wd->time[TIME_HOUR]);
-               edje_object_part_swallow(wd->base, "elm.swallow.time.min", wd->time[TIME_MIN]);
-               edje_object_part_text_set(wd->base, "elm.text.colon", ":");
-       }
-
-       edje_object_scale_set(wd->base, elm_widget_scale_get(obj) * _elm_config->scale);
-
-       _date_update(obj);
-       _sizing_eval(obj);
+   Widget_Data *wd;
+
+   wd = elm_widget_data_get(obj);
+   if (!wd ) return;
+   if (elm_widget_focus_get(obj))
+      edje_object_signal_emit(wd->base, EDC_DATEFIELD_FOCUSIN_SIG_STR, "elm");
+   else
+      edje_object_signal_emit(wd->base, EDC_DATEFIELD_FOCUSOUT_SIG_STR, "elm");
 }
 
 static void
-_sizing_eval(Evas_Object *obj)
+_mirrored_set(Evas_Object *obj, Eina_Bool rtl)
 {
-       Widget_Data *wd = elm_widget_data_get(obj);
-       Evas_Coord minw = -1, minh = -1;
+   Widget_Data *wd;
 
-       edje_object_size_min_calc(wd->base, &minw, &minh);
-       evas_object_size_hint_min_set(obj, minw, minh);
-       evas_object_size_hint_max_set(obj, -1, -1);
+   wd = elm_widget_data_get(obj);
+   if (!wd) return;
+   evas_object_hide(wd->ctxpopup);
+   edje_object_mirrored_set(wd->base, rtl);
 }
 
 static void
-_signal_ampm_mouse_down(void *data, Evas_Object *obj, const char *emission, const char *source)
+_sizing_eval(Evas_Object *obj)
 {
-       Widget_Data *wd = elm_widget_data_get(data);
-       Evas_Object *focus_obj;
-       
-       if (!wd || !wd->base) return ;  
-
-       focus_obj = elm_widget_focused_object_get(data);
-       if (focus_obj) elm_object_unfocus(focus_obj);
+   Widget_Data *wd;
+   Evas_Coord minw = -1, minh = -1;
+
+   wd = elm_widget_data_get(obj);
+   if (!wd || !wd->base) return;
+   edje_object_size_min_calc(wd->base, &minw, &minh);
+   evas_object_size_hint_min_set(obj, minw, minh);
+   evas_object_size_hint_max_set(obj, -1, -1);
 }
 
 static void
-_signal_ampm_clicked(void *data, Evas_Object *obj, const char *emission, const char *source)
+_theme_hook(Evas_Object *obj)
 {
-       Widget_Data *wd = elm_widget_data_get(data);
-       if (!wd || !wd->base) return ;  
-
-       wd->pm = !wd->pm;
-
-       if (wd->pm)
-       {
-               edje_object_part_text_set(wd->base, "elm.text.ampm", "PM");
-               wd->hour += HOUR_12H_MAXIMUM;
-       }
-       else
-       {
-               edje_object_part_text_set(wd->base, "elm.text.ampm", "AM");
-               wd->hour -= HOUR_12H_MAXIMUM;
-       }
+   Widget_Data *wd;
+   Datefield_Item *it;
+   char buf[BUFFER_SIZE];
+   unsigned int idx;
+   //Evas_Object *diskselector;
+
+   wd = elm_widget_data_get(obj);
+   if (!wd || !wd->base) return;
+   _elm_theme_object_set(obj, wd->base, "datefield", "base",
+                         elm_widget_style_get(obj));
+   _elm_widget_mirrored_reload(obj);
+   _mirrored_set(obj, elm_widget_mirrored_get(obj));
+
+   snprintf(buf, sizeof(buf), "datefield/%s", elm_object_style_get(obj));
+   elm_object_style_set(wd->ctxpopup, buf);
+   /*//Enabled once elm_object_content_get() API comes to git.
+   if (diskselector = elm_object_content_get(wd->ctxpopup))
+   elm_object_style_set(diskselector, buf);*/
+   edje_object_scale_set(wd->base,elm_widget_scale_get(obj)*_elm_config->scale);
+
+   if (elm_widget_disabled_get(obj))
+     edje_object_signal_emit(wd->base, EDC_DATEFIELD_DISABLE_SIG_STR,"elm");
+   else
+     edje_object_signal_emit(wd->base, EDC_DATEFIELD_ENABLE_SIG_STR, "elm");
+
+   for (idx= 0; idx < DATEFIELD_TYPE_COUNT; idx++ )
+     {
+        it = wd->item_list + idx;
+        if (it->fmt_exist && it->enabled )
+          {
+             snprintf(buf, sizeof(buf), EDC_PART_ITEM_STR, it->location);
+             edje_object_part_text_set(wd->base, buf, it->content);
+             snprintf(buf, sizeof(buf), EDC_PART_SEPARATOR_STR, it->location);
+             edje_object_part_text_set(wd->base, buf, it->separator);
+             snprintf(buf, sizeof(buf), EDC_PART_ITEM_ENABLE_SIG_STR,
+                      it->location);
+             edje_object_signal_emit(wd->base, buf, "elm");
+             if (it->type == ELM_DATEFIELD_AMPM)
+               snprintf(buf, sizeof(buf), EDC_PART_ITEM_STYLE_AMPM_SIG_STR,
+                        it->location);
+             else
+               snprintf(buf, sizeof(buf), EDC_PART_ITEM_STYLE_DEFAULT_SIG_STR,
+                        it->location);
+             edje_object_signal_emit(wd->base, buf, "elm");
+          }
+        else
+          {
+             snprintf(buf, sizeof(buf),EDC_PART_ITEM_DISABLE_SIG_STR,
+                      it->location);
+             edje_object_signal_emit(wd->base, buf, "elm");
+          }
+     }
+   edje_object_message_signal_process(wd->base);
+   _sizing_eval(obj);
 }
 
 static void
-_signal_rect_mouse_down(void *data, Evas_Object *obj, const char *emission, const char *source)
+_ctxpopup_dismissed_cb(void *data, Evas_Object *obj __UNUSED__,
+                       void *event_info __UNUSED__)
 {
-       Widget_Data *wd = elm_widget_data_get(data);
-       if (!wd) return ;
-
-       if (!strcmp(source, "elm.rect.date.year.over"))
-               elm_object_focus(wd->date[DATE_YEAR]);
-       else if (!strcmp(source, "elm.rect.date.month.over"))
-               elm_object_focus(wd->date[DATE_MON]);
-       else if (!strcmp(source, "elm.rect.date.day.over"))
-               elm_object_focus(wd->date[DATE_DAY]);
-       else if (!strcmp(source, "elm.rect.time.hour.over"))
-               elm_object_focus(wd->time[TIME_HOUR]);
-       else if (!strcmp(source, "elm.rect.time.min.over"))
-               elm_object_focus(wd->time[TIME_MIN]);
-       else if (!strcmp(source, "elm.rect.date.left.pad"))
-       {
-               switch (wd->date_format)
-               {
-                       case DATE_FORMAT_YYDDMM:
-                       case DATE_FORMAT_YYMMDD:
-                               elm_object_focus(wd->date[DATE_YEAR]);
-                               break;
-                       case DATE_FORMAT_MMDDYY:
-                       case DATE_FORMAT_MMYYDD:
-                               elm_object_focus(wd->date[DATE_MON]);
-                               break;
-                       case DATE_FORMAT_DDMMYY:
-                       case DATE_FORMAT_DDYYMM:
-                               elm_object_focus(wd->date[DATE_DAY]);
-               }
-       }
-       else if (!strcmp(source, "elm.rect.date.right.pad"))
-       {
-               switch (wd->date_format)
-               {
-                       case DATE_FORMAT_MMDDYY:
-                       case DATE_FORMAT_DDMMYY:
-                               elm_object_focus(wd->date[DATE_YEAR]);
-                               break;
-                       case DATE_FORMAT_DDYYMM:
-                       case DATE_FORMAT_YYDDMM:
-                               elm_object_focus(wd->date[DATE_MON]);
-                               break;
-                       case DATE_FORMAT_YYMMDD:
-                       case DATE_FORMAT_MMYYDD:
-                               elm_object_focus(wd->date[DATE_DAY]);
-               }
-       }
+   Widget_Data *wd;
+   Evas_Object *diskselector;
+   char buf[BUFFER_SIZE];
+
+   wd = elm_widget_data_get(data);
+   if (!wd || !wd->base) return;
+   diskselector = elm_ctxpopup_content_unset(wd->ctxpopup);
+   if (diskselector) evas_object_del(diskselector);
+
+   if (wd->selected_it)
+     {
+        snprintf(buf, sizeof(buf), EDC_PART_ITEM_FOCUSOUT_SIG_STR,
+                 wd->selected_it->location);
+        edje_object_signal_emit(wd->base, buf, "elm");
+        wd->selected_it = NULL;
+     }
 }
 
-static Eina_Bool 
-_focus_idler_cb(void *obj)
+static void
+_datefield_resize_cb(void *data, Evas *e __UNUSED__,Evas_Object *obj __UNUSED__,
+                     void *event_info __UNUSED__)
 {
-       Widget_Data *wd = elm_widget_data_get(obj);
-       Evas_Object *focus_obj;
-       focus_obj = elm_widget_focused_object_get(obj);
-       if (focus_obj == obj)
-       {
-               if (wd->layout == ELM_DATEFIELD_LAYOUT_TIME)
-                       elm_object_focus(wd->time[TIME_HOUR]);
-               
-               else if (wd->layout == ELM_DATEFIELD_LAYOUT_DATEANDTIME || wd->layout == ELM_DATEFIELD_LAYOUT_DATE)
-               {
-                       switch (wd->date_format)
-                       {
-                               case DATE_FORMAT_YYDDMM:
-                               case DATE_FORMAT_YYMMDD:
-                                       elm_object_focus(wd->date[DATE_YEAR]);
-                                       break;
-                               case DATE_FORMAT_MMDDYY:
-                               case DATE_FORMAT_MMYYDD:
-                                       elm_object_focus(wd->date[DATE_MON]);
-                                       break;
-                               case DATE_FORMAT_DDMMYY:
-                               case DATE_FORMAT_DDYYMM:
-                                       elm_object_focus(wd->date[DATE_DAY]);
-                       }
-               }
-       }
-       wd->idler = NULL;
-       return EINA_FALSE;
+   Widget_Data *wd;
+
+   wd = elm_widget_data_get(data);
+   if (!wd) return;
+   evas_object_hide(wd->ctxpopup);
 }
 
 static void
-_entry_focused_cb(void *data, Evas_Object *obj, void *event_info)
+_datefield_move_cb(void *data, Evas *e __UNUSED__,Evas_Object *obj __UNUSED__,
+                     void *event_info __UNUSED__)
 {
-       Widget_Data *wd = elm_widget_data_get(data);
-       if (!wd || !wd->base) return;
-
-       if (wd->idler) 
-       {
-               ecore_idler_del(wd->idler);
-               wd->idler = NULL;
-       }
-       
-       if (obj == wd->date[DATE_YEAR])
-               edje_object_signal_emit(wd->base, "elm,state,year,focus,in", "elm");
-       else if (obj == wd->date[DATE_MON])
-               edje_object_signal_emit(wd->base, "elm,state,month,focus,in", "elm");
-       else if (obj == wd->date[DATE_DAY])
-               edje_object_signal_emit(wd->base, "elm,state,day,focus,in", "elm");
-       else if (obj == wd->time[TIME_HOUR])
-               edje_object_signal_emit(wd->base, "elm,state,hour,focus,in", "elm");
-       else if (obj == wd->time[TIME_MIN])
-               edje_object_signal_emit(wd->base, "elm,state,min,focus,in", "elm");
+   Widget_Data *wd;
+
+   wd = elm_widget_data_get(data);
+   if (!wd) return;
+   evas_object_hide(wd->ctxpopup);
 }
 
 static void
-_entry_unfocused_cb(void *data, Evas_Object *obj, void *event_info)
+_contextual_field_limit_get(Evas_Object * obj, Datefield_Item * it,
+                Eina_Bool hr_fmt_check, int *range_min, int *range_max)
 {
-       Widget_Data *wd = elm_widget_data_get(data);
-       char str[YEAR_MAX_LENGTH+1] = {0,};
-       int num = 0;
-
-       if (!wd || !wd->base) return;
-       wd->editing = FALSE;
-
-       if (obj == wd->date[DATE_YEAR])
-       {
-               if (strlen(elm_entry_entry_get(wd->date[DATE_YEAR]))) wd->year = atoi(elm_entry_entry_get(wd->date[DATE_YEAR]));
-               wd->year = _check_date_boundary(data, wd->year, DATE_YEAR);
-               sprintf(str, "%d", wd->year);
-               elm_entry_entry_set(wd->date[DATE_YEAR], str);
-
-               //check month boundary
-               if(wd->month != (num = _check_date_boundary(data, wd->month, DATE_MON)))
-               {
-                       wd->month = num;
-                       elm_entry_entry_set(wd->date[DATE_MON], month_label[wd->month-1]);
-               }
-               //check day boundary
-               if (wd->day != (num = _check_date_boundary(data, wd->day, DATE_DAY)))
-               {
-                       wd->day = num;
-                       sprintf(str, "%d", wd->day);            
-                       elm_entry_entry_set(wd->date[DATE_DAY], str);
-               }               
-               edje_object_signal_emit(wd->base, "elm,state,year,focus,out", "elm");
-       }
-       else if (obj == wd->date[DATE_MON])
-       {
-               if(wd->month != (num = _check_date_boundary(data, wd->month, DATE_MON)))
-               {
-                       wd->month = num;
-                       elm_entry_entry_set(wd->date[DATE_MON], month_label[wd->month-1]);
-               }
-               //check day boundary
-               if (wd->day != (num = _check_date_boundary(data, wd->day, DATE_DAY)))
-               {
-                       wd->day = num;
-                       sprintf(str, "%d", wd->day);            
-                       elm_entry_entry_set(wd->date[DATE_DAY], str);
-               }
-               edje_object_signal_emit(wd->base, "elm,state,month,focus,out", "elm");
-       }       
-       else if (obj == wd->date[DATE_DAY])
-       {
-               if (strlen(elm_entry_entry_get(wd->date[DATE_DAY]))) wd->day = atoi(elm_entry_entry_get(wd->date[DATE_DAY]));
-               wd->day = _check_date_boundary(data, wd->day, DATE_DAY);
-               sprintf(str, "%d", wd->day);            
-               elm_entry_entry_set(wd->date[DATE_DAY], str);
-               edje_object_signal_emit(wd->base, "elm,state,day,focus,out", "elm");
-       }
-       else if (obj == wd->time[TIME_HOUR])
-       {
-               if (strlen(elm_entry_entry_get(wd->time[TIME_HOUR]))) num = atoi(elm_entry_entry_get(wd->time[TIME_HOUR]));
-               else num = wd->hour;
-               
-               if (!wd->time_mode) // 24 mode
-               {
-                       if (num > HOUR_24H_MAXIMUM) num = HOUR_24H_MAXIMUM;
-                       wd->hour = num;
-               }
-               else // 12 mode
-               {
-                       if (num > HOUR_24H_MAXIMUM || num == 0)
-                       {
-                               num = HOUR_12H_MAXIMUM;
-                               wd->pm = EINA_FALSE;
-                       }
-                       else if (num > HOUR_12H_MAXIMUM)
-                       {
-                               num -= HOUR_12H_MAXIMUM;
-                               wd->pm = EINA_TRUE;
-                       }                       
-                       wd->hour = (wd->pm == EINA_TRUE)? num + HOUR_12H_MAXIMUM : num;
-                       if((wd->hour % 12) == 0) wd->hour -= HOUR_12H_MAXIMUM;
-
-                       if (wd->pm) edje_object_part_text_set(wd->base, "elm.text.ampm", "PM");
-                       else edje_object_part_text_set(wd->base, "elm.text.ampm", "AM");
-               }
-               sprintf(str, "%02d", num);              
-               elm_entry_entry_set(wd->time[TIME_HOUR], str);
-               edje_object_signal_emit(wd->base, "elm,state,hour,focus,out", "elm");                   
-       }
-       else if (obj == wd->time[TIME_MIN])
-       {
-               if (strlen(elm_entry_entry_get(wd->time[TIME_MIN]))) wd->min = atoi(elm_entry_entry_get(wd->time[TIME_MIN]));   
-               if (wd->min > MIN_MAXIMUM) wd->min = MIN_MAXIMUM;
-
-               sprintf(str, "%02d", wd->min);
-               elm_entry_entry_set(wd->time[TIME_MIN], str);
-               edje_object_signal_emit(wd->base, "elm,state,min,focus,out", "elm");
-       }
-       evas_object_smart_callback_call(data, "changed", NULL); 
+   Widget_Data *wd;
+   Datefield_Item * tmp;
+   unsigned int idx;
+   int ctx_max;
+   Eina_Bool min_limit = EINA_TRUE;
+   Eina_Bool max_limit = EINA_TRUE;
+
+   wd = elm_widget_data_get(obj);
+   if (!wd || !it) return;
+
+   //Top to down check for current field relative min/max limit
+   if (!it->abs_min || !it->abs_max )
+     {
+        for (idx = ELM_DATEFIELD_YEAR; idx < it->type; idx++)
+          {
+             tmp = wd->item_list + idx;
+             if (max_limit && (*(tmp->value) < tmp->max)) max_limit= EINA_FALSE;
+             if (min_limit && (*(tmp->value) > tmp->min)) min_limit= EINA_FALSE;
+          }
+     }
+
+   if (it->abs_min || min_limit) (*range_min) = it->min;
+   else (*range_min) = it->default_min;
+
+   if (it->abs_max || max_limit) (*range_max) = it->max;
+   else (*range_max) = it->default_max;
+
+   ctx_max = it->default_max;
+   if (it->type == ELM_DATEFIELD_DATE )
+     {
+        ctx_max = _days_in_month[wd->time->tm_mon];
+        // Check for Leap year Feb.
+        if (__isleap((wd->time->tm_year)) && wd->time->tm_mon == 1) ctx_max= 29;
+     }
+   else if (it->type == ELM_DATEFIELD_HOUR  &&  hr_fmt_check &&
+            it->hour_type == ELM_DATEFIELD_HOUR_12 )  ctx_max = 11;
+
+   if (*range_max > ctx_max) *range_max = ctx_max;
 }
 
-static void 
-_entry_focus_move(Evas_Object *obj, Evas_Object *focus_obj)
+static void
+_update_items(Evas_Object *obj)
 {
-       Widget_Data *wd = elm_widget_data_get(obj);
-
-       if (!wd) return;
-       if (focus_obj == wd->date[DATE_YEAR])
-       {
-               switch (wd->date_format)
-               {
-                       case DATE_FORMAT_DDMMYY:
-                       case DATE_FORMAT_MMDDYY:
-                               if (wd->layout == ELM_DATEFIELD_LAYOUT_DATEANDTIME)
-                                       elm_object_focus(wd->time[TIME_HOUR]);
-                               else if (wd->layout == ELM_DATEFIELD_LAYOUT_DATE)
-                                       elm_object_unfocus(wd->date[DATE_YEAR]);
-                               break;
-                       case DATE_FORMAT_DDYYMM:
-                       case DATE_FORMAT_YYMMDD:
-                               elm_object_focus(wd->date[DATE_MON]);
-                               break;
-                       case DATE_FORMAT_MMYYDD:
-                       case DATE_FORMAT_YYDDMM:
-                               elm_object_focus(wd->date[DATE_DAY]);
-               }
-       }
-       else if (focus_obj == wd->date[DATE_MON])
-       {
-               switch (wd->date_format)
-               {
-                       case DATE_FORMAT_DDYYMM:
-                       case DATE_FORMAT_YYDDMM:
-                               if (wd->layout == ELM_DATEFIELD_LAYOUT_DATEANDTIME)
-                                       elm_object_focus(wd->time[TIME_HOUR]);
-                               else if (wd->layout == ELM_DATEFIELD_LAYOUT_DATE)
-                                       elm_object_unfocus(wd->date[DATE_MON]);
-                               break;
-                       case DATE_FORMAT_DDMMYY:
-                       case DATE_FORMAT_MMYYDD:
-                               elm_object_focus(wd->date[DATE_YEAR]);
-                               break;
-                       case DATE_FORMAT_MMDDYY:
-                       case DATE_FORMAT_YYMMDD:
-                               elm_object_focus(wd->date[DATE_DAY]);
-               }
-       }
-       else if (focus_obj == wd->date[DATE_DAY])
-       {
-               switch (wd->date_format)
-               {
-                       case DATE_FORMAT_YYMMDD:
-                       case DATE_FORMAT_MMYYDD:
-                               if (wd->layout == ELM_DATEFIELD_LAYOUT_DATEANDTIME)
-                                       elm_object_focus(wd->time[TIME_HOUR]);
-                               else if (wd->layout == ELM_DATEFIELD_LAYOUT_DATE)
-                                       elm_object_unfocus(wd->date[DATE_DAY]);
-                               break;
-                       case DATE_FORMAT_DDYYMM:
-                       case DATE_FORMAT_MMDDYY:
-                               elm_object_focus(wd->date[DATE_YEAR]);
-                               break;
-                       case DATE_FORMAT_DDMMYY:
-                       case DATE_FORMAT_YYDDMM:
-                               elm_object_focus(wd->date[DATE_MON]);
-               }
-       }
-       else if (focus_obj == wd->time[TIME_HOUR])
-               elm_object_focus(wd->time[TIME_MIN]);
-       else if (focus_obj == wd->time[TIME_MIN])
-               elm_object_unfocus(wd->time[TIME_MIN]);
+   Widget_Data *wd;
+   Datefield_Item *it;
+   char buf[BUFFER_SIZE];
+   unsigned int idx= 0;
+
+   wd = elm_widget_data_get(obj);
+   if (!wd || !wd->base) return;
+   for (idx = 0; idx < DATEFIELD_TYPE_COUNT; idx++ )
+     {
+        it = wd->item_list + idx;
+        if ( it->fmt_exist && it->enabled )
+          {
+             strftime(buf, BUFFER_SIZE, it->fmt, wd->time);
+
+             // FIXME: no locale string availble from Libc...
+             if ((!strncmp(buf, "",1)) && (it->type == ELM_DATEFIELD_AMPM))
+               {
+                  if (wd->ampm) strncpy(buf, E_("PM"), BUFFER_SIZE);
+                  else strncpy(buf, E_("AM"), BUFFER_SIZE);
+               }
+             eina_stringshare_replace(&it->content, buf);
+             snprintf(buf, sizeof(buf), EDC_PART_ITEM_STR, it->location);
+             edje_object_part_text_set(wd->base, buf, it->content);
+          }
+     }
 }
 
-static int
-_check_date_boundary(Evas_Object *obj, int num, int flag)
+static void
+_field_value_set(Evas_Object * obj, Elm_Datefield_ItemType item_type, int value,
+                 Eina_Bool adjust_time)
 {
-       Widget_Data *wd = elm_widget_data_get(obj);
-       if (flag == DATE_YEAR)
-       {
-               if (num > wd->y_max) num = wd->y_max;
-               else if (num < wd->y_min) num = wd->y_min;
-               return num;
-       }
-
-       else if (flag == DATE_MON)
-       {
-               if (wd->year == wd->y_max && num > wd->m_max) num = wd->m_max;
-               else if (wd->year == wd->y_min && num < wd->m_min) num = wd->m_min;
-               else if (num > MONTH_MAXIMUM) num = MONTH_MAXIMUM;
-               else if (num <= 0) num = 1;
-               return num;
-       }
-
-       else if (flag == DATE_DAY)
-       {
-               int day_of_month = _maximum_day_get(wd->year, wd->month);
-               if (wd->year == wd->y_max && wd->month == wd->m_max && num > wd->d_max) num = wd->d_max;
-               else if (wd->year == wd->y_min && wd->month == wd->m_min && num < wd->d_min) num = wd->d_min;
-               else if (num > day_of_month) num = day_of_month;
-               else if (num <= 0) num = 1;
-               return num;
-       }
-       return num;
+   Widget_Data *wd;
+   Datefield_Item * it;
+   unsigned int idx;
+   int min, max;
+   Eina_Bool value_changed = EINA_FALSE;
+
+   wd = elm_widget_data_get(obj);
+   if (!wd) return;
+
+   if (item_type == ELM_DATEFIELD_AMPM)
+     {
+        if ( value == wd->ampm ) return;
+        item_type = ELM_DATEFIELD_HOUR;
+        value = (wd->time->tm_hour + 12) % 24;
+        adjust_time =  EINA_FALSE;
+     }
+
+   it = wd->item_list + item_type;
+   _contextual_field_limit_get(obj, it, EINA_FALSE, &min, &max);
+
+   //12 hr format & PM then add 12 to value.
+   if (adjust_time && it->type == ELM_DATEFIELD_HOUR &&
+       it->hour_type == ELM_DATEFIELD_HOUR_12 && wd->ampm && value < 12)
+      value += 12;
+
+   if (value < min) value = min;
+   else if (value > max) value = max;
+   if ( *(it->value) == value) return;
+   *(it->value) = value;
+   value_changed = EINA_TRUE;
+
+   //Validate & reset lower order fields
+   for ( idx = item_type+1; idx < DATEFIELD_TYPE_COUNT; idx++ )
+     {
+        it = wd->item_list + idx;
+        _contextual_field_limit_get(obj, it, EINA_FALSE, &min, &max);
+        //Validate current value against context based Min/Max restriction.
+        if (*it->value < min)
+          {
+             *it->value = min;
+             value_changed = EINA_TRUE;
+          }
+        else if (*it->value > max)
+          {
+             *it->value = max;
+             value_changed = EINA_TRUE;
+          }
+     }
+   //update AM/PM state
+   wd->ampm = (wd->time->tm_hour > 11 );
+   _update_items(obj);
+
+   if (value_changed)
+     evas_object_smart_callback_call(obj, SIG_CHANGED, NULL);
 }
 
-static int
-_maximum_day_get(int year, int month)
+static void
+_diskselector_cb(void *data, Evas_Object *obj __UNUSED__,
+                 void *event_info __UNUSED__)
 {
-       int day_of_month = 0;
-       if (year == 0 || month == 0) return 0;
-
-       switch (month) {
-               case 4: 
-               case 6: 
-               case 9: 
-               case 11:
-                       day_of_month = 30;
-                       break;
-               case 2:
-                       if ((!(year % 4) && (year % 100)) || !(year % 400))
-                               day_of_month = 29;
-                       else
-                               day_of_month = 28;
-                       break;
-               default:
-                       day_of_month = 31;
-                       break;
-       }
-
-       return day_of_month;
-}
+   DiskItem_Data *cb_data;
+   Widget_Data *wd;
 
-static Eina_Bool 
-_check_input_done(Evas_Object *obj, Evas_Object *focus_obj, int strlen)
-{
-       Widget_Data *wd = elm_widget_data_get(obj);
-
-       if (!wd) return EINA_FALSE;
-
-       if (focus_obj == wd->date[DATE_YEAR] && strlen == YEAR_MAX_LENGTH)
-               wd->editing = EINA_FALSE;
-       else if (focus_obj == wd->date[DATE_MON] && strlen == MONTH_MAX_LENGTH)
-               wd->editing = EINA_FALSE;
-       else if (focus_obj == wd->date[DATE_DAY])
-       {
-               if (strlen == DAY_MAX_LENGTH || atoi(elm_entry_entry_get(focus_obj)) > 3)
-               wd->editing = EINA_FALSE;
-       }
-       else if (focus_obj == wd->time[TIME_HOUR])
-       {       
-               if (strlen == TIME_MAX_LENGTH || atoi(elm_entry_entry_get(focus_obj)) > 2)
-                       wd->editing = EINA_FALSE;
-       }
-       else if (focus_obj == wd->time[TIME_MIN])
-       {
-               if (strlen == TIME_MAX_LENGTH || atoi(elm_entry_entry_get(focus_obj)) > 5) 
-               wd->editing = EINA_FALSE;
-       }
-       return !wd->editing;
+   cb_data = (DiskItem_Data *)data;
+   if (!cb_data) return;
+   wd = elm_widget_data_get(cb_data->datefield);
+   if (!wd ) return;
+
+   _field_value_set(cb_data->datefield, wd->selected_it->type,
+                    cb_data->sel_item_value, EINA_TRUE);
+
+   evas_object_hide(wd->ctxpopup);
 }
 
 static void
-_entry_key_up_cb(void *data, Evas *e , Evas_Object *obj , void *event_info)
+_ampm_clicked (void *data)
 {
-       Evas_Event_Key_Up *ev = (Evas_Event_Key_Up *) event_info;
+   Widget_Data *wd;
+   char buf[BUFFER_SIZE];
 
-       if (!strcmp(ev->keyname, "BackSpace"))
-               elm_entry_entry_set(obj, "");
+   wd = elm_widget_data_get(data);
+   if (!wd || !wd->base) return;
+
+   _field_value_set( data, ELM_DATEFIELD_AMPM, !wd->ampm, EINA_FALSE );
+
+   snprintf(buf, sizeof(buf), EDC_PART_ITEM_FOCUSOUT_SIG_STR,
+            wd->selected_it->location);
+   edje_object_signal_emit(wd->base, buf, "elm");
+   wd->selected_it = NULL;
 }
 
-static Eina_Bool 
-_imf_event_commit_cb(void *data, int type, void *event)
+static void
+_diskselector_item_free_cb(void *data, Evas_Object *obj __UNUSED__,
+                           void *event_info __UNUSED__)
 {
-       Widget_Data *wd = elm_widget_data_get(data);
-       Ecore_IMF_Event_Commit *ev = (Ecore_IMF_Event_Commit *) event;
-       Evas_Object *focus_obj;
-       char str[YEAR_MAX_LENGTH+1] = {0,};
-       
-       if (!wd) return ECORE_CALLBACK_PASS_ON;
-       if (!elm_widget_focus_get(data)) return ECORE_CALLBACK_PASS_ON;
-       
-       focus_obj = elm_widget_focused_object_get(data);
-       if (!wd->editing) 
-       {
-               elm_entry_entry_set(focus_obj, "");
-               wd->editing = EINA_TRUE;
-       }
-       
-       if (focus_obj == wd->date[DATE_MON])
-       {
-               wd->month = atoi(ev->str);
-               strcpy(str, month_label[wd->month-1]);
-       }
-       else
-       {
-               strcpy(str, elm_entry_entry_get(focus_obj));
-               str[strlen(str)] = ev->str[0];
-       }
-       elm_entry_entry_set(focus_obj, str);
-
-       if (_check_input_done(data, focus_obj, strlen(str)))
-               _entry_focus_move(data, focus_obj);
-
-       return ECORE_CALLBACK_DONE;
+   if (data) free(data);
 }
-
-static void 
-_input_panel_event_callback(void *data, Ecore_IMF_Context *ctx, int value)
+\r
+static void
+_load_field_options(Evas_Object * data, Evas_Object *diskselector,
+                    Datefield_Item *it)
 {
-       Widget_Data *wd = elm_widget_data_get(data);
-
-       if (!wd) return;
-
-       if (wd->func)
-               wd->func(wd->func_data, data, value);
+   Widget_Data *wd;
+   DiskItem_Data *disk_data;
+   Elm_Diskselector_Item *item;
+   int idx, min, max, selected_val;
+   int text_len, max_len = 0;
+   char item_label[BUFFER_SIZE];
+   int cur_val, date_val;
+
+   wd = elm_widget_data_get(data);
+   if (!wd) return;
+
+   cur_val = *(it->value);
+   date_val = wd->time->tm_mday;
+   _contextual_field_limit_get(data, it, EINA_TRUE, &min, &max );
+
+   selected_val = *(it->value);
+   wd->time->tm_mday = 1;
+   // If 12hr format & PM, reduce 12
+   if (it->hour_type == ELM_DATEFIELD_HOUR_12 && wd->ampm) selected_val -= 12;
+
+   for (idx = min; idx <= max; idx++)\r
+     {
+        *(it->value) = idx;
+        strftime(item_label, BUFFER_SIZE, it->fmt, wd->time );
+        text_len = strlen(item_label);
+        if (text_len > max_len ) max_len = text_len; //Store max. label length
+
+        if (idx == selected_val) //Selected Item, dont attach a callback handler
+          {
+             item = elm_diskselector_item_append(diskselector, item_label,
+                                                 NULL, NULL, NULL);
+             elm_diskselector_item_selected_set(item, EINA_TRUE);
+          }
+        else
+          {
+             disk_data = (DiskItem_Data *) malloc (sizeof(DiskItem_Data));
+             disk_data->datefield = data;
+             disk_data->sel_item_value = idx;
+             item = elm_diskselector_item_append(diskselector,
+                                 item_label, NULL, _diskselector_cb, disk_data);
+             elm_diskselector_item_del_cb_set(item, _diskselector_item_free_cb);
+          }
+     }
+   *(it->value) = cur_val;
+   wd->time->tm_mday = date_val;
+   elm_diskselector_side_label_length_set(diskselector, max_len);
 }
 
 static void
-_date_update(Evas_Object *obj)
+_datefield_clicked_cb(void *data, Evas_Object *obj __UNUSED__,
+                      const char *emission __UNUSED__, const char *source)
+{
+   Widget_Data *wd = elm_widget_data_get(data);
+   Evas_Object *diskselector;
+   const Evas_Object *edj_part;
+   char buf[BUFFER_SIZE];
+   unsigned int idx = 0, idx1 = 0, display_item_num;
+   Evas_Coord x = 0, y = 0, w = 0, h = 0;
+   Evas_Coord disksel_width;
+
+   if (!wd || !wd->base) return;
+   if (elm_widget_disabled_get(data)) return;
+
+   wd->selected_it = NULL;
+   //Locate the selected Index & Selected Datefield_Item
+   for (idx = 0; idx < DATEFIELD_TYPE_COUNT; idx++ )
+     {
+        snprintf(buf, sizeof(buf), EDC_PART_ITEM_OVER_STR, idx);
+        if (!strncmp(buf, source, sizeof(buf)))
+          {
+             for (idx1 = 0; idx1 < DATEFIELD_TYPE_COUNT; idx1++ )
+               {
+                 if ((wd->item_list + idx1)->location == (int)idx)
+                   {
+                      wd->selected_it = wd->item_list + idx1;
+                      break;
+                   }
+               }
+             break;
+          }
+     }
+
+   if ( !wd->selected_it || !wd->selected_it->fmt_exist
+                         || !wd->selected_it->enabled ) return;
+   snprintf(buf, sizeof(buf), EDC_PART_ITEM_FOCUSIN_SIG_STR,
+            wd->selected_it->location);
+   edje_object_signal_emit(wd->base, buf, "elm");
+
+   if ( wd->selected_it->type == ELM_DATEFIELD_AMPM )
+     {
+        _ampm_clicked (data);
+        return;
+     }
+
+   //Recreating diskselector everytime due to diskselector behavior
+   diskselector = elm_diskselector_add(elm_widget_top_get(data));
+   snprintf(buf, sizeof(buf), "datefield/%s", elm_object_style_get(data));
+   elm_object_style_set(diskselector, buf);
+
+   //Load the options list
+   _load_field_options(data, diskselector, wd->selected_it);
+
+   elm_ctxpopup_direction_priority_set(wd->ctxpopup, ELM_CTXPOPUP_DIRECTION_DOWN,
+                                       ELM_CTXPOPUP_DIRECTION_UP, -1, -1);
+   elm_object_content_set(wd->ctxpopup, diskselector);
+   snprintf(buf,sizeof(buf), EDC_PART_ITEM_STR, wd->selected_it->location);
+   edj_part = edje_object_part_object_get(wd->base, buf);
+   evas_object_geometry_get(edj_part, &x, &y, &w, &h);
+   evas_object_move(wd->ctxpopup, (x+w/2), (y+h));
+
+   //If the direction of Ctxpopup is upwards, move it to the top of datefield
+   if (elm_ctxpopup_direction_get (wd->ctxpopup) == ELM_CTXPOPUP_DIRECTION_UP)
+     {
+        elm_ctxpopup_direction_priority_set(wd->ctxpopup, ELM_CTXPOPUP_DIRECTION_UP,
+                                            ELM_CTXPOPUP_DIRECTION_DOWN, -1, -1);
+        evas_object_move(wd->ctxpopup, (x+w/2), y);
+     }
+   evas_object_show(wd->ctxpopup);
+
+   evas_object_geometry_get(diskselector, NULL, NULL, &disksel_width, NULL);
+   display_item_num = disksel_width / (w +  elm_finger_size_get());
+   //odd number of items leads to auto selection.
+   //making as event number of item to prevent auto selection.
+   if (display_item_num%2) display_item_num-=1;
+   if (display_item_num < DISKSELECTOR_ITEMS_NUM_MIN)
+     display_item_num = DISKSELECTOR_ITEMS_NUM_MIN;
+
+   elm_diskselector_display_item_num_set(diskselector, display_item_num);
+   elm_diskselector_round_set(diskselector, EINA_TRUE);
+}
+
+static unsigned int
+_parse_format( Evas_Object *obj )
 {
-       Widget_Data *wd = elm_widget_data_get(obj);
-       char str[YEAR_MAX_LENGTH+1];
-
-       if (!wd || !wd->base) return;
-       
-       sprintf(str, "%d", wd->year);
-       elm_entry_entry_set(wd->date[DATE_YEAR], str);
-
-       sprintf(str, "%s", month_label[wd->month-1]);
-       elm_entry_entry_set(wd->date[DATE_MON], str);
-
-       sprintf(str, "%d", wd->day);
-       elm_entry_entry_set(wd->date[DATE_DAY], str);
-
-       if (!wd->time_mode) //24 mode
-               sprintf(str, "%d", wd->hour);
-       else
-       {
-               if (wd->hour >= HOUR_12H_MAXIMUM)
-               {
-                       wd->pm = EINA_TRUE;
-                       edje_object_part_text_set(wd->base, "elm.text.ampm", "PM");
-               }
-               else
-               {
-                       wd->pm = EINA_FALSE;
-                       edje_object_part_text_set(wd->base, "elm.text.ampm", "AM");             
-               }
-
-               if (wd->hour > HOUR_12H_MAXIMUM)
-                       sprintf(str, "%02d", wd->hour - HOUR_12H_MAXIMUM);
-               else if (wd->hour == 0)
-                       sprintf(str, "%02d", HOUR_12H_MAXIMUM);
-               else
-                       sprintf(str, "%02d", wd->hour);
-       }
-       elm_entry_entry_set(wd->time[TIME_HOUR], str);
-
-       sprintf(str, "%02d", wd->min);
-       elm_entry_entry_set(wd->time[TIME_MIN], str);
+   Widget_Data *wd;
+   Datefield_Item *it = NULL;
+   unsigned int len = 0, idx, location = 0;
+   char separator[MAX_SEPARATOR_LEN];
+   char *fmt_ptr;
+   char cur;
+   Eina_Bool fmt_parsing = EINA_FALSE, sep_parsing = EINA_FALSE,
+             sep_lookup = EINA_FALSE;
+
+   wd = elm_widget_data_get(obj);
+   fmt_ptr = wd->format;
+
+   while ( (cur = *fmt_ptr ) )
+     {
+        if (fmt_parsing)
+          {
+             for ( idx = 0; idx < DATEFIELD_TYPE_COUNT; idx++ )
+               {
+                  if ( strchr( mapping[idx].fmt_char, cur ) )
+                    {
+                       it = wd->item_list + idx;
+                       //Ignore the items already have or disabled
+                       //valid formats, means already parsed & repeated, ignore.
+                       if (!it->enabled || it->location != -1) break;
+                       it->fmt[1] = cur;
+
+                      //set the hour display format 12h/24h
+                       if (it->type == ELM_DATEFIELD_HOUR)
+                         {
+                            if (cur == 'H' || cur == 'k' )
+                              it->hour_type = ELM_DATEFIELD_HOUR_24;
+                            else if (cur == 'I' || cur == 'l' )
+                              it->hour_type = ELM_DATEFIELD_HOUR_12;
+                         }
+                       else it->hour_type = ELM_DATEFIELD_HOUR_NA;
+
+                       it->fmt_exist = EINA_TRUE;
+                       it->location = location++;
+                       fmt_parsing = EINA_FALSE;
+                       sep_lookup = EINA_TRUE;
+                       len = 0;
+                       break;
+                    }
+               }
+          }
+
+        if (cur == '%')
+          {
+             fmt_parsing = EINA_TRUE;
+             sep_parsing = EINA_FALSE;
+             // Set the separator to previous Item
+             separator[len] = 0;
+             if (it) eina_stringshare_replace(&it->separator, separator);
+          }
+        if (sep_parsing && (len < MAX_SEPARATOR_LEN-1)) separator[len++] = cur;
+        if (sep_lookup) sep_parsing = EINA_TRUE;
+        sep_lookup = EINA_FALSE;
+        fmt_ptr++;
+   }
+   // Return the number of valid items parsed.
+   return location;
 }
 
-static void 
-_date_entry_add(Evas_Object *obj)
+static void
+_format_reload(Evas_Object *obj)
 {
-       Widget_Data *wd = elm_widget_data_get(obj);
-       int i;
-
-       if (!wd) return;        
-       
-       for (i = 0; i < DATE_MAX; i++)
-       {
-               wd->date[i] = elm_entry_add(obj);
-               elm_entry_single_line_set(wd->date[i], EINA_TRUE);
-               elm_entry_context_menu_disabled_set(wd->date[i], EINA_TRUE);
-               if (i == DATE_MON) elm_entry_input_panel_layout_set(wd->date[i], ELM_INPUT_PANEL_LAYOUT_MONTH);
-               else elm_entry_input_panel_layout_set(wd->date[i], ELM_INPUT_PANEL_LAYOUT_NUMBERONLY);
-               evas_object_size_hint_weight_set(wd->date[i], EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-               evas_object_size_hint_align_set(wd->date[i], EVAS_HINT_FILL, EVAS_HINT_FILL);
-               evas_object_smart_callback_add(wd->date[i], "focused", _entry_focused_cb, obj);
-               evas_object_smart_callback_add(wd->date[i], "unfocused", _entry_unfocused_cb, obj);
-               evas_object_event_callback_add(wd->date[i], EVAS_CALLBACK_KEY_UP, _entry_key_up_cb, obj);
-               elm_widget_sub_object_add(obj, wd->date[i]);
-       }
-       elm_entry_maximum_bytes_set(wd->date[DATE_YEAR], YEAR_MAX_LENGTH);
-       elm_entry_maximum_bytes_set(wd->date[DATE_MON], MONTH_MAX_LENGTH);
-       elm_entry_maximum_bytes_set(wd->date[DATE_DAY], DAY_MAX_LENGTH);
+   Widget_Data *wd;
+   Datefield_Item *it;
+   char buf[BUFFER_SIZE];
+   unsigned int idx, location;
+   char *def_fmt;
+
+   wd = elm_widget_data_get(obj);
+   if (!wd) return;
+
+    // fetch the format from locale specific po file.
+   if (!wd->user_format )
+     {
+        def_fmt = E_("DateTimeFormat");
+        if (!strncmp(def_fmt, "DateTimeFormat", sizeof("DateTimeFormat")))
+          strncpy(wd->format, DEFAULT_FORMAT, MAX_FORMAT_LEN );
+        else
+          strncpy(wd->format, def_fmt, MAX_FORMAT_LEN );
+     }
+
+   //reset all the items to disable state
+   for ( idx = 0; idx < DATEFIELD_TYPE_COUNT; idx++ )
+     {
+        it = wd->item_list + idx;
+        eina_stringshare_replace(&it->content, NULL);
+        it->fmt_exist = EINA_FALSE;
+        it->location = -1;
+     }
+   location = _parse_format( obj );
+
+   //assign locations to disabled fields for uniform usage
+   for (idx = 0; idx < DATEFIELD_TYPE_COUNT; idx++)
+     {
+        it = wd->item_list + idx;
+        if (it->location == -1) it->location = location++;
+
+        if (it->fmt_exist && it->enabled)
+          {
+             snprintf(buf, sizeof(buf), EDC_PART_ITEM_ENABLE_SIG_STR,
+                      it->location);
+             edje_object_signal_emit(wd->base, buf, "elm");
+             if (it->type == ELM_DATEFIELD_AMPM)
+               snprintf(buf, sizeof(buf), EDC_PART_ITEM_STYLE_AMPM_SIG_STR,
+                        it->location);
+             else
+               snprintf(buf, sizeof(buf), EDC_PART_ITEM_STYLE_DEFAULT_SIG_STR,
+                        it->location);
+             edje_object_signal_emit(wd->base, buf, "elm");
+          }
+        else
+          {
+             snprintf(buf, sizeof(buf),EDC_PART_ITEM_DISABLE_SIG_STR,
+                      it->location);
+             edje_object_signal_emit(wd->base, buf, "elm");
+          }
+        snprintf(buf, sizeof(buf), EDC_PART_SEPARATOR_STR, it->location+1);
+        edje_object_part_text_set(wd->base, buf, it->separator);
+     }
+   edje_object_message_signal_process(wd->base);
+   _update_items(obj);
 }
 
-static void 
-_time_entry_add(Evas_Object *obj)
+static void
+_item_list_init(Evas_Object *obj)
 {
-       Widget_Data *wd = elm_widget_data_get(obj);
-       int i;
-
-       if (!wd) return;        
-       
-       for (i = 0; i < TIME_MAX; i++)
-       {
-               wd->time[i] = elm_entry_add(obj);
-               elm_entry_single_line_set(wd->time[i], EINA_TRUE);
-               elm_entry_context_menu_disabled_set(wd->time[i], EINA_TRUE);
-               elm_entry_input_panel_layout_set(wd->time[i], ELM_INPUT_PANEL_LAYOUT_NUMBERONLY);               
-               elm_entry_maximum_bytes_set(wd->time[i], TIME_MAX_LENGTH);
-               evas_object_size_hint_weight_set(wd->time[i], EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-               evas_object_size_hint_align_set(wd->time[i], EVAS_HINT_FILL, EVAS_HINT_FILL);
-               evas_object_smart_callback_add(wd->time[i], "focused", _entry_focused_cb, obj);
-               evas_object_smart_callback_add(wd->time[i], "unfocused", _entry_unfocused_cb, obj);
-               evas_object_event_callback_add(wd->time[i], EVAS_CALLBACK_KEY_UP, _entry_key_up_cb, obj);
-               elm_widget_sub_object_add(obj, wd->time[i]);
-       }
+   Widget_Data *wd;
+   Datefield_Item *it;
+   char buf[BUFFER_SIZE];
+   unsigned int idx;
+   time_t t;
+
+   wd = elm_widget_data_get(obj);
+   if (!wd) return;
+
+   wd->item_list = calloc(1, DATEFIELD_TYPE_COUNT * sizeof(Datefield_Item));
+   wd->time = calloc(1, sizeof(struct tm));
+   t = time(NULL);
+   localtime_r(&t, wd->time);
+
+   (wd->item_list + ELM_DATEFIELD_YEAR)->value = &wd->time->tm_year;
+   (wd->item_list + ELM_DATEFIELD_MONTH)->value = &wd->time->tm_mon;
+   (wd->item_list + ELM_DATEFIELD_DATE)->value = &wd->time->tm_mday;
+   (wd->item_list + ELM_DATEFIELD_HOUR)->value = &wd->time->tm_hour;
+   (wd->item_list + ELM_DATEFIELD_MINUTE)->value = &wd->time->tm_min;
+   (wd->item_list + ELM_DATEFIELD_AMPM)->value = &wd->ampm;
+    wd->ampm = (wd->time->tm_hour > 11 );
+
+   for (idx = 0; idx < DATEFIELD_TYPE_COUNT; idx++)
+     {
+        it = wd->item_list + idx;
+        it->type = ELM_DATEFIELD_YEAR + idx;
+        it->fmt[0] = '%';
+        it->fmt_exist = EINA_FALSE;
+        it->enabled  = EINA_TRUE;
+        it->min = mapping[idx].def_min;
+        it->default_min = mapping[idx].def_min;
+        it->max = mapping[idx].def_max;
+        it->default_max = mapping[idx].def_max;
+        snprintf(buf, sizeof(buf), EDC_PART_ITEM_OVER_STR, idx);
+        edje_object_signal_callback_add(wd->base, "mouse,clicked,1", buf,
+                                        _datefield_clicked_cb, obj);
+     }
 }
 
 /**
- * Add a new datefield object
+ * @brief Add a new datefield Widget
+ * The date format and strings are based on current locale
  *
- * @param parent The parent object
+ * @param[in] parent The parent object
  * @return The new object or NULL if it cannot be created
  *
  * @ingroup Datefield
@@ -746,510 +840,455 @@ _time_entry_add(Evas_Object *obj)
 EAPI Evas_Object *
 elm_datefield_add(Evas_Object *parent)
 {
-       Evas_Object *obj;
-       Evas *e;
-       Widget_Data *wd;
-
-       e = evas_object_evas_get(parent);
-       if (!e) return NULL; 
-       wd = ELM_NEW(Widget_Data);
-       obj = elm_widget_add(e); 
-       ELM_SET_WIDTYPE(widtype, "datefield");
-       elm_widget_type_set(obj, "datefield");
-       elm_widget_sub_object_add(parent, obj);
-       elm_widget_data_set(obj, wd);
-       elm_widget_del_hook_set(obj, _del_hook);
-       elm_widget_theme_hook_set(obj, _theme_hook);
-       elm_widget_on_focus_hook_set( obj, _on_focus_hook, NULL );
-       elm_widget_can_focus_set(obj, EINA_TRUE);
-
-       wd->base = edje_object_add(e);
-       elm_widget_resize_object_set(obj, wd->base);
-       edje_object_signal_callback_add(wd->base, "mouse,down,1", "elm.rect.date.left.pad", _signal_rect_mouse_down, obj);
-       edje_object_signal_callback_add(wd->base, "mouse,down,1", "elm.rect.date.year.over", _signal_rect_mouse_down, obj);
-       edje_object_signal_callback_add(wd->base, "mouse,down,1", "elm.rect.date.month.over", _signal_rect_mouse_down, obj);
-       edje_object_signal_callback_add(wd->base, "mouse,down,1", "elm.rect.date.day.over", _signal_rect_mouse_down, obj);      
-       edje_object_signal_callback_add(wd->base, "mouse,down,1", "elm.rect.date.right.pad", _signal_rect_mouse_down, obj);
-
-       edje_object_signal_callback_add(wd->base, "mouse,down,1", "elm.rect.time.hour.over", _signal_rect_mouse_down, obj);
-       edje_object_signal_callback_add(wd->base, "mouse,down,1", "elm.rect.time.min.over", _signal_rect_mouse_down, obj);
-       edje_object_signal_callback_add(wd->base, "mouse,down,1", "elm.rect.time.ampm.over", _signal_ampm_mouse_down, obj);
-       edje_object_signal_callback_add(wd->base, "mouse,clicked,1", "elm.rect.time.ampm.over", _signal_ampm_clicked, obj);
-
-       wd->handler =  ecore_event_handler_add(ECORE_IMF_EVENT_COMMIT, _imf_event_commit_cb, obj);
-       _date_entry_add(obj);
-       _time_entry_add(obj);   
-
-       wd->y_min = 1900;
-       wd->m_min = 1;
-       wd->d_min = 1;
-       wd->y_max = 2099;
-       wd->m_max = 12;
-       wd->d_max = 31; 
-       wd->year = wd->y_min;
-       wd->month = 1;
-       wd->day = 1;
-
-       wd->layout = ELM_DATEFIELD_LAYOUT_DATEANDTIME;
-       wd->time_mode = EINA_TRUE;
-       wd->date_format = DATE_FORMAT_MMDDYY;
-       
-       _theme_hook(obj);
-       
-       return obj;
+   Evas_Object *obj;
+   Evas *e;
+   Widget_Data *wd;
+
+   ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
+   ELM_SET_WIDTYPE(widtype, "datefield");
+   elm_widget_type_set(obj, widtype);
+   elm_widget_sub_object_add(parent, obj);
+   elm_widget_data_set(obj, wd);
+   elm_widget_del_hook_set(obj, _del_hook);
+   elm_widget_theme_hook_set(obj, _theme_hook);
+   elm_widget_on_focus_hook_set( obj, _on_focus_hook, NULL );
+   elm_widget_disable_hook_set(obj, _disable_hook);
+   elm_widget_can_focus_set(obj, EINA_TRUE);
+
+   wd->base = edje_object_add(e);
+   elm_widget_resize_object_set(obj, wd->base);
+   _elm_theme_object_set(obj, wd->base, "datefield", "base", "default");
+   evas_object_smart_callbacks_descriptions_set(obj, _signals);
+
+   _item_list_init(obj);
+   _format_reload(obj);
+
+   wd->ctxpopup = elm_ctxpopup_add(elm_widget_top_get(obj));
+   elm_object_style_set(wd->ctxpopup, "datefield/default");
+   elm_ctxpopup_horizontal_set(wd->ctxpopup, EINA_TRUE);
+   evas_object_size_hint_weight_set(wd->ctxpopup, EVAS_HINT_EXPAND,
+                                    EVAS_HINT_EXPAND);
+   evas_object_size_hint_align_set(wd->ctxpopup, EVAS_HINT_FILL,EVAS_HINT_FILL);
+   evas_object_smart_callback_add(wd->ctxpopup, "dismissed",
+                                  _ctxpopup_dismissed_cb, obj);
+   evas_object_event_callback_add(wd->base, EVAS_CALLBACK_RESIZE,
+                                  _datefield_resize_cb, obj);
+   evas_object_event_callback_add(wd->base, EVAS_CALLBACK_MOVE,
+                                  _datefield_move_cb, obj);
+   _mirrored_set(obj, elm_widget_mirrored_get(obj));
+
+   return obj;
 }
 
 /**
- * set layout for the datefield
+ * Set the format of datefield. Formats can be like "%b %d, %Y %I : %M %p".
+ * Maximum allowed format length is 32 chars.
+ * Format can include separators for each individual datefield item.
+ * Each separator can be a maximum of 6 UTF-8 bytes.
+ * Space is also taken as a separator.
+ * Following are the allowed set of format specifiers for each datefield item.
+ * These specifiers can be arranged at any order as per user requirement and
+ * their value will be replaced in the format as mentioned below.
+ * %Y : The year as a decimal number including the century.
+ * %y : The year as a decimal number without a century (range 00 to 99)
+ * %m : The month as a decimal number (range 01 to 12).
+ * %b : The abbreviated month name according to the current locale.
+ * %B : The full month name according to the current locale.
+ * %d : The day of the month as a decimal number (range 01 to 31).
+ * %I : The hour as a decimal number using a 12-hour clock (range 01 to 12).
+ * %H : The hour as a decimal number using a 24-hour clock (range 00 to 23).
+ * %k : The hour (24-hour clock) as a decimal number (range 0 to 23). single
+ *      digits are preceded by a blank.
+ * %l : The hour (12-hour clock) as a decimal number (range 1 to 12); single
+ *      digits are preceded by a blank.
+ * %M : The minute as a decimal number (range 00 to 59).
+ * %p : Either 'AM' or 'PM' according to the given time value, or the
+ *      corresponding strings for the current locale. Noon is treated as 'PM'
+ *      and midnight as 'AM'
+ * %P : Like %p but in lowercase: 'am' or 'pm' or a corresponding string for
+ *      the current locale.
+ * Default format is taken as per the system display language and Region format.
  *
- * @param obj The datefield object
- * @param layout set layout for date/time/dateandtime (default: ELM_DATEFIELD_LAYOUT_DATEANDTIME)
+ * @param[in] obj The datefield object
+ * @param[in] fmt The date format
  *
- * @ingroup Datefield
  */
 EAPI void
-elm_datefield_layout_set(Evas_Object *obj, Elm_Datefield_Layout layout)
+elm_datefield_format_set(Evas_Object *obj, const char *fmt)
 {
-       ELM_CHECK_WIDTYPE(obj, widtype);
-       Widget_Data *wd = elm_widget_data_get(obj);
-       
-       if (!wd) return;
-       if (layout < ELM_DATEFIELD_LAYOUT_TIME ||layout > ELM_DATEFIELD_LAYOUT_DATEANDTIME) return;
-
-       if (wd->layout != layout)
-       {
-               wd->layout = layout;
-               _theme_hook(obj);
-       }
-       return;
-}
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd;
 
-/**
- * get layout of the datefield
- *
- * @param obj The datefield object
- * @return layout of the datefield
- *
- * @ingroup Datefield
- */
-EAPI Elm_Datefield_Layout
-elm_datefield_layout_get(const Evas_Object *obj)
-{
-       ELM_CHECK_WIDTYPE(obj, widtype) 0;
-       Widget_Data *wd = elm_widget_data_get(obj);
-       
-       if (!wd) return 0;
+   wd = elm_widget_data_get(obj);
+   if (!wd) return;
 
-       return wd->layout;
+   if (fmt)
+     {
+        strncpy( wd->format, fmt, MAX_FORMAT_LEN );
+        wd->user_format = EINA_TRUE;
+     }
+   else  wd->user_format = EINA_FALSE;
+
+   _format_reload(obj);
 }
 
 /**
- * Set selected date of the datefield
+ * Get the format of datefield. Formats can be like "%b %d, %Y %I : %M %p".
+ * Maximum allowed format length is 32 chars.
+ * Format can include separators for each individual datefield item.
+ * Each separator can be a maximum of 6 UTF-8 bytes.
+ * Space is also taken as a separator.
+ * Following are the allowed set of format specifiers for each datefield item.
+ * These specifiers can be arranged at any order as per user requirement and
+ * their value will be replaced in the format as mentioned below.
+ * %Y : The year as a decimal number including the century.
+ * %y : The year as a decimal number without a century (range 00 to 99)
+ * %m : The month as a decimal number (range 01 to 12).
+ * %b : The abbreviated month name according to the current locale.
+ * %B : The full month name according to the current locale.
+ * %d : The day of the month as a decimal number (range 01 to 31).
+ * %I : The hour as a decimal number using a 12-hour clock (range 01 to 12).
+ * %H : The hour as a decimal number using a 24-hour clock (range 00 to 23).
+ * %k : The hour (24-hour clock) as a decimal number (range 0 to 23). single
+ *      digits are preceded by a blank.
+ * %l : The hour (12-hour clock) as a decimal number (range 1 to 12); single
+ *      digits are preceded by a blank.
+ * %M : The minute as a decimal number (range 00 to 59).
+ * %p : Either 'AM' or 'PM' according to the given time value, or the
+ *      corresponding strings for the current locale. Noon is treated as 'PM'
+ *      and midnight as 'AM'
+ * %P : Like %p but in lowercase: 'am' or 'pm' or a corresponding string for
+ *      the current locale.
+ * Default format is taken as per the system display language and Region format.
+ *
+ * @param[in] obj The datefield object
+ * @return date format string. ex) %b %d, %Y %I : %M %p
  *
- * @param obj The datefield object
- * @param year The year to set
- * @param month The month to set
- * @param day The day to set
- * @param hour The hours to set (24hour mode - 0~23)
- * @param min The minutes to set (0~59)
- * 
- * @ingroup Datefield
  */
-EAPI void
-elm_datefield_date_set(Evas_Object *obj, int year, int month, int day, int hour, int min)
+EAPI char *
+elm_datefield_format_get(const Evas_Object *obj)
 {
-       ELM_CHECK_WIDTYPE(obj, widtype);
-       Widget_Data *wd = elm_widget_data_get(obj);
-       
-       if (!wd) return;
-
-       wd->year = _check_date_boundary(obj, year, DATE_YEAR);
-       wd->month = _check_date_boundary(obj, month, DATE_MON);
-       wd->day = _check_date_boundary(obj, day, DATE_DAY);
-       
-       if (hour > HOUR_24H_MAXIMUM) wd->hour = HOUR_24H_MAXIMUM;
-       else if (hour < 0) wd->hour = 0;
-       else wd->hour = hour;
-
-       if (min > MIN_MAXIMUM) wd->min = MIN_MAXIMUM;
-       else if (min < 0) wd->min = 0;
-       else wd->min = min;
-
-       _date_update(obj);
+   ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd ) return NULL;
+   return strdup(wd->format);
 }
 
 /**
- * Get selected date of the datefield
+ * @brief Set the selected value of the datefield
+ * Year : years since 1900. Negative value represents year below 1900. (
+ * year value -30 represents 1870). Year default range is from 70 to 137.
+ * Month value range is from 0 to 11
+ * Date value range is from 1 to 31 according to the month value.
+ * The hour value should be set according to 24hr format (0~23)
+ * Minute value range is from 0 to 59.
+ * AM/PM. Value 0 for AM and 1 for PM.
+ * If the value is beyond the range,
+ * a) Value is less than Min range value, then Min range value is set.
+ * b) Greater than Max range value, then Max Range value is set.
+ * Both Min and Max range of individual fields are bound to the current context.
  *
- * @param obj The datefield object
- * @param year The pointer to the variable get the selected year
- * @param month The pointer to the variable get the selected month
- * @param day The pointer to the variable get the selected day
- * @param hour The pointer to the variable get the selected hour (24hour mode)
- * @param hour The pointer to the variable get the selected min
+ * @param[in] obj The datefield object
+ * @param[in] itemtype The field type of datefield. ELM_DATEFIELD_YEAR etc.
+ * @param[in] value The data to be set. ex. year/month/date/hour/minute/ampm
  *
  * @ingroup Datefield
  */
 EAPI void
-elm_datefield_date_get(const Evas_Object *obj, int *year, int *month, int *day, int *hour, int *min)
+elm_datefield_item_value_set(Evas_Object *obj, Elm_Datefield_ItemType itemtype,
+                             int value)
 {
-       ELM_CHECK_WIDTYPE(obj, widtype);
-       Widget_Data *wd = elm_widget_data_get(obj);
-       
-       if (!wd) return;
-       
-       if (year)
-               *year = wd->year;
-       if (month)
-               *month = wd->month;
-       if (day)
-               *day = wd->day;
-       if (hour)
-               *hour = wd->hour;
-       if (min)
-               *min = wd->min;
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd;
+   Datefield_Item *it;
+
+   wd = elm_widget_data_get(obj);
+   if (!wd || itemtype > ELM_DATEFIELD_AMPM ) return;
+
+   it = wd->item_list + itemtype;
+   _field_value_set(obj, it->type, value, EINA_FALSE);
 }
 
 /**
- * Set upper boundary of the datefield
+ * @brief Get Current value date of the datefield
+ * Year : years since 1900. Negative value represents year below 1900. (
+ * year value -30 represents 1870). Year default range is from 70 to 137.
+ * Month value range is from 0 to 11
+ * Date value range is from 1 to 31 according to the month value.
+ * The hour value should be set according to 24hr format (0~23)
+ * Minute value range is from 0 to 59.
+ * AM/PM. Value 0 for AM and 1 for PM.
+ * If the value is beyond the range,
+ * a) Value is less than Min range value, then Min range value is set.
+ * b) Greater than Max range value, then Max Range value is set.
+ * Both Min and Max range of individual fields are bound to the current context.
  *
- * @param obj The datefield object
- * @param year The year to set
- * @param month The month to set
- * @param day The day to set
- * @return TRUE/FALSE
+ * @param[in] obj The datefield object
+ * @param[in] itemtype The field type of datefield. ELM_DATEFIELD_YEAR etc.
+ * @return int The value of the field.
  *
  * @ingroup Datefield
  */
-EAPI Eina_Bool
-elm_datefield_date_max_set(Evas_Object *obj, int year, int month, int day)
+EAPI int
+elm_datefield_item_value_get(const Evas_Object *obj, Elm_Datefield_ItemType
+                             itemtype)
 {
-       ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
-       Widget_Data *wd = elm_widget_data_get(obj);
-       int day_of_month;
-       Eina_Bool update = EINA_FALSE;
-       
-       if (!wd) return EINA_FALSE;
-       if (month < 1 || month > MONTH_MAXIMUM) return EINA_FALSE;
-       day_of_month = _maximum_day_get(year, month);
-       if (day < 1 || day > day_of_month) return EINA_FALSE;
-
-       wd->y_max = year;
-       wd->m_max = month;
-       wd->d_max = day;
-
-       if (wd->year > wd->y_max)
-       {
-               wd->year = wd->y_max;
-               update = EINA_TRUE;
-       }
-       if (wd->year == wd->y_max && wd->month > wd->m_max)
-       {
-               wd->month = wd->m_max;
-               update = EINA_TRUE;
-       }
-       if (wd->year == wd->y_max && wd->month == wd->m_max && wd->day > wd->d_max)
-       {
-               wd->day = wd->d_max;
-               update = EINA_TRUE;
-       }
-
-       if (update) _date_update(obj);
-       return EINA_TRUE;
+   ELM_CHECK_WIDTYPE(obj, widtype) -1;
+   Widget_Data *wd;
+
+   wd = elm_widget_data_get(obj);
+   if (!wd || itemtype > ELM_DATEFIELD_AMPM ) return -1;
+
+   return (*(wd->item_list + itemtype)->value);
 }
 
+
 /**
- * Get upper boundary of the datefield
+ * @brief Enable/Disable an item of the datefield
  *
- * @param obj The datefield object
- * @param year The pointer to the variable get the maximum year
- * @param month The pointer to the variable get the maximum month
- * @param day The pointer to the variable get the maximum day
+ * @param[in] obj The datefield object
+ * @param[in] itemtype The field type of datefield. ELM_DATEFIELD_YEAR etc.
+ * @param[in] enable Item is Enabled or disabled.
  *
  * @ingroup Datefield
  */
+
 EAPI void
-elm_datefield_date_max_get(const Evas_Object *obj, int *year, int *month, int *day)
+elm_datefield_item_enabled_set(Evas_Object *obj, Elm_Datefield_ItemType itemtype,
+                              Eina_Bool enable)
 {
-       ELM_CHECK_WIDTYPE(obj, widtype);
-       Widget_Data *wd = elm_widget_data_get(obj);
-       
-       if (!wd) return;
-       
-       if (year)
-               *year = wd->y_max;
-       if (month)
-               *month = wd->m_max;
-       if (day)
-               *day = wd->d_max;
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd;
+   Datefield_Item *it;
+
+   wd = elm_widget_data_get(obj);
+   if (!wd || itemtype > ELM_DATEFIELD_AMPM ) return;
+
+   it = wd->item_list + itemtype;
+   if ( it->enabled == enable ) return;
+   it->enabled = enable;
+   _format_reload(obj);
 }
 
 /**
- * Set lower boundary of the datefield
+ * @brief Get whether the item is Enabled/Disabled
  *
- * @param obj The datefield object
- * @param year The year to set
- * @param month The month to set
- * @param day The day to set
- * @return TRUE/FALSE
+ * @param[in] obj The datefield object
+ * @param[in] itemtype The field type of datefield. ELM_DATEFIELD_YEAR etc.
+ * @return EINA_TRUE = Item is Enabled or EINA_FALSE = disabled.
  *
- * @ingroup Datepicker
+ * @ingroup Datefield
  */
+
 EAPI Eina_Bool
-elm_datefield_date_min_set(Evas_Object *obj, int year, int month, int day)
+elm_datefield_item_enabled_get(const Evas_Object *obj, Elm_Datefield_ItemType itemtype)
 {
-       ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
-       Widget_Data *wd = elm_widget_data_get(obj);
-       int day_of_month;
-       Eina_Bool update = EINA_FALSE;
-       
-       if (!wd) return EINA_FALSE;
-       if (month < 1 || month > MONTH_MAXIMUM) return EINA_FALSE;
-       day_of_month = _maximum_day_get(year, month);
-       if (day < 1 || day > day_of_month) return EINA_FALSE;
-
-       wd->y_min = year;
-       wd->m_min = month;
-       wd->d_min = day;
-
-       if (wd->year < wd->y_min)
-       {
-               wd->year = wd->y_min;
-               update = EINA_TRUE;
-       }
-       if (wd->year == wd->y_min && wd->month < wd->m_min)
-       {
-               wd->month = wd->m_min;
-               update = EINA_TRUE;
-       }
-       if (wd->year == wd->y_min && wd->month == wd->m_min && wd->day < wd->d_min)
-       {
-               wd->day = wd->d_min;
-               update = EINA_TRUE;
-       }
-
-       if (update) _date_update(obj);
-       return EINA_TRUE;
+   ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
+   Widget_Data *wd;
+   Datefield_Item *it;
+
+   wd = elm_widget_data_get(obj);
+   if (!wd || itemtype > ELM_DATEFIELD_AMPM ) return EINA_FALSE;
+
+   it = wd->item_list + itemtype;
+   return it->enabled;
 }
 
 /**
- * Get lower boundary of the datefield
- *
- * @param obj The datefield object
- * @param year The pointer to the variable get the maximum year
- * @param month The pointer to the variable get the maximum month
- * @param day The pointer to the variable get the maximum day
+ * @brief Get lower boundary of the datefield
+ * Year : years since 1900. Negative value represents year below 1900. (
+ * year value -30 represents 1870). Year default range is from 70 to 137.
+ * Month default value range is from 0 to 11
+ * Date default value range is from 1 to 31 according to the month value.
+ * Hour default value will be in terms of 24 hr format (0~23)
+ * Minute default value range will be from 0 to 59.
+ * AM/PM. Value 0 for AM and 1 for PM.
+ * If the value is beyond the range,
+ * a) Value is less than Min range value, then Min range value is set.
+ * b) Greater than Max range value, then Max Range value is set.
+ * Both Min and Max range of individual fields are bound to the current context.
  *
+ * @param[in] obj The datefield object
+ * @param[in] itemtype The field type of datefield. ELM_DATEFIELD_YEAR etc.
+ * @param[in] value The minimum value of the field that is to be set.
  * @ingroup Datefield
  */
 EAPI void
-elm_datefield_date_min_get(const Evas_Object *obj, int *year, int *month, int *day)
+elm_datefield_item_min_set(Evas_Object *obj, Elm_Datefield_ItemType itemtype,
+                           int value,  Eina_Bool abs_limit)
 {
-       ELM_CHECK_WIDTYPE(obj, widtype);
-       Widget_Data *wd = elm_widget_data_get(obj);
-       
-       if (!wd) return;
-       
-       if (year)
-               *year = wd->y_min;
-       if (month)
-               *month = wd->m_min;
-       if (day)
-               *day = wd->d_min;
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd;
+   Datefield_Item *it;
+
+   wd = elm_widget_data_get(obj);
+   if (!wd || itemtype > ELM_DATEFIELD_AMPM ) return;
+
+   it = wd->item_list + itemtype;
+   if ( it->type != ELM_DATEFIELD_YEAR && value < it->default_min )
+      it->min = it->default_min;
+   else
+      it->min = value;
+
+   if(it->min > it->max ) it->max = it->min;
+   it->abs_min = abs_limit;
+   _field_value_set(obj, it->type, *(it->value), EINA_FALSE);  // Trigger the validation
 }
 
 /**
- * Set if the datefield show hours in military or am/pm mode
+ * @brief Get lower boundary of the datefield
+ * Year : years since 1900. Negative value represents year below 1900. (
+ * year value -30 represents 1870). Year default range is from 70 to 137.
+ * Year default range is from 70 to 137.
+ * Month default value range is from 0 to 11
+ * Date default value range is from 1 to 31 according to the month value.
+ * Hour default value will be in terms of 24 hr format (0~23)
+ * Minute default value range will be from 0 to 59.
+ * AM/PM. Value 0 for AM and 1 for PM.
+ * If the value is beyond the range,
+ * a) Value is less than Min range value, then Min range value is set.
+ * b) Greater than Max range value, then Max Range value is set.
+ * Both Min and Max range of individual fields are bound to the current context.
  *
- * @param obj The datefield object
- * @param mode option for the hours mode. If true, it is shown as 12h mode, if false, it is shown as 24h mode. Default value is true 
+ * @param[in] obj The datefield object
+ * @param[in] itemtype The field type of datefield. ELM_DATEFIELD_YEAR etc.
+ * @return int The minimum value of the field.
  *
- * @ingroup Datefield
+ * @ingroup Datepicker
  */
-EAPI void
-elm_datefield_time_mode_set(Evas_Object *obj, Eina_Bool mode)
+EAPI int
+elm_datefield_item_min_get(const Evas_Object *obj, Elm_Datefield_ItemType
+                           itemtype)
 {
-       ELM_CHECK_WIDTYPE(obj, widtype);
-       Widget_Data *wd = elm_widget_data_get(obj);
-       
-       if (!wd) return;
-
-       if (wd->time_mode != mode) 
-       {
-               char str[YEAR_MAX_LENGTH+1];
-               
-               wd->time_mode = mode;
-               if (!wd->time_mode) edje_object_signal_emit(wd->base, "elm,state,mode,24h", "elm");
-               else edje_object_signal_emit(wd->base, "elm,state,mode,12h", "elm");
-
-               if (!wd->time_mode) //24 mode
-                       sprintf(str, "%d", wd->hour);
-               else
-               {
-                       if (wd->hour >= HOUR_12H_MAXIMUM)
-                       {
-                               wd->pm = EINA_TRUE;
-                               edje_object_part_text_set(wd->base, "elm.text.ampm", "PM");
-                       }
-                       else
-                       {
-                               wd->pm = EINA_FALSE;
-                               edje_object_part_text_set(wd->base, "elm.text.ampm", "AM");             
-                       }
-
-                       if (wd->hour > HOUR_12H_MAXIMUM)
-                               sprintf(str, "%d", wd->hour - HOUR_12H_MAXIMUM);
-                       else if (wd->hour == 0)
-                               sprintf(str, "%d", HOUR_12H_MAXIMUM);
-                       else
-                               sprintf(str, "%d", wd->hour);
-               }
-               elm_entry_entry_set(wd->time[TIME_HOUR], str);
-       }
+   ELM_CHECK_WIDTYPE(obj, widtype) -1;
+   Widget_Data *wd;
+
+   wd = elm_widget_data_get(obj);
+   if (!wd || itemtype > ELM_DATEFIELD_AMPM ) return -1;
+
+   return ((wd->item_list + itemtype)->min);
 }
 
 /**
- * get time mode of the datefield
+ * @brief Get whether the minimum value of the item is absolute or not
  *
- * @param obj The datefield object
- * @return time mode (EINA_TRUE: 12hour mode / EINA_FALSE: 24hour mode) 
+ * @param[in] obj The datefield object
+ * @param[in] itemtype The field type of datefield. ELM_DATEFIELD_YEAR etc.
+ * @return EINA_TRUE = Minimim is absolute or EINA_FALSE = Minimum is relative.
  *
  * @ingroup Datefield
  */
+
 EAPI Eina_Bool
-elm_datefield_time_mode_get(const Evas_Object *obj)
+elm_datefield_item_min_is_absolute(const Evas_Object *obj,
+                                   Elm_Datefield_ItemType itemtype)
 {
-       ELM_CHECK_WIDTYPE(obj, widtype);
-       Widget_Data *wd = elm_widget_data_get(obj);
-       
-       if (!wd) return EINA_FALSE;
+   ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
+   Widget_Data *wd;
+
+   wd = elm_widget_data_get(obj);
+   if (!wd || itemtype > ELM_DATEFIELD_AMPM ) return EINA_FALSE;
 
-       return wd->time_mode;
+   return ((wd->item_list + itemtype)->abs_min);
 }
 
 /**
- * Set date format of datefield
+ * @brief Set upper boundary of the datefield
+ * Year : years since 1900. Negative value represents year below 1900. (
+ * year value -30 represents 1870). Year default range is from 70 to 137.
+ * Month:default value range is from 0 to 11
+ * Date : default value range is from 1 to 31 according to the month value.
+ * Hour : default value will be in terms of 24 hr format (0~23)
+ * Minute  : default value range will be from 0 to 59.
+ * AM/PM: Value 0 for AM and 1 for PM.
+ * If the value is beyond the contextual range,
+ * a) Value is less than Min range value, then Min range value is set.
+ * b) Greater than Max range value, then Max Range value is set.
+ * Both Min and Max range of individual fields are bound to the current context.
  *
- * @param obj The datefield object
- * @param fmt The date format, ex) yymmdd. Default value is mmddyy.
+ * @param[in] obj The datefield object
+ * @param[in] itemtype The field type of datefield. ELM_DATEFIELD_YEAR etc.
+ * @param[in] value The maximum field value that is to be set.
  *
  * @ingroup Datefield
  */
 EAPI void
-elm_datefield_date_format_set(Evas_Object *obj, const char *fmt)
+elm_datefield_item_max_set(Evas_Object *obj, Elm_Datefield_ItemType itemtype,
+                           int value, Eina_Bool abs_limit )
 {
-       ELM_CHECK_WIDTYPE(obj, widtype);
-       Widget_Data *wd = elm_widget_data_get(obj);
-       char sig[32] = "elm,state,format,";
-       int i = 0, j;
-
-       if (!wd || !fmt) return;
-
-       j = strlen(sig);
-       while (j < 32) {
-               sig[j++] = tolower(fmt[i++]);
-       }
-
-       edje_object_signal_emit(wd->base, sig, "elm");
-
-       if (strstr(sig, "yymmdd")) wd->date_format = DATE_FORMAT_YYMMDD;
-       else if (strstr(sig, "yyddmm")) wd->date_format = DATE_FORMAT_YYDDMM;
-       else if (strstr(sig, "mmyydd")) wd->date_format = DATE_FORMAT_MMYYDD;
-       else if (strstr(sig, "mmddyy")) wd->date_format = DATE_FORMAT_MMDDYY;
-       else if (strstr(sig, "ddyymm")) wd->date_format = DATE_FORMAT_DDYYMM;
-       else if (strstr(sig, "ddmmyy")) wd->date_format = DATE_FORMAT_DDMMYY;
-}
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd;
+   Datefield_Item *it;
 
-/**
- * get date format of the datefield
- *
- * @param obj The datefield object
- * @return date format string. ex) yymmdd
- *
- * @ingroup Datefield
- */
-EAPI const char *
-elm_datefield_date_format_get(const Evas_Object *obj)
-{
-       ELM_CHECK_WIDTYPE(obj, widtype);
-       Widget_Data *wd = elm_widget_data_get(obj);
-
-       switch (wd->date_format)
-       {
-               case DATE_FORMAT_YYMMDD: return "yymmdd";
-               case DATE_FORMAT_YYDDMM: return "yyddmm";
-               case DATE_FORMAT_MMYYDD: return "mmyydd";
-               case DATE_FORMAT_MMDDYY: return "mmddyy";
-               case DATE_FORMAT_DDYYMM: return "ddyymm";
-               case DATE_FORMAT_DDMMYY: return "ddmmyy";
-       }
+   wd = elm_widget_data_get(obj);
+   if (!wd || itemtype > ELM_DATEFIELD_AMPM ) return;
+
+   it = wd->item_list + itemtype;
+   if (it->type != ELM_DATEFIELD_YEAR && value > it->default_max )
+      it->max = it->default_max;
+   else
+      it->max = value;
+
+   if(it->max < it->min) it->min = it->max;
+   it->abs_max = abs_limit;
+
+   _field_value_set(obj, it->type, *(it->value), EINA_FALSE);  // Trigger the validation
 }
 
 /**
- * Add a callback function for input panel state
+ * @brief Get upper boundary of the datefield
+ * Year : years since 1900. Negative value represents year below 1900. (
+ * year value -30 represents 1870). Year default range is from 70 to 137.
+ * Month default value range is from 0 to 11
+ * Date default value range is from 1 to 31 according to the month value.
+ * Hour default value will be in terms of 24 hr format (0~23)
+ * Minute default value range will be from 0 to 59.
+ * AM/PM. Value 0 for AM and 1 for PM.
+ * If the value is beyond the range,
+ * a) Value is less than Min range value, then Min range value is set.
+ * b) Greater than Max range value, then Max Range value is set.
+ * Both Min and Max range of individual fields are bound to the current context.
  *
- * @param obj The datefield object
- * @param func The function to be called when the event is triggered (value will be the Ecore_IMF_Input_Panel_State)
- * @param data The data pointer to be passed to @p func 
+ * @param[in] obj The datefield object
+ * @param[in] itemtype The field type of datefield. ELM_DATEFIELD_YEAR etc.
+ * @return int The maximum value of the field.
  *
  * @ingroup Datefield
  */
-EAPI void 
-elm_datefield_input_panel_state_callback_add(Evas_Object *obj, void (*pEventCallbackFunc) (void *data, Evas_Object *obj, int value), void *data)
+EAPI int
+elm_datefield_item_max_get(const Evas_Object *obj, Elm_Datefield_ItemType
+                           itemtype)
 {
-       ELM_CHECK_WIDTYPE(obj, widtype);
-       Widget_Data *wd = elm_widget_data_get(obj);
-       int i;
-
-       if (!wd) return;
-
-       if (wd->func && (wd->func != pEventCallbackFunc))
-               elm_datefield_input_panel_state_callback_del(obj, wd->func);    
+   ELM_CHECK_WIDTYPE(obj, widtype) -1;
+   Widget_Data *wd;
 
-       if (wd->func != pEventCallbackFunc)
-       {
-               wd->func = pEventCallbackFunc;
-               wd->func_data = data;
+   wd = elm_widget_data_get(obj);
+   if (!wd || itemtype > ELM_DATEFIELD_AMPM ) return -1;
 
-               for (i = 0; i < DATE_MAX; i++)
-                       ecore_imf_context_input_panel_event_callback_add(
-                               elm_entry_imf_context_get(wd->date[i]), ECORE_IMF_INPUT_PANEL_STATE_EVENT, _input_panel_event_callback, obj);
-
-               for (i = 0; i < TIME_MAX; i++)
-                       ecore_imf_context_input_panel_event_callback_add(
-                               elm_entry_imf_context_get(wd->time[i]), ECORE_IMF_INPUT_PANEL_STATE_EVENT, _input_panel_event_callback, obj);
-       }               
+   return ((wd->item_list + itemtype)->max);
 }
 
 /**
- * Delete a callback function for input panel state
+ * @brief Get whether the max value of the item is absolute or not
  *
- * @param obj The datefield object
- * @param func The function to be called when the event is triggered
+ * @param[in] obj The datefield object
+ * @param[in] itemtype The field type of datefield. ELM_DATEFIELD_YEAR etc.
+ * @return EINA_TRUE = Max is absolute or EINA_FALSE = Max is relative.
  *
  * @ingroup Datefield
  */
-EAPI void 
-elm_datefield_input_panel_state_callback_del(Evas_Object *obj, void (*pEventCallbackFunc) (void *data, Evas_Object *obj, int value))
-{
-       ELM_CHECK_WIDTYPE(obj, widtype);
-       Widget_Data *wd = elm_widget_data_get(obj);
-       int i;
-
-       if (!wd) return;
 
-       if (wd->func && wd->func == pEventCallbackFunc) 
-       {
-               for (i = 0; i < DATE_MAX; i++)
-                       ecore_imf_context_input_panel_event_callback_del(
-                               elm_entry_imf_context_get(wd->date[i]), ECORE_IMF_INPUT_PANEL_STATE_EVENT, _input_panel_event_callback);
+EAPI Eina_Bool
+elm_datefield_item_max_is_absolute(const Evas_Object *obj,
+                                   Elm_Datefield_ItemType itemtype)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
+   Widget_Data *wd;
 
-               for (i = 0; i < TIME_MAX; i++)
-                       ecore_imf_context_input_panel_event_callback_del(
-                               elm_entry_imf_context_get(wd->time[i]), ECORE_IMF_INPUT_PANEL_STATE_EVENT, _input_panel_event_callback);
+   wd = elm_widget_data_get(obj);
+   if (!wd || itemtype > ELM_DATEFIELD_AMPM ) return EINA_FALSE;
 
-               wd->func = NULL;
-               wd->func_data = NULL;
-       }
+   return ((wd->item_list + itemtype)->abs_max);
 }