Index : Use orientation interface APIs instead of horizontal set/get APIs

Test Plan: elementary_test

Reviewers: singh.amitesh, jpeg, cedric, raster, Hermet

Subscribers: Hermet

Differential Revision: https://phab.enlightenment.org/D3954
This commit is contained in:
Yeshwanth Reddivari 2016-05-18 18:33:53 +09:00 committed by Hermet Park
parent 5f87f5f673
commit 26316058f0
5 changed files with 80 additions and 35 deletions

View File

@ -82,7 +82,7 @@ set_api_state(api_data *api)
break;
case INDEX_HORIZONTAL:
elm_index_horizontal_set(d->id, EINA_TRUE);
efl_orientation_set(d->id, EFL_ORIENT_HORIZONTAL);
break;
case INDEX_INDICATOR_DISABLED:
@ -564,7 +564,7 @@ test_index_horizontal(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
evas_object_show(list);
api->dt.id = id = elm_index_add(win);
elm_index_horizontal_set(id, EINA_TRUE);
efl_orientation_set(id, EFL_ORIENT_HORIZONTAL);
evas_object_size_hint_weight_set(id, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(id, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_pack(tb, id, 0, 0, 1, 1);

View File

@ -59,8 +59,14 @@ _box_custom_layout(Evas_Object *o,
void *data)
{
Elm_Index_Data *sd = data;
Eina_Bool horizontal;
_els_box_layout(o, priv, sd->horizontal, EINA_TRUE, EINA_FALSE);
if (sd->orientation == EFL_ORIENT_HORIZONTAL)
horizontal = EINA_TRUE;
else
horizontal = EINA_FALSE;
_els_box_layout(o, priv, horizontal, EINA_TRUE, EINA_FALSE);
}
static void
@ -320,7 +326,7 @@ _index_box_auto_fill(Evas_Object *obj,
edje_object_mirrored_set(VIEW(it), rtl);
o = VIEW(it);
if (sd->horizontal)
if (sd->orientation == EFL_ORIENT_HORIZONTAL)
{
if (i & 0x1)
elm_widget_theme_object_set
@ -433,7 +439,7 @@ _elm_index_elm_widget_theme_apply(Eo *obj, Elm_Index_Data *sd)
_index_box_clear(obj, 0);
_index_box_clear(obj, 1);
if (sd->horizontal)
if (sd->orientation == EFL_ORIENT_HORIZONTAL)
eina_stringshare_replace(&ld->group, "base/horizontal");
else
eina_stringshare_replace(&ld->group, "base/vertical");
@ -650,7 +656,7 @@ _sel_eval(Evas_Object *obj,
x = (x * x) + (y * y);
if ((x < dist) || (!it_closest))
{
if (sd->horizontal)
if (sd->orientation == EFL_ORIENT_HORIZONTAL)
cdv = (double)(xx - bx) / (double)bw;
else
cdv = (double)(yy - by) / (double)bh;
@ -889,7 +895,7 @@ _on_mouse_move(void *data,
(wd->resize_obj, "elm.dragable.pointer",
(!edje_object_mirrored_get(wd->resize_obj)) ?
x : (x - w), y);
if (!sd->horizontal)
if (sd->orientation == EFL_ORIENT_VERTICAL)
{
if (adx > minw)
{
@ -1225,6 +1231,28 @@ elm_index_add(Evas_Object *parent)
return obj;
}
EAPI void elm_index_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
{
Efl_Orient orient;
if (horizontal)
orient = EFL_ORIENT_HORIZONTAL;
else
orient = EFL_ORIENT_VERTICAL;
efl_orientation_set(obj, orient);
}
EAPI Eina_Bool elm_index_horizontal_get(const Evas_Object *obj)
{
Efl_Orient orient = efl_orientation_get(obj);
if (orient == EFL_ORIENT_HORIZONTAL)
return EINA_TRUE;
return EINA_FALSE;
}
EOLIAN static Eo *
_elm_index_eo_base_constructor(Eo *obj, Elm_Index_Data *_pd EINA_UNUSED)
{
@ -1593,19 +1621,20 @@ _elm_index_item_letter_get(const Eo *item EINA_UNUSED, Elm_Index_Item_Data *it)
}
EOLIAN static void
_elm_index_horizontal_set(Eo *obj, Elm_Index_Data *sd, Eina_Bool horizontal)
_elm_index_efl_orientation_orientation_set(Eo *obj, Elm_Index_Data *sd, Efl_Orient dir)
{
horizontal = !!horizontal;
if (horizontal == sd->horizontal) return;
if ((dir != EFL_ORIENT_HORIZONTAL) && (dir != EFL_ORIENT_VERTICAL))
return;
sd->orientation = dir;
sd->horizontal = horizontal;
elm_obj_widget_theme_apply(obj);
}
EOLIAN static Eina_Bool
_elm_index_horizontal_get(Eo *obj EINA_UNUSED, Elm_Index_Data *sd)
EOLIAN static Efl_Orient
_elm_index_efl_orientation_orientation_get(Eo *obj, Elm_Index_Data *sd)
{
return sd->horizontal;
return sd->orientation;
}
EOLIAN static void
@ -1623,7 +1652,7 @@ _elm_index_delay_change_time_get(Eo *obj EINA_UNUSED, Elm_Index_Data *sd)
EOLIAN static void
_elm_index_omit_enabled_set(Eo *obj, Elm_Index_Data *sd, Eina_Bool enabled)
{
if (sd->horizontal) return;
if (sd->orientation == EFL_ORIENT_HORIZONTAL) return;
enabled = !!enabled;
if (sd->omit_enabled == enabled) return;

View File

@ -1,4 +1,5 @@
class Elm.Index (Elm.Layout, Evas.Clickable_Interface, Evas.Selectable_Interface)
class Elm.Index (Elm.Layout, Efl.Orientation,
Evas.Clickable_Interface, Evas.Selectable_Interface)
{
legacy_prefix: elm_index;
eo_prefix: elm_obj_index;
@ -38,24 +39,6 @@ class Elm.Index (Elm.Layout, Evas.Clickable_Interface, Evas.Selectable_Interface
priority: int; [[$priority target priority value in index]]
}
}
@property horizontal {
[[Enable or disable horizontal mode on the index object
Note: Vertical mode is set by default.
On horizontal mode items are displayed on index from left to right,
instead of from top to bottom. Also, the index will scroll horizontally.]]
set {
}
get {
}
values {
horizontal: bool; [[$true to enable horizontal or $false to
disable it, i.e., to enable vertical mode. it's an area one Fingers
"finger" wide on the bottom side of the index widget's container.]]
}
}
@property delay_change_time {
[[Set a delay change time for index object.
@ -244,6 +227,7 @@ class Elm.Index (Elm.Layout, Evas.Clickable_Interface, Evas.Selectable_Interface
Elm.Widget.focus_direction_manager_is;
Elm.Widget.access;
Elm.Widget.focus_next;
Efl.Orientation.orientation;
Elm.Layout.sizing_eval;
Elm.Interface.Atspi_Accessible.children.get;
}

View File

@ -11,5 +11,37 @@
*/
EAPI Evas_Object *elm_index_add(Evas_Object *parent);
/**
* @brief Enable or disable horizontal mode on the index object
*
* @note Vertical mode is set by default.
*
* On horizontal mode items are displayed on index from left to right, instead
* of from top to bottom. Also, the index will scroll horizontally.
*
* @param[in] horizontal @c true to enable horizontal or @c false to disable
* it, i.e., to enable vertical mode. it's an area one Fingers "finger" wide on
* the bottom side of the index widget's container.
*
* @ingroup Elm_Index
*/
EAPI void elm_index_horizontal_set(Evas_Object *obj, Eina_Bool horizontal);
/**
* @brief Get enable or disable status of horizontal mode on the index object.
*
* @note Vertical mode is set by default.
*
* Returns the current status of horizontal mode on index object.
* On horizontal mode items are displayed on index from left to right, instead
* of from top to bottom. Also, the index will scroll horizontally.
*
* @return Current status of horizontal mode on index object.
* @c true if horizontal mode is enabled or @c false if disabled.
*
* @ingroup Elm_Index
*/
EAPI Eina_Bool elm_index_horizontal_get(const Evas_Object *obj);
#include "elm_index_item.eo.legacy.h"
#include "elm_index.eo.legacy.h"

View File

@ -33,6 +33,7 @@ struct _Elm_Index_Data
* small */
Eina_List *omit;
Efl_Orient orientation;
int level;
Evas_Coord dx, dy;
Ecore_Timer *delay;
@ -44,7 +45,6 @@ struct _Elm_Index_Data
int show_group, next_group;
Eina_Bool mouse_down : 1;
Eina_Bool horizontal : 1;
Eina_Bool autohide_disabled : 1;
Eina_Bool indicator_disabled : 1;
Eina_Bool omit_enabled : 1;