2013-04-25 22:13:00 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
2018-04-03 04:27:30 -07:00
|
|
|
#define EFL_ACCESS_OBJECT_PROTECTED
|
2017-10-15 08:08:35 -07:00
|
|
|
#define EFL_UI_FOCUS_COMPOSITION_PROTECTED
|
2014-10-17 08:56:11 -07:00
|
|
|
|
2011-05-18 00:15:36 -07:00
|
|
|
#include <Elementary.h>
|
2019-03-05 14:00:37 -08: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
|
|
|
|
2016-12-21 03:29:06 -08:00
|
|
|
static void
|
2017-10-15 08:08:35 -07:00
|
|
|
_elm_grid_efl_ui_focus_composition_prepare(Eo *obj, void *pd EINA_UNUSED)
|
2016-12-21 03:29:06 -08:00
|
|
|
{
|
2018-06-23 19:56:52 -07:00
|
|
|
Eina_List *l, *ll;
|
2018-05-31 05:04:55 -07:00
|
|
|
Efl_Ui_Widget *elem;
|
|
|
|
|
2018-01-07 20:55:35 -08:00
|
|
|
Elm_Widget_Smart_Data *wpd = efl_data_scope_get(obj, EFL_UI_WIDGET_CLASS);
|
2017-09-29 02:09:33 -07:00
|
|
|
Eina_List *order = evas_object_grid_children_get(wpd->resize_obj);
|
2016-12-21 03:29:06 -08:00
|
|
|
|
2018-06-23 19:56:52 -07:00
|
|
|
EINA_LIST_FOREACH_SAFE(order, l, ll, elem)
|
2018-05-31 05:04:55 -07:00
|
|
|
{
|
|
|
|
if (!efl_isa(elem, EFL_UI_WIDGET_CLASS))
|
|
|
|
order = eina_list_remove(order, elem);
|
|
|
|
}
|
|
|
|
|
2017-10-15 08:08:35 -07:00
|
|
|
efl_ui_focus_composition_elements_set(obj, order);
|
2016-12-21 03:29:06 -08: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
|
|
|
}
|
|
|
|
|
2019-03-04 10:37:07 -08:00
|
|
|
EOLIAN static Eina_Error
|
2018-01-07 20:55:35 -08:00
|
|
|
_elm_grid_efl_ui_widget_theme_apply(Eo *obj, void *sd EINA_UNUSED)
|
2012-05-02 09:59:55 -07:00
|
|
|
{
|
2019-03-04 10:37:07 -08:00
|
|
|
Eina_Error int_ret = EFL_UI_THEME_APPLY_ERROR_GENERIC;
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2017-10-23 22:03:46 -07:00
|
|
|
int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS));
|
2019-03-04 10:36:41 -08:00
|
|
|
if (int_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) return int_ret;
|
2012-05-03 15:43:16 -07:00
|
|
|
|
2017-06-13 03:41:15 -07:00
|
|
|
_mirrored_set(obj, efl_ui_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;
|
|
|
|
|
|
|
|
grid = evas_object_grid_add(evas_object_evas_get(obj));
|
2017-08-08 05:06:43 -07:00
|
|
|
elm_widget_resize_object_set(obj, grid);
|
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);
|
|
|
|
|
2017-10-23 22:03:46 -07:00
|
|
|
efl_ui_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);
|
2017-11-06 21:00:43 -08:00
|
|
|
return elm_legacy_add(MY_CLASS, parent);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
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);
|
2018-04-03 04:27:30 -07:00
|
|
|
efl_access_object_role_set(obj, EFL_ACCESS_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
|
2018-02-14 18:14:52 -08:00
|
|
|
_elm_grid_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
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_grid_grid_size_get(const 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);
|
2017-10-15 08:08:35 -07:00
|
|
|
efl_ui_focus_composition_dirty(obj);
|
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);
|
2017-10-15 08:08:35 -07:00
|
|
|
efl_ui_focus_composition_dirty(obj);
|
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);
|
2017-10-15 08:08:35 -07:00
|
|
|
efl_ui_focus_composition_dirty(obj);
|
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);
|
2017-10-15 08:08:35 -07:00
|
|
|
efl_ui_focus_composition_dirty(obj);
|
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*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_grid_children_get(const 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
|
|
|
}
|
|
|
|
|
2017-05-18 01:52:17 -07:00
|
|
|
/* Internal EO APIs and hidden overrides */
|
|
|
|
|
|
|
|
#define ELM_GRID_EXTRA_OPS \
|
|
|
|
EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_grid)
|
|
|
|
|
2019-03-05 14:00:37 -08:00
|
|
|
#include "elm_grid_eo.c"
|