2013-04-25 22:13:00 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
2014-10-17 08:56:11 -07:00
|
|
|
#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
|
|
|
|
|
2011-05-18 00:15:36 -07:00
|
|
|
#include <Elementary.h>
|
2016-04-20 04:08:49 -07:00
|
|
|
#include <elm_grid.eo.h>
|
2011-05-18 00:15:36 -07:00
|
|
|
#include "elm_priv.h"
|
2012-07-31 15:05:06 -07:00
|
|
|
#include "elm_widget_grid.h"
|
2011-05-18 00:15:36 -07:00
|
|
|
|
2014-06-03 03:35:28 -07:00
|
|
|
#define MY_CLASS ELM_GRID_CLASS
|
2013-11-07 03:44:22 -08:00
|
|
|
#define MY_CLASS_NAME "Elm_Grid"
|
|
|
|
#define MY_CLASS_NAME_LEGACY "elm_grid"
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2014-03-23 02:46:17 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_grid_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-23 02:46:17 -07:00
|
|
|
return EINA_TRUE;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-23 02:46:17 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2015-09-15 03:41:51 -07:00
|
|
|
_elm_grid_elm_widget_focus_next(Eo *obj, void *_pd EINA_UNUSED, Elm_Focus_Direction dir, Evas_Object **next, Elm_Object_Item **next_item)
|
2011-05-25 04:47:09 -07:00
|
|
|
{
|
|
|
|
const Eina_List *items;
|
2012-05-03 15:43:16 -07:00
|
|
|
Eina_List *(*list_free)(Eina_List *list);
|
|
|
|
void *(*list_data_get)(const Eina_List *list);
|
2011-05-25 17:39:12 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
Eina_Bool int_ret;
|
|
|
|
|
2014-03-23 02:46:17 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
2011-05-25 17:39:12 -07:00
|
|
|
|
2011-05-25 04:47:09 -07:00
|
|
|
/* Focus chain */
|
|
|
|
/* TODO: Change this to use other chain */
|
|
|
|
if ((items = elm_widget_focus_custom_chain_get(obj)))
|
|
|
|
{
|
|
|
|
list_data_get = eina_list_data_get;
|
|
|
|
list_free = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
items = evas_object_grid_children_get(wd->resize_obj);
|
2011-05-25 04:47:09 -07:00
|
|
|
list_data_get = eina_list_data_get;
|
|
|
|
list_free = eina_list_free;
|
2011-05-25 17:39:12 -07:00
|
|
|
|
2014-03-23 02:46:17 -07:00
|
|
|
if (!items) return EINA_FALSE;
|
2011-05-25 04:47:09 -07:00
|
|
|
}
|
2011-05-25 17:39:12 -07:00
|
|
|
|
2015-09-15 03:41:51 -07:00
|
|
|
int_ret = elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next, next_item);
|
2011-05-25 17:39:12 -07:00
|
|
|
|
2012-05-03 15:43:16 -07:00
|
|
|
if (list_free) list_free((Eina_List *)items);
|
2011-05-25 17:39:12 -07:00
|
|
|
|
2014-03-23 02:46:17 -07:00
|
|
|
return int_ret;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-23 02:46:17 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_grid_elm_widget_focus_direction_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-23 02:46:17 -07:00
|
|
|
return EINA_TRUE;
|
2011-05-25 04:47:09 -07:00
|
|
|
}
|
|
|
|
|
2014-03-23 02:46:17 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2015-09-24 23:24:53 -07:00
|
|
|
_elm_grid_elm_widget_focus_direction(Eo *obj, void *_pd EINA_UNUSED, const Evas_Object *base, double degree, Evas_Object **direction, Elm_Object_Item **direction_item, double *weight)
|
2012-05-15 03:39:07 -07:00
|
|
|
{
|
|
|
|
const Eina_List *items;
|
|
|
|
Eina_List *(*list_free)(Eina_List *list);
|
|
|
|
void *(*list_data_get)(const Eina_List *list);
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
Eina_Bool int_ret;
|
|
|
|
|
2014-03-23 02:46:17 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
2012-05-15 03:39:07 -07:00
|
|
|
|
|
|
|
/* Focus chain */
|
|
|
|
/* TODO: Change this to use other chain */
|
|
|
|
if ((items = elm_widget_focus_custom_chain_get(obj)))
|
|
|
|
{
|
|
|
|
list_data_get = eina_list_data_get;
|
|
|
|
list_free = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
items = evas_object_grid_children_get(wd->resize_obj);
|
2012-05-15 03:39:07 -07:00
|
|
|
list_data_get = eina_list_data_get;
|
|
|
|
list_free = eina_list_free;
|
|
|
|
|
2014-03-23 02:46:17 -07:00
|
|
|
if (!items) return EINA_FALSE;
|
2012-05-15 03:39:07 -07:00
|
|
|
}
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
int_ret = elm_widget_focus_list_direction_get(obj, base, items, list_data_get,
|
2015-09-24 23:24:53 -07:00
|
|
|
degree, direction, direction_item, weight);
|
2012-05-15 03:39:07 -07:00
|
|
|
|
|
|
|
if (list_free) list_free((Eina_List *)items);
|
|
|
|
|
2014-03-23 02:46:17 -07:00
|
|
|
return int_ret;
|
2012-05-15 03:39:07 -07:00
|
|
|
}
|
|
|
|
|
2011-05-19 17:43:05 -07:00
|
|
|
static void
|
2011-05-18 00:15:36 -07:00
|
|
|
_mirrored_set(Evas_Object *obj, Eina_Bool rtl)
|
|
|
|
{
|
2012-12-05 02:59:36 -08:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-05-03 15:43:16 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_object_grid_mirrored_set(wd->resize_obj, rtl);
|
2012-05-02 09:59:55 -07:00
|
|
|
}
|
|
|
|
|
theme: return enum from elm_widget_style_set instead of bool
Summary:
if trying to apply incorrect theme, widget apply default theme and return TRUE.
so there is no way to check it really apply correct theme.
To resolve this problem, _elm_theme_set return three type enum
* related history : 4ca3ef45146e05908a13d1010909abeba9693ad6
* elm_object_style_set is public api, so I didn't change it.
* typedef name [ Theme_Apply ] is temporarily, please suggest better one.
@fix
Reviewers: singh.amitesh, herb, Hermet, cedric, jpeg, raster
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4073
2016-06-30 23:09:42 -07:00
|
|
|
EOLIAN static Elm_Theme_Apply
|
2014-03-23 02:46:17 -07:00
|
|
|
_elm_grid_elm_widget_theme_apply(Eo *obj, void *sd EINA_UNUSED)
|
2012-05-02 09:59:55 -07:00
|
|
|
{
|
theme: return enum from elm_widget_style_set instead of bool
Summary:
if trying to apply incorrect theme, widget apply default theme and return TRUE.
so there is no way to check it really apply correct theme.
To resolve this problem, _elm_theme_set return three type enum
* related history : 4ca3ef45146e05908a13d1010909abeba9693ad6
* elm_object_style_set is public api, so I didn't change it.
* typedef name [ Theme_Apply ] is temporarily, please suggest better one.
@fix
Reviewers: singh.amitesh, herb, Hermet, cedric, jpeg, raster
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4073
2016-06-30 23:09:42 -07:00
|
|
|
Elm_Theme_Apply int_ret = ELM_THEME_APPLY_FAILED;
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
int_ret = elm_obj_widget_theme_apply(efl_super(obj, MY_CLASS));
|
theme: return enum from elm_widget_style_set instead of bool
Summary:
if trying to apply incorrect theme, widget apply default theme and return TRUE.
so there is no way to check it really apply correct theme.
To resolve this problem, _elm_theme_set return three type enum
* related history : 4ca3ef45146e05908a13d1010909abeba9693ad6
* elm_object_style_set is public api, so I didn't change it.
* typedef name [ Theme_Apply ] is temporarily, please suggest better one.
@fix
Reviewers: singh.amitesh, herb, Hermet, cedric, jpeg, raster
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4073
2016-06-30 23:09:42 -07:00
|
|
|
if (!int_ret) return ELM_THEME_APPLY_FAILED;
|
2012-05-03 15:43:16 -07:00
|
|
|
|
2012-05-02 18:19:05 -07:00
|
|
|
_mirrored_set(obj, elm_widget_mirrored_get(obj));
|
2012-05-03 15:43:16 -07:00
|
|
|
|
theme: return enum from elm_widget_style_set instead of bool
Summary:
if trying to apply incorrect theme, widget apply default theme and return TRUE.
so there is no way to check it really apply correct theme.
To resolve this problem, _elm_theme_set return three type enum
* related history : 4ca3ef45146e05908a13d1010909abeba9693ad6
* elm_object_style_set is public api, so I didn't change it.
* typedef name [ Theme_Apply ] is temporarily, please suggest better one.
@fix
Reviewers: singh.amitesh, herb, Hermet, cedric, jpeg, raster
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4073
2016-06-30 23:09:42 -07:00
|
|
|
return int_ret;
|
2012-05-03 15:43:16 -07:00
|
|
|
}
|
|
|
|
|
2014-03-23 02:46:17 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_grid_efl_canvas_group_group_add(Eo *obj, void *_pd EINA_UNUSED)
|
2012-05-03 15:43:16 -07:00
|
|
|
{
|
2013-10-05 01:14:31 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2013-09-24 21:33:39 -07:00
|
|
|
Evas_Object *grid;
|
|
|
|
|
|
|
|
elm_widget_sub_object_parent_add(obj);
|
2013-08-26 22:19:19 -07:00
|
|
|
|
2013-09-24 21:33:39 -07:00
|
|
|
grid = evas_object_grid_add(evas_object_evas_get(obj));
|
2013-10-16 08:54:54 -07:00
|
|
|
elm_widget_resize_object_set(obj, grid, EINA_TRUE);
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_object_grid_size_set(wd->resize_obj, 100, 100);
|
2012-05-03 15:43:16 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_add(efl_super(obj, MY_CLASS));
|
2012-05-03 15:43:16 -07:00
|
|
|
|
|
|
|
elm_widget_can_focus_set(obj, EINA_FALSE);
|
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_obj_widget_theme_apply(obj);
|
2012-05-03 15:43:16 -07:00
|
|
|
}
|
|
|
|
|
2014-03-23 02:46:17 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_grid_efl_canvas_group_group_del(Eo *obj, void *_pd EINA_UNUSED)
|
2012-05-03 15:43:16 -07:00
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
Evas_Object *child;
|
|
|
|
|
2012-12-05 02:59:36 -08:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-05-03 15:43:16 -07:00
|
|
|
|
|
|
|
/* let's make our grid object the *last* to be processed, since it
|
|
|
|
* may (smart) parent other sub objects here */
|
2012-11-25 22:32:53 -08:00
|
|
|
EINA_LIST_FOREACH(wd->subobjs, l, child)
|
2012-05-03 15:43:16 -07:00
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
if (child == wd->resize_obj)
|
2012-05-03 15:43:16 -07:00
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
wd->subobjs =
|
|
|
|
eina_list_demote_list(wd->subobjs, l);
|
2012-05-03 15:43:16 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_del(efl_super(obj, MY_CLASS));
|
2011-05-18 00:15:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_grid_add(Evas_Object *parent)
|
|
|
|
{
|
2012-05-03 15:43:16 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
2016-08-15 06:44:41 -07:00
|
|
|
Evas_Object *obj = efl_add(MY_CLASS, parent);
|
2012-11-25 22:32:53 -08:00
|
|
|
return obj;
|
|
|
|
}
|
2012-05-03 15:43:16 -07:00
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_grid_efl_object_constructor(Eo *obj, void *_pd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
2016-06-20 21:26:15 -07:00
|
|
|
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_atspi_accessible_role_set(obj, ELM_ATSPI_ROLE_FILLER);
|
2015-05-19 05:34:07 -07:00
|
|
|
|
|
|
|
return obj;
|
2011-05-18 00:15:36 -07:00
|
|
|
}
|
|
|
|
|
2014-03-23 02:46:17 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_grid_size_set(Eo *obj, void *_pd EINA_UNUSED, Evas_Coord w, Evas_Coord h)
|
2011-05-18 00:15:36 -07:00
|
|
|
{
|
2012-12-05 02:59:36 -08:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-11-25 22:32:53 -08:00
|
|
|
|
|
|
|
evas_object_grid_size_set(wd->resize_obj, w, h);
|
2011-05-18 00:15:36 -07:00
|
|
|
}
|
|
|
|
|
2014-03-23 02:46:17 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_grid_size_get(Eo *obj, void *_pd EINA_UNUSED, Evas_Coord *w, Evas_Coord *h)
|
2011-05-18 00:15:36 -07:00
|
|
|
{
|
2012-12-05 02:59:36 -08:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-11-25 22:32:53 -08:00
|
|
|
|
|
|
|
evas_object_grid_size_get(wd->resize_obj, w, h);
|
2011-05-18 00:15:36 -07:00
|
|
|
}
|
|
|
|
|
2014-03-23 02:46:17 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_grid_pack(Eo *obj, void *_pd EINA_UNUSED, Evas_Object *subobj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
|
2011-05-18 00:15:36 -07:00
|
|
|
{
|
2012-12-05 02:59:36 -08:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-05-03 15:43:16 -07:00
|
|
|
|
2011-05-18 00:29:32 -07:00
|
|
|
elm_widget_sub_object_add(obj, subobj);
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_object_grid_pack(wd->resize_obj, subobj, x, y, w, h);
|
2011-05-18 00:15:36 -07:00
|
|
|
}
|
|
|
|
|
2014-03-23 02:46:17 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_grid_unpack(Eo *obj, void *_pd EINA_UNUSED, Evas_Object *subobj)
|
2011-05-18 00:15:36 -07:00
|
|
|
{
|
2012-12-05 02:59:36 -08:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-05-03 15:43:16 -07:00
|
|
|
|
2016-05-29 17:47:39 -07:00
|
|
|
_elm_widget_sub_object_redirect_to_top(obj, subobj);
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_object_grid_unpack(wd->resize_obj, subobj);
|
2011-05-18 00:15:36 -07:00
|
|
|
}
|
|
|
|
|
2014-03-23 02:46:17 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_grid_clear(Eo *obj, void *_pd EINA_UNUSED, Eina_Bool clear)
|
2011-05-18 00:15:36 -07:00
|
|
|
{
|
|
|
|
Eina_List *chld;
|
|
|
|
Evas_Object *o;
|
2012-05-03 15:43:16 -07:00
|
|
|
|
2012-12-05 02:59:36 -08:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-05-03 15:43:16 -07:00
|
|
|
|
|
|
|
if (!clear)
|
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
chld = evas_object_grid_children_get(wd->resize_obj);
|
2013-03-08 20:23:42 -08:00
|
|
|
EINA_LIST_FREE(chld, o)
|
2016-05-29 19:36:49 -07:00
|
|
|
_elm_widget_sub_object_redirect_to_top(obj, o);
|
2012-05-03 15:43:16 -07:00
|
|
|
}
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_object_grid_clear(wd->resize_obj, clear);
|
2011-05-18 00:15:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-05-03 15:43:16 -07:00
|
|
|
elm_grid_pack_set(Evas_Object *subobj,
|
|
|
|
Evas_Coord x,
|
|
|
|
Evas_Coord y,
|
|
|
|
Evas_Coord w,
|
|
|
|
Evas_Coord h)
|
2011-05-18 00:15:36 -07:00
|
|
|
{
|
|
|
|
Evas_Object *obj = elm_widget_parent_widget_get(subobj);
|
2012-05-03 15:43:16 -07:00
|
|
|
|
|
|
|
ELM_GRID_CHECK(obj);
|
2012-12-05 02:59:36 -08:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-05-03 15:43:16 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_object_grid_pack(wd->resize_obj, subobj, x, y, w, h);
|
2011-05-18 00:15:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-05-03 15:43:16 -07:00
|
|
|
elm_grid_pack_get(Evas_Object *subobj,
|
|
|
|
int *x,
|
|
|
|
int *y,
|
|
|
|
int *w,
|
|
|
|
int *h)
|
2011-05-18 00:15:36 -07:00
|
|
|
{
|
|
|
|
Evas_Object *obj = elm_widget_parent_widget_get(subobj);
|
2012-05-03 15:43:16 -07:00
|
|
|
|
|
|
|
ELM_GRID_CHECK(obj);
|
2012-12-05 02:59:36 -08:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-05-03 15:43:16 -07:00
|
|
|
|
2012-07-31 15:05:06 -07:00
|
|
|
evas_object_grid_pack_get
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, subobj, x, y, w, h);
|
2011-05-18 00:15:36 -07:00
|
|
|
}
|
2012-02-20 20:39:15 -08:00
|
|
|
|
2014-03-23 02:46:17 -07:00
|
|
|
EOLIAN static Eina_List*
|
|
|
|
_elm_grid_children_get(Eo *obj, void *_pd EINA_UNUSED)
|
2012-02-20 20:39:15 -08:00
|
|
|
{
|
2014-03-23 02:46:17 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
|
|
|
return evas_object_grid_children_get(wd->resize_obj);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_grid_class_constructor(Efl_Class *klass)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2013-11-07 03:44:22 -08:00
|
|
|
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-23 02:46:17 -07:00
|
|
|
#include "elm_grid.eo.c"
|