ELM_CONFIG_VAL(D, T, naviframe_prev_btn_auto_pushed, T_UCHAR);
ELM_CONFIG_VAL(D, T, popup_horizontal_align, T_DOUBLE);
ELM_CONFIG_VAL(D, T, popup_vertical_align, T_DOUBLE);
+ ELM_CONFIG_VAL(D, T, spinner_min_max_filter_enable, T_UCHAR);
#undef T
#undef D
#undef T_INT
_elm_config->indicator_service_270 = eina_stringshare_add("elm_indicator_landscape");
_elm_config->disable_external_menu = EINA_FALSE;
_elm_config->magnifier_enable = EINA_TRUE;
+ _elm_config->spinner_min_max_filter_enable = EINA_FALSE;
_elm_config->magnifier_scale = 1.5;
_elm_config->audio_mute_effect = 0;
_elm_config->audio_mute_background = 0;
if (s) _elm_config->magnifier_scale = _elm_atof(s);
s = getenv("ELM_ATSPI_MODE");
if (s) _elm_config->atspi_mode = ELM_ATSPI_MODE_ON;
+ s = getenv("ELM_SPINNER_MIN_MAX_FILTER_ENABLE");
+ if (s) _elm_config->spinner_min_max_filter_enable = !!atoi(s);
s = getenv("ELM_TRANSITION_DURATION_FACTOR");
if (s) _elm_config->transition_duration_factor = atof(s);
if ((*itr == 'd') || (*itr == 'u') || (*itr == 'i') ||
(*itr == 'o') || (*itr == 'x') || (*itr == 'X'))
return EINA_TRUE;
- else if ((*itr == 'f'))
+ else if ((*itr == 'f') || (*itr == 'F'))
return EINA_FALSE;
}
elm_entry_markup_filter_append(sd->ent, elm_entry_filter_accept_set, &digits_filter_data);
}
+char *
+_text_insert(const char *text, const char *input, int pos)
+{
+ char *result = NULL;
+ int text_len, input_len;
+
+ text_len = evas_string_char_len_get(text);
+ input_len = evas_string_char_len_get(input);
+ result = (char *)calloc(text_len + input_len + 1, sizeof(char));
+ if (!result) return NULL;
+
+ strncpy(result, text, pos);
+ strcpy(result + pos, input);
+ strcpy(result + pos + input_len, text + pos);
+
+ return result;
+}
+
+static void
+_min_max_validity_filter(void *data, Evas_Object *obj, char **text)
+{
+ const char *str, *new_str;
+ char *insert;
+ double val;
+ int max_len, len;
+
+ EINA_SAFETY_ON_NULL_RETURN(data);
+ EINA_SAFETY_ON_NULL_RETURN(obj);
+ EINA_SAFETY_ON_NULL_RETURN(text);
+
+ ELM_SPINNER_DATA_GET(data, sd);
+
+ str = elm_object_text_get(obj);
+ if (!str) return;
+
+ insert = *text;
+ new_str = _text_insert(str, insert, elm_entry_cursor_pos_get(obj));
+ if (!new_str) return;
+
+ max_len = log10(abs(sd->val_max)) + 1;
+ len = evas_string_char_len_get(new_str);
+ if (len < max_len) return;
+
+ val = strtod(new_str, NULL);
+ ELM_SAFE_FREE(new_str, free);
+
+ if ((val < sd->val_min) || (val > sd->val_max))
+ *insert = 0;
+}
+
static void
_entry_show_cb(void *data,
Evas *e EINA_UNUSED,
(ELM_ENTRY_EVENT_ACTIVATED, _entry_activated_cb, obj));
elm_layout_content_set(obj, "elm.swallow.entry", sd->ent);
_entry_filter_add(obj);
+ if (_elm_config->spinner_min_max_filter_enable)
+ elm_entry_markup_filter_append(sd->ent, _min_max_validity_filter, obj);
}
if (!sd->button_layout)
{