if (ITEM_IS_OUTSIDE_VISIBLE(item_id))
{
- int new_id = efl_ui_position_manager_entity_relative_item(collection_pd->pos_man, efl_ui_item_index_get(item), direction);
- if (new_id == -1)
+ unsigned int new_id;
+
+ if (!efl_ui_position_manager_entity_relative_item(collection_pd->pos_man, efl_ui_item_index_get(item), direction, &new_id))
{
new_item = NULL;
}
if (ITEM_IS_OUTSIDE_VISIBLE(item_id))
{
- int new_id;
+ unsigned int new_id;
- new_id = efl_ui_position_manager_entity_relative_item(cpd->manager,
- item_id,
- direction);
- if (new_id < 0)
+ if (!efl_ui_position_manager_entity_relative_item(cpd->manager,
+ item_id,
+ direction,
+ &new_id))
{
new_item = NULL;
}
params {
current_id : uint; [[The id where the direction is oriented at]]
direction : Efl.Ui.Focus.Direction; [[The direction where the new id is]]
+ @out index: uint; [[The relative item index after the translation has been applied.]]
}
- return : int; [[The id of the item in that direction, or -1 if there is no item in that direction]]
+ return : bool; [[$true if there is a next item, $false otherwise.]]
}
}
events {
return geom;
}
-EOLIAN static int
-_efl_ui_position_manager_grid_efl_ui_position_manager_entity_relative_item(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_Grid_Data *pd, unsigned int current_id, Efl_Ui_Focus_Direction direction)
+EOLIAN static Eina_Bool
+_efl_ui_position_manager_grid_efl_ui_position_manager_entity_relative_item(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_Grid_Data *pd, unsigned int current_id, Efl_Ui_Focus_Direction direction, unsigned int *index)
{
- int new_id = current_id;
switch(direction)
{
case EFL_UI_FOCUS_DIRECTION_RIGHT:
case EFL_UI_FOCUS_DIRECTION_NEXT:
- new_id += 1;
- break;
+ if (current_id + 1 >= pd->size) return EINA_FALSE;
+ current_id += 1;
+ break;
case EFL_UI_FOCUS_DIRECTION_LEFT:
case EFL_UI_FOCUS_DIRECTION_PREVIOUS:
- new_id -= 1;
- break;
+ if (current_id == 0) return EINA_FALSE;
+ current_id -= 1;
+ break;
case EFL_UI_FOCUS_DIRECTION_UP:
- //FIXME
- break;
+ //FIXME
+ break;
case EFL_UI_FOCUS_DIRECTION_DOWN:
- //FIXME
- break;
+ //FIXME
+ break;
default:
- new_id = -1;
- ERR("Uncaught case!");
- break;
+ ERR("Uncaught case!");
+ return EINA_FALSE;
}
- if (new_id < 0 || new_id > (int)pd->size)
- return -1;
- else
- return new_id;
+
+ if (index) *index = current_id;
+ return EINA_TRUE;
}
EOLIAN static int
efl_invalidate(efl_super(obj, MY_CLASS));
}
-EOLIAN static int
-_efl_ui_position_manager_list_efl_ui_position_manager_entity_relative_item(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd, unsigned int current_id, Efl_Ui_Focus_Direction direction)
+EOLIAN static Eina_Bool
+_efl_ui_position_manager_list_efl_ui_position_manager_entity_relative_item(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd, unsigned int current_id, Efl_Ui_Focus_Direction direction, unsigned int *index)
{
- int new_id = current_id;
switch(direction)
{
case EFL_UI_FOCUS_DIRECTION_RIGHT:
case EFL_UI_FOCUS_DIRECTION_NEXT:
case EFL_UI_FOCUS_DIRECTION_DOWN:
- new_id += 1;
- break;
+ if (current_id + 1 >= pd->size) return EINA_FALSE;
+ current_id += 1;
+ break;
case EFL_UI_FOCUS_DIRECTION_LEFT:
case EFL_UI_FOCUS_DIRECTION_PREVIOUS:
case EFL_UI_FOCUS_DIRECTION_UP:
- new_id -= 1;
- break;
+ if (current_id == 0) return EINA_FALSE;
+ current_id -= 1;
+ break;
default:
- ERR("Uncaught case!");
- new_id = -1;
- break;
+ ERR("Uncaught case!");
+ return EINA_FALSE;
}
- if (new_id < 0 || new_id > (int)pd->size)
- return -1;
- else
- return new_id;
+
+ if (index) *index = current_id;
+ return EINA_TRUE;
}
EOLIAN static int