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
|
2016-04-20 05:07:38 -07:00
|
|
|
#define ELM_LAYOUT_PROTECTED
|
2017-11-23 21:41:31 -08:00
|
|
|
#define EFL_UI_WIDGET_PART_BG_PROTECTED
|
2018-05-03 16:34:17 -07:00
|
|
|
#define EFL_PART_PROTECTED
|
2014-10-17 08:56:11 -07:00
|
|
|
|
2008-10-06 23:55:11 -07:00
|
|
|
#include <Elementary.h>
|
2013-04-25 22:13:00 -07:00
|
|
|
|
2008-10-06 23:55:11 -07:00
|
|
|
#include "elm_priv.h"
|
2012-05-03 15:41:26 -07:00
|
|
|
#include "elm_widget_layout.h"
|
2016-05-24 04:40:18 -07:00
|
|
|
#include "elm_part_helper.h"
|
2017-10-31 23:16:30 -07:00
|
|
|
#include "elm_entry.eo.h"
|
2016-05-24 04:40:18 -07:00
|
|
|
|
2018-04-06 09:15:31 -07:00
|
|
|
#define MY_CLASS EFL_UI_LAYOUT_OBJECT_CLASS
|
|
|
|
#define MY_CLASS_PFX efl_ui_layout_object
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2018-04-06 09:15:31 -07:00
|
|
|
#define MY_CLASS_NAME "Efl.Ui.Layout.Object"
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2018-04-06 09:15:31 -07:00
|
|
|
Eo *_efl_ui_layout_pack_proxy_get(Efl_Ui_Layout_Object *obj, Edje_Part_Type type, const char *part);
|
2017-01-31 12:17:58 -08:00
|
|
|
static void _efl_model_properties_changed_cb(void *, const Efl_Event *);
|
2018-04-06 09:15:31 -07:00
|
|
|
static Eina_Bool _efl_ui_layout_part_cursor_unset(Efl_Ui_Layout_Object_Data *sd, const char *part_name);
|
2016-04-25 05:36:56 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
static const char SIG_THEME_CHANGED[] = "theme,changed";
|
2014-02-05 23:18:57 -08:00
|
|
|
const char SIG_LAYOUT_FOCUSED[] = "focused";
|
|
|
|
const char SIG_LAYOUT_UNFOCUSED[] = "unfocused";
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-01-31 12:17:58 -08:00
|
|
|
const char SIGNAL_PREFIX[] = "signal/";
|
|
|
|
|
2012-05-03 15:41:26 -07:00
|
|
|
/* smart callbacks coming from elm layout objects: */
|
|
|
|
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
|
|
|
{SIG_THEME_CHANGED, ""},
|
2014-02-05 23:18:57 -08:00
|
|
|
{SIG_LAYOUT_FOCUSED, ""},
|
|
|
|
{SIG_LAYOUT_UNFOCUSED, ""},
|
2014-01-23 03:07:20 -08:00
|
|
|
{SIG_WIDGET_LANG_CHANGED, ""}, /**< handled by elm_widget */
|
2014-02-07 21:05:06 -08:00
|
|
|
{SIG_WIDGET_ACCESS_CHANGED, ""}, /**< handled by elm_widget */
|
2012-05-03 15:41:26 -07:00
|
|
|
{NULL, NULL}
|
|
|
|
};
|
2008-10-06 23:55:11 -07:00
|
|
|
|
2018-04-26 03:27:43 -07:00
|
|
|
static const char efl_ui_default_text[] = "efl.text";
|
|
|
|
static const char efl_ui_default_content[] = "efl.content";
|
|
|
|
|
2015-03-10 00:40:53 -07:00
|
|
|
static const Elm_Layout_Part_Alias_Description _text_aliases[] =
|
|
|
|
{
|
|
|
|
{"default", "elm.text"},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2015-03-10 00:56:22 -07:00
|
|
|
static const Elm_Layout_Part_Alias_Description _content_aliases[] =
|
|
|
|
{
|
|
|
|
{"default", "elm.swallow.content"},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2018-04-26 03:27:43 -07:00
|
|
|
static const char *_elm_legacy_layout_swallow_parts[] = {
|
2016-02-12 11:59:44 -08:00
|
|
|
"elm.swallow.icon",
|
|
|
|
"elm.swallow.end",
|
|
|
|
"elm.swallow.background",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2018-04-26 03:27:43 -07:00
|
|
|
static const char *_efl_ui_layout_swallow_parts[] = {
|
|
|
|
"efl.content",
|
|
|
|
"efl.icon",
|
|
|
|
"efl.end",
|
|
|
|
"efl.background",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-05-03 15:41:26 -07:00
|
|
|
/* these are data operated by layout's class functions internally, and
|
|
|
|
* should not be messed up by inhering classes */
|
2017-08-07 21:28:50 -07:00
|
|
|
typedef struct _Efl_Ui_Layout_Sub_Object_Data Efl_Ui_Layout_Sub_Object_Data;
|
|
|
|
typedef struct _Efl_Ui_Layout_Sub_Object_Cursor Efl_Ui_Layout_Sub_Object_Cursor;
|
|
|
|
typedef struct _Efl_Ui_Layout_Sub_Iterator Efl_Ui_Layout_Sub_Iterator;
|
2016-03-28 21:30:13 -07:00
|
|
|
|
2017-08-07 21:28:50 -07:00
|
|
|
struct _Efl_Ui_Layout_Sub_Iterator
|
2016-03-28 21:30:13 -07:00
|
|
|
{
|
|
|
|
Eina_Iterator iterator;
|
|
|
|
Eina_Iterator *real_iterator;
|
2018-04-06 09:15:31 -07:00
|
|
|
Efl_Ui_Layout_Object *object;
|
2016-03-28 21:30:13 -07:00
|
|
|
};
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-08-07 21:28:50 -07:00
|
|
|
struct _Efl_Ui_Layout_Sub_Object_Data
|
2008-10-06 23:55:11 -07:00
|
|
|
{
|
2012-05-03 15:41:26 -07:00
|
|
|
const char *part;
|
2010-09-26 16:19:15 -07:00
|
|
|
Evas_Object *obj;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
|
|
|
enum {
|
|
|
|
SWALLOW,
|
|
|
|
BOX_APPEND,
|
|
|
|
BOX_PREPEND,
|
|
|
|
BOX_INSERT_BEFORE,
|
|
|
|
BOX_INSERT_AT,
|
|
|
|
TABLE_PACK,
|
|
|
|
TEXT
|
|
|
|
} type;
|
|
|
|
|
|
|
|
union {
|
|
|
|
union {
|
|
|
|
const Evas_Object *reference;
|
|
|
|
unsigned int pos;
|
|
|
|
} box;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
unsigned short col, row, colspan, rowspan;
|
|
|
|
} table;
|
|
|
|
} p;
|
2008-10-06 23:55:11 -07:00
|
|
|
};
|
|
|
|
|
2017-08-07 21:28:50 -07:00
|
|
|
struct _Efl_Ui_Layout_Sub_Object_Cursor
|
2008-10-06 23:55:11 -07:00
|
|
|
{
|
|
|
|
Evas_Object *obj;
|
2012-05-03 15:41:26 -07:00
|
|
|
const char *part;
|
|
|
|
const char *cursor;
|
|
|
|
const char *style;
|
|
|
|
|
|
|
|
Eina_Bool engine_only : 1;
|
2008-10-06 23:55:11 -07:00
|
|
|
};
|
|
|
|
|
2012-05-02 09:58:10 -07:00
|
|
|
static void
|
2012-05-03 15:41:26 -07:00
|
|
|
_on_sub_object_size_hint_change(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2012-05-02 09:58:10 -07:00
|
|
|
{
|
2013-10-05 00:36:33 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(data, wd);
|
2017-08-02 23:20:58 -07:00
|
|
|
elm_layout_sizing_eval(data);
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
2012-05-02 09:58:10 -07:00
|
|
|
|
2012-05-03 15:41:26 -07:00
|
|
|
static void
|
2017-08-07 21:28:50 -07:00
|
|
|
_part_cursor_free(Efl_Ui_Layout_Sub_Object_Cursor *pc)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
|
|
|
eina_stringshare_del(pc->part);
|
|
|
|
eina_stringshare_del(pc->style);
|
|
|
|
eina_stringshare_del(pc->cursor);
|
|
|
|
|
|
|
|
free(pc);
|
|
|
|
}
|
|
|
|
|
2011-02-08 04:08:28 -08:00
|
|
|
static void
|
2018-04-06 09:15:31 -07:00
|
|
|
_sizing_eval(Evas_Object *obj, Efl_Ui_Layout_Object_Data *sd)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2013-03-18 09:07:38 -07:00
|
|
|
Evas_Coord minh = -1, minw = -1;
|
2013-10-25 09:51:33 -07:00
|
|
|
Evas_Coord rest_w = 0, rest_h = 0;
|
2013-10-05 00:36:33 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(sd->obj, wd);
|
|
|
|
|
2013-10-25 09:51:33 -07:00
|
|
|
if (sd->restricted_calc_w)
|
|
|
|
rest_w = wd->w;
|
|
|
|
if (sd->restricted_calc_h)
|
|
|
|
rest_h = wd->h;
|
|
|
|
|
|
|
|
edje_object_size_min_restricted_calc(wd->resize_obj, &minw, &minh,
|
|
|
|
rest_w, rest_h);
|
2012-05-03 15:41:26 -07:00
|
|
|
evas_object_size_hint_min_set(obj, minw, minh);
|
2013-10-25 09:51:33 -07:00
|
|
|
|
|
|
|
sd->restricted_calc_w = sd->restricted_calc_h = EINA_FALSE;
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* common content cases for layout objects: icon and text */
|
efl.ui.layout: change signal name for icon/text
Summary:
when set/unset icon and text,
signal "elm,state,[part],visible/hidden" is emitted.
This is wrong because visible/hidden should be handled by
Efl.Gfx.visible, not Efl.Text nor Efl.Content.
This should be changed into elm,state,[part],set/unset"
All relating edc should be fixed.
Test Plan: run elementary_test->button, Efl.Ui.Button
Reviewers: jpeg, cedric, woohyun, Jaehyun_Cho
Differential Revision: https://phab.enlightenment.org/D5798
Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
2018-02-14 11:29:19 -08:00
|
|
|
static inline void
|
|
|
|
_signals_emit(Eo *obj,
|
|
|
|
const char *type,
|
|
|
|
Eina_Bool set)
|
|
|
|
{
|
|
|
|
char buf[1024];
|
|
|
|
|
|
|
|
if (elm_widget_is_legacy(obj))
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,%s", type,
|
|
|
|
set ? "visible" : "hidden");
|
2018-04-26 04:24:09 -07:00
|
|
|
efl_layout_signal_emit(obj, buf, "elm");
|
efl.ui.layout: change signal name for icon/text
Summary:
when set/unset icon and text,
signal "elm,state,[part],visible/hidden" is emitted.
This is wrong because visible/hidden should be handled by
Efl.Gfx.visible, not Efl.Text nor Efl.Content.
This should be changed into elm,state,[part],set/unset"
All relating edc should be fixed.
Test Plan: run elementary_test->button, Efl.Ui.Button
Reviewers: jpeg, cedric, woohyun, Jaehyun_Cho
Differential Revision: https://phab.enlightenment.org/D5798
Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
2018-02-14 11:29:19 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-04-26 04:24:09 -07:00
|
|
|
snprintf(buf, sizeof(buf), "efl,state,%s,%s", type,
|
efl.ui.layout: change signal name for icon/text
Summary:
when set/unset icon and text,
signal "elm,state,[part],visible/hidden" is emitted.
This is wrong because visible/hidden should be handled by
Efl.Gfx.visible, not Efl.Text nor Efl.Content.
This should be changed into elm,state,[part],set/unset"
All relating edc should be fixed.
Test Plan: run elementary_test->button, Efl.Ui.Button
Reviewers: jpeg, cedric, woohyun, Jaehyun_Cho
Differential Revision: https://phab.enlightenment.org/D5798
Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
2018-02-14 11:29:19 -08:00
|
|
|
set ? "set" : "unset");
|
2018-04-26 04:24:09 -07:00
|
|
|
efl_layout_signal_emit(obj, buf, "efl");
|
efl.ui.layout: change signal name for icon/text
Summary:
when set/unset icon and text,
signal "elm,state,[part],visible/hidden" is emitted.
This is wrong because visible/hidden should be handled by
Efl.Gfx.visible, not Efl.Text nor Efl.Content.
This should be changed into elm,state,[part],set/unset"
All relating edc should be fixed.
Test Plan: run elementary_test->button, Efl.Ui.Button
Reviewers: jpeg, cedric, woohyun, Jaehyun_Cho
Differential Revision: https://phab.enlightenment.org/D5798
Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
2018-02-14 11:29:19 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-03 15:41:26 -07:00
|
|
|
static inline void
|
2018-04-06 09:15:31 -07:00
|
|
|
_icon_signal_emit(Efl_Ui_Layout_Object_Data *sd,
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Data *sub_d,
|
2012-05-03 15:41:26 -07:00
|
|
|
Eina_Bool visible)
|
2011-02-08 04:08:28 -08:00
|
|
|
{
|
2012-05-03 15:41:26 -07:00
|
|
|
const char *type;
|
2018-01-15 22:12:49 -08:00
|
|
|
Eo *edje;
|
2016-02-12 11:59:44 -08:00
|
|
|
int i;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2018-01-15 22:12:49 -08:00
|
|
|
edje = elm_widget_resize_object_get(sd->obj);
|
|
|
|
if (!edje) return;
|
|
|
|
|
2013-07-17 21:02:19 -07:00
|
|
|
//FIXME: Don't limit to the icon and end here.
|
|
|
|
// send signals for all contents after elm 2.0
|
2016-02-12 11:59:44 -08:00
|
|
|
if (sub_d->type != SWALLOW) return;
|
efl.ui.layout: change signal name for icon/text
Summary:
when set/unset icon and text,
signal "elm,state,[part],visible/hidden" is emitted.
This is wrong because visible/hidden should be handled by
Efl.Gfx.visible, not Efl.Text nor Efl.Content.
This should be changed into elm,state,[part],set/unset"
All relating edc should be fixed.
Test Plan: run elementary_test->button, Efl.Ui.Button
Reviewers: jpeg, cedric, woohyun, Jaehyun_Cho
Differential Revision: https://phab.enlightenment.org/D5798
Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
2018-02-14 11:29:19 -08:00
|
|
|
if (elm_widget_is_legacy(sd->obj))
|
2018-04-26 03:27:43 -07:00
|
|
|
{
|
|
|
|
for (i = 0;; i++)
|
|
|
|
{
|
|
|
|
if (!_elm_legacy_layout_swallow_parts[i]) return;
|
|
|
|
if (!strcmp(sub_d->part, _elm_legacy_layout_swallow_parts[i])) break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2016-02-12 11:59:44 -08:00
|
|
|
{
|
efl.ui.layout: change signal name for icon/text
Summary:
when set/unset icon and text,
signal "elm,state,[part],visible/hidden" is emitted.
This is wrong because visible/hidden should be handled by
Efl.Gfx.visible, not Efl.Text nor Efl.Content.
This should be changed into elm,state,[part],set/unset"
All relating edc should be fixed.
Test Plan: run elementary_test->button, Efl.Ui.Button
Reviewers: jpeg, cedric, woohyun, Jaehyun_Cho
Differential Revision: https://phab.enlightenment.org/D5798
Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
2018-02-14 11:29:19 -08:00
|
|
|
for (i = 0;; i++)
|
|
|
|
{
|
|
|
|
if (!_efl_ui_layout_swallow_parts[i]) return;
|
|
|
|
if (!strcmp(sub_d->part, _efl_ui_layout_swallow_parts[i])) break;
|
|
|
|
}
|
2016-02-12 11:59:44 -08:00
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2018-04-26 03:27:43 -07:00
|
|
|
if (elm_widget_is_legacy(sd->obj))
|
|
|
|
{
|
|
|
|
if (!strncmp(sub_d->part, "elm.swallow.", strlen("elm.swallow.")))
|
|
|
|
type = sub_d->part + strlen("elm.swallow.");
|
|
|
|
else
|
|
|
|
type = sub_d->part;
|
|
|
|
}
|
2012-08-16 14:41:24 -07:00
|
|
|
else
|
2018-04-26 03:27:43 -07:00
|
|
|
{
|
|
|
|
if (!strncmp(sub_d->part, "efl.", strlen("efl.")))
|
|
|
|
type = sub_d->part + strlen("efl.");
|
|
|
|
else
|
|
|
|
type = sub_d->part;
|
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
efl.ui.layout: change signal name for icon/text
Summary:
when set/unset icon and text,
signal "elm,state,[part],visible/hidden" is emitted.
This is wrong because visible/hidden should be handled by
Efl.Gfx.visible, not Efl.Text nor Efl.Content.
This should be changed into elm,state,[part],set/unset"
All relating edc should be fixed.
Test Plan: run elementary_test->button, Efl.Ui.Button
Reviewers: jpeg, cedric, woohyun, Jaehyun_Cho
Differential Revision: https://phab.enlightenment.org/D5798
Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
2018-02-14 11:29:19 -08:00
|
|
|
_signals_emit(sd->obj, type, visible);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2013-02-28 07:18:58 -08:00
|
|
|
/* themes might need immediate action here */
|
efl.ui.layout: change signal name for icon/text
Summary:
when set/unset icon and text,
signal "elm,state,[part],visible/hidden" is emitted.
This is wrong because visible/hidden should be handled by
Efl.Gfx.visible, not Efl.Text nor Efl.Content.
This should be changed into elm,state,[part],set/unset"
All relating edc should be fixed.
Test Plan: run elementary_test->button, Efl.Ui.Button
Reviewers: jpeg, cedric, woohyun, Jaehyun_Cho
Differential Revision: https://phab.enlightenment.org/D5798
Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
2018-02-14 11:29:19 -08:00
|
|
|
efl_layout_signal_process(sd->obj, EINA_FALSE);
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
2018-04-06 09:15:31 -07:00
|
|
|
_text_signal_emit(Efl_Ui_Layout_Object_Data *sd,
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Data *sub_d,
|
2012-05-03 15:41:26 -07:00
|
|
|
Eina_Bool visible)
|
|
|
|
{
|
2012-08-16 14:41:24 -07:00
|
|
|
char buf[1024];
|
|
|
|
const char *type;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2013-07-17 21:02:19 -07:00
|
|
|
//FIXME: Don't limit to "elm.text" prefix.
|
|
|
|
//Send signals for all text parts after elm 2.0
|
2018-04-26 03:27:43 -07:00
|
|
|
if (sub_d->type != TEXT) return;
|
|
|
|
|
|
|
|
if (elm_widget_is_legacy(sd->obj))
|
|
|
|
{
|
|
|
|
if (!((!strcmp("elm.text", sub_d->part)) ||
|
|
|
|
(!strncmp("elm.text.", sub_d->part, 9))))
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!((!strcmp("efl.text", sub_d->part)) ||
|
|
|
|
(!strncmp("efl.text.", sub_d->part, 9))))
|
|
|
|
return;
|
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2013-10-05 00:36:33 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(sd->obj, wd);
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2018-04-26 03:27:43 -07:00
|
|
|
if (elm_widget_is_legacy(sd->obj))
|
|
|
|
{
|
|
|
|
if (!strncmp(sub_d->part, "elm.text.", strlen("elm.text.")))
|
|
|
|
type = sub_d->part + strlen("elm.text.");
|
|
|
|
else
|
|
|
|
type = sub_d->part;
|
|
|
|
}
|
2012-08-16 14:41:24 -07:00
|
|
|
else
|
2018-04-26 03:27:43 -07:00
|
|
|
{
|
|
|
|
if (!strncmp(sub_d->part, "efl.", strlen("efl.")))
|
|
|
|
type = sub_d->part + strlen("efl.");
|
|
|
|
else
|
|
|
|
type = sub_d->part;
|
|
|
|
}
|
2012-08-16 14:41:24 -07:00
|
|
|
|
efl.ui.layout: change signal name for icon/text
Summary:
when set/unset icon and text,
signal "elm,state,[part],visible/hidden" is emitted.
This is wrong because visible/hidden should be handled by
Efl.Gfx.visible, not Efl.Text nor Efl.Content.
This should be changed into elm,state,[part],set/unset"
All relating edc should be fixed.
Test Plan: run elementary_test->button, Efl.Ui.Button
Reviewers: jpeg, cedric, woohyun, Jaehyun_Cho
Differential Revision: https://phab.enlightenment.org/D5798
Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
2018-02-14 11:29:19 -08:00
|
|
|
_signals_emit(sd->obj, type, visible);
|
2012-08-16 14:41:24 -07:00
|
|
|
|
|
|
|
/* TODO: is this right? It was like that, but IMO it should be removed: */
|
2012-05-03 15:41:26 -07:00
|
|
|
|
efl.ui.layout: change signal name for icon/text
Summary:
when set/unset icon and text,
signal "elm,state,[part],visible/hidden" is emitted.
This is wrong because visible/hidden should be handled by
Efl.Gfx.visible, not Efl.Text nor Efl.Content.
This should be changed into elm,state,[part],set/unset"
All relating edc should be fixed.
Test Plan: run elementary_test->button, Efl.Ui.Button
Reviewers: jpeg, cedric, woohyun, Jaehyun_Cho
Differential Revision: https://phab.enlightenment.org/D5798
Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
2018-02-14 11:29:19 -08:00
|
|
|
if (elm_widget_is_legacy(sd->obj))
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf),
|
|
|
|
visible ? "elm,state,text,visible" : "elm,state,text,hidden");
|
|
|
|
efl_layout_signal_emit(sd->obj, buf, "elm");
|
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2013-02-28 07:18:58 -08:00
|
|
|
/* themes might need immediate action here */
|
efl.ui.layout: change signal name for icon/text
Summary:
when set/unset icon and text,
signal "elm,state,[part],visible/hidden" is emitted.
This is wrong because visible/hidden should be handled by
Efl.Gfx.visible, not Efl.Text nor Efl.Content.
This should be changed into elm,state,[part],set/unset"
All relating edc should be fixed.
Test Plan: run elementary_test->button, Efl.Ui.Button
Reviewers: jpeg, cedric, woohyun, Jaehyun_Cho
Differential Revision: https://phab.enlightenment.org/D5798
Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
2018-02-14 11:29:19 -08:00
|
|
|
efl_layout_signal_process(sd->obj, EINA_FALSE);
|
2011-02-08 04:08:28 -08:00
|
|
|
}
|
|
|
|
|
2008-11-15 05:58:50 -08:00
|
|
|
static void
|
2018-04-06 09:15:31 -07:00
|
|
|
_parts_signals_emit(Efl_Ui_Layout_Object_Data *sd)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
|
|
|
const Eina_List *l;
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Data *sub_d;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(sd->subs, l, sub_d)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
|
|
|
_icon_signal_emit(sd, sub_d, EINA_TRUE);
|
|
|
|
_text_signal_emit(sd, sub_d, EINA_TRUE);
|
|
|
|
}
|
2008-11-15 05:58:50 -08:00
|
|
|
}
|
|
|
|
|
2010-10-28 08:54:35 -07:00
|
|
|
static void
|
2017-08-07 21:28:50 -07:00
|
|
|
_part_cursor_part_apply(const Efl_Ui_Layout_Sub_Object_Cursor *pc)
|
2010-10-28 08:54:35 -07:00
|
|
|
{
|
2012-05-03 15:41:26 -07:00
|
|
|
elm_object_cursor_set(pc->obj, pc->cursor);
|
|
|
|
elm_object_cursor_style_set(pc->obj, pc->style);
|
2013-05-01 00:39:51 -07:00
|
|
|
elm_object_cursor_theme_search_enabled_set(pc->obj, !pc->engine_only);
|
2010-10-28 08:54:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2018-04-06 09:15:31 -07:00
|
|
|
_parts_cursors_apply(Efl_Ui_Layout_Object_Data *sd)
|
2010-10-28 08:54:35 -07:00
|
|
|
{
|
2012-05-03 15:41:26 -07:00
|
|
|
const Eina_List *l;
|
|
|
|
const char *file, *group;
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Cursor *pc;
|
2013-10-05 00:36:33 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(sd->obj, wd);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
edje_object_file_get(wd->resize_obj, &file, &group);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(sd->parts_cursors, l, pc)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
|
|
|
Evas_Object *obj = (Evas_Object *)edje_object_part_object_get
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, pc->part);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
|
|
|
if (!obj)
|
|
|
|
{
|
|
|
|
pc->obj = NULL;
|
|
|
|
WRN("no part '%s' in group '%s' of file '%s'. "
|
|
|
|
"Cannot set cursor '%s'",
|
|
|
|
pc->part, group, file, pc->cursor);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else if (evas_object_pass_events_get(obj))
|
|
|
|
{
|
|
|
|
pc->obj = NULL;
|
|
|
|
WRN("part '%s' in group '%s' of file '%s' has mouse_events: 0. "
|
|
|
|
"Cannot set cursor '%s'",
|
|
|
|
pc->part, group, file, pc->cursor);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
pc->obj = obj;
|
|
|
|
_part_cursor_part_apply(pc);
|
|
|
|
}
|
2010-10-28 08:54:35 -07:00
|
|
|
}
|
|
|
|
|
2010-10-29 11:21:58 -07:00
|
|
|
static void
|
2017-08-07 19:48:31 -07:00
|
|
|
_efl_ui_layout_highlight_in_theme(Evas_Object *obj)
|
2015-02-26 21:15:42 -08:00
|
|
|
{
|
|
|
|
const char *fh;
|
|
|
|
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
|
|
|
|
|
|
|
fh = edje_object_data_get
|
|
|
|
(wd->resize_obj, "focus_highlight");
|
|
|
|
if ((fh) && (!strcmp(fh, "on")))
|
|
|
|
elm_widget_highlight_in_theme_set(obj, EINA_TRUE);
|
|
|
|
else
|
|
|
|
elm_widget_highlight_in_theme_set(obj, EINA_FALSE);
|
|
|
|
|
|
|
|
fh = edje_object_data_get
|
|
|
|
(wd->resize_obj, "access_highlight");
|
|
|
|
if ((fh) && (!strcmp(fh, "on")))
|
|
|
|
elm_widget_access_highlight_in_theme_set(obj, EINA_TRUE);
|
|
|
|
else
|
|
|
|
elm_widget_access_highlight_in_theme_set(obj, EINA_FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2012-05-03 15:41:26 -07:00
|
|
|
_visuals_refresh(Evas_Object *obj,
|
2018-04-06 09:15:31 -07:00
|
|
|
Efl_Ui_Layout_Object_Data *sd)
|
2010-10-28 08:54:35 -07:00
|
|
|
{
|
2015-02-26 21:15:42 -08:00
|
|
|
Eina_Bool ret = EINA_FALSE;
|
2013-09-26 10:05:00 -07:00
|
|
|
|
2015-02-26 21:15:42 -08:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
2013-09-26 10:05:00 -07:00
|
|
|
|
2012-05-28 20:09:06 -07:00
|
|
|
_parts_signals_emit(sd);
|
2012-05-03 15:41:26 -07:00
|
|
|
_parts_cursors_apply(sd);
|
|
|
|
|
2015-02-26 21:15:42 -08:00
|
|
|
edje_object_mirrored_set
|
2017-06-13 03:41:15 -07:00
|
|
|
(wd->resize_obj, efl_ui_mirrored_get(obj));
|
2015-02-26 21:15:42 -08:00
|
|
|
|
|
|
|
edje_object_scale_set
|
|
|
|
(wd->resize_obj,
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_scale_get(obj) * elm_config_scale_get());
|
2015-02-26 21:15:42 -08:00
|
|
|
|
2017-08-07 19:48:31 -07:00
|
|
|
_efl_ui_layout_highlight_in_theme(obj);
|
2015-02-26 21:15:42 -08:00
|
|
|
|
2017-10-23 22:03:46 -07:00
|
|
|
ret = efl_ui_widget_on_disabled_update(obj, elm_widget_disabled_get(obj));
|
2015-02-26 21:15:42 -08:00
|
|
|
|
2017-08-02 23:20:58 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2015-02-26 21:15:42 -08:00
|
|
|
|
|
|
|
return ret;
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_object_efl_ui_widget_on_disabled_update(Eo *obj, Efl_Ui_Layout_Object_Data *_pd EINA_UNUSED, Eina_Bool disabled)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2014-03-16 06:43:07 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-08-23 22:06:32 -07:00
|
|
|
// Not calling efl_super here: Elm.Widget simply returns false.
|
|
|
|
|
2018-04-26 04:24:09 -07:00
|
|
|
if (elm_widget_is_legacy(obj))
|
|
|
|
{
|
|
|
|
if (disabled)
|
|
|
|
edje_object_signal_emit
|
|
|
|
(wd->resize_obj, "elm,state,disabled", "elm");
|
|
|
|
else
|
|
|
|
edje_object_signal_emit
|
|
|
|
(wd->resize_obj, "elm,state,enabled", "elm");
|
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
else
|
2018-04-26 04:24:09 -07:00
|
|
|
{
|
|
|
|
if (disabled)
|
|
|
|
edje_object_signal_emit
|
|
|
|
(wd->resize_obj, "efl,state,disabled", "efl");
|
|
|
|
else
|
|
|
|
edje_object_signal_emit
|
|
|
|
(wd->resize_obj, "efl,state,enabled", "efl");
|
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2010-10-28 08:54:35 -07:00
|
|
|
}
|
|
|
|
|
2017-08-09 00:13:06 -07:00
|
|
|
static Efl_Ui_Theme_Apply
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_theme_internal(Eo *obj, Efl_Ui_Layout_Object_Data *sd)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2017-08-09 00:13:06 -07:00
|
|
|
Efl_Ui_Theme_Apply ret = EFL_UI_THEME_APPLY_FAILED;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-08-09 00:13:06 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_UI_THEME_APPLY_FAILED);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
|
|
|
/* function already prints error messages, if any */
|
[layout] support mirrored set for layout which is using elm_layout_file_set()
Summary: mirroed mode does not work, if layout uses elm_layout_file_set().
Test Plan:
the following is test code.
[test.edc]
collections {
group {
name: "layout/test";
parts {
part {
name: "bg";
type: RECT;
description {
state: "default" 0.0;
color: 255 255 0 100;
}
}
part {
name: "test.rect";
type: RECT;
description {
state: "default" 0.0;
color: 255 0 0 255;
rel1.to: bg;
rel1.relative: 0.2 0.1;
rel2.to: bg;
rel2.relative: 0.5 0.2;
}
}
} /* parts */
} /* group */
} /* collections */
[test.c]
//Compile with:
//gcc -g test.c -o test `pkg-config --cflags --libs elementary`
#include <Elementary.h>
#include <Ecore_X.h>
static void
_bt_click(void *data, Evas_Object *obj, void *event_info)
{
Eina_Bool mirrored;
Evas_Object *layout;
layout = data;
mirrored = elm_config_mirrored_get();
mirrored = !mirrored;
printf("mirred: %d\n", mirrored);
elm_config_mirrored_set(mirrored);
}
EAPI_MAIN int
elm_main(int argc, char **argv)
{
Evas_Object *win, *box, *layout, *bt, *check;
char buf[PATH_MAX];
elm_app_info_set(elm_main, "elementary", "./test.edj");
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
win = elm_win_add(NULL, "Layout", ELM_WIN_BASIC);
elm_win_autodel_set(win, EINA_TRUE);
box = elm_box_add(win);
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, box);
evas_object_show(box);
// Adding layout and filling it with widgets
layout = elm_layout_add(win);
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
snprintf(buf, sizeof(buf), "./test.edj");
elm_layout_file_set(layout, buf, "layout/test");
elm_box_pack_end(box, layout);
evas_object_show(layout);
bt = elm_button_add(win);
elm_object_text_set(bt, "mirrored");
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_smart_callback_add(bt, "clicked", _bt_click, layout);
elm_box_pack_end(box, bt);
evas_object_show(bt);
check = elm_check_add(win);
elm_object_text_set(check, "test");
evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(box, check);
evas_object_show(check);
evas_object_resize(win, 500, 500);
evas_object_show(win);
elm_run();
elm_shutdown();
return 0;
}
ELM_MAIN()
Reviewers: seoz, raster, tasn, Hermet
Subscribers: seoz, cedric
Differential Revision: https://phab.enlightenment.org/D2142
2015-06-09 06:05:58 -07:00
|
|
|
if (!sd->file_set)
|
|
|
|
{
|
|
|
|
ret = elm_widget_theme_object_set
|
2017-11-14 01:42:48 -08:00
|
|
|
(obj, wd->resize_obj,
|
|
|
|
elm_widget_theme_klass_get(obj),
|
|
|
|
elm_widget_theme_element_get(obj),
|
|
|
|
elm_widget_theme_style_get(obj));
|
[layout] support mirrored set for layout which is using elm_layout_file_set()
Summary: mirroed mode does not work, if layout uses elm_layout_file_set().
Test Plan:
the following is test code.
[test.edc]
collections {
group {
name: "layout/test";
parts {
part {
name: "bg";
type: RECT;
description {
state: "default" 0.0;
color: 255 255 0 100;
}
}
part {
name: "test.rect";
type: RECT;
description {
state: "default" 0.0;
color: 255 0 0 255;
rel1.to: bg;
rel1.relative: 0.2 0.1;
rel2.to: bg;
rel2.relative: 0.5 0.2;
}
}
} /* parts */
} /* group */
} /* collections */
[test.c]
//Compile with:
//gcc -g test.c -o test `pkg-config --cflags --libs elementary`
#include <Elementary.h>
#include <Ecore_X.h>
static void
_bt_click(void *data, Evas_Object *obj, void *event_info)
{
Eina_Bool mirrored;
Evas_Object *layout;
layout = data;
mirrored = elm_config_mirrored_get();
mirrored = !mirrored;
printf("mirred: %d\n", mirrored);
elm_config_mirrored_set(mirrored);
}
EAPI_MAIN int
elm_main(int argc, char **argv)
{
Evas_Object *win, *box, *layout, *bt, *check;
char buf[PATH_MAX];
elm_app_info_set(elm_main, "elementary", "./test.edj");
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
win = elm_win_add(NULL, "Layout", ELM_WIN_BASIC);
elm_win_autodel_set(win, EINA_TRUE);
box = elm_box_add(win);
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, box);
evas_object_show(box);
// Adding layout and filling it with widgets
layout = elm_layout_add(win);
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
snprintf(buf, sizeof(buf), "./test.edj");
elm_layout_file_set(layout, buf, "layout/test");
elm_box_pack_end(box, layout);
evas_object_show(layout);
bt = elm_button_add(win);
elm_object_text_set(bt, "mirrored");
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_smart_callback_add(bt, "clicked", _bt_click, layout);
elm_box_pack_end(box, bt);
evas_object_show(bt);
check = elm_check_add(win);
elm_object_text_set(check, "test");
evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(box, check);
evas_object_show(check);
evas_object_resize(win, 500, 500);
evas_object_show(win);
elm_run();
elm_shutdown();
return 0;
}
ELM_MAIN()
Reviewers: seoz, raster, tasn, Hermet
Subscribers: seoz, cedric
Differential Revision: https://phab.enlightenment.org/D2142
2015-06-09 06:05:58 -07:00
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
[layout] support mirrored set for layout which is using elm_layout_file_set()
Summary: mirroed mode does not work, if layout uses elm_layout_file_set().
Test Plan:
the following is test code.
[test.edc]
collections {
group {
name: "layout/test";
parts {
part {
name: "bg";
type: RECT;
description {
state: "default" 0.0;
color: 255 255 0 100;
}
}
part {
name: "test.rect";
type: RECT;
description {
state: "default" 0.0;
color: 255 0 0 255;
rel1.to: bg;
rel1.relative: 0.2 0.1;
rel2.to: bg;
rel2.relative: 0.5 0.2;
}
}
} /* parts */
} /* group */
} /* collections */
[test.c]
//Compile with:
//gcc -g test.c -o test `pkg-config --cflags --libs elementary`
#include <Elementary.h>
#include <Ecore_X.h>
static void
_bt_click(void *data, Evas_Object *obj, void *event_info)
{
Eina_Bool mirrored;
Evas_Object *layout;
layout = data;
mirrored = elm_config_mirrored_get();
mirrored = !mirrored;
printf("mirred: %d\n", mirrored);
elm_config_mirrored_set(mirrored);
}
EAPI_MAIN int
elm_main(int argc, char **argv)
{
Evas_Object *win, *box, *layout, *bt, *check;
char buf[PATH_MAX];
elm_app_info_set(elm_main, "elementary", "./test.edj");
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
win = elm_win_add(NULL, "Layout", ELM_WIN_BASIC);
elm_win_autodel_set(win, EINA_TRUE);
box = elm_box_add(win);
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, box);
evas_object_show(box);
// Adding layout and filling it with widgets
layout = elm_layout_add(win);
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
snprintf(buf, sizeof(buf), "./test.edj");
elm_layout_file_set(layout, buf, "layout/test");
elm_box_pack_end(box, layout);
evas_object_show(layout);
bt = elm_button_add(win);
elm_object_text_set(bt, "mirrored");
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_smart_callback_add(bt, "clicked", _bt_click, layout);
elm_box_pack_end(box, bt);
evas_object_show(bt);
check = elm_check_add(win);
elm_object_text_set(check, "test");
evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(box, check);
evas_object_show(check);
evas_object_resize(win, 500, 500);
evas_object_show(win);
elm_run();
elm_shutdown();
return 0;
}
ELM_MAIN()
Reviewers: seoz, raster, tasn, Hermet
Subscribers: seoz, cedric
Differential Revision: https://phab.enlightenment.org/D2142
2015-06-09 06:05:58 -07:00
|
|
|
if (ret)
|
2018-04-06 09:15:31 -07:00
|
|
|
efl_event_callback_legacy_call(obj, EFL_UI_LAYOUT_OBJECT_EVENT_THEME_CHANGED, NULL);
|
2012-05-03 15:41:26 -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
|
|
|
if (!_visuals_refresh(obj, sd))
|
2017-08-09 00:13:06 -07:00
|
|
|
ret = EFL_UI_THEME_APPLY_FAILED;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2014-01-09 03:33:30 -08:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2017-08-09 00:13:06 -07:00
|
|
|
EOLIAN static Efl_Ui_Theme_Apply
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_object_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Layout_Object_Data *sd)
|
2014-01-09 03:33:30 -08:00
|
|
|
{
|
2017-08-09 00:13:06 -07:00
|
|
|
Efl_Ui_Theme_Apply theme_apply = EFL_UI_THEME_APPLY_FAILED;
|
2014-01-09 03:33:30 -08:00
|
|
|
|
2017-10-23 22:03:46 -07:00
|
|
|
theme_apply = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS));
|
2017-08-09 00:13:06 -07:00
|
|
|
if (!theme_apply) return EFL_UI_THEME_APPLY_FAILED;
|
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
|
|
|
|
2017-08-07 19:48:31 -07:00
|
|
|
theme_apply &= _efl_ui_layout_theme_internal(obj, sd);
|
2017-08-02 05:15:50 -07:00
|
|
|
return theme_apply;
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
2010-10-28 08:54:35 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_object_efl_ui_focus_object_on_focus_update(Eo *obj, Efl_Ui_Layout_Object_Data *_pd EINA_UNUSED)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2014-03-16 06:43:07 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
2013-06-06 09:13:37 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
if (!elm_widget_can_focus_get(obj)) return EINA_FALSE;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-11-29 00:39:42 -08:00
|
|
|
if (efl_ui_focus_object_focus_get(obj))
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2018-04-26 04:24:09 -07:00
|
|
|
if (elm_widget_is_legacy(obj))
|
|
|
|
elm_layout_signal_emit(obj, "elm,action,focus", "elm");
|
|
|
|
else
|
|
|
|
elm_layout_signal_emit(obj, "efl,action,focus", "efl");
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_object_focus_set(wd->resize_obj, EINA_TRUE);
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-04-26 04:24:09 -07:00
|
|
|
if (elm_widget_is_legacy(obj))
|
|
|
|
elm_layout_signal_emit(obj, "elm,action,unfocus", "elm");
|
|
|
|
else
|
|
|
|
elm_layout_signal_emit(obj, "efl,action,unfocus", "efl");
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_object_focus_set(wd->resize_obj, EINA_FALSE);
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
2017-11-20 12:12:34 -08:00
|
|
|
|
2018-01-19 00:25:47 -08:00
|
|
|
efl_ui_focus_object_on_focus_update(efl_super(obj, MY_CLASS));
|
2017-11-20 12:12:34 -08:00
|
|
|
|
2017-12-05 19:15:39 -08:00
|
|
|
if (efl_isa(wd->resize_obj, EFL_CANVAS_LAYOUT_CLASS))
|
2015-06-30 21:08:32 -07:00
|
|
|
edje_object_message_signal_process(wd->resize_obj);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_object_efl_ui_widget_widget_sub_object_add(Eo *obj, Efl_Ui_Layout_Object_Data *_pd EINA_UNUSED, Evas_Object *sobj)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
if (evas_object_data_get(sobj, "elm-parent") == obj) return EINA_TRUE;
|
2013-01-03 01:52:57 -08:00
|
|
|
|
2017-08-23 04:41:37 -07:00
|
|
|
int_ret = elm_widget_sub_object_add(efl_super(obj, MY_CLASS), sobj);
|
2014-03-16 06:43:07 -07:00
|
|
|
if (!int_ret) return EINA_FALSE;
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2017-08-02 05:39:25 -07:00
|
|
|
evas_object_event_callback_add
|
|
|
|
(sobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_on_sub_object_size_hint_change, obj);
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_object_efl_ui_widget_widget_sub_object_del(Eo *obj, Efl_Ui_Layout_Object_Data *sd, Evas_Object *sobj)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
|
|
|
Eina_List *l;
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Data *sub_d;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(sobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_on_sub_object_size_hint_change, obj);
|
|
|
|
|
2017-08-23 04:41:37 -07:00
|
|
|
int_ret = elm_widget_sub_object_del(efl_super(obj, MY_CLASS), sobj);
|
2014-03-16 06:43:07 -07:00
|
|
|
if (!int_ret) return EINA_FALSE;
|
2014-05-13 20:02:10 -07:00
|
|
|
if (sd->destructed_is) return EINA_TRUE;
|
2012-05-23 14:56:44 -07:00
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(sd->subs, l, sub_d)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
|
|
|
if (sub_d->obj != sobj) continue;
|
|
|
|
|
|
|
|
sd->subs = eina_list_remove_list(sd->subs, l);
|
|
|
|
|
|
|
|
_icon_signal_emit(sd, sub_d, EINA_FALSE);
|
|
|
|
|
|
|
|
eina_stringshare_del(sub_d->part);
|
|
|
|
free(sub_d);
|
|
|
|
|
|
|
|
break;
|
2010-09-24 07:47:59 -07:00
|
|
|
}
|
|
|
|
|
2018-05-04 14:40:06 -07:00
|
|
|
// No need to resize object during destruction
|
|
|
|
if (!efl_invalidated_get(obj))
|
|
|
|
elm_layout_sizing_eval(obj);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2010-09-24 07:47:59 -07:00
|
|
|
}
|
|
|
|
|
2009-11-17 08:32:45 -08:00
|
|
|
static void
|
2012-05-03 15:41:26 -07:00
|
|
|
_edje_signal_callback(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
2012-05-03 15:41:26 -07:00
|
|
|
const char *emission,
|
|
|
|
const char *source)
|
2009-11-17 08:32:45 -08:00
|
|
|
{
|
2012-05-25 12:53:59 -07:00
|
|
|
Edje_Signal_Data *esd = data;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2012-05-25 12:53:59 -07:00
|
|
|
esd->func(esd->data, esd->obj, emission, source);
|
2009-11-17 08:32:45 -08:00
|
|
|
}
|
|
|
|
|
2017-06-29 03:32:19 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
_elm_layout_part_aliasing_eval(const Evas_Object *obj,
|
2012-05-03 15:41:26 -07:00
|
|
|
const char **part,
|
|
|
|
Eina_Bool is_text)
|
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
const Elm_Layout_Part_Alias_Description *aliases = NULL;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2018-04-26 03:27:43 -07:00
|
|
|
if (!elm_widget_is_legacy(obj))
|
|
|
|
{
|
|
|
|
if (!*part)
|
|
|
|
{
|
|
|
|
if (is_text)
|
|
|
|
*part = efl_ui_default_text;
|
|
|
|
else
|
|
|
|
*part = efl_ui_default_content;
|
|
|
|
}
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
if (is_text)
|
2017-07-27 23:35:10 -07:00
|
|
|
aliases = elm_layout_text_aliases_get(obj);
|
2012-11-25 22:32:53 -08:00
|
|
|
else
|
2017-07-27 23:35:10 -07:00
|
|
|
aliases = elm_layout_content_aliases_get(obj);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2012-11-29 22:18:48 -08:00
|
|
|
while (aliases && aliases->alias && aliases->real_part)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
|
|
|
/* NULL matches the 1st */
|
|
|
|
if ((!*part) || (!strcmp(*part, aliases->alias)))
|
|
|
|
{
|
|
|
|
*part = aliases->real_part;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
aliases++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!*part)
|
|
|
|
{
|
|
|
|
ERR("no default content part set for object %p -- "
|
2017-06-29 03:32:19 -07:00
|
|
|
"part must not be NULL", obj);
|
2012-05-03 15:41:26 -07:00
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if no match, part goes on with the same value */
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2016-04-07 06:50:32 -07:00
|
|
|
static void
|
|
|
|
_eo_unparent_helper(Eo *child, Eo *parent)
|
|
|
|
{
|
2016-08-10 07:23:04 -07:00
|
|
|
if (efl_parent_get(child) == parent)
|
2016-04-07 06:50:32 -07:00
|
|
|
{
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_parent_set(child, evas_object_evas_get(parent));
|
2016-04-07 06:50:32 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
static void
|
2013-08-29 00:39:20 -07:00
|
|
|
_box_reference_del(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Data *sub_d = data;
|
2013-08-29 00:39:20 -07:00
|
|
|
sub_d->p.box.reference = NULL;
|
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
static Evas_Object *
|
|
|
|
_sub_box_remove(Evas_Object *obj,
|
2018-04-06 09:15:31 -07:00
|
|
|
Efl_Ui_Layout_Object_Data *sd,
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Data *sub_d)
|
2013-08-29 00:39:20 -07:00
|
|
|
{
|
|
|
|
Evas_Object *child = sub_d->obj; /* sub_d will die in
|
2017-08-23 04:41:37 -07:00
|
|
|
* _efl_ui_layout_smart_widget_sub_object_del */
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
if (sub_d->type == BOX_INSERT_BEFORE)
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
((Evas_Object *)sub_d->p.box.reference,
|
|
|
|
EVAS_CALLBACK_DEL, _box_reference_del, sub_d);
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2013-10-05 00:36:33 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(sd->obj, wd, NULL);
|
2013-08-29 00:39:20 -07:00
|
|
|
edje_object_part_box_remove
|
|
|
|
(wd->resize_obj, sub_d->part, child);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2016-04-07 06:50:32 -07:00
|
|
|
_eo_unparent_helper(child, obj);
|
2016-05-29 17:47:39 -07:00
|
|
|
if (!_elm_widget_sub_object_redirect_to_top(obj, child))
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2013-08-29 00:39:20 -07:00
|
|
|
ERR("could not remove sub object %p from %p", child, obj);
|
|
|
|
return NULL;
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
return child;
|
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
static Eina_Bool
|
2017-08-07 21:28:50 -07:00
|
|
|
_sub_box_is(const Efl_Ui_Layout_Sub_Object_Data *sub_d)
|
2013-08-29 00:39:20 -07:00
|
|
|
{
|
|
|
|
switch (sub_d->type)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2013-08-29 00:39:20 -07:00
|
|
|
case BOX_APPEND:
|
|
|
|
case BOX_PREPEND:
|
|
|
|
case BOX_INSERT_BEFORE:
|
|
|
|
case BOX_INSERT_AT:
|
|
|
|
return EINA_TRUE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return EINA_FALSE;
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
2013-08-29 00:39:20 -07:00
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
static Evas_Object *
|
|
|
|
_sub_table_remove(Evas_Object *obj,
|
2018-04-06 09:15:31 -07:00
|
|
|
Efl_Ui_Layout_Object_Data *sd,
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Data *sub_d)
|
2013-08-29 00:39:20 -07:00
|
|
|
{
|
|
|
|
Evas_Object *child;
|
2013-10-05 00:36:33 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(sd->obj, wd, NULL);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-08-23 04:41:37 -07:00
|
|
|
child = sub_d->obj; /* sub_d will die in _efl_ui_layout_smart_widget_sub_object_del */
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
edje_object_part_table_unpack
|
|
|
|
(wd->resize_obj, sub_d->part, child);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2016-04-07 06:50:32 -07:00
|
|
|
_eo_unparent_helper(child, obj);
|
|
|
|
|
2016-05-29 17:47:39 -07:00
|
|
|
if (!_elm_widget_sub_object_redirect_to_top(obj, child))
|
2013-08-29 00:39:20 -07:00
|
|
|
{
|
|
|
|
ERR("could not remove sub object %p from %p", child, obj);
|
|
|
|
return NULL;
|
|
|
|
}
|
2012-06-25 22:54:45 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
return child;
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
static void
|
2013-08-29 00:39:20 -07:00
|
|
|
_on_size_evaluate_signal(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2017-08-02 23:20:58 -07:00
|
|
|
elm_layout_sizing_eval(data);
|
2013-08-29 00:39:20 -07:00
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
EOLIAN static void
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Layout_Object_Data *_pd EINA_UNUSED)
|
2013-08-29 00:39:20 -07:00
|
|
|
{
|
|
|
|
Evas_Object *edje;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2013-09-24 21:33:39 -07:00
|
|
|
elm_widget_sub_object_parent_add(obj);
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
/* has to be there *before* parent's smart_add() */
|
|
|
|
edje = edje_object_add(evas_object_evas_get(obj));
|
2017-08-08 05:06:43 -07:00
|
|
|
elm_widget_resize_object_set(obj, edje);
|
2013-08-29 00:39:20 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_add(efl_super(obj, MY_CLASS));
|
2013-08-29 00:39:20 -07:00
|
|
|
|
|
|
|
elm_widget_can_focus_set(obj, EINA_FALSE);
|
|
|
|
|
2018-04-26 04:24:09 -07:00
|
|
|
if (elm_widget_is_legacy(obj))
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(edje, "size,eval", "elm", _on_size_evaluate_signal, obj);
|
|
|
|
else
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(edje, "size,eval", "efl", _on_size_evaluate_signal, obj);
|
2013-08-29 00:39:20 -07:00
|
|
|
|
2017-08-02 23:20:58 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
EOLIAN static void
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Layout_Object_Data *sd)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Data *sub_d;
|
|
|
|
Efl_Ui_Layout_Sub_Object_Cursor *pc;
|
2013-08-29 00:39:20 -07:00
|
|
|
Edje_Signal_Data *esd;
|
|
|
|
Evas_Object *child;
|
2018-01-21 02:26:38 -08:00
|
|
|
Eina_List *l;
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2013-10-05 00:36:33 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
elm_layout_freeze(obj);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2018-01-21 02:26:38 -08:00
|
|
|
EINA_LIST_FREE(sd->subs, sub_d)
|
|
|
|
{
|
|
|
|
eina_stringshare_del(sub_d->part);
|
|
|
|
free(sub_d);
|
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
EINA_LIST_FREE(sd->parts_cursors, pc)
|
|
|
|
_part_cursor_free(pc);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
EINA_LIST_FREE(sd->edje_signals, esd)
|
|
|
|
{
|
2014-02-07 01:06:05 -08:00
|
|
|
edje_object_signal_callback_del_full
|
|
|
|
(wd->resize_obj, esd->emission, esd->source,
|
|
|
|
_edje_signal_callback, esd);
|
2013-08-29 00:39:20 -07:00
|
|
|
eina_stringshare_del(esd->emission);
|
|
|
|
eina_stringshare_del(esd->source);
|
|
|
|
free(esd);
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
|
2018-01-26 16:56:53 -08:00
|
|
|
if(sd->connect.model)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
2018-01-26 16:56:53 -08:00
|
|
|
efl_event_callback_del(sd->connect.model, EFL_MODEL_EVENT_PROPERTIES_CHANGED,
|
|
|
|
_efl_model_properties_changed_cb, sd);
|
|
|
|
efl_unref(sd->connect.model);
|
|
|
|
sd->connect.model = NULL;
|
2017-01-31 12:17:58 -08:00
|
|
|
}
|
2017-09-06 20:07:08 -07:00
|
|
|
|
2018-01-26 16:56:53 -08:00
|
|
|
eina_hash_free(sd->connect.properties);
|
|
|
|
sd->connect.properties = NULL;
|
|
|
|
eina_hash_free(sd->connect.signals);
|
|
|
|
sd->connect.signals = NULL;
|
|
|
|
eina_hash_free(sd->connect.factories);
|
|
|
|
sd->connect.factories = NULL;
|
2017-01-31 12:17:58 -08:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
/* let's make our Edje object the *last* to be processed, since it
|
|
|
|
* may (smart) parent other sub objects here */
|
|
|
|
EINA_LIST_FOREACH(wd->subobjs, l, child)
|
|
|
|
{
|
|
|
|
if (child == wd->resize_obj)
|
|
|
|
{
|
|
|
|
wd->subobjs =
|
|
|
|
eina_list_demote_list(wd->subobjs, l);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2014-05-13 20:02:10 -07:00
|
|
|
sd->destructed_is = EINA_TRUE;
|
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_del(efl_super(obj, MY_CLASS));
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
/* rewrite or extend this one on your derived class as to suit your
|
|
|
|
* needs */
|
2014-03-16 06:43:07 -07:00
|
|
|
EOLIAN static void
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_object_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Layout_Object_Data *sd)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2013-08-29 00:39:20 -07:00
|
|
|
if (sd->needs_size_calc)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2013-08-29 00:39:20 -07:00
|
|
|
_sizing_eval(obj, sd);
|
|
|
|
sd->needs_size_calc = EINA_FALSE;
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-07 21:28:50 -07:00
|
|
|
static Efl_Ui_Layout_Sub_Object_Cursor *
|
2018-04-06 09:15:31 -07:00
|
|
|
_parts_cursors_find(Efl_Ui_Layout_Object_Data *sd,
|
2013-08-29 00:39:20 -07:00
|
|
|
const char *part)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
|
|
|
const Eina_List *l;
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Cursor *pc;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
EINA_LIST_FOREACH(sd->parts_cursors, l, pc)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2013-08-29 00:39:20 -07:00
|
|
|
if (!strcmp(pc->part, part))
|
|
|
|
return pc;
|
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
return NULL;
|
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
/* The public functions down here are meant to operate on whichever
|
|
|
|
* widget inheriting from elm_layout */
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_object_efl_file_file_set(Eo *obj, Efl_Ui_Layout_Object_Data *sd, const char *file, const char *group)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2013-08-29 00:39:20 -07:00
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
int_ret =
|
|
|
|
edje_object_file_set(wd->resize_obj, file, group);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
[layout] support mirrored set for layout which is using elm_layout_file_set()
Summary: mirroed mode does not work, if layout uses elm_layout_file_set().
Test Plan:
the following is test code.
[test.edc]
collections {
group {
name: "layout/test";
parts {
part {
name: "bg";
type: RECT;
description {
state: "default" 0.0;
color: 255 255 0 100;
}
}
part {
name: "test.rect";
type: RECT;
description {
state: "default" 0.0;
color: 255 0 0 255;
rel1.to: bg;
rel1.relative: 0.2 0.1;
rel2.to: bg;
rel2.relative: 0.5 0.2;
}
}
} /* parts */
} /* group */
} /* collections */
[test.c]
//Compile with:
//gcc -g test.c -o test `pkg-config --cflags --libs elementary`
#include <Elementary.h>
#include <Ecore_X.h>
static void
_bt_click(void *data, Evas_Object *obj, void *event_info)
{
Eina_Bool mirrored;
Evas_Object *layout;
layout = data;
mirrored = elm_config_mirrored_get();
mirrored = !mirrored;
printf("mirred: %d\n", mirrored);
elm_config_mirrored_set(mirrored);
}
EAPI_MAIN int
elm_main(int argc, char **argv)
{
Evas_Object *win, *box, *layout, *bt, *check;
char buf[PATH_MAX];
elm_app_info_set(elm_main, "elementary", "./test.edj");
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
win = elm_win_add(NULL, "Layout", ELM_WIN_BASIC);
elm_win_autodel_set(win, EINA_TRUE);
box = elm_box_add(win);
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, box);
evas_object_show(box);
// Adding layout and filling it with widgets
layout = elm_layout_add(win);
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
snprintf(buf, sizeof(buf), "./test.edj");
elm_layout_file_set(layout, buf, "layout/test");
elm_box_pack_end(box, layout);
evas_object_show(layout);
bt = elm_button_add(win);
elm_object_text_set(bt, "mirrored");
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_smart_callback_add(bt, "clicked", _bt_click, layout);
elm_box_pack_end(box, bt);
evas_object_show(bt);
check = elm_check_add(win);
elm_object_text_set(check, "test");
evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(box, check);
evas_object_show(check);
evas_object_resize(win, 500, 500);
evas_object_show(win);
elm_run();
elm_shutdown();
return 0;
}
ELM_MAIN()
Reviewers: seoz, raster, tasn, Hermet
Subscribers: seoz, cedric
Differential Revision: https://phab.enlightenment.org/D2142
2015-06-09 06:05:58 -07:00
|
|
|
if (int_ret)
|
|
|
|
{
|
|
|
|
sd->file_set = EINA_TRUE;
|
|
|
|
_visuals_refresh(obj, sd);
|
|
|
|
}
|
2013-08-29 00:39:20 -07:00
|
|
|
else
|
|
|
|
ERR("failed to set edje file '%s', group '%s': %s",
|
|
|
|
file, group,
|
|
|
|
edje_load_error_str
|
|
|
|
(edje_object_load_error_get(wd->resize_obj)));
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return int_ret;
|
2013-08-29 00:39:20 -07:00
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2015-03-19 05:08:23 -07:00
|
|
|
EOLIAN static void
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_object_efl_file_file_get(const Eo *obj, Efl_Ui_Layout_Object_Data *sd EINA_UNUSED, const char **file, const char **group)
|
2015-03-19 05:08:23 -07:00
|
|
|
{
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
|
|
|
edje_object_file_get(wd->resize_obj, file, group);
|
|
|
|
}
|
|
|
|
|
2016-11-07 14:42:04 -08:00
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_object_efl_file_mmap_set(Eo *obj, Efl_Ui_Layout_Object_Data *sd, const Eina_File *file, const char *group)
|
2016-11-07 14:42:04 -08:00
|
|
|
{
|
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
|
|
|
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
|
|
|
|
|
|
|
int_ret =
|
|
|
|
edje_object_mmap_set(wd->resize_obj, file, group);
|
|
|
|
|
|
|
|
if (int_ret)
|
|
|
|
{
|
|
|
|
sd->file_set = EINA_TRUE;
|
|
|
|
_visuals_refresh(obj, sd);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ERR("failed to set edje mmap file %p, group '%s': %s",
|
|
|
|
file, group,
|
|
|
|
edje_load_error_str
|
|
|
|
(edje_object_load_error_get(wd->resize_obj)));
|
|
|
|
|
|
|
|
return int_ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_object_efl_file_mmap_get(const Eo *obj, Efl_Ui_Layout_Object_Data *sd EINA_UNUSED, const Eina_File **file, const char **group)
|
2016-11-07 14:42:04 -08:00
|
|
|
{
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
|
|
|
efl_file_mmap_get(wd->resize_obj, file, group);
|
|
|
|
}
|
|
|
|
|
2017-08-09 00:13:06 -07:00
|
|
|
EOLIAN static Efl_Ui_Theme_Apply
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_object_theme_set(Eo *obj, Efl_Ui_Layout_Object_Data *sd, const char *klass, const char *group, const char *style)
|
2013-08-29 00:39:20 -07:00
|
|
|
{
|
2017-11-14 01:42:48 -08:00
|
|
|
Eina_Bool changed = EINA_FALSE;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2018-01-23 22:50:58 -08:00
|
|
|
if (!elm_widget_is_legacy(obj) && efl_finalized_get(obj))
|
2017-08-09 00:22:48 -07:00
|
|
|
{
|
|
|
|
ERR("Efl.Ui.Layout.theme can only be set before finalize!");
|
|
|
|
return EFL_UI_THEME_APPLY_FAILED;
|
|
|
|
}
|
|
|
|
|
[layout] support mirrored set for layout which is using elm_layout_file_set()
Summary: mirroed mode does not work, if layout uses elm_layout_file_set().
Test Plan:
the following is test code.
[test.edc]
collections {
group {
name: "layout/test";
parts {
part {
name: "bg";
type: RECT;
description {
state: "default" 0.0;
color: 255 255 0 100;
}
}
part {
name: "test.rect";
type: RECT;
description {
state: "default" 0.0;
color: 255 0 0 255;
rel1.to: bg;
rel1.relative: 0.2 0.1;
rel2.to: bg;
rel2.relative: 0.5 0.2;
}
}
} /* parts */
} /* group */
} /* collections */
[test.c]
//Compile with:
//gcc -g test.c -o test `pkg-config --cflags --libs elementary`
#include <Elementary.h>
#include <Ecore_X.h>
static void
_bt_click(void *data, Evas_Object *obj, void *event_info)
{
Eina_Bool mirrored;
Evas_Object *layout;
layout = data;
mirrored = elm_config_mirrored_get();
mirrored = !mirrored;
printf("mirred: %d\n", mirrored);
elm_config_mirrored_set(mirrored);
}
EAPI_MAIN int
elm_main(int argc, char **argv)
{
Evas_Object *win, *box, *layout, *bt, *check;
char buf[PATH_MAX];
elm_app_info_set(elm_main, "elementary", "./test.edj");
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
win = elm_win_add(NULL, "Layout", ELM_WIN_BASIC);
elm_win_autodel_set(win, EINA_TRUE);
box = elm_box_add(win);
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, box);
evas_object_show(box);
// Adding layout and filling it with widgets
layout = elm_layout_add(win);
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
snprintf(buf, sizeof(buf), "./test.edj");
elm_layout_file_set(layout, buf, "layout/test");
elm_box_pack_end(box, layout);
evas_object_show(layout);
bt = elm_button_add(win);
elm_object_text_set(bt, "mirrored");
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_smart_callback_add(bt, "clicked", _bt_click, layout);
elm_box_pack_end(box, bt);
evas_object_show(bt);
check = elm_check_add(win);
elm_object_text_set(check, "test");
evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(box, check);
evas_object_show(check);
evas_object_resize(win, 500, 500);
evas_object_show(win);
elm_run();
elm_shutdown();
return 0;
}
ELM_MAIN()
Reviewers: seoz, raster, tasn, Hermet
Subscribers: seoz, cedric
Differential Revision: https://phab.enlightenment.org/D2142
2015-06-09 06:05:58 -07:00
|
|
|
if (sd->file_set) sd->file_set = EINA_FALSE;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-11-14 01:42:48 -08:00
|
|
|
changed |= elm_widget_theme_klass_set(obj, klass);
|
|
|
|
changed |= elm_widget_theme_element_set(obj, group);
|
|
|
|
changed |= elm_widget_theme_style_set(obj, style);
|
|
|
|
|
|
|
|
if (changed)
|
|
|
|
return efl_ui_widget_theme_apply(obj);
|
|
|
|
return EFL_UI_THEME_APPLY_SUCCESS;
|
2010-09-26 17:51:16 -07:00
|
|
|
}
|
|
|
|
|
2016-08-05 10:31:49 -07:00
|
|
|
EOLIAN static void
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_object_efl_layout_signal_signal_emit(Eo *obj, Efl_Ui_Layout_Object_Data *_pd EINA_UNUSED, const char *emission, const char *source)
|
2012-05-02 09:58:10 -07:00
|
|
|
{
|
2017-08-03 01:24:50 -07:00
|
|
|
// Don't do anything else than call forward here
|
2016-08-05 10:31:49 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2017-12-04 21:39:20 -08:00
|
|
|
efl_layout_signal_emit(wd->resize_obj, emission, source);
|
2013-08-29 00:39:20 -07:00
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-08-03 01:24:50 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_object_efl_layout_signal_signal_callback_add(Eo *obj, Efl_Ui_Layout_Object_Data *_pd EINA_UNUSED, const char *emission, const char *source, Efl_Signal_Cb func, void *data)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2017-08-03 01:24:50 -07:00
|
|
|
// Don't do anything else than call forward here
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
2017-12-04 21:39:20 -08:00
|
|
|
return efl_layout_signal_callback_add(wd->resize_obj, emission, source, func, data);
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
|
2017-08-03 01:24:50 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_object_efl_layout_signal_signal_callback_del(Eo *obj, Efl_Ui_Layout_Object_Data *_pd EINA_UNUSED, const char *emission, const char *source, Edje_Signal_Cb func, void *data)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2017-08-03 01:24:50 -07:00
|
|
|
// Don't do anything else than call forward here
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
2017-12-04 21:39:20 -08:00
|
|
|
return efl_layout_signal_callback_add(wd->resize_obj, emission, source, func, data);
|
2013-08-29 00:39:20 -07:00
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-08-03 01:24:50 -07:00
|
|
|
// TODO:
|
|
|
|
// - message_send
|
|
|
|
// - message_signal_process
|
|
|
|
// and also message handler (not implemented yet as an EO interface!)
|
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
EAPI Eina_Bool
|
2017-09-19 23:16:12 -07:00
|
|
|
elm_layout_content_set(Evas_Object *obj, const char *swallow, Evas_Object *content)
|
2013-08-29 00:39:20 -07:00
|
|
|
{
|
2017-08-07 21:28:50 -07:00
|
|
|
EFL_UI_LAYOUT_CHECK(obj) EINA_FALSE;
|
2017-07-03 19:37:37 -07:00
|
|
|
if (!swallow)
|
|
|
|
{
|
2018-01-07 20:55:35 -08:00
|
|
|
swallow = efl_ui_widget_default_content_part_get(obj);
|
2017-07-03 19:37:37 -07:00
|
|
|
if (!swallow) return EINA_FALSE;
|
|
|
|
}
|
2017-09-19 23:16:12 -07:00
|
|
|
else if (!_elm_layout_part_aliasing_eval(obj, &swallow, EINA_FALSE))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
2016-05-24 04:40:18 -07:00
|
|
|
return efl_content_set(efl_part(obj, swallow), content);
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
|
2016-05-24 04:40:18 -07:00
|
|
|
static Eina_Bool
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_content_set(Eo *obj, Efl_Ui_Layout_Object_Data *sd, const char *part, Evas_Object *content)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Data *sub_d;
|
2017-09-20 01:31:23 -07:00
|
|
|
Eina_List *l;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
EINA_LIST_FOREACH(sd->subs, l, sub_d)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2013-08-29 00:39:20 -07:00
|
|
|
if (sub_d->type == SWALLOW)
|
|
|
|
{
|
|
|
|
if (!strcmp(part, sub_d->part))
|
|
|
|
{
|
|
|
|
if (content == sub_d->obj) goto end;
|
2016-04-07 06:50:32 -07:00
|
|
|
_eo_unparent_helper(sub_d->obj, obj);
|
2013-08-29 00:39:20 -07:00
|
|
|
evas_object_del(sub_d->obj);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* was previously swallowed at another part -- mimic
|
|
|
|
* edje_object_part_swallow()'s behavior, then */
|
|
|
|
else if (content == sub_d->obj)
|
|
|
|
{
|
2017-09-20 01:31:23 -07:00
|
|
|
sd->subs = eina_list_remove_list(sd->subs, l);
|
|
|
|
_icon_signal_emit(sd, sub_d, EINA_FALSE);
|
|
|
|
eina_stringshare_del(sub_d->part);
|
|
|
|
free(sub_d);
|
|
|
|
|
2016-05-29 17:47:39 -07:00
|
|
|
_elm_widget_sub_object_redirect_to_top(obj, content);
|
2013-08-29 00:39:20 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
if (content)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2013-08-29 00:39:20 -07:00
|
|
|
if (!elm_widget_sub_object_add(obj, content))
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_FALSE;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
if (!edje_object_part_swallow
|
|
|
|
(wd->resize_obj, part, content))
|
|
|
|
{
|
|
|
|
ERR("could not swallow %p into part '%s'", content, part);
|
2016-05-29 17:47:39 -07:00
|
|
|
_elm_widget_sub_object_redirect_to_top(obj, content);
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_FALSE;
|
2013-08-29 00:39:20 -07:00
|
|
|
}
|
2017-08-07 21:28:50 -07:00
|
|
|
sub_d = ELM_NEW(Efl_Ui_Layout_Sub_Object_Data);
|
2015-06-14 22:56:42 -07:00
|
|
|
if (!sub_d)
|
|
|
|
{
|
|
|
|
ERR("failed to allocate memory!");
|
2015-06-14 23:35:31 -07:00
|
|
|
edje_object_part_unswallow(wd->resize_obj, content);
|
2016-05-29 17:47:39 -07:00
|
|
|
_elm_widget_sub_object_redirect_to_top(obj, content);
|
2015-06-14 22:56:42 -07:00
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2013-08-29 00:39:20 -07:00
|
|
|
sub_d->type = SWALLOW;
|
|
|
|
sub_d->part = eina_stringshare_add(part);
|
|
|
|
sub_d->obj = content;
|
|
|
|
sd->subs = eina_list_append(sd->subs, sub_d);
|
|
|
|
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_parent_set(content, obj);
|
2013-08-29 00:39:20 -07:00
|
|
|
_icon_signal_emit(sd, sub_d, EINA_TRUE);
|
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-08-02 23:20:58 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
end:
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2010-09-26 17:51:16 -07:00
|
|
|
}
|
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
EAPI Evas_Object *
|
2017-09-19 19:16:17 -07:00
|
|
|
elm_layout_content_get(const Evas_Object *obj, const char *swallow)
|
2010-09-26 17:51:16 -07:00
|
|
|
{
|
2017-08-07 21:28:50 -07:00
|
|
|
EFL_UI_LAYOUT_CHECK(obj) NULL;
|
2018-05-04 14:46:51 -07:00
|
|
|
// If the object is already dead, their shouldn't be any part in it
|
|
|
|
if (efl_invalidated_get(obj)) return NULL;
|
2017-07-03 19:37:37 -07:00
|
|
|
if (!swallow)
|
|
|
|
{
|
2018-01-07 20:55:35 -08:00
|
|
|
swallow = efl_ui_widget_default_content_part_get(obj);
|
2017-07-03 19:37:37 -07:00
|
|
|
if (!swallow) return NULL;
|
|
|
|
}
|
2017-09-19 19:16:17 -07:00
|
|
|
else if (!_elm_layout_part_aliasing_eval(obj, &swallow, EINA_FALSE))
|
|
|
|
return NULL;
|
2017-09-19 23:16:12 -07:00
|
|
|
|
2016-05-24 04:40:18 -07:00
|
|
|
return efl_content_get(efl_part(obj, swallow));
|
2010-09-26 17:51:16 -07:00
|
|
|
}
|
|
|
|
|
2016-05-24 04:40:18 -07:00
|
|
|
static Evas_Object*
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_content_get(Eo *obj, Efl_Ui_Layout_Object_Data *sd, const char *part)
|
2010-09-26 17:51:16 -07:00
|
|
|
{
|
2013-08-29 00:39:20 -07:00
|
|
|
const Eina_List *l;
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Data *sub_d;
|
2010-09-26 17:51:16 -07:00
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(sd->subs, l, sub_d)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2016-04-25 05:36:56 -07:00
|
|
|
if ((sub_d->type != TEXT) && !strcmp(part, sub_d->part))
|
|
|
|
{
|
|
|
|
if (sub_d->type == SWALLOW)
|
|
|
|
return sub_d->obj;
|
|
|
|
}
|
2012-05-02 18:19:05 -07:00
|
|
|
}
|
2014-03-16 06:43:07 -07:00
|
|
|
|
2016-04-25 05:36:56 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
2016-05-24 04:40:18 -07:00
|
|
|
return efl_content_get(efl_part(wd->resize_obj, part));
|
2012-05-02 18:19:05 -07:00
|
|
|
}
|
2012-05-02 09:58:10 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
EAPI Evas_Object *
|
2017-09-19 23:16:12 -07:00
|
|
|
elm_layout_content_unset(Evas_Object *obj, const char *swallow)
|
2013-08-29 00:39:20 -07:00
|
|
|
{
|
2017-08-07 21:28:50 -07:00
|
|
|
EFL_UI_LAYOUT_CHECK(obj) NULL;
|
2017-09-19 23:16:12 -07:00
|
|
|
if (!swallow)
|
|
|
|
{
|
2018-01-07 20:55:35 -08:00
|
|
|
swallow = efl_ui_widget_default_content_part_get(obj);
|
2017-09-19 23:16:12 -07:00
|
|
|
if (!swallow) return NULL;
|
|
|
|
}
|
|
|
|
else if (!_elm_layout_part_aliasing_eval(obj, &swallow, EINA_FALSE))
|
|
|
|
return NULL;
|
|
|
|
|
2016-08-04 03:37:56 -07:00
|
|
|
return efl_content_unset(efl_part(obj, swallow));
|
2013-08-29 00:39:20 -07:00
|
|
|
}
|
|
|
|
|
2016-05-24 04:40:18 -07:00
|
|
|
static Evas_Object*
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_content_unset(Eo *obj, Efl_Ui_Layout_Object_Data *sd, const char *part)
|
2012-05-02 18:19:05 -07:00
|
|
|
{
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Data *sub_d;
|
2017-09-20 01:31:23 -07:00
|
|
|
Eina_List *l;
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
EINA_LIST_FOREACH(sd->subs, l, sub_d)
|
2008-10-06 23:55:11 -07:00
|
|
|
{
|
2013-08-29 00:39:20 -07:00
|
|
|
if ((sub_d->type == SWALLOW) && (!strcmp(part, sub_d->part)))
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
{
|
2013-08-29 00:39:20 -07:00
|
|
|
Evas_Object *content;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
if (!sub_d->obj) return NULL;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
content = sub_d->obj; /* sub_d will die in
|
2017-08-23 04:41:37 -07:00
|
|
|
* _efl_ui_layout_smart_widget_sub_object_del */
|
2008-10-06 23:55:11 -07:00
|
|
|
|
2016-05-29 17:47:39 -07:00
|
|
|
if (!_elm_widget_sub_object_redirect_to_top(obj, content))
|
2013-08-29 00:39:20 -07:00
|
|
|
{
|
|
|
|
ERR("could not remove sub object %p from %p", content, obj);
|
2014-03-16 06:43:07 -07:00
|
|
|
return NULL;
|
2013-08-29 00:39:20 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
edje_object_part_unswallow
|
|
|
|
(wd->resize_obj, content);
|
2017-09-20 01:31:23 -07:00
|
|
|
EINA_LIST_FOREACH(sd->subs, l, sub_d)
|
|
|
|
{
|
|
|
|
if (sub_d->obj == content)
|
|
|
|
{
|
|
|
|
sd->subs = eina_list_remove_list(sd->subs, l);
|
|
|
|
_icon_signal_emit(sd, sub_d, EINA_FALSE);
|
|
|
|
eina_stringshare_del(sub_d->part);
|
|
|
|
free(sub_d);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2016-04-07 06:50:32 -07:00
|
|
|
_eo_unparent_helper(content, obj);
|
2014-03-16 06:43:07 -07:00
|
|
|
return content;
|
2013-08-29 00:39:20 -07:00
|
|
|
}
|
|
|
|
}
|
2014-03-16 06:43:07 -07:00
|
|
|
|
|
|
|
return NULL;
|
2009-12-07 20:41:02 -08:00
|
|
|
}
|
|
|
|
|
2016-04-25 03:53:51 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-05 01:47:26 -07:00
|
|
|
_efl_ui_layout_object_efl_container_content_remove(Eo *obj, Efl_Ui_Layout_Object_Data *sd EINA_UNUSED,
|
|
|
|
Efl_Gfx_Entity *content)
|
2016-04-25 03:53:51 -07:00
|
|
|
{
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
|
|
|
|
2016-05-29 17:47:39 -07:00
|
|
|
if (!_elm_widget_sub_object_redirect_to_top(obj, content))
|
2016-04-25 03:53:51 -07:00
|
|
|
{
|
|
|
|
ERR("could not remove sub object %p from %p", content, obj);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
edje_object_part_unswallow(wd->resize_obj, content);
|
|
|
|
_eo_unparent_helper(content, obj);
|
|
|
|
|
2016-04-25 05:36:56 -07:00
|
|
|
return EINA_TRUE;
|
2016-04-25 03:53:51 -07:00
|
|
|
}
|
|
|
|
|
2016-03-28 21:30:13 -07:00
|
|
|
/* legacy only - eo is iterator */
|
2013-12-28 00:33:10 -08:00
|
|
|
EAPI Eina_List *
|
|
|
|
elm_layout_content_swallow_list_get(const Evas_Object *obj)
|
|
|
|
{
|
2017-08-07 21:28:50 -07:00
|
|
|
EFL_UI_LAYOUT_CHECK(obj) NULL;
|
2013-12-28 00:33:10 -08:00
|
|
|
Eina_List *ret = NULL;
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Data *sub_d = NULL;
|
2018-04-06 09:15:31 -07:00
|
|
|
Efl_Ui_Layout_Object_Data *sd = efl_data_scope_get(obj, MY_CLASS);
|
2013-12-28 00:33:10 -08:00
|
|
|
Eina_List *l = NULL;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(sd->subs, l, sub_d)
|
|
|
|
{
|
2014-03-19 22:12:16 -07:00
|
|
|
if (sub_d->type == SWALLOW)
|
2014-03-16 06:43:07 -07:00
|
|
|
ret = eina_list_append(ret, sub_d->obj);
|
2013-12-28 00:33:10 -08:00
|
|
|
}
|
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
return ret;
|
2010-10-27 09:58:35 -07:00
|
|
|
}
|
|
|
|
|
2016-03-28 21:30:13 -07:00
|
|
|
static Eina_Bool
|
2017-08-07 21:28:50 -07:00
|
|
|
_sub_iterator_next(Efl_Ui_Layout_Sub_Iterator *it, void **data)
|
2016-03-28 21:30:13 -07:00
|
|
|
{
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Data *sub;
|
2016-03-28 21:30:13 -07:00
|
|
|
|
|
|
|
if (!eina_iterator_next(it->real_iterator, (void **)&sub))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
if (data) *data = sub->obj;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2018-04-06 09:15:31 -07:00
|
|
|
static Efl_Ui_Layout_Object *
|
2017-08-07 21:28:50 -07:00
|
|
|
_sub_iterator_get_container(Efl_Ui_Layout_Sub_Iterator *it)
|
2016-03-28 21:30:13 -07:00
|
|
|
{
|
|
|
|
return it->object;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-08-07 21:28:50 -07:00
|
|
|
_sub_iterator_free(Efl_Ui_Layout_Sub_Iterator *it)
|
2016-03-28 21:30:13 -07:00
|
|
|
{
|
|
|
|
eina_iterator_free(it->real_iterator);
|
|
|
|
free(it);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Iterator *
|
2018-04-06 09:15:31 -07:00
|
|
|
_sub_iterator_create(Eo *eo_obj, Efl_Ui_Layout_Object_Data *sd)
|
2016-03-28 21:30:13 -07:00
|
|
|
{
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Iterator *it;
|
2016-03-28 21:30:13 -07:00
|
|
|
|
|
|
|
it = calloc(1, sizeof(*it));
|
|
|
|
if (!it) return NULL;
|
|
|
|
|
|
|
|
EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_ITERATOR);
|
|
|
|
|
|
|
|
it->real_iterator = eina_list_iterator_new(sd->subs);
|
|
|
|
it->iterator.version = EINA_ITERATOR_VERSION;
|
2016-04-19 22:55:26 -07:00
|
|
|
it->iterator.next = FUNC_ITERATOR_NEXT(_sub_iterator_next);
|
2016-03-28 21:30:13 -07:00
|
|
|
it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_sub_iterator_get_container);
|
|
|
|
it->iterator.free = FUNC_ITERATOR_FREE(_sub_iterator_free);
|
2016-04-04 05:39:29 -07:00
|
|
|
it->object = eo_obj;
|
2016-03-28 21:30:13 -07:00
|
|
|
|
|
|
|
return &it->iterator;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Iterator *
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_object_efl_container_content_iterate(Eo *eo_obj EINA_UNUSED, Efl_Ui_Layout_Object_Data *sd)
|
2016-03-28 21:30:13 -07:00
|
|
|
{
|
2016-04-19 22:55:26 -07:00
|
|
|
return _sub_iterator_create(eo_obj, sd);
|
2016-03-28 21:30:13 -07:00
|
|
|
}
|
|
|
|
|
2016-04-19 22:55:26 -07:00
|
|
|
EOLIAN static int
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_object_efl_container_content_count(Eo *eo_obj EINA_UNUSED, Efl_Ui_Layout_Object_Data *sd)
|
2016-03-28 21:30:13 -07:00
|
|
|
{
|
2016-04-19 22:55:26 -07:00
|
|
|
return eina_list_count(sd->subs);
|
2016-03-28 21:30:13 -07:00
|
|
|
}
|
|
|
|
|
2017-09-19 05:46:59 -07:00
|
|
|
static Eina_Bool
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_text_generic_set(Eo *obj, Efl_Ui_Layout_Object_Data *sd, const char *part, const char *text, Eina_Bool is_markup)
|
2011-06-29 02:30:56 -07:00
|
|
|
{
|
2014-03-16 06:43:07 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Data *sub_d = NULL;
|
2018-01-26 16:56:53 -08:00
|
|
|
Eina_List *l;
|
2011-06-29 02:30:56 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
EINA_LIST_FOREACH(sd->subs, l, sub_d)
|
2011-10-25 17:46:16 -07:00
|
|
|
{
|
2013-08-29 00:39:20 -07:00
|
|
|
if ((sub_d->type == TEXT) && (!strcmp(part, sub_d->part)))
|
2011-10-25 17:46:16 -07:00
|
|
|
{
|
2013-08-29 00:39:20 -07:00
|
|
|
if (!text)
|
|
|
|
{
|
2017-08-03 23:33:27 -07:00
|
|
|
_text_signal_emit(sd, sub_d, EINA_FALSE);
|
2013-08-29 00:39:20 -07:00
|
|
|
eina_stringshare_del(sub_d->part);
|
|
|
|
free(sub_d);
|
|
|
|
edje_object_part_text_escaped_set
|
|
|
|
(wd->resize_obj, part, NULL);
|
|
|
|
sd->subs = eina_list_remove_list(sd->subs, l);
|
2017-08-22 21:29:14 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2013-08-29 00:39:20 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
break;
|
2011-10-25 17:46:16 -07:00
|
|
|
}
|
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2016-06-29 22:20:44 -07:00
|
|
|
if (!text) return EINA_TRUE;
|
|
|
|
|
2018-01-23 22:50:58 -08:00
|
|
|
if (elm_widget_is_legacy(obj))
|
2017-09-28 00:27:32 -07:00
|
|
|
{
|
|
|
|
if (!edje_object_part_text_escaped_set
|
2013-08-29 00:39:20 -07:00
|
|
|
(wd->resize_obj, part, text))
|
2017-09-28 00:27:32 -07:00
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2017-10-01 08:40:50 -07:00
|
|
|
else if (is_markup)
|
|
|
|
{
|
|
|
|
efl_text_markup_set(efl_part(wd->resize_obj, part), text);
|
|
|
|
}
|
2017-09-28 00:27:32 -07:00
|
|
|
else
|
|
|
|
{
|
2017-10-01 08:40:50 -07:00
|
|
|
efl_text_set(efl_part(wd->resize_obj, part), text);
|
2017-09-28 00:27:32 -07:00
|
|
|
}
|
2011-10-25 17:46:16 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
if (!sub_d)
|
2011-10-25 17:46:16 -07:00
|
|
|
{
|
2017-08-07 21:28:50 -07:00
|
|
|
sub_d = ELM_NEW(Efl_Ui_Layout_Sub_Object_Data);
|
2014-03-16 06:43:07 -07:00
|
|
|
if (!sub_d) return EINA_FALSE;
|
2013-08-29 00:39:20 -07:00
|
|
|
sub_d->type = TEXT;
|
|
|
|
sub_d->part = eina_stringshare_add(part);
|
|
|
|
sd->subs = eina_list_append(sd->subs, sub_d);
|
2011-10-25 17:46:16 -07:00
|
|
|
}
|
|
|
|
|
2017-08-03 23:33:27 -07:00
|
|
|
_text_signal_emit(sd, sub_d, EINA_TRUE);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-08-02 23:20:58 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2011-10-25 17:46:16 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON &&
|
2014-01-01 16:23:03 -08:00
|
|
|
sd->can_access && !(sub_d->obj))
|
2013-08-29 00:39:20 -07:00
|
|
|
sub_d->obj = _elm_access_edje_object_part_object_register
|
|
|
|
(obj, elm_layout_edje_get(obj), part);
|
|
|
|
|
2018-01-26 16:56:53 -08:00
|
|
|
if (sd->connect.model && !sd->connect.updating)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
2018-01-26 16:56:53 -08:00
|
|
|
char *property = eina_hash_find(sd->connect.properties, sub_d->part);
|
|
|
|
|
|
|
|
if (property)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
2018-01-26 16:56:53 -08:00
|
|
|
Eina_Value v = EINA_VALUE_EMPTY;
|
|
|
|
|
|
|
|
eina_value_setup(&v, EINA_VALUE_TYPE_STRING);
|
|
|
|
eina_value_set(&v, text);
|
|
|
|
|
|
|
|
efl_model_property_set(sd->connect.model, property, &v);
|
2017-01-31 12:17:58 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
|
2017-09-28 00:27:32 -07:00
|
|
|
static Eina_Bool
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_text_set(Eo *obj, Efl_Ui_Layout_Object_Data *sd, const char *part, const char *text)
|
2017-09-28 00:27:32 -07:00
|
|
|
{
|
|
|
|
return _efl_ui_layout_text_generic_set(obj, sd, part, text, EINA_FALSE);
|
|
|
|
}
|
|
|
|
|
2017-09-19 05:46:59 -07:00
|
|
|
static const char*
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_text_get(Eo *obj, Efl_Ui_Layout_Object_Data *sd EINA_UNUSED, const char *part)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-16 06:43:07 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2018-02-01 02:57:43 -08:00
|
|
|
if (elm_widget_is_legacy(obj))
|
|
|
|
{
|
|
|
|
return edje_object_part_text_get(wd->resize_obj, part);
|
|
|
|
}
|
2017-09-28 00:27:32 -07:00
|
|
|
return efl_text_get(efl_part(wd->resize_obj, part));
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char*
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_text_markup_get(Eo *obj, Efl_Ui_Layout_Object_Data *sd EINA_UNUSED, const char *part)
|
2017-09-28 00:27:32 -07:00
|
|
|
{
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
|
|
|
|
|
|
|
return efl_text_markup_get(efl_part(wd->resize_obj, part));
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_text_markup_set(Eo *obj, Efl_Ui_Layout_Object_Data *sd, const char *part, const char *text)
|
2017-09-28 00:27:32 -07:00
|
|
|
{
|
|
|
|
return _efl_ui_layout_text_generic_set(obj, sd, part, text, EINA_TRUE);
|
2010-10-13 19:36:37 -07:00
|
|
|
}
|
|
|
|
|
2016-04-07 06:50:32 -07:00
|
|
|
static void
|
2018-04-06 09:15:31 -07:00
|
|
|
_layout_box_subobj_init(Efl_Ui_Layout_Object_Data *sd, Efl_Ui_Layout_Sub_Object_Data *sub_d, const char *part, Evas_Object *child)
|
2016-04-07 06:50:32 -07:00
|
|
|
{
|
|
|
|
sub_d->part = eina_stringshare_add(part);
|
|
|
|
sub_d->obj = child;
|
|
|
|
sd->subs = eina_list_append(sd->subs, sub_d);
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_parent_set(child, sd->obj);
|
2016-04-07 06:50:32 -07:00
|
|
|
}
|
|
|
|
|
2016-04-25 05:36:56 -07:00
|
|
|
Eina_Bool
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_box_append(Eo *obj, Efl_Ui_Layout_Object_Data *sd, const char *part, Evas_Object *child)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Data *sub_d;
|
2013-08-29 00:39:20 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
2012-03-06 12:25:29 -08:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
if (!edje_object_part_box_append
|
|
|
|
(wd->resize_obj, part, child))
|
|
|
|
{
|
|
|
|
ERR("child %p could not be appended to box part '%s'", child, part);
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_FALSE;
|
2013-08-29 00:39:20 -07:00
|
|
|
}
|
2010-10-13 19:36:37 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
if (!elm_widget_sub_object_add(obj, child))
|
|
|
|
{
|
|
|
|
edje_object_part_box_remove
|
|
|
|
(wd->resize_obj, part, child);
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_FALSE;
|
2013-08-29 00:39:20 -07:00
|
|
|
}
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2017-08-07 21:28:50 -07:00
|
|
|
sub_d = ELM_NEW(Efl_Ui_Layout_Sub_Object_Data);
|
2015-06-14 22:56:42 -07:00
|
|
|
if (!sub_d)
|
|
|
|
{
|
|
|
|
ERR("failed to allocate memory!");
|
2016-05-29 17:47:39 -07:00
|
|
|
_elm_widget_sub_object_redirect_to_top(obj, child);
|
2015-06-14 22:56:42 -07:00
|
|
|
edje_object_part_box_remove(wd->resize_obj, part, child);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2013-08-29 00:39:20 -07:00
|
|
|
sub_d->type = BOX_APPEND;
|
2016-04-07 06:50:32 -07:00
|
|
|
_layout_box_subobj_init(sd, sub_d, part, child);
|
2010-10-13 19:36:37 -07:00
|
|
|
|
2017-08-02 23:20:58 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2010-10-13 19:36:37 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
2010-10-13 19:36:37 -07:00
|
|
|
|
2016-04-25 05:36:56 -07:00
|
|
|
Eina_Bool
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_box_prepend(Eo *obj, Efl_Ui_Layout_Object_Data *sd, const char *part, Evas_Object *child)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Data *sub_d;
|
2010-10-13 19:36:37 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
2010-10-13 19:36:37 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
if (!edje_object_part_box_prepend
|
|
|
|
(wd->resize_obj, part, child))
|
|
|
|
{
|
|
|
|
ERR("child %p could not be prepended to box part '%s'", child, part);
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_FALSE;
|
2013-08-29 00:39:20 -07:00
|
|
|
}
|
2012-05-02 09:58:10 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
if (!elm_widget_sub_object_add(obj, child))
|
|
|
|
{
|
|
|
|
edje_object_part_box_remove
|
|
|
|
(wd->resize_obj, part, child);
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_FALSE;
|
2013-08-29 00:39:20 -07:00
|
|
|
}
|
|
|
|
|
2017-08-07 21:28:50 -07:00
|
|
|
sub_d = ELM_NEW(Efl_Ui_Layout_Sub_Object_Data);
|
2015-06-14 22:56:42 -07:00
|
|
|
if (!sub_d)
|
|
|
|
{
|
|
|
|
ERR("failed to allocate memory!");
|
2016-05-29 17:47:39 -07:00
|
|
|
_elm_widget_sub_object_redirect_to_top(obj, child);
|
2015-06-14 22:56:42 -07:00
|
|
|
edje_object_part_box_remove(wd->resize_obj, part, child);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2013-08-29 00:39:20 -07:00
|
|
|
sub_d->type = BOX_PREPEND;
|
2016-04-07 06:50:32 -07:00
|
|
|
_layout_box_subobj_init(sd, sub_d, part, child);
|
2013-08-29 00:39:20 -07:00
|
|
|
|
2017-08-02 23:20:58 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2013-08-29 00:39:20 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2010-10-13 19:36:37 -07:00
|
|
|
}
|
|
|
|
|
2016-04-25 05:36:56 -07:00
|
|
|
Eina_Bool
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_box_insert_before(Eo *obj, Efl_Ui_Layout_Object_Data *sd, const char *part, Evas_Object *child, const Evas_Object *reference)
|
2010-10-13 19:36:37 -07:00
|
|
|
{
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Data *sub_d;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
2013-08-29 00:39:20 -07:00
|
|
|
|
|
|
|
if (!edje_object_part_box_insert_before
|
|
|
|
(wd->resize_obj, part, child, reference))
|
|
|
|
{
|
|
|
|
ERR("child %p could not be inserted before %p inf box part '%s'",
|
|
|
|
child, reference, part);
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_FALSE;
|
2013-08-29 00:39:20 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!elm_widget_sub_object_add(obj, child))
|
|
|
|
{
|
|
|
|
edje_object_part_box_remove
|
|
|
|
(wd->resize_obj, part, child);
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_FALSE;
|
2013-08-29 00:39:20 -07:00
|
|
|
}
|
|
|
|
|
2017-08-07 21:28:50 -07:00
|
|
|
sub_d = ELM_NEW(Efl_Ui_Layout_Sub_Object_Data);
|
2015-06-14 22:56:42 -07:00
|
|
|
if (!sub_d)
|
|
|
|
{
|
|
|
|
ERR("failed to allocate memory!");
|
2016-05-29 17:47:39 -07:00
|
|
|
_elm_widget_sub_object_redirect_to_top(obj, child);
|
2015-06-14 22:56:42 -07:00
|
|
|
edje_object_part_box_remove(wd->resize_obj, part, child);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2013-08-29 00:39:20 -07:00
|
|
|
sub_d->type = BOX_INSERT_BEFORE;
|
|
|
|
sub_d->p.box.reference = reference;
|
2016-04-07 06:50:32 -07:00
|
|
|
_layout_box_subobj_init(sd, sub_d, part, child);
|
2013-08-29 00:39:20 -07:00
|
|
|
|
|
|
|
evas_object_event_callback_add
|
|
|
|
((Evas_Object *)reference, EVAS_CALLBACK_DEL, _box_reference_del, sub_d);
|
2010-10-13 19:36:37 -07:00
|
|
|
|
2017-08-02 23:20:58 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2012-03-06 12:25:29 -08:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
2012-05-02 18:19:05 -07:00
|
|
|
|
2016-04-25 05:36:56 -07:00
|
|
|
Eina_Bool
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_box_insert_at(Eo *obj, Efl_Ui_Layout_Object_Data *sd, const char *part, Evas_Object *child, unsigned int pos)
|
2013-08-29 00:39:20 -07:00
|
|
|
{
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Data *sub_d;
|
2014-03-16 06:43:07 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
2013-08-29 00:39:20 -07:00
|
|
|
|
|
|
|
if (!edje_object_part_box_insert_at
|
|
|
|
(wd->resize_obj, part, child, pos))
|
|
|
|
{
|
|
|
|
ERR("child %p could not be inserted at %u to box part '%s'",
|
|
|
|
child, pos, part);
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_FALSE;
|
2013-08-29 00:39:20 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!elm_widget_sub_object_add(obj, child))
|
|
|
|
{
|
|
|
|
edje_object_part_box_remove
|
|
|
|
(wd->resize_obj, part, child);
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_FALSE;
|
2013-08-29 00:39:20 -07:00
|
|
|
}
|
|
|
|
|
2017-08-07 21:28:50 -07:00
|
|
|
sub_d = ELM_NEW(Efl_Ui_Layout_Sub_Object_Data);
|
2015-06-14 22:56:42 -07:00
|
|
|
if (!sub_d)
|
|
|
|
{
|
|
|
|
ERR("failed to allocate memory!");
|
2016-05-29 17:47:39 -07:00
|
|
|
_elm_widget_sub_object_redirect_to_top(obj, child);
|
2015-06-14 22:56:42 -07:00
|
|
|
edje_object_part_box_remove(wd->resize_obj, part, child);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2013-08-29 00:39:20 -07:00
|
|
|
sub_d->type = BOX_INSERT_AT;
|
|
|
|
sub_d->p.box.pos = pos;
|
2016-04-07 06:50:32 -07:00
|
|
|
_layout_box_subobj_init(sd, sub_d, part, child);
|
2013-08-29 00:39:20 -07:00
|
|
|
|
2017-08-02 23:20:58 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2013-08-29 00:39:20 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2012-05-02 09:58:10 -07:00
|
|
|
}
|
2010-10-13 19:36:37 -07:00
|
|
|
|
2016-04-25 05:36:56 -07:00
|
|
|
Evas_Object *
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_box_remove(Eo *obj, Efl_Ui_Layout_Object_Data *sd, const char *part, Evas_Object *child)
|
2013-08-29 00:39:20 -07:00
|
|
|
{
|
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(child, NULL);
|
2013-08-29 00:39:20 -07:00
|
|
|
|
|
|
|
|
|
|
|
const Eina_List *l;
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Data *sub_d;
|
2013-08-29 00:39:20 -07:00
|
|
|
|
|
|
|
EINA_LIST_FOREACH(sd->subs, l, sub_d)
|
|
|
|
{
|
|
|
|
if (!_sub_box_is(sub_d)) continue;
|
|
|
|
if ((sub_d->obj == child) && (!strcmp(sub_d->part, part)))
|
2014-03-16 06:43:07 -07:00
|
|
|
return _sub_box_remove(obj, sd, sub_d);
|
2013-08-29 00:39:20 -07:00
|
|
|
}
|
2012-05-02 18:19:05 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return NULL;
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
2012-03-06 12:25:29 -08:00
|
|
|
|
2016-04-25 05:36:56 -07:00
|
|
|
Eina_Bool
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_box_remove_all(Eo *obj, Efl_Ui_Layout_Object_Data *sd, const char *part, Eina_Bool clear)
|
2013-08-29 00:39:20 -07:00
|
|
|
{
|
2014-03-16 06:43:07 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(part, EINA_FALSE);
|
2013-08-29 00:39:20 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
2013-08-29 00:39:20 -07:00
|
|
|
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Data *sub_d;
|
2013-08-29 00:39:20 -07:00
|
|
|
Eina_List *lst;
|
|
|
|
|
|
|
|
lst = eina_list_clone(sd->subs);
|
|
|
|
EINA_LIST_FREE(lst, sub_d)
|
|
|
|
{
|
|
|
|
if (!_sub_box_is(sub_d)) continue;
|
|
|
|
if (!strcmp(sub_d->part, part))
|
|
|
|
{
|
|
|
|
/* original item's deletion handled at sub-obj-del */
|
|
|
|
Evas_Object *child = _sub_box_remove(obj, sd, sub_d);
|
|
|
|
if ((clear) && (child)) evas_object_del(child);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* eventually something may not be added with elm_layout, delete them
|
|
|
|
* as well */
|
|
|
|
edje_object_part_box_remove_all
|
|
|
|
(wd->resize_obj, part, clear);
|
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2010-10-13 19:36:37 -07:00
|
|
|
}
|
|
|
|
|
2016-04-25 05:36:56 -07:00
|
|
|
Eina_Bool
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_table_pack(Eo *obj, Efl_Ui_Layout_Object_Data *sd, const char *part, Evas_Object *child, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan)
|
2013-08-29 00:39:20 -07:00
|
|
|
{
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Data *sub_d;
|
2013-08-29 00:39:20 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
2013-08-29 00:39:20 -07:00
|
|
|
|
|
|
|
if (!edje_object_part_table_pack
|
|
|
|
(wd->resize_obj, part, child, col,
|
|
|
|
row, colspan, rowspan))
|
|
|
|
{
|
2015-12-16 22:48:57 -08:00
|
|
|
ERR("child %p could not be packed into table part '%s' col=%uh, row=%hu,"
|
2013-08-29 00:39:20 -07:00
|
|
|
" colspan=%hu, rowspan=%hu", child, part, col, row, colspan,
|
|
|
|
rowspan);
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_FALSE;
|
2013-08-29 00:39:20 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!elm_widget_sub_object_add(obj, child))
|
|
|
|
{
|
|
|
|
edje_object_part_table_unpack
|
|
|
|
(wd->resize_obj, part, child);
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_FALSE;
|
2013-08-29 00:39:20 -07:00
|
|
|
}
|
|
|
|
|
2017-08-07 21:28:50 -07:00
|
|
|
sub_d = ELM_NEW(Efl_Ui_Layout_Sub_Object_Data);
|
2015-06-14 22:56:42 -07:00
|
|
|
if (!sub_d)
|
|
|
|
{
|
|
|
|
ERR("failed to allocate memory!");
|
2016-05-29 17:47:39 -07:00
|
|
|
_elm_widget_sub_object_redirect_to_top(obj, child);
|
2015-06-14 22:56:42 -07:00
|
|
|
edje_object_part_table_unpack(wd->resize_obj, part, child);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2013-08-29 00:39:20 -07:00
|
|
|
sub_d->type = TABLE_PACK;
|
|
|
|
sub_d->part = eina_stringshare_add(part);
|
|
|
|
sub_d->obj = child;
|
|
|
|
sub_d->p.table.col = col;
|
|
|
|
sub_d->p.table.row = row;
|
|
|
|
sub_d->p.table.colspan = colspan;
|
|
|
|
sub_d->p.table.rowspan = rowspan;
|
|
|
|
sd->subs = eina_list_append(sd->subs, sub_d);
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_parent_set(child, obj);
|
2013-08-29 00:39:20 -07:00
|
|
|
|
2017-08-02 23:20:58 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2013-08-29 00:39:20 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2010-10-13 19:36:37 -07:00
|
|
|
}
|
|
|
|
|
2016-04-25 05:36:56 -07:00
|
|
|
Evas_Object *
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_table_unpack(Eo *obj, Efl_Ui_Layout_Object_Data *sd, const char *part, Evas_Object *child)
|
2013-08-29 00:39:20 -07:00
|
|
|
{
|
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(child, NULL);
|
2013-08-29 00:39:20 -07:00
|
|
|
|
|
|
|
const Eina_List *l;
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Data *sub_d;
|
2013-08-29 00:39:20 -07:00
|
|
|
|
|
|
|
EINA_LIST_FOREACH(sd->subs, l, sub_d)
|
|
|
|
{
|
|
|
|
if (sub_d->type != TABLE_PACK) continue;
|
|
|
|
if ((sub_d->obj == child) && (!strcmp(sub_d->part, part)))
|
|
|
|
{
|
2014-03-16 06:43:07 -07:00
|
|
|
return _sub_table_remove(obj, sd, sub_d);
|
2013-08-29 00:39:20 -07:00
|
|
|
}
|
|
|
|
}
|
2012-03-06 12:25:29 -08:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return NULL;
|
2010-10-13 19:36:37 -07:00
|
|
|
}
|
|
|
|
|
2016-04-25 05:36:56 -07:00
|
|
|
Eina_Bool
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_table_clear(Eo *obj, Efl_Ui_Layout_Object_Data *sd, const char *part, Eina_Bool clear)
|
2013-08-29 00:39:20 -07:00
|
|
|
{
|
2014-03-16 06:43:07 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(part, EINA_FALSE);
|
2013-08-29 00:39:20 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
2013-08-29 00:39:20 -07:00
|
|
|
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Data *sub_d;
|
2013-08-29 00:39:20 -07:00
|
|
|
Eina_List *lst;
|
|
|
|
|
|
|
|
lst = eina_list_clone(sd->subs);
|
|
|
|
EINA_LIST_FREE(lst, sub_d)
|
|
|
|
{
|
|
|
|
if (sub_d->type != TABLE_PACK) continue;
|
|
|
|
if (!strcmp(sub_d->part, part))
|
|
|
|
{
|
|
|
|
/* original item's deletion handled at sub-obj-del */
|
|
|
|
Evas_Object *child = _sub_table_remove(obj, sd, sub_d);
|
|
|
|
if ((clear) && (child)) evas_object_del(child);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* eventually something may not be added with elm_layout, delete them
|
|
|
|
* as well */
|
|
|
|
edje_object_part_table_clear(wd->resize_obj, part, clear);
|
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2017-08-02 18:29:21 -07:00
|
|
|
EAPI Evas_Object*
|
|
|
|
elm_layout_edje_get(const Eo *obj)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2017-08-02 18:29:21 -07:00
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(obj, MY_CLASS), NULL);
|
2014-03-16 06:43:07 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return wd->resize_obj;
|
2008-10-07 00:45:49 -07:00
|
|
|
}
|
2009-12-07 20:41:02 -08:00
|
|
|
|
2017-08-03 02:22:29 -07:00
|
|
|
EOLIAN static const char *
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_object_efl_layout_group_group_data_get(const Eo *obj, Efl_Ui_Layout_Object_Data *_pd EINA_UNUSED, const char *key)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-08-05 10:31:49 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
|
|
|
|
2017-12-04 23:00:08 -08:00
|
|
|
return efl_layout_group_data_get(wd->resize_obj, key);
|
2017-08-03 02:22:29 -07:00
|
|
|
}
|
|
|
|
|
2017-09-18 01:01:10 -07:00
|
|
|
EOLIAN static Eina_Size2D
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_object_efl_layout_group_group_size_min_get(const Eo *obj, Efl_Ui_Layout_Object_Data *_pd EINA_UNUSED)
|
2017-08-03 02:22:29 -07:00
|
|
|
{
|
2017-09-18 01:01:10 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_SIZE2D(0, 0));
|
2017-08-03 02:22:29 -07:00
|
|
|
|
2017-12-04 23:00:08 -08:00
|
|
|
return efl_layout_group_size_min_get(wd->resize_obj);
|
2017-08-03 02:22:29 -07:00
|
|
|
}
|
|
|
|
|
2017-09-18 01:01:10 -07:00
|
|
|
EOLIAN static Eina_Size2D
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_object_efl_layout_group_group_size_max_get(const Eo *obj, Efl_Ui_Layout_Object_Data *_pd EINA_UNUSED)
|
2017-08-03 02:22:29 -07:00
|
|
|
{
|
2017-09-18 01:01:10 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_SIZE2D(0, 0));
|
2017-08-03 02:22:29 -07:00
|
|
|
|
2017-12-04 23:00:08 -08:00
|
|
|
return efl_layout_group_size_max_get(wd->resize_obj);
|
2009-12-07 20:41:02 -08:00
|
|
|
}
|
2010-09-26 17:51:16 -07:00
|
|
|
|
2018-01-15 00:27:10 -08:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_object_efl_layout_group_part_exist_get(const Eo *obj, Efl_Ui_Layout_Object_Data *_pd EINA_UNUSED, const char *part)
|
2018-01-15 00:27:10 -08:00
|
|
|
{
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
|
|
|
|
|
|
|
return efl_layout_group_part_exist_get(wd->resize_obj, part);
|
|
|
|
}
|
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
/* layout's sizing evaluation is deferred. evaluation requests are
|
|
|
|
* queued up and only flag the object as 'changed'. when it comes to
|
|
|
|
* Evas's rendering phase, it will be addressed, finally (see
|
2017-08-07 19:48:31 -07:00
|
|
|
* _efl_ui_layout_smart_calculate()). */
|
2017-08-07 00:13:38 -07:00
|
|
|
static void
|
2018-04-06 09:15:31 -07:00
|
|
|
_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Layout_Object_Data *sd)
|
2013-08-29 00:39:20 -07:00
|
|
|
{
|
2013-10-05 01:59:58 -07:00
|
|
|
if (sd->frozen) return;
|
2013-08-29 00:39:20 -07:00
|
|
|
if (sd->needs_size_calc) return;
|
|
|
|
sd->needs_size_calc = EINA_TRUE;
|
|
|
|
|
|
|
|
evas_object_smart_changed(obj);
|
|
|
|
}
|
|
|
|
|
2017-08-07 00:13:38 -07:00
|
|
|
EAPI void
|
|
|
|
elm_layout_sizing_restricted_eval(Eo *obj, Eina_Bool w, Eina_Bool h)
|
2013-10-25 09:51:33 -07:00
|
|
|
{
|
2018-04-06 09:15:31 -07:00
|
|
|
Efl_Ui_Layout_Object_Data *sd = efl_data_scope_safe_get(obj, MY_CLASS);
|
2017-08-07 00:13:38 -07:00
|
|
|
|
|
|
|
if (!sd) return;
|
2013-10-25 09:51:33 -07:00
|
|
|
sd->restricted_calc_w = !!w;
|
|
|
|
sd->restricted_calc_h = !!h;
|
|
|
|
|
|
|
|
evas_object_smart_changed(obj);
|
|
|
|
}
|
|
|
|
|
2016-06-27 11:18:02 -07:00
|
|
|
EOLIAN static int
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_object_efl_layout_calc_calc_freeze(Eo *obj, Efl_Ui_Layout_Object_Data *sd)
|
2016-06-27 11:18:02 -07:00
|
|
|
{
|
2017-08-02 04:46:16 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, 0);
|
2016-08-05 10:31:49 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
if ((sd->frozen)++ != 0) return sd->frozen;
|
2012-07-30 00:14:33 -07:00
|
|
|
|
2016-08-05 10:31:49 -07:00
|
|
|
edje_object_freeze(wd->resize_obj);
|
2012-07-30 00:14:33 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return 1;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2016-06-27 11:18:02 -07:00
|
|
|
EOLIAN static int
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_object_efl_layout_calc_calc_thaw(Eo *obj, Efl_Ui_Layout_Object_Data *sd)
|
2016-06-27 11:18:02 -07:00
|
|
|
{
|
2016-08-05 10:31:49 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, 0);
|
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
if (--(sd->frozen) != 0) return sd->frozen;
|
2012-07-30 00:14:33 -07:00
|
|
|
|
2016-08-05 10:31:49 -07:00
|
|
|
edje_object_thaw(wd->resize_obj);
|
2012-07-30 00:14:33 -07:00
|
|
|
|
2017-08-02 23:20:58 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2012-07-30 00:14:33 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return 0;
|
2012-07-30 00:14:33 -07:00
|
|
|
}
|
|
|
|
|
2017-08-02 03:41:47 -07:00
|
|
|
static Eina_Bool
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_part_cursor_set(Efl_Ui_Layout_Object_Data *sd, const char *part_name, const char *cursor)
|
2010-09-26 17:51:16 -07:00
|
|
|
{
|
2017-08-02 03:41:47 -07:00
|
|
|
Evas_Object *part_obj;
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Cursor *pc;
|
2017-08-02 03:41:47 -07:00
|
|
|
Eo *obj = sd->obj;
|
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, EINA_FALSE);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-08-07 19:48:31 -07:00
|
|
|
if (!cursor) return _efl_ui_layout_part_cursor_unset(sd, part_name);
|
2010-09-26 17:51:16 -07:00
|
|
|
|
2012-05-03 15:41:26 -07:00
|
|
|
part_obj = (Evas_Object *)edje_object_part_object_get
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, part_name);
|
2010-09-26 17:51:16 -07:00
|
|
|
if (!part_obj)
|
|
|
|
{
|
|
|
|
const char *group, *file;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
edje_object_file_get(wd->resize_obj, &file, &group);
|
2012-05-03 15:41:26 -07:00
|
|
|
ERR("no part '%s' in group '%s' of file '%s'. Cannot set cursor '%s'",
|
2010-09-26 17:51:16 -07:00
|
|
|
part_name, group, file, cursor);
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_FALSE;
|
2010-09-26 17:51:16 -07:00
|
|
|
}
|
|
|
|
if (evas_object_pass_events_get(part_obj))
|
|
|
|
{
|
|
|
|
const char *group, *file;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
edje_object_file_get(wd->resize_obj, &file, &group);
|
2012-05-03 15:41:26 -07:00
|
|
|
ERR("part '%s' in group '%s' of file '%s' has mouse_events: 0. "
|
2010-09-26 17:51:16 -07:00
|
|
|
"Cannot set cursor '%s'",
|
|
|
|
part_name, group, file, cursor);
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_FALSE;
|
2010-09-26 17:51:16 -07:00
|
|
|
}
|
|
|
|
|
2012-05-03 15:41:26 -07:00
|
|
|
pc = _parts_cursors_find(sd, part_name);
|
2010-09-26 17:51:16 -07:00
|
|
|
if (pc) eina_stringshare_replace(&pc->cursor, cursor);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pc = calloc(1, sizeof(*pc));
|
2015-06-14 23:39:02 -07:00
|
|
|
if (!pc)
|
|
|
|
{
|
|
|
|
ERR("failed to allocate memory!");
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2010-09-26 17:51:16 -07:00
|
|
|
pc->part = eina_stringshare_add(part_name);
|
|
|
|
pc->cursor = eina_stringshare_add(cursor);
|
2012-01-13 15:43:17 -08:00
|
|
|
pc->style = eina_stringshare_add("default");
|
2012-05-03 15:41:26 -07:00
|
|
|
sd->parts_cursors = eina_list_append(sd->parts_cursors, pc);
|
2010-09-26 17:51:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
pc->obj = part_obj;
|
|
|
|
elm_object_sub_cursor_set(part_obj, obj, pc->cursor);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2017-08-02 03:41:47 -07:00
|
|
|
static const char *
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_part_cursor_get(Efl_Ui_Layout_Object_Data *sd, const char *part_name)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-16 06:43:07 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, NULL);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Cursor *pc = _parts_cursors_find(sd, part_name);
|
2014-03-16 06:43:07 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(pc, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(pc->obj, NULL);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return elm_object_cursor_get(pc->obj);
|
2010-11-04 17:46:54 -07:00
|
|
|
}
|
|
|
|
|
2017-08-02 03:41:47 -07:00
|
|
|
static Eina_Bool
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_part_cursor_unset(Efl_Ui_Layout_Object_Data *sd, const char *part_name)
|
2010-09-26 17:51:16 -07:00
|
|
|
{
|
2014-03-16 06:43:07 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, EINA_FALSE);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2010-09-26 17:51:16 -07:00
|
|
|
Eina_List *l;
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Cursor *pc;
|
2010-09-26 17:51:16 -07:00
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(sd->parts_cursors, l, pc)
|
2010-09-26 17:51:16 -07:00
|
|
|
{
|
2010-10-22 14:41:27 -07:00
|
|
|
if (!strcmp(part_name, pc->part))
|
2010-09-26 17:51:16 -07:00
|
|
|
{
|
|
|
|
if (pc->obj) elm_object_cursor_unset(pc->obj);
|
|
|
|
_part_cursor_free(pc);
|
2012-05-03 15:41:26 -07:00
|
|
|
sd->parts_cursors = eina_list_remove_list(sd->parts_cursors, l);
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2010-09-26 17:51:16 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_FALSE;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2017-08-02 03:41:47 -07:00
|
|
|
static Eina_Bool
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_part_cursor_style_set(Efl_Ui_Layout_Object_Data *sd, const char *part_name, const char *style)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-16 06:43:07 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, EINA_FALSE);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Cursor *pc = _parts_cursors_find(sd, part_name);
|
2014-03-16 06:43:07 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(pc, EINA_FALSE);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(pc->obj, EINA_FALSE);
|
2010-09-26 17:51:16 -07:00
|
|
|
|
|
|
|
eina_stringshare_replace(&pc->style, style);
|
|
|
|
elm_object_cursor_style_set(pc->obj, pc->style);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2017-08-02 03:41:47 -07:00
|
|
|
static const char*
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_part_cursor_style_get(Efl_Ui_Layout_Object_Data *sd, const char *part_name)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-16 06:43:07 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, NULL);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Cursor *pc = _parts_cursors_find(sd, part_name);
|
2014-03-16 06:43:07 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(pc, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(pc->obj, NULL);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return elm_object_cursor_style_get(pc->obj);
|
2010-09-26 17:51:16 -07:00
|
|
|
}
|
|
|
|
|
2017-08-02 03:41:47 -07:00
|
|
|
static Eina_Bool
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_part_cursor_engine_only_set(Efl_Ui_Layout_Object_Data *sd, const char *part_name, Eina_Bool engine_only)
|
2010-09-26 17:51:16 -07:00
|
|
|
{
|
2014-03-16 06:43:07 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, EINA_FALSE);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Cursor *pc = _parts_cursors_find(sd, part_name);
|
2014-03-16 06:43:07 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(pc, EINA_FALSE);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(pc->obj, EINA_FALSE);
|
2010-09-26 17:51:16 -07:00
|
|
|
|
|
|
|
pc->engine_only = !!engine_only;
|
2013-05-01 00:39:51 -07:00
|
|
|
elm_object_cursor_theme_search_enabled_set(pc->obj, !pc->engine_only);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2017-08-02 03:41:47 -07:00
|
|
|
static Eina_Bool
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_part_cursor_engine_only_get(Efl_Ui_Layout_Object_Data *sd, const char *part_name)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-16 06:43:07 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, EINA_FALSE);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Cursor *pc = _parts_cursors_find(sd, part_name);
|
2014-03-16 06:43:07 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(pc, EINA_FALSE);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(pc->obj, EINA_FALSE);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return !elm_object_cursor_theme_search_enabled_get(pc->obj);
|
2010-09-26 17:51:16 -07:00
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-08-01 23:17:54 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_layout_edje_object_can_access_set(Eo *obj, Eina_Bool can_access)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2018-04-06 09:15:31 -07:00
|
|
|
Efl_Ui_Layout_Object_Data *sd = efl_data_scope_safe_get(obj, MY_CLASS);
|
2017-08-01 23:17:54 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(sd, EINA_FALSE);
|
2014-01-01 16:23:03 -08:00
|
|
|
sd->can_access = !!can_access;
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2017-08-01 23:17:54 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_layout_edje_object_can_access_get(const Eo *obj)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2018-04-06 09:15:31 -07:00
|
|
|
Efl_Ui_Layout_Object_Data *sd = efl_data_scope_safe_get(obj, MY_CLASS);
|
2017-08-01 23:17:54 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(sd, EINA_FALSE);
|
2014-03-16 06:43:07 -07:00
|
|
|
return sd->can_access;
|
2012-07-05 21:03:21 -07:00
|
|
|
}
|
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
EOLIAN static void
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_efl_object_dbg_info_get(Eo *eo_obj, Efl_Ui_Layout_Object_Data *_pd EINA_UNUSED, Efl_Dbg_Info *root)
|
2013-02-19 08:23:27 -08:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_dbg_info_get(efl_super(eo_obj, MY_CLASS), root);
|
2013-10-05 00:36:33 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(eo_obj, wd);
|
2013-02-19 08:23:27 -08:00
|
|
|
|
2017-12-05 19:15:39 -08:00
|
|
|
if (wd->resize_obj && efl_isa(wd->resize_obj, EFL_CANVAS_LAYOUT_CLASS))
|
2013-02-19 08:23:27 -08:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
Efl_Dbg_Info *group = EFL_DBG_INFO_LIST_APPEND(root, MY_CLASS_NAME);
|
2013-04-08 22:48:42 -07:00
|
|
|
const char *file, *edje_group;
|
2013-02-19 08:23:27 -08:00
|
|
|
Evas_Object *edje_obj = wd->resize_obj;
|
2017-05-25 18:29:05 -07:00
|
|
|
Edje_Load_Error error;
|
2013-02-19 08:23:27 -08:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
efl_file_get(edje_obj, &file, &edje_group);
|
2016-08-15 06:44:41 -07:00
|
|
|
EFL_DBG_INFO_APPEND(group, "File", EINA_VALUE_TYPE_STRING, file);
|
|
|
|
EFL_DBG_INFO_APPEND(group, "Group", EINA_VALUE_TYPE_STRING, edje_group);
|
2013-02-19 08:23:27 -08:00
|
|
|
|
2017-05-25 18:29:05 -07:00
|
|
|
error = edje_object_load_error_get(edje_obj);
|
2013-02-19 08:23:27 -08:00
|
|
|
if (error != EDJE_LOAD_ERROR_NONE)
|
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
EFL_DBG_INFO_APPEND(group, "Error", EINA_VALUE_TYPE_STRING,
|
2013-04-08 22:48:42 -07:00
|
|
|
edje_load_error_str(error));
|
2013-02-19 08:23:27 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-31 12:17:58 -08:00
|
|
|
static void
|
2018-01-26 16:56:53 -08:00
|
|
|
_efl_ui_layout_view_model_property_update(Efl_Ui_Layout_Object_Data *pd, const char *part, const char *fetch)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
2018-01-26 16:56:53 -08:00
|
|
|
Eina_Value *v = NULL;
|
|
|
|
char *value;
|
|
|
|
|
|
|
|
v = efl_model_property_get(pd->connect.model, fetch);
|
|
|
|
value = eina_value_to_string(v);
|
|
|
|
|
|
|
|
pd->connect.updating = EINA_TRUE; // Prevent recursive call to property_set while updating text
|
|
|
|
efl_text_set(efl_part(pd->obj, part), value);
|
|
|
|
pd->connect.updating = EINA_FALSE;
|
|
|
|
|
|
|
|
eina_value_free(v);
|
|
|
|
free(value);
|
2017-01-31 12:17:58 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2018-01-26 16:56:53 -08:00
|
|
|
_efl_ui_layout_view_model_signal_update(Efl_Ui_Layout_Object_Data *pd, const char *signal, const char *fetch)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
2018-01-26 16:56:53 -08:00
|
|
|
Eina_Value *v = NULL;
|
2017-01-31 12:17:58 -08:00
|
|
|
Eina_Strbuf *buf;
|
2018-01-26 16:56:53 -08:00
|
|
|
char *value;
|
|
|
|
|
|
|
|
v = efl_model_property_get(pd->connect.model, fetch);
|
2017-01-31 12:17:58 -08:00
|
|
|
|
2018-01-26 16:56:53 -08:00
|
|
|
// FIXME: previous implementation would just do that for signal/part == "selected"
|
|
|
|
if (eina_value_type_get(v) == EINA_VALUE_TYPE_UCHAR)
|
|
|
|
{
|
|
|
|
Eina_Bool bl;
|
|
|
|
|
|
|
|
eina_value_bool_get(v, &bl);
|
|
|
|
if (bl) value = strdup("selected");
|
|
|
|
else value = strdup("unselected");
|
|
|
|
}
|
|
|
|
else
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
2018-01-26 16:56:53 -08:00
|
|
|
value = eina_value_to_string(v);
|
2017-01-31 12:17:58 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
buf = eina_strbuf_new();
|
2018-01-26 16:56:53 -08:00
|
|
|
// FIXME: is it really the form of signal we want to send ?
|
|
|
|
eina_strbuf_append_printf(buf, "%s%s", signal, value);
|
|
|
|
elm_layout_signal_emit(pd->obj, eina_strbuf_string_get(buf),
|
|
|
|
elm_widget_is_legacy(pd->obj) ? "elm" : "efl");
|
2017-01-31 12:17:58 -08:00
|
|
|
|
|
|
|
eina_strbuf_free(buf);
|
2018-01-26 16:56:53 -08:00
|
|
|
eina_value_free(v);
|
|
|
|
free(value);
|
2017-01-31 12:17:58 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2018-01-26 16:56:53 -08:00
|
|
|
_efl_ui_layout_view_model_content_update(Efl_Ui_Layout_Object_Data *pd, Efl_Ui_Factory *factory, const char *name)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
2018-01-26 16:56:53 -08:00
|
|
|
Efl_Gfx_Entity *content;
|
2017-12-12 16:59:48 -08:00
|
|
|
|
2018-01-26 16:56:53 -08:00
|
|
|
content = efl_ui_factory_create(factory, pd->connect.model, pd->obj);
|
|
|
|
elm_layout_content_set(pd->obj, name, content);
|
2017-01-31 12:17:58 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_view_model_update(Efl_Ui_Layout_Object_Data *pd)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
2018-01-26 16:56:53 -08:00
|
|
|
Eina_Hash_Tuple *tuple;
|
|
|
|
Eina_Iterator *it;
|
2017-01-31 12:17:58 -08:00
|
|
|
|
2018-01-26 16:56:53 -08:00
|
|
|
if (!pd->connect.model) return ;
|
2017-01-31 12:17:58 -08:00
|
|
|
|
2018-01-26 16:56:53 -08:00
|
|
|
it = eina_hash_iterator_tuple_new(pd->connect.properties);
|
|
|
|
EINA_ITERATOR_FOREACH(it, tuple)
|
|
|
|
_efl_ui_layout_view_model_property_update(pd, tuple->data, tuple->key);
|
|
|
|
eina_iterator_free(it);
|
|
|
|
|
|
|
|
it = eina_hash_iterator_tuple_new(pd->connect.signals);
|
|
|
|
EINA_ITERATOR_FOREACH(it, tuple)
|
|
|
|
_efl_ui_layout_view_model_signal_update(pd, tuple->data, tuple->key);
|
|
|
|
eina_iterator_free(it);
|
|
|
|
|
|
|
|
it = eina_hash_iterator_tuple_new(pd->connect.factories);
|
|
|
|
EINA_ITERATOR_FOREACH(it, tuple)
|
|
|
|
_efl_ui_layout_view_model_content_update(pd, tuple->data, tuple->key);
|
|
|
|
eina_iterator_free(it);
|
2017-01-31 12:17:58 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_efl_model_properties_changed_cb(void *data, const Efl_Event *event)
|
|
|
|
{
|
|
|
|
Efl_Model_Property_Event *evt = event->info;
|
2018-01-26 16:56:53 -08:00
|
|
|
Efl_Ui_Layout_Object_Data *pd = data;
|
2017-01-31 12:17:58 -08:00
|
|
|
const char *prop;
|
|
|
|
Eina_Array_Iterator it;
|
|
|
|
unsigned int i;
|
|
|
|
|
2018-01-26 16:56:53 -08:00
|
|
|
if (!evt->changed_properties) return ;
|
2017-01-31 12:17:58 -08:00
|
|
|
|
|
|
|
EINA_ARRAY_ITER_NEXT(evt->changed_properties, i, prop, it)
|
|
|
|
{
|
2018-01-26 16:56:53 -08:00
|
|
|
Eina_Stringshare *sprop = eina_stringshare_add(prop);
|
|
|
|
const char *part;
|
|
|
|
const char *signal;
|
|
|
|
Efl_Ui_Factory *factory;
|
|
|
|
|
|
|
|
part = eina_hash_find(pd->connect.properties, sprop);
|
|
|
|
if (part) _efl_ui_layout_view_model_property_update(pd, part, sprop);
|
|
|
|
|
|
|
|
signal = eina_hash_find(pd->connect.signals, sprop);
|
|
|
|
if (signal) _efl_ui_layout_view_model_signal_update(pd, signal, sprop);
|
|
|
|
|
|
|
|
factory = eina_hash_find(pd->connect.factories, sprop);
|
|
|
|
if (factory) _efl_ui_layout_view_model_content_update(pd, factory, sprop);
|
|
|
|
|
|
|
|
eina_stringshare_del(sprop);
|
2017-01-31 12:17:58 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-26 16:56:53 -08:00
|
|
|
static void
|
|
|
|
_efl_ui_layout_connect_hash(Efl_Ui_Layout_Object_Data *pd)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
2018-01-26 16:56:53 -08:00
|
|
|
if (pd->connect.properties) return ;
|
2017-12-12 16:59:48 -08:00
|
|
|
|
2018-01-26 16:56:53 -08:00
|
|
|
// FIXME: fix destruction function definition
|
|
|
|
pd->connect.properties = eina_hash_stringshared_new(NULL); // Hash of property targeting a part
|
|
|
|
pd->connect.signals = eina_hash_stringshared_new(NULL); // Hash of property triggering a signal
|
|
|
|
pd->connect.factories = eina_hash_stringshared_new(EINA_FREE_CB(efl_unref)); // Hash of property triggering a content creation
|
|
|
|
}
|
2017-12-12 16:59:48 -08:00
|
|
|
|
2018-01-26 16:56:53 -08:00
|
|
|
EOLIAN static void
|
|
|
|
_efl_ui_layout_object_efl_ui_view_model_set(Eo *obj, Efl_Ui_Layout_Object_Data *pd, Efl_Model *model)
|
|
|
|
{
|
|
|
|
Eina_Stringshare *name;
|
|
|
|
Eina_Hash_Tuple *tuple;
|
|
|
|
Eina_Iterator *it;
|
|
|
|
|
|
|
|
efl_replace(&pd->connect.model, model);
|
2017-01-31 12:17:58 -08:00
|
|
|
|
|
|
|
if (model)
|
|
|
|
{
|
2018-01-26 16:56:53 -08:00
|
|
|
efl_event_callback_add(pd->connect.model, EFL_MODEL_EVENT_PROPERTIES_CHANGED,
|
|
|
|
_efl_model_properties_changed_cb, pd);
|
2017-01-31 12:17:58 -08:00
|
|
|
}
|
2017-12-12 16:59:48 -08:00
|
|
|
|
2018-01-26 16:56:53 -08:00
|
|
|
_efl_ui_layout_connect_hash(pd);
|
2017-01-31 12:17:58 -08:00
|
|
|
|
2018-01-26 16:56:53 -08:00
|
|
|
// Reset to empty state
|
|
|
|
it = eina_hash_iterator_key_new(pd->connect.properties);
|
|
|
|
EINA_ITERATOR_FOREACH(it, name)
|
|
|
|
{
|
|
|
|
efl_text_set(efl_part(obj, name), NULL);
|
|
|
|
}
|
|
|
|
eina_iterator_free(it);
|
2017-01-31 12:17:58 -08:00
|
|
|
|
2018-01-26 16:56:53 -08:00
|
|
|
it = eina_hash_iterator_tuple_new(pd->connect.factories);
|
|
|
|
EINA_ITERATOR_FOREACH(it, tuple)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
2018-01-26 16:56:53 -08:00
|
|
|
Efl_Ui_Factory *factory;
|
|
|
|
Efl_Gfx_Entity *content;
|
2017-01-31 12:17:58 -08:00
|
|
|
|
2018-01-26 16:56:53 -08:00
|
|
|
name = tuple->key;
|
|
|
|
factory = tuple->data;
|
|
|
|
content = elm_layout_content_get(obj, name);
|
2017-01-31 12:17:58 -08:00
|
|
|
|
2018-01-26 16:56:53 -08:00
|
|
|
elm_layout_content_set(obj, name, NULL);
|
|
|
|
efl_ui_factory_release(factory, content);
|
2017-01-31 12:17:58 -08:00
|
|
|
}
|
2018-01-26 16:56:53 -08:00
|
|
|
eina_iterator_free(it);
|
|
|
|
|
|
|
|
// Refresh content if necessary
|
|
|
|
_efl_ui_layout_view_model_update(pd);
|
2017-01-31 12:17:58 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Efl_Model *
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_object_efl_ui_view_model_get(const Eo *obj EINA_UNUSED, Efl_Ui_Layout_Object_Data *pd)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
2018-01-26 16:56:53 -08:00
|
|
|
return pd->connect.model;
|
2017-01-31 12:17:58 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_object_efl_ui_model_connect_connect(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Object_Data *pd, const char *name, const char *property)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(name);
|
2018-01-26 16:56:53 -08:00
|
|
|
Eina_Stringshare *sprop;
|
|
|
|
Eina_Hash *hash = NULL;
|
|
|
|
char *data = NULL;
|
2017-06-07 10:23:27 -07:00
|
|
|
|
2017-06-29 03:32:19 -07:00
|
|
|
if (!_elm_layout_part_aliasing_eval(obj, &name, EINA_TRUE))
|
2017-01-31 12:17:58 -08:00
|
|
|
return;
|
|
|
|
|
2018-01-26 16:56:53 -08:00
|
|
|
_efl_ui_layout_connect_hash(pd);
|
|
|
|
|
|
|
|
sprop = eina_stringshare_add(property);
|
2017-09-06 20:07:08 -07:00
|
|
|
|
2018-01-26 16:56:53 -08:00
|
|
|
// FIXME: prevent double connect of name to multiple property ?
|
|
|
|
if (strncmp(SIGNAL_PREFIX, name, sizeof(SIGNAL_PREFIX) - 1) == 0)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
2018-01-26 16:56:53 -08:00
|
|
|
hash = pd->connect.signals;
|
|
|
|
data = strdup(name + sizeof(SIGNAL_PREFIX) - 1);
|
2017-09-06 20:07:08 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-01-26 16:56:53 -08:00
|
|
|
hash = pd->connect.properties;
|
|
|
|
data = strdup(name);
|
2017-01-31 12:17:58 -08:00
|
|
|
}
|
|
|
|
|
2018-01-26 16:56:53 -08:00
|
|
|
if (!sprop)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
2018-01-26 16:56:53 -08:00
|
|
|
// FIXME: remove the entry from the hash ?
|
2017-09-06 20:07:08 -07:00
|
|
|
}
|
2018-01-26 16:56:53 -08:00
|
|
|
else
|
2017-09-06 20:07:08 -07:00
|
|
|
{
|
2018-01-26 16:56:53 -08:00
|
|
|
eina_hash_add(hash, sprop, data);
|
2017-01-31 12:17:58 -08:00
|
|
|
}
|
2018-01-26 16:56:53 -08:00
|
|
|
|
|
|
|
// Update display right away if possible
|
|
|
|
if (!pd->connect.model) return ;
|
|
|
|
|
|
|
|
if (hash == pd->connect.signals)
|
|
|
|
_efl_ui_layout_view_model_signal_update(pd, data, sprop);
|
|
|
|
else
|
|
|
|
_efl_ui_layout_view_model_property_update(pd, data, sprop);
|
2017-01-31 12:17:58 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_object_efl_ui_factory_model_connect(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Object_Data *pd,
|
2017-01-31 12:17:58 -08:00
|
|
|
const char *name, Efl_Ui_Factory *factory)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(name);
|
|
|
|
Eina_Stringshare *ss_name;
|
|
|
|
Efl_Ui_Factory *old_factory;
|
|
|
|
Evas_Object *new_ev, *old_ev;
|
|
|
|
|
2017-06-29 03:32:19 -07:00
|
|
|
if (!_elm_layout_part_aliasing_eval(obj, &name, EINA_TRUE))
|
2017-01-31 12:17:58 -08:00
|
|
|
return;
|
|
|
|
|
|
|
|
ss_name = eina_stringshare_add(name);
|
|
|
|
|
2018-01-26 16:56:53 -08:00
|
|
|
if (!pd->connect.factories)
|
|
|
|
pd->connect.factories = eina_hash_stringshared_new(EINA_FREE_CB(efl_unref));
|
2017-01-31 12:17:58 -08:00
|
|
|
|
2018-01-26 16:56:53 -08:00
|
|
|
new_ev = efl_ui_factory_create(factory, pd->connect.model, obj);
|
2017-01-31 12:17:58 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(new_ev);
|
|
|
|
|
2018-01-26 16:56:53 -08:00
|
|
|
old_factory = eina_hash_set(pd->connect.factories, ss_name, efl_ref(factory));
|
2017-01-31 12:17:58 -08:00
|
|
|
if (old_factory)
|
|
|
|
{
|
|
|
|
old_ev = elm_layout_content_get(obj, name);
|
|
|
|
if (old_ev)
|
|
|
|
efl_ui_factory_release(old_factory, old_ev);
|
|
|
|
efl_unref(old_factory);
|
|
|
|
}
|
|
|
|
|
|
|
|
elm_layout_content_set(obj, name, new_ev);
|
|
|
|
}
|
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_object_efl_object_constructor(Eo *obj, Efl_Ui_Layout_Object_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
|
|
|
sd->obj = obj;
|
2016-08-15 06:44:41 -07:00
|
|
|
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
2016-06-16 22:12:02 -07:00
|
|
|
evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
|
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;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-11-14 03:38:49 -08:00
|
|
|
EOLIAN static Efl_Object*
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_object_efl_object_finalize(Eo *obj, Efl_Ui_Layout_Object_Data *pd EINA_UNUSED)
|
2017-11-14 03:38:49 -08:00
|
|
|
{
|
|
|
|
Eo *eo;
|
|
|
|
|
|
|
|
eo = efl_finalize(efl_super(obj, MY_CLASS));
|
|
|
|
efl_ui_widget_theme_apply(eo);
|
|
|
|
|
|
|
|
return eo;
|
|
|
|
}
|
|
|
|
|
2017-08-07 03:11:31 -07:00
|
|
|
EOLIAN static void
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_object_efl_layout_signal_message_send(Eo *obj, Efl_Ui_Layout_Object_Data *pd EINA_UNUSED, int id, const Eina_Value msg)
|
2017-08-07 03:11:31 -07:00
|
|
|
{
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2017-12-04 21:39:20 -08:00
|
|
|
efl_layout_signal_message_send(wd->resize_obj, id, msg);
|
2017-08-07 03:11:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_object_efl_layout_signal_signal_process(Eo *obj, Efl_Ui_Layout_Object_Data *pd EINA_UNUSED, Eina_Bool recurse)
|
2017-08-07 03:11:31 -07:00
|
|
|
{
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2017-12-04 21:39:20 -08:00
|
|
|
efl_layout_signal_process(wd->resize_obj, recurse);
|
2017-08-07 03:11:31 -07:00
|
|
|
}
|
2016-05-24 04:40:18 -07:00
|
|
|
|
2018-01-23 22:50:58 -08:00
|
|
|
/* Efl.Part implementation */
|
|
|
|
|
|
|
|
EOLIAN static Eo *
|
2018-05-03 16:34:17 -07:00
|
|
|
_efl_ui_layout_object_efl_part_part_get(const Eo *obj, Efl_Ui_Layout_Object_Data *sd EINA_UNUSED, const char *part)
|
2018-01-23 22:50:58 -08:00
|
|
|
{
|
|
|
|
Efl_Canvas_Layout_Part_Type type = EFL_CANVAS_LAYOUT_PART_TYPE_NONE;
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL);
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN((Eo *) obj, wd, NULL);
|
|
|
|
|
|
|
|
// Check part type without using edje_object_part_object_get(), as this
|
|
|
|
// can cause recalc, which has side effects... and could be slow.
|
|
|
|
|
|
|
|
if (eina_streq(part, "background"))
|
|
|
|
{
|
2018-04-26 03:27:43 -07:00
|
|
|
if (efl_layout_group_part_exist_get(wd->resize_obj, "efl.background"))
|
|
|
|
type = efl_canvas_layout_part_type_get(efl_part(wd->resize_obj, "efl.background"));
|
2018-01-23 22:50:58 -08:00
|
|
|
if (type != EFL_CANVAS_LAYOUT_PART_TYPE_SWALLOW)
|
|
|
|
{
|
|
|
|
if (type < EFL_CANVAS_LAYOUT_PART_TYPE_LAST &&
|
|
|
|
type > EFL_CANVAS_LAYOUT_PART_TYPE_NONE)
|
|
|
|
{
|
|
|
|
const char *file = NULL, *key = NULL;
|
|
|
|
efl_file_get(wd->resize_obj, &file, &key);
|
|
|
|
WRN("Layout has a background but it's not a swallow: '%s'",
|
|
|
|
elm_widget_theme_element_get(obj));
|
|
|
|
}
|
2018-05-03 16:34:17 -07:00
|
|
|
return efl_part_get(efl_super(obj, MY_CLASS), part);
|
2018-01-23 22:50:58 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
return ELM_PART_IMPLEMENT(EFL_UI_LAYOUT_PART_BG_CLASS, obj, part);
|
|
|
|
}
|
|
|
|
else if (eina_streq(part, "shadow"))
|
2018-05-03 16:34:17 -07:00
|
|
|
return efl_part_get(efl_super(obj, MY_CLASS), part);
|
2018-01-23 22:50:58 -08:00
|
|
|
|
|
|
|
if (!efl_layout_group_part_exist_get(wd->resize_obj, part))
|
|
|
|
{
|
|
|
|
// edje part will handle the error message
|
2018-05-03 16:34:17 -07:00
|
|
|
return efl_part_get(wd->resize_obj, part);
|
2018-01-23 22:50:58 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
type = efl_canvas_layout_part_type_get(efl_part(wd->resize_obj, part));
|
|
|
|
if (type >= EFL_CANVAS_LAYOUT_PART_TYPE_LAST)
|
|
|
|
{
|
|
|
|
ERR("Invalid type found for part '%s' in group '%s'",
|
|
|
|
part, elm_widget_theme_element_get(obj));
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case EFL_CANVAS_LAYOUT_PART_TYPE_BOX:
|
|
|
|
case EFL_CANVAS_LAYOUT_PART_TYPE_TABLE:
|
|
|
|
return _efl_ui_layout_pack_proxy_get((Eo *) obj, type, part);
|
|
|
|
case EFL_CANVAS_LAYOUT_PART_TYPE_TEXT:
|
|
|
|
case EFL_CANVAS_LAYOUT_PART_TYPE_TEXTBLOCK:
|
|
|
|
return ELM_PART_IMPLEMENT(EFL_UI_LAYOUT_PART_TEXT_CLASS, obj, part);
|
|
|
|
case EFL_CANVAS_LAYOUT_PART_TYPE_SWALLOW:
|
|
|
|
return ELM_PART_IMPLEMENT(EFL_UI_LAYOUT_PART_CONTENT_CLASS, obj, part);
|
|
|
|
default:
|
|
|
|
return ELM_PART_IMPLEMENT(EFL_UI_LAYOUT_PART_CLASS, obj, part);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char *
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_default_content_part_get(const Eo *obj, Efl_Ui_Layout_Object_Data *sd EINA_UNUSED)
|
2018-01-23 22:50:58 -08:00
|
|
|
{
|
|
|
|
const char *part = NULL;
|
|
|
|
if (!_elm_layout_part_aliasing_eval(obj, &part, EINA_FALSE))
|
|
|
|
return NULL;
|
|
|
|
return part;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char *
|
2018-04-06 09:15:31 -07:00
|
|
|
_efl_ui_layout_default_text_part_get(const Eo *obj, Efl_Ui_Layout_Object_Data *sd EINA_UNUSED)
|
2018-01-23 22:50:58 -08:00
|
|
|
{
|
|
|
|
const char *part = NULL;
|
|
|
|
if (!_elm_layout_part_aliasing_eval(obj, &part, EINA_TRUE))
|
|
|
|
return NULL;
|
|
|
|
return part;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Efl.Ui.Layout.Part (common) */
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_efl_ui_layout_part_efl_ui_cursor_cursor_set(Eo *obj, void *_pd EINA_UNUSED, const char *cursor)
|
|
|
|
{
|
|
|
|
Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
|
2018-04-06 09:15:31 -07:00
|
|
|
Efl_Ui_Layout_Object_Data *sd = efl_data_scope_get(pd->obj, MY_CLASS);
|
2018-01-23 22:50:58 -08:00
|
|
|
return _efl_ui_layout_part_cursor_set(sd, pd->part, cursor);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static const char *
|
2018-04-17 11:09:44 -07:00
|
|
|
_efl_ui_layout_part_efl_ui_cursor_cursor_get(const Eo *obj, void *_pd EINA_UNUSED)
|
2018-01-23 22:50:58 -08:00
|
|
|
{
|
|
|
|
Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
|
2018-04-06 09:15:31 -07:00
|
|
|
Efl_Ui_Layout_Object_Data *sd = efl_data_scope_get(pd->obj, MY_CLASS);
|
2018-01-23 22:50:58 -08:00
|
|
|
return _efl_ui_layout_part_cursor_get(sd, pd->part);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_efl_ui_layout_part_efl_ui_cursor_cursor_style_set(Eo *obj, void *_pd EINA_UNUSED, const char *style)
|
|
|
|
{
|
|
|
|
Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
|
2018-04-06 09:15:31 -07:00
|
|
|
Efl_Ui_Layout_Object_Data *sd = efl_data_scope_get(pd->obj, MY_CLASS);
|
2018-01-23 22:50:58 -08:00
|
|
|
return _efl_ui_layout_part_cursor_style_set(sd, pd->part, style);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static const char *
|
2018-04-17 11:09:44 -07:00
|
|
|
_efl_ui_layout_part_efl_ui_cursor_cursor_style_get(const Eo *obj, void *_pd EINA_UNUSED)
|
2018-01-23 22:50:58 -08:00
|
|
|
{
|
|
|
|
Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
|
2018-04-06 09:15:31 -07:00
|
|
|
Efl_Ui_Layout_Object_Data *sd = efl_data_scope_get(pd->obj, MY_CLASS);
|
2018-01-23 22:50:58 -08:00
|
|
|
return _efl_ui_layout_part_cursor_style_get(sd, pd->part);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_efl_ui_layout_part_efl_ui_cursor_cursor_theme_search_enabled_set(Eo *obj, void *_pd EINA_UNUSED, Eina_Bool allow)
|
|
|
|
{
|
|
|
|
Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
|
2018-04-06 09:15:31 -07:00
|
|
|
Efl_Ui_Layout_Object_Data *sd = efl_data_scope_get(pd->obj, MY_CLASS);
|
2018-01-23 22:50:58 -08:00
|
|
|
return _efl_ui_layout_part_cursor_engine_only_set(sd, pd->part, !allow);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_efl_ui_layout_part_efl_ui_cursor_cursor_theme_search_enabled_get(const Eo *obj, void *_pd EINA_UNUSED)
|
2018-01-23 22:50:58 -08:00
|
|
|
{
|
|
|
|
Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
|
2018-04-06 09:15:31 -07:00
|
|
|
Efl_Ui_Layout_Object_Data *sd = efl_data_scope_get(pd->obj, MY_CLASS);
|
2018-01-23 22:50:58 -08:00
|
|
|
return !_efl_ui_layout_part_cursor_engine_only_get(sd, pd->part);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Efl.Ui.Layout.Part_Content */
|
2018-04-06 09:15:31 -07:00
|
|
|
ELM_PART_OVERRIDE_CONTENT_GET_FULL(efl_ui_layout_part_content, efl_ui_layout, EFL_UI_LAYOUT_OBJECT, Efl_Ui_Layout_Object_Data)
|
|
|
|
ELM_PART_OVERRIDE_CONTENT_SET_FULL(efl_ui_layout_part_content, efl_ui_layout, EFL_UI_LAYOUT_OBJECT, Efl_Ui_Layout_Object_Data)
|
|
|
|
ELM_PART_OVERRIDE_CONTENT_UNSET_FULL(efl_ui_layout_part_content, efl_ui_layout, EFL_UI_LAYOUT_OBJECT, Efl_Ui_Layout_Object_Data)
|
2018-01-23 22:50:58 -08:00
|
|
|
|
|
|
|
/* Efl.Ui.Layout.Part_Text */
|
2018-04-06 09:15:31 -07:00
|
|
|
ELM_PART_OVERRIDE_TEXT_TEXT_GET_FULL(efl_ui_layout_part_text, efl_ui_layout, EFL_UI_LAYOUT_OBJECT, Efl_Ui_Layout_Object_Data)
|
|
|
|
ELM_PART_OVERRIDE_TEXT_TEXT_SET_FULL(efl_ui_layout_part_text, efl_ui_layout, EFL_UI_LAYOUT_OBJECT, Efl_Ui_Layout_Object_Data)
|
|
|
|
ELM_PART_OVERRIDE_TEXT_MARKUP_GET_FULL(efl_ui_layout_part_text, efl_ui_layout, EFL_UI_LAYOUT_OBJECT, Efl_Ui_Layout_Object_Data)
|
|
|
|
ELM_PART_OVERRIDE_TEXT_MARKUP_SET_FULL(efl_ui_layout_part_text, efl_ui_layout, EFL_UI_LAYOUT_OBJECT, Efl_Ui_Layout_Object_Data)
|
2018-01-23 22:50:58 -08:00
|
|
|
|
|
|
|
EOLIAN static const char *
|
2018-04-17 11:09:44 -07:00
|
|
|
_efl_ui_layout_part_text_efl_ui_translatable_translatable_text_get(const Eo *obj, void *_pd EINA_UNUSED, const char **domain)
|
2018-01-23 22:50:58 -08:00
|
|
|
{
|
|
|
|
Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
|
|
|
|
return elm_widget_part_translatable_text_get(pd->obj, pd->part, domain);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
|
|
|
_efl_ui_layout_part_text_efl_ui_translatable_translatable_text_set(Eo *obj, void *_pd EINA_UNUSED, const char *label, const char *domain)
|
|
|
|
{
|
|
|
|
Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
|
|
|
|
elm_widget_part_translatable_text_set(pd->obj, pd->part, label, domain);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Efl.Ui.Layout.Part_Legacy */
|
2018-04-06 09:15:31 -07:00
|
|
|
ELM_PART_OVERRIDE_CONTENT_GET_FULL(efl_ui_layout_part_legacy, efl_ui_layout, EFL_UI_LAYOUT_OBJECT, Efl_Ui_Layout_Object_Data)
|
|
|
|
ELM_PART_OVERRIDE_CONTENT_SET_FULL(efl_ui_layout_part_legacy, efl_ui_layout, EFL_UI_LAYOUT_OBJECT, Efl_Ui_Layout_Object_Data)
|
|
|
|
ELM_PART_OVERRIDE_CONTENT_UNSET_FULL(efl_ui_layout_part_legacy, efl_ui_layout, EFL_UI_LAYOUT_OBJECT, Efl_Ui_Layout_Object_Data)
|
|
|
|
ELM_PART_OVERRIDE_TEXT_TEXT_GET_FULL(efl_ui_layout_part_legacy, efl_ui_layout, EFL_UI_LAYOUT_OBJECT, Efl_Ui_Layout_Object_Data)
|
|
|
|
ELM_PART_OVERRIDE_TEXT_TEXT_SET_FULL(efl_ui_layout_part_legacy, efl_ui_layout, EFL_UI_LAYOUT_OBJECT, Efl_Ui_Layout_Object_Data)
|
|
|
|
ELM_PART_OVERRIDE_TEXT_MARKUP_GET_FULL(efl_ui_layout_part_legacy, efl_ui_layout, EFL_UI_LAYOUT_OBJECT, Efl_Ui_Layout_Object_Data)
|
|
|
|
ELM_PART_OVERRIDE_TEXT_MARKUP_SET_FULL(efl_ui_layout_part_legacy, efl_ui_layout, EFL_UI_LAYOUT_OBJECT, Efl_Ui_Layout_Object_Data)
|
2018-01-23 22:50:58 -08:00
|
|
|
|
|
|
|
EOLIAN static const char *
|
2018-04-17 11:09:44 -07:00
|
|
|
_efl_ui_layout_part_legacy_efl_ui_translatable_translatable_text_get(const Eo *obj, void *_pd EINA_UNUSED, const char **domain)
|
2018-01-23 22:50:58 -08:00
|
|
|
{
|
|
|
|
Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
|
|
|
|
return elm_widget_part_translatable_text_get(pd->obj, pd->part, domain);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
|
|
|
_efl_ui_layout_part_legacy_efl_ui_translatable_translatable_text_set(Eo *obj, void *_pd EINA_UNUSED, const char *label, const char *domain)
|
|
|
|
{
|
|
|
|
Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
|
|
|
|
elm_widget_part_translatable_text_set(pd->obj, pd->part, label, domain);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Efl.Ui.Layout.Part_Bg (common) */
|
|
|
|
|
|
|
|
EOLIAN static Efl_Object *
|
|
|
|
_efl_ui_layout_part_bg_efl_object_finalize(Eo *obj, void *_pd EINA_UNUSED)
|
|
|
|
{
|
2018-04-06 09:15:31 -07:00
|
|
|
Efl_Ui_Layout_Object_Data *sd;
|
2018-01-23 22:50:58 -08:00
|
|
|
Elm_Part_Data *pd;
|
|
|
|
Eo *bg;
|
|
|
|
|
|
|
|
obj = efl_finalize(efl_super(obj, EFL_UI_LAYOUT_PART_BG_CLASS));
|
|
|
|
if (!obj) return NULL;
|
|
|
|
|
|
|
|
pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
|
|
|
|
sd = efl_data_scope_get(pd->obj, MY_CLASS);
|
|
|
|
bg = _efl_ui_widget_bg_get(pd->obj);
|
2018-04-26 03:27:43 -07:00
|
|
|
if (!_efl_ui_layout_content_set(pd->obj, sd, "efl.background", bg))
|
2018-01-23 22:50:58 -08:00
|
|
|
{
|
|
|
|
ERR("Failed to swallow new background object!");
|
|
|
|
// Shouldn't happen. What now? del bg? call super? return null?
|
|
|
|
}
|
|
|
|
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Efl.Ui.Layout.Part_Xxx includes */
|
|
|
|
#include "efl_ui_layout_part.eo.c"
|
|
|
|
#include "efl_ui_layout_part_content.eo.c"
|
|
|
|
#include "efl_ui_layout_part_bg.eo.c"
|
|
|
|
#include "efl_ui_layout_part_text.eo.c"
|
|
|
|
#include "efl_ui_layout_part_legacy.eo.c"
|
|
|
|
|
|
|
|
/* Efl.Part end */
|
|
|
|
|
|
|
|
|
|
|
|
/* Internal EO APIs and hidden overrides */
|
|
|
|
|
|
|
|
EAPI EFL_VOID_FUNC_BODY(elm_layout_sizing_eval)
|
|
|
|
EFL_FUNC_BODY_CONST(elm_layout_text_aliases_get, const Elm_Layout_Part_Alias_Description *, NULL)
|
|
|
|
EFL_FUNC_BODY_CONST(elm_layout_content_aliases_get, const Elm_Layout_Part_Alias_Description *, NULL)
|
|
|
|
|
|
|
|
ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX)
|
|
|
|
ELM_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX)
|
|
|
|
|
2018-04-06 09:15:31 -07:00
|
|
|
#define EFL_UI_LAYOUT_OBJECT_EXTRA_OPS \
|
2018-01-23 22:50:58 -08:00
|
|
|
EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_ui_layout), \
|
|
|
|
ELM_PART_CONTENT_DEFAULT_OPS(efl_ui_layout), \
|
|
|
|
ELM_PART_TEXT_DEFAULT_OPS(efl_ui_layout), \
|
|
|
|
ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \
|
|
|
|
ELM_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX), \
|
|
|
|
EFL_OBJECT_OP_FUNC(elm_layout_sizing_eval, _elm_layout_sizing_eval), \
|
|
|
|
EFL_OBJECT_OP_FUNC(efl_dbg_info_get, _efl_ui_layout_efl_object_dbg_info_get)
|
|
|
|
|
2018-04-06 09:15:31 -07:00
|
|
|
#include "efl_ui_layout_object.eo.c"
|
2018-01-23 22:50:58 -08:00
|
|
|
|
|
|
|
#include "efl_ui_layout_legacy.eo.h"
|
|
|
|
|
|
|
|
#define MY_CLASS_NAME_LEGACY "elm_layout"
|
|
|
|
|
|
|
|
static void
|
|
|
|
_efl_ui_layout_legacy_class_constructor(Efl_Class *klass)
|
|
|
|
{
|
|
|
|
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eo *
|
|
|
|
_efl_ui_layout_legacy_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED)
|
|
|
|
{
|
|
|
|
obj = efl_constructor(efl_super(obj, EFL_UI_LAYOUT_LEGACY_CLASS));
|
|
|
|
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
|
|
|
|
return obj;
|
|
|
|
}
|
2016-05-24 04:40:18 -07:00
|
|
|
|
2018-01-23 22:50:58 -08:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_layout_add(Evas_Object *parent)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
|
|
|
return elm_legacy_add(EFL_UI_LAYOUT_LEGACY_CLASS, parent);
|
|
|
|
}
|
2016-04-25 05:36:56 -07:00
|
|
|
|
2014-07-22 08:29:37 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_layout_file_set(Eo *obj, const char *file, const char *group)
|
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
return efl_file_set((Eo *) obj, file, group);
|
2014-07-22 08:29:37 -07:00
|
|
|
}
|
|
|
|
|
2015-04-14 13:19:18 -07:00
|
|
|
EAPI void
|
|
|
|
elm_layout_file_get(Eo *obj, const char **file, const char **group)
|
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
efl_file_get((Eo *) obj, file, group);
|
2015-04-14 13:19:18 -07:00
|
|
|
}
|
|
|
|
|
2016-11-07 14:42:04 -08:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_layout_mmap_set(Eo *obj, const Eina_File *file, const char *group)
|
|
|
|
{
|
|
|
|
return efl_file_mmap_set((Eo *) obj, file, group);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_layout_mmap_get(Eo *obj, const Eina_File **file, const char **group)
|
|
|
|
{
|
|
|
|
efl_file_mmap_get((Eo *) obj, file, group);
|
|
|
|
}
|
|
|
|
|
2016-04-25 05:36:56 -07:00
|
|
|
EAPI Eina_Bool
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_box_append(Eo *obj, const char *part, Evas_Object *child)
|
2016-04-25 05:36:56 -07:00
|
|
|
{
|
2016-05-25 19:54:30 -07:00
|
|
|
return efl_pack(efl_part(obj, part), child);
|
2016-04-25 05:36:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_box_prepend(Eo *obj, const char *part, Evas_Object *child)
|
2016-04-25 05:36:56 -07:00
|
|
|
{
|
2016-05-25 19:54:30 -07:00
|
|
|
return efl_pack_begin(efl_part(obj, part), child);
|
2016-04-25 05:36:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_box_insert_before(Eo *obj, const char *part, Evas_Object *child, const Evas_Object *reference)
|
2016-04-25 05:36:56 -07:00
|
|
|
{
|
2016-05-25 19:54:30 -07:00
|
|
|
return efl_pack_before(efl_part(obj, part), child, reference);
|
2016-04-25 05:36:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_box_insert_at(Eo *obj, const char *part, Evas_Object *child, unsigned int pos)
|
2016-04-25 05:36:56 -07:00
|
|
|
{
|
2016-05-25 19:54:30 -07:00
|
|
|
return efl_pack_at(efl_part(obj, part), child, pos);
|
2016-04-25 05:36:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Evas_Object *
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_box_remove(Eo *obj, const char *part, Evas_Object *child)
|
2016-04-25 05:36:56 -07:00
|
|
|
{
|
2016-05-25 19:54:30 -07:00
|
|
|
if (!efl_pack_unpack(efl_part(obj, part), child))
|
2016-04-25 05:36:56 -07:00
|
|
|
return NULL;
|
|
|
|
return child;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_box_remove_all(Eo *obj, const char *part, Eina_Bool clear)
|
2016-04-25 05:36:56 -07:00
|
|
|
{
|
|
|
|
if (clear)
|
2016-05-25 19:54:30 -07:00
|
|
|
return efl_pack_clear(efl_part(obj, part));
|
2016-04-25 05:36:56 -07:00
|
|
|
else
|
2016-05-25 19:54:30 -07:00
|
|
|
return efl_pack_unpack_all(efl_part(obj, part));
|
2016-04-25 05:36:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_table_pack(Eo *obj, const char *part, Evas_Object *child, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan)
|
2016-04-25 05:36:56 -07:00
|
|
|
{
|
2017-12-18 21:13:58 -08:00
|
|
|
return efl_pack_table(efl_part(obj, part), child, col, row, colspan, rowspan);
|
2016-04-25 05:36:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Evas_Object *
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_table_unpack(Eo *obj, const char *part, Evas_Object *child)
|
2016-04-25 05:36:56 -07:00
|
|
|
{
|
2016-05-25 19:54:30 -07:00
|
|
|
if (!efl_pack_unpack(efl_part(obj, part), child))
|
|
|
|
return NULL;
|
|
|
|
return child;
|
2016-04-25 05:36:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_table_clear(Eo *obj, const char *part, Eina_Bool clear)
|
2016-04-25 05:36:56 -07:00
|
|
|
{
|
|
|
|
if (clear)
|
2016-05-25 19:54:30 -07:00
|
|
|
return efl_pack_clear(efl_part(obj, part));
|
2016-04-25 05:36:56 -07:00
|
|
|
else
|
2016-05-25 19:54:30 -07:00
|
|
|
return efl_pack_unpack_all(efl_part(obj, part));
|
2016-04-25 05:36:56 -07:00
|
|
|
}
|
|
|
|
|
2017-06-04 07:25:36 -07:00
|
|
|
EAPI Eina_Bool
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_text_set(Eo *obj, const char *part, const char *text)
|
2017-06-04 07:25:36 -07:00
|
|
|
{
|
2017-07-04 02:54:44 -07:00
|
|
|
if (!part)
|
|
|
|
{
|
2018-01-07 20:55:35 -08:00
|
|
|
part = efl_ui_widget_default_text_part_get(obj);
|
2017-07-04 02:54:44 -07:00
|
|
|
if (!part) return EINA_FALSE;
|
|
|
|
}
|
2017-09-19 23:16:12 -07:00
|
|
|
else if (!_elm_layout_part_aliasing_eval(obj, &part, EINA_TRUE))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
2018-02-01 02:57:43 -08:00
|
|
|
efl_text_set(efl_part(obj, part), text);
|
2017-06-04 07:25:36 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI const char *
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_text_get(const Eo *obj, const char *part)
|
2017-06-04 07:25:36 -07:00
|
|
|
{
|
2017-07-04 02:54:44 -07:00
|
|
|
if (!part)
|
2017-06-04 07:25:36 -07:00
|
|
|
{
|
2018-01-07 20:55:35 -08:00
|
|
|
part = efl_ui_widget_default_text_part_get(obj);
|
2017-07-04 02:54:44 -07:00
|
|
|
if (!part) return NULL;
|
2017-06-04 07:25:36 -07:00
|
|
|
}
|
2017-09-19 23:16:12 -07:00
|
|
|
else if (!_elm_layout_part_aliasing_eval(obj, &part, EINA_TRUE))
|
|
|
|
return NULL;
|
|
|
|
|
2018-02-01 09:24:44 -08:00
|
|
|
return efl_text_get(efl_part(obj, part));
|
2017-06-04 07:25:36 -07:00
|
|
|
}
|
|
|
|
|
2017-08-02 03:41:47 -07:00
|
|
|
EAPI Eina_Bool
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_part_cursor_engine_only_set(Eo *obj, const char *part, Eina_Bool engine_only)
|
2017-08-02 03:41:47 -07:00
|
|
|
{
|
|
|
|
return efl_ui_cursor_theme_search_enabled_set(efl_part(obj, part), !engine_only);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_part_cursor_engine_only_get(const Eo *obj, const char *part)
|
2017-08-02 03:41:47 -07:00
|
|
|
{
|
|
|
|
return !efl_ui_cursor_theme_search_enabled_get(efl_part(obj, part));
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_part_cursor_set(Eo *obj, const char *part, const char *cursor)
|
2017-08-02 03:41:47 -07:00
|
|
|
{
|
|
|
|
return efl_ui_cursor_set(efl_part(obj, part), cursor);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI const char *
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_part_cursor_get(const Eo *obj, const char *part)
|
2017-08-02 03:41:47 -07:00
|
|
|
{
|
|
|
|
return efl_ui_cursor_get(efl_part(obj, part));
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_part_cursor_style_set(Eo *obj, const char *part, const char *style)
|
2017-08-02 03:41:47 -07:00
|
|
|
{
|
|
|
|
return efl_ui_cursor_style_set(efl_part(obj, part), style);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI const char *
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_part_cursor_style_get(const Eo *obj, const char *part)
|
2017-08-02 03:41:47 -07:00
|
|
|
{
|
|
|
|
return efl_ui_cursor_style_get(efl_part(obj, part));
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_part_cursor_unset(Eo *obj, const char *part)
|
2017-08-02 03:41:47 -07:00
|
|
|
{
|
|
|
|
return efl_ui_cursor_set(efl_part(obj, part), NULL);
|
|
|
|
}
|
2017-08-02 04:46:16 -07:00
|
|
|
|
|
|
|
EAPI int
|
|
|
|
elm_layout_freeze(Evas_Object *obj)
|
|
|
|
{
|
2017-12-04 22:29:07 -08:00
|
|
|
return efl_layout_calc_freeze(obj);
|
2017-08-02 04:46:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI int
|
|
|
|
elm_layout_thaw(Evas_Object *obj)
|
|
|
|
{
|
2017-12-04 22:29:07 -08:00
|
|
|
return efl_layout_calc_thaw(obj);
|
2017-08-02 04:46:16 -07:00
|
|
|
}
|
2017-08-03 01:24:50 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_elm_layout_signal_callback_add_legacy(Eo *obj, Eo *edje, Eina_List **p_edje_signals,
|
|
|
|
const char *emission, const char *source,
|
|
|
|
Edje_Signal_Cb func, void *data)
|
|
|
|
{
|
|
|
|
Edje_Signal_Data *esd;
|
|
|
|
|
|
|
|
esd = ELM_NEW(Edje_Signal_Data);
|
|
|
|
if (!esd) return;
|
|
|
|
|
|
|
|
esd->obj = obj;
|
|
|
|
esd->func = func;
|
|
|
|
esd->emission = eina_stringshare_add(emission);
|
|
|
|
esd->source = eina_stringshare_add(source);
|
|
|
|
esd->data = data;
|
|
|
|
*p_edje_signals = eina_list_append(*p_edje_signals, esd);
|
|
|
|
|
2017-12-04 21:39:20 -08:00
|
|
|
efl_layout_signal_callback_add(edje, emission, source,
|
2017-08-03 01:24:50 -07:00
|
|
|
_edje_signal_callback, esd);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_signal_callback_add(Eo *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data)
|
2017-08-03 01:24:50 -07:00
|
|
|
{
|
2018-04-06 09:15:31 -07:00
|
|
|
Efl_Ui_Layout_Object_Data *sd;
|
2017-08-03 01:24:50 -07:00
|
|
|
|
|
|
|
if (!emission || !source) return;
|
|
|
|
|
|
|
|
if (efl_isa(obj, ELM_ENTRY_CLASS))
|
|
|
|
{
|
|
|
|
_elm_entry_signal_callback_add_legacy(obj, emission, source, func, data);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
sd = efl_data_scope_safe_get(obj, MY_CLASS);
|
|
|
|
if (!sd) return;
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
|
|
|
|
|
|
|
_elm_layout_signal_callback_add_legacy(obj, wd->resize_obj, &sd->edje_signals,
|
|
|
|
emission, source, func, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
void *
|
|
|
|
_elm_layout_signal_callback_del_legacy(Eo *obj EINA_UNUSED, Eo *edje, Eina_List **p_edje_signals,
|
|
|
|
const char *emission, const char *source,
|
|
|
|
Edje_Signal_Cb func)
|
|
|
|
{
|
|
|
|
Edje_Signal_Data *esd = NULL;
|
|
|
|
void *data = NULL;
|
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
if (!emission || !source) return NULL;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(*p_edje_signals, l, esd)
|
|
|
|
{
|
|
|
|
if ((esd->func == func) && (!strcmp(esd->emission, emission)) &&
|
|
|
|
(!strcmp(esd->source, source)))
|
|
|
|
{
|
|
|
|
*p_edje_signals = eina_list_remove_list(*p_edje_signals, l);
|
|
|
|
|
2017-12-04 21:39:20 -08:00
|
|
|
efl_layout_signal_callback_del(edje, emission, source,
|
2017-08-03 01:24:50 -07:00
|
|
|
_edje_signal_callback, esd);
|
|
|
|
|
|
|
|
eina_stringshare_del(esd->emission);
|
|
|
|
eina_stringshare_del(esd->source);
|
|
|
|
data = esd->data;
|
|
|
|
free(esd);
|
|
|
|
|
|
|
|
return data; /* stop at 1st match */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void *
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_signal_callback_del(Eo *obj, const char *emission, const char *source, Edje_Signal_Cb func)
|
2017-08-03 01:24:50 -07:00
|
|
|
{
|
2018-04-06 09:15:31 -07:00
|
|
|
Efl_Ui_Layout_Object_Data *sd;
|
2017-08-03 01:24:50 -07:00
|
|
|
|
|
|
|
if (!emission || !source) return NULL;
|
|
|
|
|
|
|
|
if (efl_isa(obj, ELM_ENTRY_CLASS))
|
|
|
|
return _elm_entry_signal_callback_del_legacy(obj, emission, source, func);
|
|
|
|
|
|
|
|
sd = efl_data_scope_safe_get(obj, MY_CLASS);
|
|
|
|
if (!sd) return NULL;
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
|
|
|
|
|
|
|
return _elm_layout_signal_callback_del_legacy(obj, wd->resize_obj, &sd->edje_signals,
|
|
|
|
emission, source, func);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_signal_emit(Eo *obj, const char *emission, const char *source)
|
2017-08-03 01:24:50 -07:00
|
|
|
{
|
2017-12-04 21:39:20 -08:00
|
|
|
efl_layout_signal_emit(obj, emission, source);
|
2017-08-03 01:24:50 -07:00
|
|
|
}
|
2017-08-03 02:22:29 -07:00
|
|
|
|
|
|
|
EAPI const char *
|
|
|
|
elm_layout_data_get(const Evas_Object *obj, const char *key)
|
|
|
|
{
|
2017-12-04 23:00:08 -08:00
|
|
|
return efl_layout_group_data_get(obj, key);
|
2017-08-03 02:22:29 -07:00
|
|
|
}
|
2017-08-02 03:41:47 -07:00
|
|
|
|
2017-08-09 00:13:06 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_layout_theme_set(Evas_Object *obj, const char *klass, const char *group, const char *style)
|
|
|
|
{
|
|
|
|
Efl_Ui_Theme_Apply ta;
|
|
|
|
|
2018-04-06 09:15:31 -07:00
|
|
|
ta = efl_ui_layout_object_theme_set(obj, klass, group, style);
|
2017-08-09 00:13:06 -07:00
|
|
|
return (ta != EFL_UI_THEME_APPLY_FAILED);
|
|
|
|
}
|
|
|
|
|
2018-01-23 22:50:58 -08:00
|
|
|
#include "efl_ui_layout_legacy.eo.c"
|