From: sumanth Date: Tue, 19 Mar 2013 10:51:07 +0000 (+0530) Subject: [elm_datetime.c] Separate edj signals are added for the enable/disable of field separ... X-Git-Tag: 2.1b_release~73 X-Git-Url: http://review.tizen.org/git/?p=framework%2Fuifw%2Felementary.git;a=commitdiff_plain;h=a51238dab97a6612bc56f0240f9263c8538d4d5a;hp=7c445c95f28b5b8849a21328c51d3805ec42ac9d [elm_datetime.c] Separate edj signals are added for the enable/disable of field separators. [datetime ctxpopup module] Different label styles can be set for individual datetime fields. Change-Id: I0140df84e07b046480027dcfbc2a1cde4123c6d6 --- diff --git a/src/lib/elm_datetime.c b/src/lib/elm_datetime.c index 4c88c83..ba01942 100644 --- a/src/lib/elm_datetime.c +++ b/src/lib/elm_datetime.c @@ -26,6 +26,8 @@ EAPI const char ELM_DATETIME_SMART_NAME[] = "elm_datetime"; #define EDC_PART_SEPARATOR_STR "separator%d" #define EDC_PART_FIELD_ENABLE_SIG_STR "field%d,enable" #define EDC_PART_FIELD_DISABLE_SIG_STR "field%d,disable" +#define EDC_PART_FIELD_SEPARATOR_ENABLE_SIG_STR "field%d,separator,enable" +#define EDC_PART_FIELD_SEPARATOR_DISABLE_SIG_STR "field%d,separator,disable" /* struct tm does not define the fields in the order year, month, * date, hour, minute. values are reassigned to an array for easy @@ -50,7 +52,7 @@ static Format_Map mapping[ELM_DATETIME_TYPE_COUNT] = { }; static const char *multifield_formats = "cxXrRTDF"; -static const char *ignore_separators = "()"; +static const char *ignore_separators = "() "; static Datetime_Mod_Api *dt_mod = NULL; static const char SIG_CHANGED[] = "changed"; @@ -341,16 +343,31 @@ _reload_format(Evas_Object *obj) snprintf(buf, sizeof(buf), EDC_PART_FIELD_ENABLE_SIG_STR, field->location); elm_layout_signal_emit(obj, buf, "elm"); + + if (field->separator && strcmp(field->separator, "")) + { + snprintf(buf, sizeof(buf), EDC_PART_FIELD_SEPARATOR_ENABLE_SIG_STR, + field->location); + elm_layout_signal_emit(obj, buf, "elm"); + snprintf(buf, sizeof(buf), EDC_PART_SEPARATOR_STR, field->location); + elm_layout_text_set(obj, buf, field->separator); + } + else + { + snprintf(buf, sizeof(buf), EDC_PART_FIELD_SEPARATOR_DISABLE_SIG_STR, + field->location); + elm_layout_signal_emit(obj, buf, "elm"); + } } else { snprintf(buf, sizeof(buf), EDC_PART_FIELD_DISABLE_SIG_STR, field->location); elm_layout_signal_emit(obj, buf, "elm"); + snprintf(buf, sizeof(buf), EDC_PART_FIELD_SEPARATOR_DISABLE_SIG_STR, + field->location); + elm_layout_signal_emit(obj, buf, "elm"); } - snprintf - (buf, sizeof(buf), EDC_PART_SEPARATOR_STR, (field->location + 1)); - elm_layout_text_set(obj, buf, field->separator); } edje_object_message_signal_process(ELM_WIDGET_DATA(sd)->resize_obj); @@ -492,17 +509,31 @@ _elm_datetime_smart_theme(Evas_Object *obj) field->location); elm_layout_signal_emit(obj, buf, "elm"); - snprintf - (buf, sizeof(buf), EDC_PART_SEPARATOR_STR, (field->location + 1)); - elm_layout_text_set(obj, buf, field->separator); - dt_mod->field_value_display(sd->mod_data, field->item_obj); + + if (field->separator && strcmp(field->separator, "")) + { + snprintf(buf, sizeof(buf), EDC_PART_FIELD_SEPARATOR_ENABLE_SIG_STR, + field->location); + elm_layout_signal_emit(obj, buf, "elm"); + snprintf(buf, sizeof(buf), EDC_PART_SEPARATOR_STR, field->location); + elm_layout_text_set(obj, buf, field->separator); + } + else + { + snprintf(buf, sizeof(buf), EDC_PART_FIELD_SEPARATOR_DISABLE_SIG_STR, + field->location); + elm_layout_signal_emit(obj, buf, "elm"); + } } else { snprintf(buf, sizeof(buf), EDC_PART_FIELD_DISABLE_SIG_STR, field->location); elm_layout_signal_emit(obj, buf, "elm"); + snprintf(buf, sizeof(buf), EDC_PART_FIELD_SEPARATOR_DISABLE_SIG_STR, + field->location); + elm_layout_signal_emit(obj, buf, "elm"); } } diff --git a/src/modules/datetime_input_ctxpopup/datetime_input_ctxpopup.c b/src/modules/datetime_input_ctxpopup/datetime_input_ctxpopup.c index d5474c5..2de764f 100644 --- a/src/modules/datetime_input_ctxpopup/datetime_input_ctxpopup.c +++ b/src/modules/datetime_input_ctxpopup/datetime_input_ctxpopup.c @@ -9,6 +9,9 @@ #define DISKSELECTOR_MIN_ITEMS 4 #define BUFF_SIZE 1024 +static const char *field_styles[] = { + "year", "month", "date", "hour", "minute", "ampm" }; + typedef struct _Ctxpopup_Module_Data Ctxpopup_Module_Data; typedef struct _DiskItem_Data DiskItem_Data; static void _field_clicked_cb(void *data, Evas_Object *obj); @@ -184,7 +187,7 @@ _field_clicked_cb(void *data, Evas_Object *obj) const char *fmt; int idx, min, max, val; unsigned int display_item_num, text_len = 0; - Evas_Coord x = 0, y = 0, w = 0, h = 0, width; + Evas_Coord x = 0, y = 0, w = 0, h = 0, width, w_item; ctx_mod = (Ctxpopup_Module_Data *)data; if (!ctx_mod || !ctx_mod->ctxpopup) return; @@ -234,9 +237,14 @@ _field_clicked_cb(void *data, Evas_Object *obj) elm_diskselector_side_text_max_length_set(diskselector, text_len); evas_object_geometry_get(obj, &x, &y, &w, &h); + if (edje_object_part_exists(elm_layout_edje_get(obj), "elm.text")) + edje_object_part_geometry_get(elm_layout_edje_get(obj), "elm.text", NULL, NULL, &w_item, NULL); + else + w_item = w; + evas_object_geometry_get(elm_widget_top_get(ctx_mod->mod_data.base), NULL, NULL, &width, NULL); evas_object_size_hint_min_set(ctx_mod->ctxpopup, width, -1); - display_item_num = width / (w + elm_config_finger_size_get()); + display_item_num = width / (w_item + elm_config_finger_size_get()); // always display even number of items to avoid autoselection if (display_item_num % 2) display_item_num -= 1; if (display_item_num < DISKSELECTOR_MIN_ITEMS) @@ -438,6 +446,7 @@ field_create(Elm_Datetime_Module_Data *module_data, Elm_Datetime_Field_Type fie { Ctxpopup_Module_Data *ctx_mod; Evas_Object *field_obj; + char buf[BUFF_SIZE]; ctx_mod = (Ctxpopup_Module_Data *)module_data; if (!ctx_mod) return NULL; @@ -445,7 +454,6 @@ field_create(Elm_Datetime_Module_Data *module_data, Elm_Datetime_Field_Type fie if (field_type == ELM_DATETIME_AMPM) { field_obj = elm_button_add(ctx_mod->mod_data.base); - elm_object_style_set(field_obj, "datetime_ampm/default"); evas_object_smart_callback_add(field_obj, "clicked", _ampm_clicked_cb, ctx_mod); } else @@ -454,8 +462,9 @@ field_create(Elm_Datetime_Module_Data *module_data, Elm_Datetime_Field_Type fie evas_object_event_callback_add(field_obj, EVAS_CALLBACK_MOUSE_DOWN, _field_mouse_down_cb, ctx_mod); evas_object_event_callback_add(field_obj, EVAS_CALLBACK_MOUSE_MOVE, _field_mouse_move_cb, ctx_mod); evas_object_event_callback_add(field_obj, EVAS_CALLBACK_MOUSE_UP, _field_mouse_up_cb, ctx_mod); - elm_object_style_set(field_obj,"datetime"); } + snprintf(buf, sizeof(buf), "datetime/%s/default", field_styles[field_type]); + elm_object_style_set(field_obj, buf); evas_object_data_set(field_obj, "_field_type", (void *)field_type); // ACCESS