elementary/focus - reviewed done!

SVN revision: 68218
This commit is contained in:
ChunEon Park 2012-02-21 12:36:54 +00:00
parent b40b6d68b8
commit ed5c8799f5
7 changed files with 75 additions and 56 deletions

View File

@ -198,7 +198,7 @@ EAPI extern Elm_Version *elm_version;
#include <elm_finger.h> //Done
#include <elm_flip.h> //Done. There are many TODOs in flip.c
#include <elm_flipselector.h> //Done + XXX in header. There are many TODOs in flipselector.c
#include <elm_focus.h>
#include <elm_focus.h> //Done + XXX in header
#include <elm_fonts.h> //Done + XXX in header
#include <elm_frame.h> //Done + XXX in header
#include <elm_gengrid.h>

View File

@ -44,16 +44,18 @@ EAPI void elm_config_reload(void);
* Flush all config settings then apply those settings to all applications
* using elementary on the current display.
* Following functions will update the config settings
* @li elm_scale_set()
* @li elm_finger_size_set()
* @li elm_profile_set()
* @li elm_font_overlay_set()
* @li elm_cache_flush_interval_set()
* @li elm_cache_flush_enabled_set()
* @li elm_font_cache_set()
* @li elm_image_cache_set()
* @li elm_edje_file_cache_set()
* @li elm_edje_collection_cache_set()
* @li elm_finger_size_set()
* @li elm_focus_highlight_enabled_set()
* @li elm_focus_highlight_animate_set()
* @li elm_font_overlay_set()
* @li elm_font_cache_set()
* @li elm_image_cache_set()
* @li elm_profile_set()
* @li elm_scale_set()
* @li elm_scroll_bounce_enabled_set()
* @li elm_scroll_bounce_friction_set()
* @li elm_scroll_page_scroll_friction_set()

View File

@ -1728,6 +1728,21 @@ EINA_DEPRECATED EAPI void elm_object_focus(Evas_Object *obj);
*/
EINA_DEPRECATED EAPI void elm_object_unfocus(Evas_Object *obj);
/**
* Give focus to near object in one direction.
*
* Give focus to near object in direction of one object.
* If none focusable object in given direction, the focus will not change.
*
* @param obj The reference object
* @param x Horizontal component of direction to focus
* @param y Vertical component of direction to focus
*
* @deprecated Support it later.
* @ingroup Focus
*/
EINA_DEPRECATED EAPI void elm_object_focus_direction_go(Evas_Object *obj, int x, int y);
/**
* @brief Set the frame label
*

View File

@ -43,9 +43,8 @@ EAPI const char *elm_engine_get(void);
*
* @param engine The rendering engine's name
*
* This sets global rendering engine that is applied to all Elementary
* applications. Note that it will take effect only to Elementary windows
* created after this is called.
* Note that it will take effect only to Elementary windows created after
* this is called.
*
* @see elm_win_add()
*/

View File

@ -36,6 +36,8 @@
* Get the enable status of the focus highlight
*
* This gets whether the highlight on focused objects is enabled or not
*
* @see elm_focus_highlight_enabled_set()
* @ingroup Focus
*/
EAPI Eina_Bool elm_focus_highlight_enabled_get(void);
@ -46,6 +48,12 @@ EAPI Eina_Bool elm_focus_highlight_enabled_get(void);
* @param enable Enable highlight if EINA_TRUE, disable otherwise
*
* Set whether to show or not the highlight on focused objects
*
* Note that it will take effect only to Elementary windows created after
* this is called.
*
* @see elm_win_add()
*
* @ingroup Focus
*/
EAPI void elm_focus_highlight_enabled_set(Eina_Bool enable);
@ -70,6 +78,11 @@ EAPI Eina_Bool elm_focus_highlight_animate_get(void);
* Set whether the focus highlight, if enabled, will animate its switch from
* one object to the next
*
* Note that it will take effect only to Elementary windows created after
* this is called.
*
* @see elm_win_add()
*
* @ingroup Focus
*/
EAPI void elm_focus_highlight_animate_set(Eina_Bool animate);
@ -107,7 +120,7 @@ EAPI Eina_Bool elm_object_focus_get(const Evas_Object *obj);
EAPI void elm_object_focus_set(Evas_Object *obj, Eina_Bool focus);
/**
* Set the ability for an Element object to be focused
* Set the ability for an Elmentary object to be focused
*
* @param obj The Elementary object to operate on
* @param enable @c EINA_TRUE if the object can be focused, @c
@ -216,22 +229,9 @@ EAPI void elm_object_focus_custom_chain_prepend(Evas_Object *obj
*
* @ingroup Focus
*/
//XXX: How about elm_object_focus_move()? focus_next() ?
EAPI void elm_object_focus_cycle(Evas_Object *obj, Elm_Focus_Direction dir);
/**
* Give focus to near object in one direction.
*
* Give focus to near object in direction of one object.
* If none focusable object in given direction, the focus will not change.
*
* @param obj The reference object
* @param x Horizontal component of direction to focus
* @param y Vertical component of direction to focus
*
* @ingroup Focus
*/
EAPI void elm_object_focus_direction_go(Evas_Object *obj, int x, int y);
/**
* Make the elementary object and its children to be unfocusable
* (or focusable).
@ -251,7 +251,9 @@ EAPI void elm_object_focus_direction_go(Evas_Object *obj, int x,
* @see elm_object_tree_unfocusable_get()
*
* @ingroup Focus
*
*/
//XXX: How about elm_object_tree_focus_allow_set()?
EAPI void elm_object_tree_unfocusable_set(Evas_Object *obj, Eina_Bool tree_unfocusable);
/**
@ -265,4 +267,5 @@ EAPI void elm_object_tree_unfocusable_set(Evas_Object *obj, Eina
*
* @ingroup Focus
*/
//XXX: How about elm_object_tree_focus_allow_get()?
EAPI Eina_Bool elm_object_tree_unfocusable_get(const Evas_Object *obj);

View File

@ -1429,16 +1429,13 @@ elm_object_focus_set(Evas_Object *obj,
Eina_Bool focus)
{
EINA_SAFETY_ON_NULL_RETURN(obj);
if (focus == elm_widget_focus_get(obj)) return;
if (focus)
{
if (elm_widget_focus_get(obj)) return;
elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
}
elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
else
{
if (!elm_widget_can_focus_get(obj)) return;
elm_widget_focused_object_clear(obj);
}
elm_widget_focused_object_clear(obj);
}
EAPI void
@ -1461,6 +1458,8 @@ elm_object_focus_allow_set(Evas_Object *obj,
{
EINA_SAFETY_ON_NULL_RETURN(obj);
elm_widget_can_focus_set(obj, enable);
/*FIXME: According to the elm_object_focus_allow_get(), child_can_focus field
of the parent should be updated. Otherwise, the checking of it's child focus allow states should not be in elm_object_focus_allow_get() */
}
EAPI Eina_Bool
@ -1498,7 +1497,6 @@ elm_object_focus_custom_chain_append(Evas_Object *obj,
Evas_Object *relative_child)
{
EINA_SAFETY_ON_NULL_RETURN(obj);
EINA_SAFETY_ON_NULL_RETURN(child);
elm_widget_focus_custom_chain_append(obj, child, relative_child);
}
@ -1508,7 +1506,6 @@ elm_object_focus_custom_chain_prepend(Evas_Object *obj,
Evas_Object *relative_child)
{
EINA_SAFETY_ON_NULL_RETURN(obj);
EINA_SAFETY_ON_NULL_RETURN(child);
elm_widget_focus_custom_chain_prepend(obj, child, relative_child);
}

View File

@ -1148,7 +1148,11 @@ elm_widget_can_focus_set(Evas_Object *obj,
Eina_Bool can_focus)
{
API_ENTRY return;
sd->can_focus = can_focus;
can_focus = !!can_focus;
if (sd->can_focus == can_focus) return;
if (can_focus)
{
evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN,
@ -1207,8 +1211,9 @@ elm_widget_tree_unfocusable_set(Evas_Object *obj,
{
API_ENTRY return;
tree_unfocusable = !!tree_unfocusable;
if (sd->tree_unfocusable == tree_unfocusable) return;
sd->tree_unfocusable = !!tree_unfocusable;
sd->tree_unfocusable = tree_unfocusable;
elm_widget_focus_tree_unfocusable_handle(obj);
}
@ -1499,7 +1504,7 @@ EAPI const Eina_List *
elm_widget_focus_custom_chain_get(const Evas_Object *obj)
{
API_ENTRY return NULL;
return (const Eina_List *)sd->focus_chain;
return (const Eina_List *) sd->focus_chain;
}
/**
@ -1547,20 +1552,16 @@ elm_widget_focus_custom_chain_append(Evas_Object *obj,
{
API_ENTRY return;
EINA_SAFETY_ON_NULL_RETURN(child);
if (!sd->focus_next_func)
return;
if (!sd->focus_next_func) return;
evas_object_event_callback_del_full(child, EVAS_CALLBACK_DEL,
_elm_object_focus_chain_del_cb, sd);
if (!relative_child)
{
sd->focus_chain = eina_list_append(sd->focus_chain, child);
return;
}
sd->focus_chain = eina_list_append_relative(sd->focus_chain, child, relative_child);
return;
sd->focus_chain = eina_list_append(sd->focus_chain, child);
else
sd->focus_chain = eina_list_append_relative(sd->focus_chain,
child, relative_child);
}
/**
@ -1585,20 +1586,17 @@ elm_widget_focus_custom_chain_prepend(Evas_Object *obj,
{
API_ENTRY return;
EINA_SAFETY_ON_NULL_RETURN(child);
if (!sd->focus_next_func)
return;
if (!sd->focus_next_func) return;
evas_object_event_callback_del_full(child, EVAS_CALLBACK_DEL,
_elm_object_focus_chain_del_cb, sd);
if (!relative_child)
{
sd->focus_chain = eina_list_prepend(sd->focus_chain, child);
return;
}
sd->focus_chain = eina_list_prepend_relative(sd->focus_chain, child, relative_child);
return;
sd->focus_chain = eina_list_prepend(sd->focus_chain, child);
else
sd->focus_chain = eina_list_prepend_relative(sd->focus_chain,
child, relative_child);
}
/**
@ -1641,6 +1639,9 @@ elm_widget_focus_cycle(Evas_Object *obj,
*
* @ingroup Widget
*/
//XXX: If x, y indicates the elements of the directional vector,
//It would be better if these values are the normalized value(float x, float y)
//or degree.
EAPI void
elm_widget_focus_direction_go(Evas_Object *obj __UNUSED__,
int x __UNUSED__,
@ -2764,6 +2765,8 @@ elm_widget_focus_tree_unfocusable_handle(Evas_Object *obj)
{
API_ENTRY return;
//FIXME: Need to check whether the object is unfocusable or not.
if (!elm_widget_parent_get(obj))
elm_widget_focused_object_clear(obj);
else