[elementary/entry] Add elm_entry_markup_filter_append/prepend/remove

and make elm_entry_text_filter_append/prepend/remove be deprecated. In
a filter function appended by elm_entry_text_filter_append, the type of text can
be format, text, or markup. So correct filtering is impossible. But
with elm_entry_markup_filter_append, the type is always markup.


SVN revision: 67747
This commit is contained in:
WooHyun Jung 2012-02-08 07:23:08 +00:00
parent bd6e730da3
commit fcffc57076
4 changed files with 69 additions and 23 deletions

View File

@ -366,7 +366,7 @@ test_entry_scrolled(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *ev
digits_filter_data.accepted = "0123456789";
digits_filter_data.rejected = NULL;
elm_entry_text_filter_append(en, elm_entry_filter_accept_set, &digits_filter_data);
elm_entry_markup_filter_append(en, elm_entry_filter_accept_set, &digits_filter_data);
/* No digits entry */
en = elm_entry_add(win);
@ -381,7 +381,7 @@ test_entry_scrolled(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *ev
digits_filter_data2.accepted = NULL;
digits_filter_data2.rejected = "0123456789";
elm_entry_text_filter_append(en, elm_entry_filter_accept_set, &digits_filter_data2);
elm_entry_markup_filter_append(en, elm_entry_filter_accept_set, &digits_filter_data2);
/* Size limited entry */
en = elm_entry_add(win);
@ -396,7 +396,7 @@ test_entry_scrolled(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *ev
limit_filter_data.max_char_count = 20;
limit_filter_data.max_byte_count = 0;
elm_entry_text_filter_append(en, elm_entry_filter_limit_size, &limit_filter_data);
elm_entry_markup_filter_append(en, elm_entry_filter_limit_size, &limit_filter_data);
/* Byte size limited entry */
en = elm_entry_add(win);
@ -411,7 +411,7 @@ test_entry_scrolled(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *ev
limit_filter_data2.max_char_count = 0;
limit_filter_data2.max_byte_count = 30;
elm_entry_text_filter_append(en, elm_entry_filter_limit_size, &limit_filter_data2);
elm_entry_markup_filter_append(en, elm_entry_filter_limit_size, &limit_filter_data2);
/* Single line password entry */
en_p = elm_entry_add(win);

View File

@ -163,13 +163,13 @@ elm_scrolled_entry_item_provider_remove(Evas_Object *obj, Evas_Object *(*func) (
{elm_entry_item_provider_remove(obj, func, data);}
EINA_DEPRECATED EAPI void
elm_scrolled_entry_text_filter_append(Evas_Object *obj, void (*func) (void *data, Evas_Object *entry, char **text), void *data)
{elm_entry_text_filter_append(obj, func, data);}
{elm_entry_markup_filter_append(obj, func, data);}
EINA_DEPRECATED EAPI void
elm_scrolled_entry_text_filter_prepend(Evas_Object *obj, void (*func) (void *data, Evas_Object *entry, char **text), void *data)
{elm_entry_text_filter_prepend(obj, func, data);}
{elm_entry_markup_filter_prepend(obj, func, data);}
EINA_DEPRECATED EAPI void
elm_scrolled_entry_text_filter_remove(Evas_Object *obj, void (*func) (void *data, Evas_Object *entry, char **text), void *data)
{elm_entry_text_filter_remove(obj, func, data);}
{elm_entry_markup_filter_remove(obj, func, data);}
EINA_DEPRECATED EAPI void
elm_scrolled_entry_file_set(Evas_Object *obj, const char *file, Elm_Text_Format format)
{elm_entry_file_set(obj, file, format);}

View File

@ -4211,4 +4211,49 @@ EINA_DEPRECATED EAPI Eina_Bool elm_gengrid_item_disabled_get
*/
EINA_DEPRECATED EAPI void elm_gengrid_item_del(Elm_Object_Item *it);
/**
* Append a filter function for text inserted in the entry
*
* Append the given callback to the list. This functions will be called
* whenever any text is inserted into the entry, with the text to be inserted
* as a parameter. The callback function is free to alter the text in any way
* it wants, but it must remember to free the given pointer and update it.
* If the new text is to be discarded, the function can free it and set its
* text parameter to NULL. This will also prevent any following filters from
* being called.
*
* @param obj The entry object
* @param func The function to use as text filter
* @param data User data to pass to @p func
* @deprecated use elm_entry_markup_filter_append() instead
* @ingroup Entry
*/
EINA_DEPRECATED EAPI void elm_entry_text_filter_append(Evas_Object *obj, Elm_Entry_Filter_Cb func, void *data);
/**
* Prepend a filter function for text inserted in the entry
*
* Prepend the given callback to the list. See elm_entry_text_filter_append()
* for more information
*
* @param obj The entry object
* @param func The function to use as text filter
* @param data User data to pass to @p func
* @deprecated use elm_entry_markup_filter_prepend() instead
* @ingroup Entry
*/
EINA_DEPRECATED EAPI void elm_entry_text_filter_prepend(Evas_Object *obj, Elm_Entry_Filter_Cb func, void *data);
/**
* Remove a filter from the list
*
* Removes the given callback from the filter list. See
* elm_entry_text_filter_append() for more information.
*
* @param obj The entry object
* @param func The filter function to remove
* @param data The user data passed when adding the function
* @deprecated use elm_entry_markup_filter_remove() instead
* @ingroup Entry
*/
EINA_DEPRECATED EAPI void elm_entry_text_filter_remove(Evas_Object *obj, Elm_Entry_Filter_Cb func, void *data);

View File

@ -62,7 +62,7 @@ typedef enum
* indicated by Elm_Wrap_Type.
*
* Other features include password mode, filtering of inserted text with
* elm_entry_text_filter_append() and related functions, inline "items" and
* elm_entry_markup_filter_append() and related functions, inline "items" and
* formatted markup text.
*
* @section entry-markup Formatted text
@ -310,10 +310,10 @@ struct _Elm_Entry_Anchor_Info
* This callback type is used by entry filters to modify text.
* @param data The data specified as the last param when adding the filter
* @param entry The entry object
* @param text A pointer to the location of the text being filtered. This data can be modified,
* @param text A pointer to the location of the text being filtered. The type of text is always markup. This data can be modified,
* but any additional allocations must be managed by the user.
* @see elm_entry_text_filter_append
* @see elm_entry_text_filter_prepend
* @see elm_entry_markup_filter_append
* @see elm_entry_markup_filter_prepend
*/
typedef void (*Elm_Entry_Filter_Cb)(void *data, Evas_Object *entry, char **text);
@ -418,7 +418,7 @@ EAPI const char *elm_entry_entry_get(const Evas_Object *obj);
* @param obj The entry object
* @param entry The text to be displayed
*
* @see elm_entry_text_filter_append()
* @see elm_entry_markup_filter_append()
*/
EAPI void elm_entry_entry_append(Evas_Object *obj, const char *entry);
@ -507,7 +507,7 @@ EAPI void elm_entry_calc_force(Evas_Object *obj);
* @param obj The entry object
* @param entry The text to insert
*
* @see elm_entry_text_filter_append()
* @see elm_entry_markup_filter_append()
*/
EAPI void elm_entry_entry_insert(Evas_Object *obj, const char *entry);
@ -844,12 +844,13 @@ EAPI void elm_entry_item_provider_prepend(Evas_Object *obj, Evas_O
EAPI void elm_entry_item_provider_remove(Evas_Object *obj, Evas_Object * (*func)(void *data, Evas_Object * entry, const char *item), void *data);
/**
* Append a filter function for text inserted in the entry
* Append a markup filter function for text inserted in the entry
*
* Append the given callback to the list. This functions will be called
* whenever any text is inserted into the entry, with the text to be inserted
* as a parameter. The callback function is free to alter the text in any way
* it wants, but it must remember to free the given pointer and update it.
* as a parameter. The type of given text is always markup.
* The callback function is free to alter the text in any way it wants, but
* it must remember to free the given pointer and update it.
* If the new text is to be discarded, the function can free it and set its
* text parameter to NULL. This will also prevent any following filters from
* being called.
@ -858,31 +859,31 @@ EAPI void elm_entry_item_provider_remove(Evas_Object *obj, Evas_Ob
* @param func The function to use as text filter
* @param data User data to pass to @p func
*/
EAPI void elm_entry_text_filter_append(Evas_Object *obj, Elm_Entry_Filter_Cb func, void *data);
EAPI void elm_entry_markup_filter_append(Evas_Object *obj, Elm_Entry_Filter_Cb func, void *data);
/**
* Prepend a filter function for text insdrted in the entry
* Prepend a markup filter function for text insdrted in the entry
*
* Prepend the given callback to the list. See elm_entry_text_filter_append()
* Prepend the given callback to the list. See elm_entry_markup_filter_append()
* for more information
*
* @param obj The entry object
* @param func The function to use as text filter
* @param data User data to pass to @p func
*/
EAPI void elm_entry_text_filter_prepend(Evas_Object *obj, Elm_Entry_Filter_Cb func, void *data);
EAPI void elm_entry_markup_filter_prepend(Evas_Object *obj, Elm_Entry_Filter_Cb func, void *data);
/**
* Remove a filter from the list
* Remove a markup filter from the list
*
* Removes the given callback from the filter list. See
* elm_entry_text_filter_append() for more information.
* elm_entry_markup_filter_append() for more information.
*
* @param obj The entry object
* @param func The filter function to remove
* @param data The user data passed when adding the function
*/
EAPI void elm_entry_text_filter_remove(Evas_Object *obj, Elm_Entry_Filter_Cb func, void *data);
EAPI void elm_entry_markup_filter_remove(Evas_Object *obj, Elm_Entry_Filter_Cb func, void *data);
/**
* This converts a markup (HTML-like) string into UTF-8.