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
|
2019-01-23 12:39:43 -08:00
|
|
|
#define EFL_LAYOUT_CALC_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"
|
2019-03-05 14:00:37 -08:00
|
|
|
#include "elm_entry_eo.h"
|
2016-05-24 04:40:18 -07:00
|
|
|
|
2019-02-27 10:17:16 -08:00
|
|
|
#define MY_CLASS EFL_UI_LAYOUT_BASE_CLASS
|
2018-11-16 01:45:05 -08:00
|
|
|
#define MY_CLASS_PFX efl_ui_layout
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2018-11-16 01:45:05 -08:00
|
|
|
#define MY_CLASS_NAME "Efl.Ui.Layout"
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2018-11-16 01:45:05 -08:00
|
|
|
Eo *_efl_ui_layout_pack_proxy_get(Efl_Ui_Layout *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-11-16 01:45:05 -08:00
|
|
|
static Eina_Bool _efl_ui_layout_part_cursor_unset(Efl_Ui_Layout_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.background",
|
2019-08-28 18:18:35 -07:00
|
|
|
"efl.extra",
|
2018-04-26 03:27:43 -07:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2019-09-25 14:55:29 -07:00
|
|
|
typedef struct _Deferred_Version_Signal
|
|
|
|
{
|
|
|
|
Eina_Stringshare *old_sig;
|
|
|
|
Eina_Stringshare *new_sig;
|
|
|
|
unsigned int version_threshold;
|
|
|
|
} Deferred_Version_Signal;
|
|
|
|
|
2018-12-07 02:26:54 -08:00
|
|
|
typedef struct _Efl_Ui_Layout_Factory_Tracking Efl_Ui_Layout_Factory_Tracking;
|
|
|
|
|
|
|
|
struct _Efl_Ui_Layout_Factory_Tracking
|
|
|
|
{
|
|
|
|
Efl_Ui_Factory *factory;
|
|
|
|
Eina_Future *in_flight;
|
2019-01-31 03:59:19 -08:00
|
|
|
Eina_Stringshare *key;
|
2018-12-07 02:26:54 -08:00
|
|
|
};
|
|
|
|
|
2018-04-26 03:27:43 -07:00
|
|
|
|
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-11-16 01:45:05 -08:00
|
|
|
Efl_Ui_Layout *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
|
|
|
};
|
|
|
|
|
2018-06-26 09:21:54 -07:00
|
|
|
#define MY_CLASS_NAME_LEGACY "elm_layout"
|
|
|
|
|
|
|
|
static void
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_class_constructor(Efl_Class *klass)
|
2018-06-26 09:21:54 -07:00
|
|
|
{
|
|
|
|
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2019-05-29 06:25:24 -07:00
|
|
|
if (!efl_alive_get(data)) return;
|
2013-10-05 00:36:33 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(data, wd);
|
2019-07-30 10:11:19 -07:00
|
|
|
efl_canvas_group_change(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
|
2019-07-30 10:11:54 -07:00
|
|
|
_sizing_eval(Evas_Object *obj, Efl_Ui_Layout_Data *sd, Elm_Layout_Data *ld)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2019-07-30 10:11:24 -07:00
|
|
|
int minh = 0, minw = 0;
|
|
|
|
int rest_w = 0, rest_h = 0;
|
|
|
|
Eina_Size2D sz;
|
2013-10-05 00:36:33 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(sd->obj, wd);
|
|
|
|
|
2018-08-01 07:41:45 -07:00
|
|
|
if (!efl_alive_get(obj)) return;
|
elm/layout: add some workarounds to try handling legacy min sizes
Summary:
if a legacy widget calls evas_object_size_hint_min_set, this actually sets
efl_gfx_hint_size_restricted_min now, which is supposed to be the hint that
is used internally by widgets. as a result, there is a conflict between the
size which the user expects and the size which the widget tries to calculate.
the user size should always be respected, however, so this adds some tracking
to determine whether the layout's min size was set by the layout during its own
calc or by something externally
@fix
Reviewers: eagleeye, CHAN, woohyun, Jaehyun_Cho, cedric
Reviewed By: cedric
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10373
2019-10-14 06:30:23 -07:00
|
|
|
if (ld) ld->in_calc = EINA_TRUE;
|
2018-08-01 07:41:45 -07:00
|
|
|
|
2019-07-30 10:11:41 -07:00
|
|
|
if (sd->calc_subobjs && !evas_smart_objects_calculating_get(evas_object_evas_get(obj)))
|
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
Eo *subobj;
|
|
|
|
/* user has manually triggered a smart calc and wants subobjs to also calc */
|
|
|
|
EINA_LIST_FOREACH(wd->subobjs, l, subobj)
|
|
|
|
efl_canvas_group_calculate(subobj);
|
|
|
|
}
|
2019-07-30 10:11:35 -07:00
|
|
|
elm_coords_finger_size_adjust(sd->finger_size_multiplier_x, &rest_w,
|
|
|
|
sd->finger_size_multiplier_y, &rest_h);
|
elm/layout: add some workarounds to try handling legacy min sizes
Summary:
if a legacy widget calls evas_object_size_hint_min_set, this actually sets
efl_gfx_hint_size_restricted_min now, which is supposed to be the hint that
is used internally by widgets. as a result, there is a conflict between the
size which the user expects and the size which the widget tries to calculate.
the user size should always be respected, however, so this adds some tracking
to determine whether the layout's min size was set by the layout during its own
calc or by something externally
@fix
Reviewers: eagleeye, CHAN, woohyun, Jaehyun_Cho, cedric
Reviewed By: cedric
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10373
2019-10-14 06:30:23 -07:00
|
|
|
if (ld && ld->user_min_sz)
|
2019-07-30 10:11:24 -07:00
|
|
|
sz = efl_gfx_hint_size_combined_min_get(obj);
|
|
|
|
else
|
|
|
|
sz = efl_gfx_hint_size_min_get(obj);
|
|
|
|
minw = sz.w;
|
|
|
|
minh = sz.h;
|
|
|
|
|
2019-07-30 10:12:14 -07:00
|
|
|
rest_w = MAX(minw, rest_w);
|
|
|
|
rest_h = MAX(minh, rest_h);
|
2019-07-30 10:11:24 -07:00
|
|
|
|
2019-07-30 10:12:00 -07:00
|
|
|
if (ld)
|
|
|
|
{
|
2019-08-20 02:02:39 -07:00
|
|
|
Eina_Size2D size = efl_gfx_entity_size_get(sd->obj);
|
2019-07-30 10:12:00 -07:00
|
|
|
if (ld->restricted_calc_w)
|
2019-08-20 02:02:39 -07:00
|
|
|
rest_w = MIN(size.w, rest_w);
|
2019-07-30 10:12:00 -07:00
|
|
|
if (ld->restricted_calc_h)
|
2019-08-20 02:02:39 -07:00
|
|
|
rest_h = MIN(size.h, rest_h);
|
2019-07-30 10:12:00 -07:00
|
|
|
}
|
2013-10-25 09:51:33 -07:00
|
|
|
|
|
|
|
edje_object_size_min_restricted_calc(wd->resize_obj, &minw, &minh,
|
|
|
|
rest_w, rest_h);
|
2019-07-30 10:11:35 -07:00
|
|
|
/* if desired, scale layout by finger size */
|
|
|
|
if (sd->finger_size_multiplier_x)
|
|
|
|
elm_coords_finger_size_adjust(sd->finger_size_multiplier_x, &minw,
|
|
|
|
sd->finger_size_multiplier_y, NULL);
|
|
|
|
if (sd->finger_size_multiplier_y)
|
|
|
|
elm_coords_finger_size_adjust(sd->finger_size_multiplier_x, NULL,
|
|
|
|
sd->finger_size_multiplier_y, &minh);
|
2019-07-30 10:11:54 -07:00
|
|
|
|
2019-07-30 10:11:48 -07:00
|
|
|
efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(minw, minh));
|
2019-07-30 10:11:54 -07:00
|
|
|
|
|
|
|
if (ld)
|
elm/layout: add some workarounds to try handling legacy min sizes
Summary:
if a legacy widget calls evas_object_size_hint_min_set, this actually sets
efl_gfx_hint_size_restricted_min now, which is supposed to be the hint that
is used internally by widgets. as a result, there is a conflict between the
size which the user expects and the size which the widget tries to calculate.
the user size should always be respected, however, so this adds some tracking
to determine whether the layout's min size was set by the layout during its own
calc or by something externally
@fix
Reviewers: eagleeye, CHAN, woohyun, Jaehyun_Cho, cedric
Reviewed By: cedric
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10373
2019-10-14 06:30:23 -07:00
|
|
|
ld->in_calc = ld->restricted_calc_w = ld->restricted_calc_h = EINA_FALSE;
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
|
2019-07-30 10:11:41 -07:00
|
|
|
void
|
|
|
|
_efl_ui_layout_subobjs_calc_set(Eo *obj, Eina_Bool set)
|
|
|
|
{
|
|
|
|
Efl_Ui_Layout_Data *sd = efl_data_scope_safe_get(obj, MY_CLASS);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(sd);
|
|
|
|
sd->calc_subobjs = !!set;
|
|
|
|
}
|
|
|
|
|
2019-09-25 14:55:29 -07:00
|
|
|
static void
|
|
|
|
_defer_version_signal(Efl_Ui_Layout_Data *sd, Eina_Stringshare *old_sig, Eina_Stringshare *new_sig, unsigned int version_threshold)
|
|
|
|
{
|
|
|
|
Deferred_Version_Signal dvs;
|
|
|
|
if (!sd->deferred_signals)
|
|
|
|
sd->deferred_signals = eina_inarray_new(sizeof(Deferred_Version_Signal), 5);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(sd->deferred_signals);
|
|
|
|
dvs.old_sig = old_sig;
|
|
|
|
dvs.new_sig = new_sig;
|
|
|
|
dvs.version_threshold = version_threshold;
|
|
|
|
eina_inarray_push(sd->deferred_signals, &dvs);
|
|
|
|
}
|
|
|
|
|
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
|
2019-09-25 14:55:35 -07:00
|
|
|
_signals_emit(Efl_Ui_Layout_Data *sd,
|
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
|
|
|
const char *type,
|
|
|
|
Eina_Bool set)
|
|
|
|
{
|
|
|
|
char buf[1024];
|
|
|
|
|
2019-09-25 14:55:35 -07:00
|
|
|
if (elm_widget_is_legacy(sd->obj))
|
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
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,%s", type,
|
|
|
|
set ? "visible" : "hidden");
|
2019-09-25 14:55:35 -07:00
|
|
|
efl_layout_signal_emit(sd->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
|
|
|
|
{
|
2019-09-25 14:55:35 -07:00
|
|
|
char buf2[1024];
|
|
|
|
char *use = buf;
|
|
|
|
if (sd->version >= 123) // efl,state,(content|text),(set|unset) -> efl,(content|text),(set|unset)
|
|
|
|
use = buf2;
|
|
|
|
snprintf(buf, sizeof(buf), "efl,state,%s,%s", type, set ? "set" : "unset");
|
|
|
|
snprintf(buf2, sizeof(buf2), "efl,%s,%s", type, set ? "set" : "unset");
|
2019-09-26 08:03:28 -07:00
|
|
|
if (efl_isa(sd->obj, EFL_UI_LAYOUT_CLASS) || efl_finalized_get(sd->obj))
|
2019-09-25 14:55:35 -07:00
|
|
|
efl_layout_signal_emit(sd->obj, use, "efl");
|
|
|
|
else
|
|
|
|
_defer_version_signal(sd, eina_stringshare_add(buf), eina_stringshare_add(buf2), 123);
|
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-11-16 01:45:05 -08:00
|
|
|
_icon_signal_emit(Efl_Ui_Layout_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
|
|
|
|
2019-09-25 14:55:35 -07:00
|
|
|
_signals_emit(sd, 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-11-16 01:45:05 -08:00
|
|
|
_text_signal_emit(Efl_Ui_Layout_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
|
|
|
|
2019-09-25 14:55:35 -07:00
|
|
|
_signals_emit(sd, 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-11-16 01:45:05 -08:00
|
|
|
_parts_signals_emit(Efl_Ui_Layout_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-11-16 01:45:05 -08:00
|
|
|
_parts_cursors_apply(Efl_Ui_Layout_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
|
|
|
{
|
2018-06-25 08:29:41 -07:00
|
|
|
Evas_Object *obj;
|
|
|
|
|
|
|
|
edje_object_freeze(wd->resize_obj);
|
|
|
|
obj = (Evas_Object *)edje_object_part_object_get
|
|
|
|
(wd->resize_obj, pc->part);
|
|
|
|
edje_object_thaw(wd->resize_obj);
|
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);
|
|
|
|
}
|
|
|
|
|
2019-02-27 11:00:14 -08:00
|
|
|
static void
|
|
|
|
_flush_mirrored_state(Eo *obj)
|
|
|
|
{
|
|
|
|
char prefix[4], state[10], signal[100];
|
2019-03-29 05:25:54 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
|
|
|
|
|
|
|
if (!wd->resize_obj) return;
|
2019-02-27 11:00:14 -08:00
|
|
|
|
|
|
|
if (efl_ui_widget_disabled_get(obj))
|
|
|
|
snprintf(state, sizeof(state), "disabled");
|
|
|
|
else
|
|
|
|
snprintf(state, sizeof(state), "enabled");
|
|
|
|
|
|
|
|
if (!elm_widget_is_legacy(obj))
|
|
|
|
snprintf(prefix, sizeof(prefix), "efl");
|
|
|
|
else
|
|
|
|
snprintf(prefix, sizeof(prefix), "elm");
|
|
|
|
|
|
|
|
snprintf(signal, sizeof(signal), "%s,state,%s", prefix, state);
|
|
|
|
efl_layout_signal_emit(obj, signal, prefix);
|
|
|
|
}
|
|
|
|
|
2015-02-26 21:15:42 -08:00
|
|
|
static Eina_Bool
|
2012-05-03 15:41:26 -07:00
|
|
|
_visuals_refresh(Evas_Object *obj,
|
2018-11-16 01:45:05 -08:00
|
|
|
Efl_Ui_Layout_Data *sd)
|
2010-10-28 08:54:35 -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);
|
2019-02-27 11:00:14 -08:00
|
|
|
_flush_mirrored_state(obj);
|
2015-02-26 21:15:42 -08:00
|
|
|
|
2019-07-30 10:11:19 -07:00
|
|
|
efl_canvas_group_change(obj);
|
2015-02-26 21:15:42 -08:00
|
|
|
|
2019-02-27 11:00:14 -08:00
|
|
|
return EINA_TRUE;
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
|
2019-02-27 11:00:14 -08:00
|
|
|
EOLIAN static void
|
|
|
|
_efl_ui_layout_base_efl_ui_widget_disabled_set(Eo *obj, Efl_Ui_Layout_Data *_pd EINA_UNUSED, Eina_Bool disabled)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2019-02-27 11:00:14 -08:00
|
|
|
efl_ui_widget_disabled_set(efl_super(obj, MY_CLASS), disabled);
|
|
|
|
_flush_mirrored_state(obj);
|
2010-10-28 08:54:35 -07:00
|
|
|
}
|
|
|
|
|
2019-03-04 10:37:07 -08:00
|
|
|
static Eina_Error
|
2019-09-24 13:59:39 -07:00
|
|
|
_efl_ui_layout_theme_internal(Eo *obj, Efl_Ui_Layout_Data *sd, Elm_Widget_Smart_Data **widget_data)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2019-03-04 10:37:07 -08:00
|
|
|
Eina_Error ret = EFL_UI_THEME_APPLY_ERROR_GENERIC;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2019-03-04 10:36:41 -08:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_UI_THEME_APPLY_ERROR_GENERIC);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2019-09-24 13:59:39 -07:00
|
|
|
*widget_data = wd;
|
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,
|
2018-06-26 09:21:54 -07:00
|
|
|
elm_widget_theme_klass_get(obj),
|
2017-11-14 01:42:48 -08:00
|
|
|
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
|
|
|
|
2019-03-04 10:36:41 -08:00
|
|
|
if (ret != EFL_UI_THEME_APPLY_ERROR_GENERIC)
|
2019-10-14 06:30:10 -07:00
|
|
|
{
|
|
|
|
if (sd->cb_theme_changed)
|
2019-11-27 05:12:52 -08:00
|
|
|
efl_event_callback_call(obj, EFL_UI_LAYOUT_EVENT_THEME_CHANGED, NULL);
|
|
|
|
if (elm_widget_is_legacy(obj))
|
|
|
|
evas_object_smart_callback_call(obj, "theme,changed", NULL);
|
2019-10-14 06:30:10 -07:00
|
|
|
}
|
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))
|
2019-03-04 10:36:41 -08:00
|
|
|
ret = EFL_UI_THEME_APPLY_ERROR_GENERIC;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2014-01-09 03:33:30 -08:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-03-04 10:37:07 -08:00
|
|
|
EOLIAN static Eina_Error
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Layout_Data *sd)
|
2014-01-09 03:33:30 -08:00
|
|
|
{
|
2019-03-21 20:38:44 -07:00
|
|
|
Eina_Error theme_apply_ret, theme_apply_internal_ret;
|
2019-09-25 13:15:43 -07:00
|
|
|
Elm_Widget_Smart_Data *wd = NULL;
|
2019-09-24 13:59:39 -07:00
|
|
|
char buf[64];
|
|
|
|
static unsigned int version = 0;
|
2014-01-09 03:33:30 -08:00
|
|
|
|
2019-11-26 07:49:55 -08:00
|
|
|
sd->needs_theme_apply = EINA_FALSE;
|
|
|
|
|
2018-11-19 20:56:37 -08:00
|
|
|
theme_apply_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS));
|
2019-03-04 10:36:41 -08:00
|
|
|
if (theme_apply_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) return EFL_UI_THEME_APPLY_ERROR_GENERIC;
|
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
|
|
|
|
2019-09-24 13:59:39 -07:00
|
|
|
theme_apply_internal_ret = _efl_ui_layout_theme_internal(obj, sd, &wd);
|
2019-03-21 20:38:44 -07:00
|
|
|
if (theme_apply_internal_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC)
|
|
|
|
return EFL_UI_THEME_APPLY_ERROR_GENERIC;
|
|
|
|
|
|
|
|
if ((theme_apply_ret == EFL_UI_THEME_APPLY_ERROR_DEFAULT) ||
|
|
|
|
(theme_apply_internal_ret == EFL_UI_THEME_APPLY_ERROR_DEFAULT))
|
|
|
|
return EFL_UI_THEME_APPLY_ERROR_DEFAULT;
|
|
|
|
|
2019-07-30 10:11:48 -07:00
|
|
|
/* unset existing size hints to force accurate recalc */
|
|
|
|
efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(0, 0));
|
|
|
|
if (elm_widget_is_legacy(obj))
|
|
|
|
efl_gfx_hint_size_min_set(obj, EINA_SIZE2D(0, 0));
|
2019-09-24 13:59:39 -07:00
|
|
|
else
|
|
|
|
{
|
2019-09-26 08:03:32 -07:00
|
|
|
const char *theme_version = edje_object_data_get(wd->resize_obj, "version");
|
|
|
|
if (!theme_version)
|
2019-09-25 04:30:24 -07:00
|
|
|
{
|
|
|
|
ERR("Widget(%p) with type '%s' is not providing a version in its theme!", obj,
|
|
|
|
efl_class_name_get(efl_class_get(obj)));
|
2019-09-26 08:03:38 -07:00
|
|
|
ERR("Group '%s' should have data.item: \"version\" \"%d%d\";",
|
|
|
|
efl_file_key_get(wd->resize_obj), EFL_VERSION_MAJOR, EFL_VERSION_MINOR);
|
2019-09-25 04:30:24 -07:00
|
|
|
return EFL_UI_THEME_APPLY_ERROR_VERSION;
|
|
|
|
}
|
2019-09-25 03:44:56 -07:00
|
|
|
else
|
2019-09-24 13:59:39 -07:00
|
|
|
{
|
2019-09-25 03:44:56 -07:00
|
|
|
errno = 0;
|
2019-09-26 08:03:32 -07:00
|
|
|
sd->version = strtoul(theme_version, NULL, 10);
|
2019-09-25 03:44:56 -07:00
|
|
|
if (errno)
|
|
|
|
{
|
|
|
|
ERR("Widget(%p) with type '%s' is not providing a valid version in its theme!", obj,
|
|
|
|
efl_class_name_get(efl_class_get(obj)));
|
2019-09-26 08:03:38 -07:00
|
|
|
ERR("Group '%s' should have data.item: \"version\" \"%d%d\";",
|
|
|
|
efl_file_key_get(wd->resize_obj), EFL_VERSION_MAJOR, EFL_VERSION_MINOR);
|
2019-09-25 03:44:56 -07:00
|
|
|
sd->version = 0;
|
2019-09-25 04:30:24 -07:00
|
|
|
return EFL_UI_THEME_APPLY_ERROR_VERSION;
|
2019-09-25 03:44:56 -07:00
|
|
|
}
|
2019-09-24 13:59:39 -07:00
|
|
|
}
|
|
|
|
}
|
2019-09-25 14:55:29 -07:00
|
|
|
if (sd->deferred_signals)
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
Deferred_Version_Signal *dvs = eina_inarray_pop(sd->deferred_signals);
|
|
|
|
|
|
|
|
if (sd->version < dvs->version_threshold)
|
|
|
|
efl_layout_signal_emit(sd->obj, dvs->old_sig, "efl");
|
|
|
|
else
|
|
|
|
efl_layout_signal_emit(sd->obj, dvs->new_sig, "efl");
|
|
|
|
eina_stringshare_del(dvs->old_sig);
|
|
|
|
eina_stringshare_del(dvs->new_sig);
|
|
|
|
} while (eina_inarray_count(sd->deferred_signals));
|
|
|
|
ELM_SAFE_FREE(sd->deferred_signals, eina_inarray_free);
|
|
|
|
}
|
2019-09-24 13:59:39 -07:00
|
|
|
if (!version)
|
|
|
|
{
|
2019-12-17 01:10:56 -08:00
|
|
|
snprintf(buf, sizeof(buf), "%d%d", EFL_VERSION_MAJOR, EFL_VERSION_MINOR + (EFL_VERSION_MICRO == 99 ? 1 : 0));
|
2019-09-24 13:59:39 -07:00
|
|
|
errno = 0;
|
|
|
|
version = strtoul(buf, NULL, 10);
|
|
|
|
if (errno)
|
|
|
|
{
|
|
|
|
ERR("something broke in theme parsing, this system is probably busted");
|
|
|
|
version = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (version && (!_running_in_tree))
|
|
|
|
{
|
|
|
|
if (sd->version < version)
|
|
|
|
WRN("Widget(%p) with type '%s' is providing a potentially old version in its theme: found %u, should be %u", obj,
|
|
|
|
efl_class_name_get(efl_class_get(obj)), sd->version, version);
|
2019-09-25 04:30:24 -07:00
|
|
|
else if (sd->version > version)
|
|
|
|
{
|
|
|
|
CRI("Widget(%p) with type '%s' is attempting to use a theme that is too new: found %u, should be %u", obj,
|
|
|
|
efl_class_name_get(efl_class_get(obj)), sd->version, version);
|
|
|
|
CRI("\tTheme file: %s\tTheme group: %s", efl_file_get(obj), efl_file_key_get(obj));
|
|
|
|
return EFL_UI_THEME_APPLY_ERROR_VERSION;
|
|
|
|
}
|
2019-09-24 13:59:39 -07:00
|
|
|
}
|
2019-07-30 10:11:48 -07:00
|
|
|
|
2019-03-21 20:38:44 -07:00
|
|
|
return EFL_UI_THEME_APPLY_ERROR_NONE;
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
2010-10-28 08:54:35 -07:00
|
|
|
|
2019-12-20 07:13:58 -08:00
|
|
|
EOLIAN static int
|
|
|
|
_efl_ui_layout_base_theme_version_get(const Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *pd)
|
|
|
|
{
|
|
|
|
return pd->version;
|
|
|
|
}
|
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_efl_ui_focus_object_on_focus_update(Eo *obj, Efl_Ui_Layout_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
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_efl_ui_widget_widget_sub_object_add(Eo *obj, Efl_Ui_Layout_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
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_efl_ui_widget_widget_sub_object_del(Eo *obj, Efl_Ui_Layout_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
|
2019-05-29 06:26:08 -07:00
|
|
|
if (wd->resize_obj && efl_alive_get(obj))
|
2019-07-30 10:11:19 -07:00
|
|
|
efl_canvas_group_change(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;
|
2019-09-23 12:20:07 -07:00
|
|
|
return EINA_TRUE;
|
2018-04-26 03:27:43 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
if (is_text)
|
2019-09-23 10:24:51 -07:00
|
|
|
aliases = efl_ui_layout_text_aliases_get(obj);
|
2012-11-25 22:32:53 -08:00
|
|
|
else
|
2019-09-23 10:24:51 -07:00
|
|
|
aliases = efl_ui_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-11-16 01:45:05 -08:00
|
|
|
Efl_Ui_Layout_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-11-16 01:45:05 -08:00
|
|
|
Efl_Ui_Layout_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
|
|
|
{
|
2019-07-30 10:11:19 -07:00
|
|
|
efl_canvas_group_change(data);
|
|
|
|
efl_canvas_group_calculate(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
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Layout_Data *_pd EINA_UNUSED)
|
2013-08-29 00:39:20 -07:00
|
|
|
{
|
|
|
|
Evas_Object *edje;
|
2012-05-03 15:41:26 -07: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);
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
EOLIAN static void
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Layout_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;
|
2019-02-12 11:55:50 -08:00
|
|
|
Efl_Model *model;
|
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
|
|
|
|
2019-05-29 06:26:15 -07:00
|
|
|
/* freeze edje object if it exists */
|
|
|
|
if (wd->resize_obj)
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2019-02-12 11:55:50 -08:00
|
|
|
model = efl_ui_view_model_get(obj);
|
|
|
|
if(model)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
2019-02-12 11:55:50 -08:00
|
|
|
efl_event_callback_del(model, EFL_MODEL_EVENT_PROPERTIES_CHANGED,
|
2018-01-26 16:56:53 -08:00
|
|
|
_efl_model_properties_changed_cb, sd);
|
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;
|
2019-09-25 14:55:29 -07:00
|
|
|
if (sd->deferred_signals)
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
Deferred_Version_Signal *dvs = eina_inarray_pop(sd->deferred_signals);
|
|
|
|
|
|
|
|
eina_stringshare_del(dvs->old_sig);
|
|
|
|
eina_stringshare_del(dvs->new_sig);
|
|
|
|
} while (eina_inarray_count(sd->deferred_signals));
|
|
|
|
ELM_SAFE_FREE(sd->deferred_signals, eina_inarray_free);
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
2019-07-30 10:11:30 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_efl_ui_layout_efl_canvas_group_group_calculate(Eo *obj, void *_pd EINA_UNUSED)
|
|
|
|
{
|
|
|
|
efl_canvas_group_need_recalculate_set(obj, EINA_FALSE);
|
|
|
|
_sizing_eval(obj, efl_data_scope_get(obj, MY_CLASS), NULL);
|
|
|
|
}
|
|
|
|
|
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
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Layout_Data *sd)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2019-07-30 10:11:54 -07:00
|
|
|
Elm_Layout_Data *ld = efl_data_scope_safe_get(obj, ELM_LAYOUT_MIXIN);
|
2019-07-30 10:11:30 -07:00
|
|
|
efl_canvas_group_need_recalculate_set(obj, EINA_FALSE);
|
2019-07-30 10:11:54 -07:00
|
|
|
if ((!ld) || ld->needs_size_calc)
|
|
|
|
_sizing_eval(obj, sd, ld);
|
|
|
|
if (ld) ld->needs_size_calc = EINA_FALSE;
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
|
2019-07-30 10:11:35 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_efl_ui_layout_base_finger_size_multiplier_get(const Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *sd, unsigned int *mult_x, unsigned int *mult_y)
|
|
|
|
{
|
|
|
|
if (mult_x)
|
|
|
|
*mult_x = sd->finger_size_multiplier_x;
|
|
|
|
if (mult_y)
|
|
|
|
*mult_y = sd->finger_size_multiplier_y;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
|
|
|
_efl_ui_layout_base_finger_size_multiplier_set(Eo *obj, Efl_Ui_Layout_Data *sd, unsigned int mult_x, unsigned int mult_y)
|
|
|
|
{
|
|
|
|
if ((sd->finger_size_multiplier_x == mult_x) &&
|
|
|
|
(sd->finger_size_multiplier_y == mult_y))
|
|
|
|
return;
|
|
|
|
sd->finger_size_multiplier_x = mult_x;
|
|
|
|
sd->finger_size_multiplier_y = mult_y;
|
|
|
|
if (efl_alive_get(obj))
|
|
|
|
efl_canvas_group_change(obj);
|
|
|
|
}
|
|
|
|
|
2017-08-07 21:28:50 -07:00
|
|
|
static Efl_Ui_Layout_Sub_Object_Cursor *
|
2018-11-16 01:45:05 -08:00
|
|
|
_parts_cursors_find(Efl_Ui_Layout_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
|
|
|
|
2019-08-29 06:26:15 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_efl_ui_layout_efl_file_unload(Eo *obj, void *_pd EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Efl_Ui_Layout_Data *sd = efl_data_scope_get(obj, MY_CLASS);
|
|
|
|
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
|
|
|
|
|
|
|
efl_file_unload(wd->resize_obj);
|
|
|
|
sd->file_set = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2019-02-27 10:17:09 -08:00
|
|
|
EOLIAN static Eina_Error
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_efl_file_load(Eo *obj, void *_pd EINA_UNUSED)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2019-02-27 10:17:09 -08:00
|
|
|
Eina_Error err;
|
2019-02-27 10:17:16 -08:00
|
|
|
Efl_Ui_Layout_Data *sd = efl_data_scope_get(obj, MY_CLASS);
|
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
|
|
|
|
2019-02-27 10:17:09 -08:00
|
|
|
if (efl_file_loaded_get(obj)) return 0;
|
|
|
|
err = efl_file_load(wd->resize_obj);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2019-02-27 10:17:09 -08:00
|
|
|
if (!err)
|
[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
|
|
|
{
|
|
|
|
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",
|
2019-02-27 10:17:09 -08:00
|
|
|
efl_file_get(wd->resize_obj), efl_file_key_get(wd->resize_obj),
|
2013-08-29 00:39:20 -07:00
|
|
|
edje_load_error_str
|
|
|
|
(edje_object_load_error_get(wd->resize_obj)));
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2019-02-27 10:17:09 -08:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Error
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_efl_file_file_set(Eo *obj, void *_pd EINA_UNUSED, const char *file)
|
2019-02-27 10:17:09 -08:00
|
|
|
{
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_GFX_IMAGE_LOAD_ERROR_GENERIC);
|
|
|
|
return efl_file_set(wd->resize_obj, file);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static const char *
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_efl_file_file_get(const Eo *obj, void *_pd EINA_UNUSED)
|
2019-02-27 10:17:09 -08:00
|
|
|
{
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
|
|
|
return efl_file_get(wd->resize_obj);
|
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
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_efl_file_key_set(Eo *obj, void *_pd EINA_UNUSED, const char *key)
|
2015-03-19 05:08:23 -07:00
|
|
|
{
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2019-02-27 10:17:09 -08:00
|
|
|
return efl_file_key_set(wd->resize_obj, key);
|
2015-03-19 05:08:23 -07:00
|
|
|
}
|
|
|
|
|
2019-02-27 10:17:09 -08:00
|
|
|
EOLIAN static const char *
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_efl_file_key_get(const Eo *obj, void *_pd EINA_UNUSED)
|
2016-11-07 14:42:04 -08:00
|
|
|
{
|
2019-02-27 10:17:09 -08:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
|
|
|
return efl_file_key_get(wd->resize_obj);
|
|
|
|
}
|
2016-11-07 14:42:04 -08:00
|
|
|
|
2019-02-27 10:17:09 -08:00
|
|
|
EOLIAN static Eina_Error
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_efl_file_mmap_set(Eo *obj, void *_pd EINA_UNUSED, const Eina_File *file)
|
2019-02-27 10:17:09 -08:00
|
|
|
{
|
2016-11-07 14:42:04 -08:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
2019-02-27 10:17:09 -08:00
|
|
|
return efl_file_mmap_set(wd->resize_obj, file);
|
2016-11-07 14:42:04 -08:00
|
|
|
}
|
|
|
|
|
2019-02-27 10:17:09 -08:00
|
|
|
EOLIAN static const Eina_File *
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_efl_file_mmap_get(const Eo *obj, void *_pd EINA_UNUSED)
|
2016-11-07 14:42:04 -08:00
|
|
|
{
|
2019-02-27 10:17:09 -08:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
|
|
|
return efl_file_mmap_get(wd->resize_obj);
|
2016-11-07 14:42:04 -08:00
|
|
|
}
|
|
|
|
|
2019-03-04 10:36:25 -08:00
|
|
|
EOLIAN static void
|
|
|
|
_efl_ui_layout_base_theme_get(const Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED, const char **klass, const char **group, const char **style)
|
|
|
|
{
|
|
|
|
if (klass) *klass = elm_widget_theme_klass_get(obj);
|
|
|
|
if (group) *group = elm_widget_theme_element_get(obj);
|
|
|
|
if (style) *style = elm_widget_theme_style_get(obj);
|
|
|
|
}
|
|
|
|
|
2019-03-04 10:37:07 -08:00
|
|
|
EOLIAN static Eina_Error
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_theme_set(Eo *obj, Efl_Ui_Layout_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
|
|
|
{
|
2018-11-16 01:45:05 -08:00
|
|
|
ERR("Efl.Ui.Layout_theme can only be set before finalize!");
|
2019-03-04 10:36:41 -08:00
|
|
|
return EFL_UI_THEME_APPLY_ERROR_GENERIC;
|
2017-08-09 00:22:48 -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 (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);
|
2019-03-04 10:36:41 -08:00
|
|
|
return EFL_UI_THEME_APPLY_ERROR_NONE;
|
2010-09-26 17:51:16 -07:00
|
|
|
}
|
|
|
|
|
2016-08-05 10:31:49 -07:00
|
|
|
EOLIAN static void
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_efl_layout_signal_signal_emit(Eo *obj, Efl_Ui_Layout_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
|
2018-07-25 11:57:41 -07:00
|
|
|
EINA_SAFETY_ON_TRUE_RETURN(efl_invalidated_get(obj));
|
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
|
|
|
|
2019-02-06 10:48:43 -08:00
|
|
|
static Eina_Bool
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_efl_layout_signal_signal_callback_add(Eo *obj, Efl_Ui_Layout_Data *pd EINA_UNUSED, const char *emission, const char *source, void *func_data, EflLayoutSignalCb func, Eina_Free_Cb func_free_cb)
|
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);
|
2019-02-06 10:48:43 -08:00
|
|
|
return efl_layout_signal_callback_add(wd->resize_obj, emission, source, func_data, func, func_free_cb);
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
|
2019-02-06 10:48:43 -08:00
|
|
|
static Eina_Bool
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_efl_layout_signal_signal_callback_del(Eo *obj, Efl_Ui_Layout_Data *pd EINA_UNUSED, const char *emission, const char *source, void *func_data, EflLayoutSignalCb func, Eina_Free_Cb func_free_cb)
|
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);
|
2019-02-06 10:48:43 -08:00
|
|
|
return efl_layout_signal_callback_del(wd->resize_obj, emission, source, func_data, func, func_free_cb);
|
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-11-16 01:45:05 -08:00
|
|
|
_efl_ui_layout_content_set(Eo *obj, Efl_Ui_Layout_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;
|
2019-04-17 09:51:32 -07:00
|
|
|
if (efl_alive_get(sub_d->obj))
|
|
|
|
{
|
|
|
|
_eo_unparent_helper(sub_d->obj, obj);
|
|
|
|
evas_object_del(sub_d->obj);
|
|
|
|
}
|
2013-08-29 00:39:20 -07:00
|
|
|
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
|
|
|
|
2019-07-30 10:11:19 -07:00
|
|
|
efl_canvas_group_change(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-11-16 01:45:05 -08:00
|
|
|
_efl_ui_layout_content_get(Eo *obj, Efl_Ui_Layout_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-11-16 01:45:05 -08:00
|
|
|
_efl_ui_layout_content_unset(Eo *obj, Efl_Ui_Layout_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-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-11-16 01:45:05 -08:00
|
|
|
Efl_Ui_Layout_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-11-16 01:45:05 -08:00
|
|
|
static Efl_Ui_Layout *
|
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-11-16 01:45:05 -08:00
|
|
|
_sub_iterator_create(Eo *eo_obj, Efl_Ui_Layout_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 *
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_efl_container_content_iterate(Eo *eo_obj EINA_UNUSED, Efl_Ui_Layout_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
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_efl_container_content_count(Eo *eo_obj EINA_UNUSED, Efl_Ui_Layout_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-11-16 01:45:05 -08:00
|
|
|
_efl_ui_layout_text_generic_set(Eo *obj, Efl_Ui_Layout_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;
|
2019-02-12 11:55:50 -08:00
|
|
|
Efl_Model *model;
|
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);
|
2019-07-30 10:11:19 -07:00
|
|
|
efl_canvas_group_change(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
|
|
|
|
2019-07-30 10:11:19 -07:00
|
|
|
efl_canvas_group_change(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);
|
|
|
|
|
2019-02-12 11:55:50 -08:00
|
|
|
model = efl_ui_view_model_get(obj);
|
|
|
|
if (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);
|
|
|
|
|
2019-02-12 11:55:50 -08:00
|
|
|
efl_model_property_set(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-11-16 01:45:05 -08:00
|
|
|
_efl_ui_layout_text_set(Eo *obj, Efl_Ui_Layout_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-11-16 01:45:05 -08:00
|
|
|
_efl_ui_layout_text_get(Eo *obj, Efl_Ui_Layout_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-11-16 01:45:05 -08:00
|
|
|
_efl_ui_layout_text_markup_get(Eo *obj, Efl_Ui_Layout_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-11-16 01:45:05 -08:00
|
|
|
_efl_ui_layout_text_markup_set(Eo *obj, Efl_Ui_Layout_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-11-16 01:45:05 -08:00
|
|
|
_layout_box_subobj_init(Efl_Ui_Layout_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-11-16 01:45:05 -08:00
|
|
|
_efl_ui_layout_box_append(Eo *obj, Efl_Ui_Layout_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
|
|
|
|
2019-07-30 10:11:19 -07:00
|
|
|
efl_canvas_group_change(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-11-16 01:45:05 -08:00
|
|
|
_efl_ui_layout_box_prepend(Eo *obj, Efl_Ui_Layout_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
|
|
|
|
2019-07-30 10:11:19 -07:00
|
|
|
efl_canvas_group_change(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-11-16 01:45:05 -08:00
|
|
|
_efl_ui_layout_box_insert_before(Eo *obj, Efl_Ui_Layout_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
|
|
|
|
2019-07-30 10:11:19 -07:00
|
|
|
efl_canvas_group_change(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-11-16 01:45:05 -08:00
|
|
|
_efl_ui_layout_box_insert_at(Eo *obj, Efl_Ui_Layout_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
|
|
|
|
2019-07-30 10:11:19 -07:00
|
|
|
efl_canvas_group_change(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-11-16 01:45:05 -08:00
|
|
|
_efl_ui_layout_box_remove(Eo *obj, Efl_Ui_Layout_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-11-16 01:45:05 -08:00
|
|
|
_efl_ui_layout_box_remove_all(Eo *obj, Efl_Ui_Layout_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-11-16 01:45:05 -08:00
|
|
|
_efl_ui_layout_table_pack(Eo *obj, Efl_Ui_Layout_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
|
|
|
|
2019-07-30 10:11:19 -07:00
|
|
|
efl_canvas_group_change(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-11-16 01:45:05 -08:00
|
|
|
_efl_ui_layout_table_unpack(Eo *obj, Efl_Ui_Layout_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-11-16 01:45:05 -08:00
|
|
|
_efl_ui_layout_table_clear(Eo *obj, Efl_Ui_Layout_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 *
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_efl_layout_group_group_data_get(const Eo *obj, Efl_Ui_Layout_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
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_efl_layout_group_group_size_min_get(const Eo *obj, Efl_Ui_Layout_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
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_efl_layout_group_group_size_max_get(const Eo *obj, Efl_Ui_Layout_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
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_efl_layout_group_part_exist_get(const Eo *obj, Efl_Ui_Layout_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);
|
|
|
|
}
|
|
|
|
|
2019-07-30 10:11:54 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_layout_efl_canvas_group_change(Eo *obj, Elm_Layout_Data *ld)
|
|
|
|
{
|
|
|
|
Efl_Ui_Layout_Data *sd;
|
|
|
|
|
|
|
|
sd = efl_data_scope_safe_get(obj, EFL_UI_LAYOUT_BASE_CLASS);
|
2019-09-16 08:19:49 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(sd);
|
2019-07-30 10:11:54 -07:00
|
|
|
if (sd->frozen) return;
|
|
|
|
ld->needs_size_calc = EINA_TRUE;
|
|
|
|
efl_canvas_group_change(efl_super(obj, ELM_LAYOUT_MIXIN));
|
|
|
|
}
|
|
|
|
|
elm/layout: add some workarounds to try handling legacy min sizes
Summary:
if a legacy widget calls evas_object_size_hint_min_set, this actually sets
efl_gfx_hint_size_restricted_min now, which is supposed to be the hint that
is used internally by widgets. as a result, there is a conflict between the
size which the user expects and the size which the widget tries to calculate.
the user size should always be respected, however, so this adds some tracking
to determine whether the layout's min size was set by the layout during its own
calc or by something externally
@fix
Reviewers: eagleeye, CHAN, woohyun, Jaehyun_Cho, cedric
Reviewed By: cedric
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10373
2019-10-14 06:30:23 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_layout_efl_gfx_hint_size_restricted_min_set(Eo *obj, Elm_Layout_Data *ld, Eina_Size2D sz)
|
|
|
|
{
|
|
|
|
/* correctly handle legacy case where the user has set a min size hint on the object:
|
|
|
|
* in legacy code, only restricted_min existed, which resulted in conflicts between
|
|
|
|
* internal sizing and user-expected sizing. we attempt to simulate this now in a more controlled
|
|
|
|
* manner by only checking this hint during sizing calcs if the user has set it
|
|
|
|
*/
|
|
|
|
if (!ld->in_calc)
|
|
|
|
ld->user_min_sz = (sz.w > 0) || (sz.h > 0);
|
|
|
|
efl_gfx_hint_size_restricted_min_set(efl_super(obj, ELM_LAYOUT_MIXIN), sz);
|
|
|
|
}
|
|
|
|
|
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()). */
|
2019-07-30 10:11:54 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_layout_sizing_eval(Eo *obj, Elm_Layout_Data *ld)
|
2013-08-29 00:39:20 -07:00
|
|
|
{
|
2019-07-30 10:11:54 -07:00
|
|
|
_elm_layout_efl_canvas_group_change(obj, ld);
|
2013-08-29 00:39:20 -07:00
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2019-07-30 10:12:00 -07:00
|
|
|
Elm_Layout_Data *ld = efl_data_scope_safe_get(obj, ELM_LAYOUT_MIXIN);
|
2017-08-07 00:13:38 -07:00
|
|
|
|
2019-07-30 10:12:00 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(ld);
|
|
|
|
ld->restricted_calc_w = !!w;
|
|
|
|
ld->restricted_calc_h = !!h;
|
2013-10-25 09:51:33 -07:00
|
|
|
|
2019-07-30 10:11:19 -07:00
|
|
|
efl_canvas_group_change(obj);
|
2013-10-25 09:51:33 -07:00
|
|
|
}
|
|
|
|
|
2016-06-27 11:18:02 -07:00
|
|
|
EOLIAN static int
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_efl_layout_calc_calc_freeze(Eo *obj, Efl_Ui_Layout_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);
|
2019-09-23 06:30:03 -07:00
|
|
|
sd->frozen = EINA_TRUE;
|
|
|
|
return edje_object_freeze(wd->resize_obj);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2016-06-27 11:18:02 -07:00
|
|
|
EOLIAN static int
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_efl_layout_calc_calc_thaw(Eo *obj, Efl_Ui_Layout_Data *sd)
|
2016-06-27 11:18:02 -07:00
|
|
|
{
|
2019-09-23 06:30:03 -07:00
|
|
|
int ret;
|
2016-08-05 10:31:49 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, 0);
|
|
|
|
|
2019-09-23 06:30:03 -07:00
|
|
|
ret = edje_object_thaw(wd->resize_obj);
|
2012-07-30 00:14:33 -07:00
|
|
|
|
2019-09-23 06:30:03 -07:00
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
sd->frozen = EINA_FALSE;
|
|
|
|
efl_canvas_group_change(obj);
|
|
|
|
}
|
2012-07-30 00:14:33 -07:00
|
|
|
|
2019-09-23 06:30:03 -07:00
|
|
|
return ret;
|
2012-07-30 00:14:33 -07:00
|
|
|
}
|
|
|
|
|
2019-01-23 12:39:43 -08:00
|
|
|
EOLIAN void
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_efl_layout_calc_calc_auto_update_hints_set(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *sd EINA_UNUSED, Eina_Bool update)
|
2019-01-23 12:39:43 -08:00
|
|
|
{
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
|
|
|
efl_layout_calc_auto_update_hints_set(wd->resize_obj, update);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Bool
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_efl_layout_calc_calc_auto_update_hints_get(const Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *sd EINA_UNUSED)
|
2019-01-23 12:39:43 -08:00
|
|
|
{
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
|
|
|
return efl_layout_calc_auto_update_hints_get(wd->resize_obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Size2D
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_efl_layout_calc_calc_size_min(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *sd EINA_UNUSED, Eina_Size2D restricted)
|
2019-01-23 12:39:43 -08:00
|
|
|
{
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, restricted);
|
2019-01-24 00:52:37 -08:00
|
|
|
return efl_layout_calc_size_min(wd->resize_obj, restricted);
|
2019-01-23 12:39:43 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Rect
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_efl_layout_calc_calc_parts_extends(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *sd EINA_UNUSED)
|
2019-01-23 12:39:43 -08:00
|
|
|
{
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, (Eina_Rect){.rect = {0, 0, 0, 0}});
|
2019-01-24 00:52:37 -08:00
|
|
|
return efl_layout_calc_parts_extends(wd->resize_obj);
|
2019-01-23 12:39:43 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN void
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_efl_layout_calc_calc_force(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *sd EINA_UNUSED)
|
2019-01-23 12:39:43 -08:00
|
|
|
{
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2019-01-24 00:52:37 -08:00
|
|
|
efl_layout_calc_force(wd->resize_obj);
|
2019-01-23 12:39:43 -08:00
|
|
|
}
|
|
|
|
|
2017-08-02 03:41:47 -07:00
|
|
|
static Eina_Bool
|
2018-11-16 01:45:05 -08:00
|
|
|
_efl_ui_layout_part_cursor_set(Efl_Ui_Layout_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
|
|
|
|
2018-06-25 08:29:41 -07:00
|
|
|
edje_object_freeze(wd->resize_obj);
|
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);
|
2018-06-25 08:29:41 -07:00
|
|
|
edje_object_thaw(wd->resize_obj);
|
|
|
|
|
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-11-16 01:45:05 -08:00
|
|
|
_efl_ui_layout_part_cursor_get(Efl_Ui_Layout_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-11-16 01:45:05 -08:00
|
|
|
_efl_ui_layout_part_cursor_unset(Efl_Ui_Layout_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-11-16 01:45:05 -08:00
|
|
|
_efl_ui_layout_part_cursor_style_set(Efl_Ui_Layout_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-11-16 01:45:05 -08:00
|
|
|
_efl_ui_layout_part_cursor_style_get(Efl_Ui_Layout_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-11-16 01:45:05 -08:00
|
|
|
_efl_ui_layout_part_cursor_engine_only_set(Efl_Ui_Layout_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-11-16 01:45:05 -08:00
|
|
|
_efl_ui_layout_part_cursor_engine_only_get(Efl_Ui_Layout_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-11-16 01:45:05 -08:00
|
|
|
Efl_Ui_Layout_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-11-16 01:45:05 -08:00
|
|
|
Efl_Ui_Layout_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
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_efl_object_dbg_info_get(Eo *eo_obj, Efl_Ui_Layout_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
|
|
|
|
2019-02-27 10:17:09 -08:00
|
|
|
efl_file_simple_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-11-16 01:45:05 -08:00
|
|
|
_efl_ui_layout_view_model_property_update(Efl_Ui_Layout_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;
|
2018-06-07 14:44:37 -07:00
|
|
|
char *value = NULL;
|
2019-02-12 11:55:50 -08:00
|
|
|
Efl_Model *model;
|
2018-01-26 16:56:53 -08:00
|
|
|
|
2019-02-12 11:55:50 -08:00
|
|
|
model = efl_ui_view_model_get(pd->obj);
|
|
|
|
v = efl_model_property_get(model, fetch);
|
2018-06-07 14:44:37 -07:00
|
|
|
if (!v) return;
|
|
|
|
|
|
|
|
if (eina_value_type_get(v) != EINA_VALUE_TYPE_ERROR)
|
|
|
|
value = eina_value_to_string(v);
|
2018-01-26 16:56:53 -08:00
|
|
|
|
|
|
|
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-11-16 01:45:05 -08:00
|
|
|
_efl_ui_layout_view_model_signal_update(Efl_Ui_Layout_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-11-06 05:23:21 -08:00
|
|
|
char *value = NULL;
|
2019-02-12 11:55:50 -08:00
|
|
|
Efl_Model *model;
|
2018-11-06 05:23:21 -08:00
|
|
|
Eina_Bool eval = EINA_FALSE;
|
|
|
|
Eina_Bool is_bool = EINA_FALSE;
|
2018-01-26 16:56:53 -08:00
|
|
|
|
2019-02-12 11:55:50 -08:00
|
|
|
model = efl_ui_view_model_get(pd->obj);
|
|
|
|
v = efl_model_property_get(model, fetch);
|
2018-06-07 14:44:37 -07:00
|
|
|
if (!v) return;
|
2017-01-31 12:17:58 -08:00
|
|
|
|
2018-06-25 03:56:09 -07:00
|
|
|
if (eina_value_type_get(v) == EINA_VALUE_TYPE_ERROR)
|
|
|
|
{
|
|
|
|
Eina_Error error;
|
|
|
|
|
|
|
|
eina_value_get(v, &error);
|
2019-03-01 16:22:08 -08:00
|
|
|
if (error != EAGAIN) ERR("Failed to fetch signal value %s for property %s got error: %s", signal, fetch, eina_error_msg_get(error));
|
2018-06-25 03:56:09 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-11-06 05:23:21 -08:00
|
|
|
is_bool = (eina_value_type_get(v) == EINA_VALUE_TYPE_BOOL);
|
|
|
|
if (is_bool)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
2018-11-06 05:23:21 -08:00
|
|
|
eina_value_bool_get(v, &eval);
|
2017-01-31 12:17:58 -08:00
|
|
|
}
|
2018-11-06 05:23:21 -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 ?
|
2018-11-06 05:23:21 -08:00
|
|
|
const char *ini = signal;
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
const char *last = ini;
|
|
|
|
ini = strstr(last, "%{");
|
|
|
|
if (!ini)
|
|
|
|
{
|
|
|
|
eina_strbuf_append(buf, last);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!is_bool)
|
|
|
|
{
|
|
|
|
ERR("Using signal connection `%%{;}' with a property that is not boolean. Signal: `%s'; Property: `%s'.", signal, fetch);
|
|
|
|
goto on_error;
|
|
|
|
}
|
|
|
|
eina_strbuf_append_length(buf, last, (size_t)(ini-last));
|
|
|
|
const char *sep = strchr(ini+2, ';');
|
|
|
|
if (!sep)
|
|
|
|
{
|
|
|
|
ERR("Could not find separator `;'.");
|
|
|
|
goto on_error;
|
|
|
|
}
|
|
|
|
const char *fin = strchr(sep+1, '}');
|
|
|
|
if (!fin)
|
|
|
|
{
|
|
|
|
ERR("Could not find terminator `}'.");
|
|
|
|
goto on_error;
|
|
|
|
}
|
|
|
|
if (eval)
|
|
|
|
eina_strbuf_append_length(buf, ini+2, (size_t)(sep-(ini+2)));
|
|
|
|
else
|
|
|
|
eina_strbuf_append_length(buf, sep+1, (size_t)(fin-(sep+1)));
|
|
|
|
ini = fin+1;
|
|
|
|
}
|
|
|
|
eina_strbuf_replace_all(buf, "%v", value);
|
|
|
|
|
2018-01-26 16:56:53 -08:00
|
|
|
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
|
|
|
|
2018-11-06 05:23:21 -08:00
|
|
|
on_error:
|
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
|
|
|
}
|
|
|
|
|
2018-12-07 02:26:54 -08:00
|
|
|
typedef struct _Efl_Ui_Layout_Factory_Request Efl_Ui_Layout_Factory_Request;
|
|
|
|
struct _Efl_Ui_Layout_Factory_Request
|
|
|
|
{
|
|
|
|
Efl_Ui_Layout_Factory_Tracking *tracking;
|
|
|
|
Efl_Ui_Layout_Data *pd;
|
|
|
|
Efl_Ui_Factory *factory;
|
2019-01-31 03:59:19 -08:00
|
|
|
const char *key;
|
2018-12-07 02:26:54 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
static Eina_Value
|
2018-12-07 16:03:49 -08:00
|
|
|
_content_created(Eo *obj, void *data, const Eina_Value value)
|
2018-12-07 02:26:54 -08:00
|
|
|
{
|
|
|
|
Efl_Ui_Layout_Factory_Request *request = data;
|
|
|
|
Efl_Gfx_Entity *content = NULL;
|
2019-09-15 22:39:05 -07:00
|
|
|
Efl_Gfx_Entity *old_content[1];
|
2019-08-15 20:45:09 -07:00
|
|
|
int len, i;
|
2018-12-07 02:26:54 -08:00
|
|
|
|
2019-08-15 20:45:09 -07:00
|
|
|
EINA_VALUE_ARRAY_FOREACH(&value, len, i, content)
|
|
|
|
{
|
|
|
|
// Recycle old content
|
2019-09-15 22:39:05 -07:00
|
|
|
old_content[0] = efl_content_get(efl_part(obj, request->key));
|
|
|
|
if (old_content[0]) efl_ui_factory_release(request->factory, EINA_C_ARRAY_ITERATOR_NEW(old_content));
|
2018-12-07 02:26:54 -08:00
|
|
|
|
2019-08-15 20:45:09 -07:00
|
|
|
// Set new content
|
|
|
|
efl_content_set(efl_part(obj, request->key), content);
|
|
|
|
}
|
2018-12-07 02:26:54 -08:00
|
|
|
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
2017-01-31 12:17:58 -08:00
|
|
|
static void
|
2018-12-07 16:03:49 -08:00
|
|
|
_clean_request(Eo *obj EINA_UNUSED, void *data, const Eina_Future *dead_future EINA_UNUSED)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
2018-12-07 02:26:54 -08:00
|
|
|
Efl_Ui_Layout_Factory_Request *request = data;
|
|
|
|
|
|
|
|
request->tracking->in_flight = NULL;
|
2019-01-31 03:59:19 -08:00
|
|
|
eina_stringshare_del(request->key);
|
2018-12-07 02:26:54 -08:00
|
|
|
efl_unref(request->factory);
|
|
|
|
free(request);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-01-31 03:59:19 -08:00
|
|
|
_efl_ui_layout_view_model_content_update(Efl_Ui_Layout_Data *pd, Efl_Ui_Layout_Factory_Tracking *tracking, const char *key)
|
2018-12-07 02:26:54 -08:00
|
|
|
{
|
2019-08-15 20:45:09 -07:00
|
|
|
Efl_Ui_Layout_Factory_Request *request;
|
2018-12-07 02:26:54 -08:00
|
|
|
Eina_Future *f;
|
2019-08-15 20:45:09 -07:00
|
|
|
Efl_Model *models[1];
|
2018-12-07 02:26:54 -08:00
|
|
|
|
2019-08-15 20:45:09 -07:00
|
|
|
request = calloc(1, sizeof (Efl_Ui_Layout_Factory_Request));
|
2018-12-07 02:26:54 -08:00
|
|
|
if (!request) return ;
|
|
|
|
|
|
|
|
if (tracking->in_flight) eina_future_cancel(tracking->in_flight);
|
2017-12-12 16:59:48 -08:00
|
|
|
|
2019-01-31 03:59:19 -08:00
|
|
|
request->key = eina_stringshare_ref(key);
|
2018-12-07 02:26:54 -08:00
|
|
|
request->pd = pd;
|
|
|
|
request->factory = efl_ref(tracking->factory);
|
|
|
|
request->tracking = tracking;
|
|
|
|
|
2019-08-15 20:45:09 -07:00
|
|
|
models[0] = efl_ui_view_model_get(pd->obj);
|
2019-09-15 20:50:05 -07:00
|
|
|
f = efl_ui_view_factory_create_with_event(tracking->factory, EINA_C_ARRAY_ITERATOR_NEW(models));
|
2018-12-07 16:03:49 -08:00
|
|
|
f = efl_future_then(pd->obj, f,
|
|
|
|
.success = _content_created,
|
2019-08-15 20:45:09 -07:00
|
|
|
.success_type = EINA_VALUE_TYPE_ARRAY,
|
2018-12-07 16:03:49 -08:00
|
|
|
.data = request,
|
|
|
|
.free = _clean_request);
|
2017-01-31 12:17:58 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2018-11-16 01:45:05 -08:00
|
|
|
_efl_ui_layout_view_model_update(Efl_Ui_Layout_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
|
|
|
|
2019-02-12 11:55:50 -08:00
|
|
|
if (!efl_ui_view_model_get(pd->obj)) 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)
|
2018-12-07 02:26:54 -08:00
|
|
|
{
|
|
|
|
Efl_Ui_Layout_Factory_Tracking *factory = tuple->data;
|
|
|
|
|
|
|
|
_efl_ui_layout_view_model_content_update(pd, factory, tuple->key);
|
|
|
|
}
|
2018-01-26 16:56:53 -08:00
|
|
|
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-11-16 01:45:05 -08:00
|
|
|
Efl_Ui_Layout_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
|
|
|
const char *part;
|
|
|
|
const char *signal;
|
2018-12-07 02:26:54 -08:00
|
|
|
Efl_Ui_Layout_Factory_Tracking *factory;
|
2018-01-26 16:56:53 -08:00
|
|
|
|
2019-02-13 10:46:31 -08:00
|
|
|
part = eina_hash_find(pd->connect.properties, prop);
|
|
|
|
if (part) _efl_ui_layout_view_model_property_update(pd, part, prop);
|
2018-01-26 16:56:53 -08:00
|
|
|
|
2019-02-13 10:46:31 -08:00
|
|
|
signal = eina_hash_find(pd->connect.signals, prop);
|
|
|
|
if (signal) _efl_ui_layout_view_model_signal_update(pd, signal, prop);
|
2018-01-26 16:56:53 -08:00
|
|
|
|
2019-02-13 10:46:31 -08:00
|
|
|
factory = eina_hash_find(pd->connect.factories, prop);
|
|
|
|
if (factory) _efl_ui_layout_view_model_content_update(pd, factory, prop);
|
2017-01-31 12:17:58 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-07 02:26:54 -08:00
|
|
|
static void
|
|
|
|
_efl_ui_layout_factory_free(Efl_Ui_Layout_Factory_Tracking *tracking)
|
|
|
|
{
|
|
|
|
if (tracking->in_flight) eina_future_cancel(tracking->in_flight);
|
|
|
|
efl_unref(tracking->factory);
|
2019-01-31 03:59:19 -08:00
|
|
|
eina_stringshare_del(tracking->key);
|
2018-12-07 02:26:54 -08:00
|
|
|
free(tracking);
|
|
|
|
}
|
|
|
|
|
2018-01-26 16:56:53 -08:00
|
|
|
static void
|
2018-11-16 01:45:05 -08:00
|
|
|
_efl_ui_layout_connect_hash(Efl_Ui_Layout_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-11-29 09:11:51 -08:00
|
|
|
pd->connect.properties = eina_hash_stringshared_new(EINA_FREE_CB(free)); // Hash of property targeting a part
|
|
|
|
pd->connect.signals = eina_hash_stringshared_new(EINA_FREE_CB(free)); // Hash of property triggering a signal
|
2018-12-07 02:26:54 -08:00
|
|
|
pd->connect.factories = eina_hash_stringshared_new(EINA_FREE_CB(_efl_ui_layout_factory_free)); // Hash of property triggering a content creation
|
2018-01-26 16:56:53 -08:00
|
|
|
}
|
2017-12-12 16:59:48 -08:00
|
|
|
|
2019-07-11 10:56:51 -07:00
|
|
|
|
|
|
|
static void
|
|
|
|
_efl_ui_layout_base_model_unregister(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *pd,
|
|
|
|
Efl_Model *model)
|
|
|
|
{
|
|
|
|
if (!model) return ;
|
|
|
|
if (!pd->model_bound) return ;
|
|
|
|
|
|
|
|
efl_event_callback_del(model, EFL_MODEL_EVENT_PROPERTIES_CHANGED,
|
|
|
|
_efl_model_properties_changed_cb, pd);
|
|
|
|
|
|
|
|
pd->model_bound = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_efl_ui_layout_base_model_register(Eo *obj, Efl_Ui_Layout_Data *pd,
|
|
|
|
Efl_Model *model)
|
2018-01-26 16:56:53 -08:00
|
|
|
{
|
2019-01-31 03:59:19 -08:00
|
|
|
Eina_Stringshare *key;
|
2018-01-26 16:56:53 -08:00
|
|
|
Eina_Hash_Tuple *tuple;
|
|
|
|
Eina_Iterator *it;
|
|
|
|
|
2019-07-11 10:56:51 -07:00
|
|
|
if (!model) return ;
|
|
|
|
if (pd->model_bound) return;
|
|
|
|
pd->model_bound = EINA_TRUE;
|
2018-11-29 09:11:51 -08:00
|
|
|
|
2019-07-11 10:56:51 -07:00
|
|
|
efl_event_callback_add(model, EFL_MODEL_EVENT_PROPERTIES_CHANGED,
|
|
|
|
_efl_model_properties_changed_cb, pd);
|
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);
|
2019-01-31 03:59:19 -08:00
|
|
|
EINA_ITERATOR_FOREACH(it, key)
|
2018-01-26 16:56:53 -08:00
|
|
|
{
|
2019-01-31 03:59:19 -08:00
|
|
|
efl_text_set(efl_part(obj, key), NULL);
|
2018-01-26 16:56:53 -08:00
|
|
|
}
|
|
|
|
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-12-07 02:26:54 -08:00
|
|
|
Efl_Ui_Layout_Factory_Tracking *factory;
|
2019-09-15 22:39:05 -07:00
|
|
|
Efl_Gfx_Entity *content[1];
|
2017-01-31 12:17:58 -08:00
|
|
|
|
2019-01-31 03:59:19 -08:00
|
|
|
key = tuple->key;
|
2018-01-26 16:56:53 -08:00
|
|
|
factory = tuple->data;
|
2017-01-31 12:17:58 -08:00
|
|
|
|
2018-12-07 02:26:54 -08:00
|
|
|
// Cancel in flight creation request
|
|
|
|
if (factory->in_flight) eina_future_cancel(factory->in_flight);
|
|
|
|
|
|
|
|
// Cleanup content
|
2019-09-15 22:39:05 -07:00
|
|
|
content[0] = efl_content_get(efl_part(obj, key));
|
2019-03-01 16:22:08 -08:00
|
|
|
efl_content_unset(efl_part(obj, key));
|
2018-12-07 02:26:54 -08:00
|
|
|
|
|
|
|
// And recycle it
|
2019-09-15 22:39:05 -07:00
|
|
|
if (content[0]) efl_ui_factory_release(factory->factory, EINA_C_ARRAY_ITERATOR_NEW(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
|
|
|
}
|
|
|
|
|
2019-07-11 10:56:51 -07:00
|
|
|
static void
|
|
|
|
_efl_ui_layout_base_model_update(void *data, const Efl_Event *event)
|
|
|
|
{
|
|
|
|
Efl_Ui_Layout_Data *pd = data;
|
|
|
|
Efl_Model_Changed_Event *ev = event->info;
|
|
|
|
|
|
|
|
_efl_ui_layout_base_model_unregister(event->object, pd, ev->previous);
|
|
|
|
_efl_ui_layout_base_model_register(event->object, pd, ev->current);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_efl_ui_layout_base_model_watch(Eo *obj, Efl_Ui_Layout_Data *pd)
|
|
|
|
{
|
|
|
|
Efl_Model *model;
|
|
|
|
|
|
|
|
if (pd->model_watch) return ;
|
|
|
|
pd->model_watch = EINA_TRUE;
|
|
|
|
|
|
|
|
efl_event_callback_add(obj, EFL_UI_VIEW_EVENT_MODEL_CHANGED,
|
|
|
|
_efl_ui_layout_base_model_update, pd);
|
|
|
|
model = efl_ui_view_model_get(obj);
|
|
|
|
if (!model) return ;
|
|
|
|
_efl_ui_layout_base_model_register(obj, pd, model);
|
|
|
|
}
|
|
|
|
|
2019-02-12 11:55:03 -08:00
|
|
|
EOLIAN static Eina_Error
|
2019-02-12 11:55:50 -08:00
|
|
|
_efl_ui_layout_base_efl_ui_property_bind_property_bind(Eo *obj, Efl_Ui_Layout_Data *pd, const char *key, const char *property)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
2019-02-12 11:55:03 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(key, EFL_PROPERTY_ERROR_INVALID_KEY);
|
2018-01-26 16:56:53 -08:00
|
|
|
Eina_Stringshare *sprop;
|
2019-02-12 16:47:31 -08:00
|
|
|
Eina_Stringshare *sk;
|
2018-01-26 16:56:53 -08:00
|
|
|
Eina_Hash *hash = NULL;
|
|
|
|
char *data = NULL;
|
2019-02-12 11:55:50 -08:00
|
|
|
Efl_Model *model;
|
|
|
|
Eina_Error r;
|
2017-06-07 10:23:27 -07:00
|
|
|
|
2019-02-12 11:55:50 -08:00
|
|
|
// First try binding with property on the Widget
|
|
|
|
r = efl_ui_property_bind(efl_super(obj, EFL_UI_LAYOUT_BASE_CLASS), key, property);
|
|
|
|
if (!r) return r;
|
|
|
|
|
|
|
|
// Before trying to bind on the part of this object.
|
2019-01-31 03:59:19 -08:00
|
|
|
if (!_elm_layout_part_aliasing_eval(obj, &key, EINA_TRUE))
|
2019-02-12 11:55:03 -08:00
|
|
|
return EFL_PROPERTY_ERROR_INVALID_KEY;
|
2017-01-31 12:17:58 -08:00
|
|
|
|
2019-07-11 10:56:51 -07:00
|
|
|
// Check if there is a model and register it
|
|
|
|
_efl_ui_layout_base_model_watch(obj, pd);
|
|
|
|
|
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
|
|
|
|
2019-01-31 03:59:19 -08:00
|
|
|
// FIXME: prevent double connect of key to multiple property ?
|
|
|
|
if (strncmp(SIGNAL_PREFIX, key, 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;
|
2019-01-31 03:59:19 -08:00
|
|
|
data = strdup(key + 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;
|
2019-01-31 03:59:19 -08:00
|
|
|
data = strdup(key);
|
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
|
2019-02-12 11:55:50 -08:00
|
|
|
model = efl_ui_view_model_get(obj);
|
|
|
|
if (model)
|
2018-09-21 00:50:30 -07:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
2018-01-26 16:56:53 -08:00
|
|
|
|
2019-02-12 16:47:31 -08:00
|
|
|
sk = eina_stringshare_add(key);
|
|
|
|
efl_event_callback_call(obj, EFL_UI_PROPERTY_BIND_EVENT_PROPERTY_BOUND, (void*) sk);
|
|
|
|
eina_stringshare_del(sk);
|
|
|
|
|
2018-09-21 00:50:30 -07:00
|
|
|
if (!sprop)
|
|
|
|
free(data);
|
2019-02-12 11:55:03 -08:00
|
|
|
|
|
|
|
return 0;
|
2017-01-31 12:17:58 -08:00
|
|
|
}
|
|
|
|
|
2019-09-25 09:52:18 -07:00
|
|
|
EOLIAN static Eina_Error
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *pd,
|
2019-01-31 03:59:19 -08:00
|
|
|
const char *key, Efl_Ui_Factory *factory)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
2019-09-25 09:52:18 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(key, EFL_PROPERTY_ERROR_INVALID_KEY);
|
2018-12-07 02:26:54 -08:00
|
|
|
Efl_Ui_Layout_Factory_Tracking *tracking;
|
2019-01-31 03:59:19 -08:00
|
|
|
Eina_Stringshare *ss_key;
|
2017-01-31 12:17:58 -08:00
|
|
|
|
2019-01-31 03:59:19 -08:00
|
|
|
if (!_elm_layout_part_aliasing_eval(obj, &key, EINA_TRUE))
|
2019-09-25 09:52:18 -07:00
|
|
|
return EFL_PROPERTY_ERROR_INVALID_KEY;
|
2017-01-31 12:17:58 -08:00
|
|
|
|
2019-07-11 10:56:51 -07:00
|
|
|
// Check if there is a model and register it
|
|
|
|
_efl_ui_layout_base_model_watch(obj, pd);
|
|
|
|
|
2018-12-07 02:26:54 -08:00
|
|
|
if (!pd->connect.factories)
|
|
|
|
pd->connect.factories = eina_hash_stringshared_new(EINA_FREE_CB(_efl_ui_layout_factory_free));
|
|
|
|
|
2019-01-31 03:59:19 -08:00
|
|
|
ss_key = eina_stringshare_add(key);
|
2017-01-31 12:17:58 -08:00
|
|
|
|
2018-12-07 02:26:54 -08:00
|
|
|
// First undo the old one if there is one
|
2019-01-31 03:59:19 -08:00
|
|
|
tracking = eina_hash_find(pd->connect.factories, ss_key);
|
2018-12-07 02:26:54 -08:00
|
|
|
if (tracking)
|
|
|
|
{
|
2019-09-15 22:39:05 -07:00
|
|
|
Efl_Gfx_Entity *old[1];
|
2018-12-07 02:26:54 -08:00
|
|
|
|
|
|
|
// Unset and recycle
|
2019-09-15 22:39:05 -07:00
|
|
|
old[0] = efl_content_get(efl_part(obj, ss_key));
|
2019-03-01 16:22:08 -08:00
|
|
|
efl_content_unset(efl_part(obj, ss_key));
|
2019-09-15 22:39:05 -07:00
|
|
|
if (old[0]) efl_ui_factory_release(tracking->factory, EINA_C_ARRAY_ITERATOR_NEW(old));
|
2017-01-31 12:17:58 -08:00
|
|
|
|
2018-12-07 02:26:54 -08:00
|
|
|
// Stop in flight request
|
|
|
|
if (tracking->in_flight) eina_future_cancel(tracking->in_flight);
|
2017-01-31 12:17:58 -08:00
|
|
|
|
2018-12-07 02:26:54 -08:00
|
|
|
// Release previous factory
|
|
|
|
efl_replace(&tracking->factory, NULL);
|
|
|
|
}
|
|
|
|
else
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
2018-12-07 02:26:54 -08:00
|
|
|
tracking = calloc(1, sizeof (Efl_Ui_Layout_Factory_Tracking));
|
2019-09-25 09:52:18 -07:00
|
|
|
if (!tracking) return ENOMEM;
|
2018-12-07 02:26:54 -08:00
|
|
|
|
2019-01-31 03:59:19 -08:00
|
|
|
tracking->key = ss_key;
|
2018-12-07 02:26:54 -08:00
|
|
|
|
2019-01-31 03:59:19 -08:00
|
|
|
eina_hash_add(pd->connect.factories, ss_key, tracking);
|
2017-01-31 12:17:58 -08:00
|
|
|
}
|
|
|
|
|
2018-12-07 02:26:54 -08:00
|
|
|
// And update content with the new factory
|
|
|
|
tracking->factory = efl_ref(factory);
|
|
|
|
|
2019-01-31 03:59:19 -08:00
|
|
|
_efl_ui_layout_view_model_content_update(pd, tracking, ss_key);
|
2019-09-25 09:52:18 -07:00
|
|
|
|
|
|
|
return EINA_ERROR_NO_ERROR;
|
2017-01-31 12:17:58 -08:00
|
|
|
}
|
|
|
|
|
2019-08-14 10:25:53 -07:00
|
|
|
EOLIAN void
|
|
|
|
_efl_ui_layout_base_efl_ui_i18n_language_set(Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED, const char *locale)
|
|
|
|
{
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
|
|
|
efl_ui_language_set(wd->resize_obj, locale);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN const char *
|
|
|
|
_efl_ui_layout_base_efl_ui_i18n_language_get(const Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED)
|
|
|
|
{
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
|
|
|
return efl_ui_language_get(wd->resize_obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
|
|
|
_efl_ui_layout_base_efl_ui_l10n_l10n_text_set(Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED, const char *label, const char *domain)
|
|
|
|
{
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
|
|
|
efl_ui_l10n_text_set(efl_part(obj, efl_ui_widget_default_text_part_get(obj)), label, domain);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static const char *
|
|
|
|
_efl_ui_layout_base_efl_ui_l10n_l10n_text_get(const Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED, const char **domain)
|
|
|
|
{
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
|
|
|
return efl_ui_l10n_text_get(efl_part(obj, efl_ui_widget_default_text_part_get(obj)), domain);
|
|
|
|
}
|
|
|
|
|
2019-07-30 10:11:35 -07:00
|
|
|
EOLIAN static Eo *
|
|
|
|
_efl_ui_layout_efl_object_constructor(Eo *obj, void *_pd EINA_UNUSED)
|
|
|
|
{
|
|
|
|
obj = efl_constructor(efl_super(obj, EFL_UI_LAYOUT_CLASS));
|
|
|
|
Efl_Ui_Layout_Data *sd = efl_data_scope_get(obj, MY_CLASS);
|
|
|
|
|
|
|
|
/* basic layouts should not obey finger size */
|
|
|
|
sd->finger_size_multiplier_x = sd->finger_size_multiplier_y = 0;
|
|
|
|
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_efl_object_constructor(Eo *obj, Efl_Ui_Layout_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
|
|
|
sd->obj = obj;
|
2019-11-26 07:49:55 -08:00
|
|
|
sd->needs_theme_apply = EINA_TRUE;
|
2019-07-30 10:11:35 -07:00
|
|
|
sd->finger_size_multiplier_x = sd->finger_size_multiplier_y = 1;
|
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*
|
2019-11-26 07:49:55 -08:00
|
|
|
_efl_ui_layout_base_efl_object_finalize(Eo *obj, Efl_Ui_Layout_Data *pd)
|
2017-11-14 03:38:49 -08:00
|
|
|
{
|
2019-02-27 10:52:14 -08:00
|
|
|
Eo *eo, *win;
|
2019-02-27 10:17:09 -08:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
2017-11-14 03:38:49 -08:00
|
|
|
eo = efl_finalize(efl_super(obj, MY_CLASS));
|
2019-11-26 07:49:55 -08:00
|
|
|
if (pd->needs_theme_apply)
|
|
|
|
{
|
|
|
|
efl_ui_widget_theme_apply(eo);
|
|
|
|
/* handle case where subclass does not call into layout */
|
|
|
|
pd->needs_theme_apply = EINA_FALSE;
|
|
|
|
}
|
2019-07-30 10:11:48 -07:00
|
|
|
efl_canvas_group_change(obj);
|
2019-02-27 10:52:14 -08:00
|
|
|
|
2019-07-30 10:11:54 -07:00
|
|
|
Elm_Layout_Data *ld = efl_data_scope_safe_get(obj, ELM_LAYOUT_MIXIN);
|
|
|
|
/* need to explicitly set this here to permit group_calc since efl_canvas_group_change
|
|
|
|
* blocks non-finalized objects and the object will not be finalized until after this
|
|
|
|
* function returns
|
|
|
|
*/
|
|
|
|
if (ld) ld->needs_size_calc = EINA_TRUE;
|
|
|
|
|
2019-03-04 10:36:47 -08:00
|
|
|
win = elm_widget_top_get(obj);
|
2019-02-27 10:52:14 -08:00
|
|
|
if (efl_isa(win, EFL_UI_WIN_CLASS))
|
|
|
|
efl_ui_layout_theme_rotation_apply(obj, efl_ui_win_rotation_get(win));
|
|
|
|
|
2019-02-27 10:17:09 -08:00
|
|
|
if (efl_file_get(wd->resize_obj) || efl_file_mmap_get(wd->resize_obj))
|
|
|
|
efl_file_load(wd->resize_obj);
|
2017-11-14 03:38:49 -08:00
|
|
|
|
|
|
|
return eo;
|
|
|
|
}
|
|
|
|
|
2019-07-11 10:56:51 -07:00
|
|
|
static void
|
|
|
|
_efl_ui_layout_base_efl_object_invalidate(Eo *obj, Efl_Ui_Layout_Data *pd)
|
|
|
|
{
|
|
|
|
if (pd->model_watch)
|
|
|
|
{
|
|
|
|
Efl_Model *model;
|
|
|
|
|
|
|
|
pd->model_watch = EINA_FALSE;
|
|
|
|
efl_event_callback_del(obj, EFL_UI_VIEW_EVENT_MODEL_CHANGED,
|
|
|
|
_efl_ui_layout_base_model_update, pd);
|
|
|
|
|
|
|
|
model = efl_ui_view_model_get(obj);
|
|
|
|
if (!model)
|
|
|
|
{
|
|
|
|
_efl_ui_layout_base_model_unregister(obj, pd, model);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
efl_invalidate(efl_super(obj, EFL_UI_LAYOUT_BASE_CLASS));
|
|
|
|
}
|
|
|
|
|
2017-08-07 03:11:31 -07:00
|
|
|
EOLIAN static void
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_efl_layout_signal_message_send(Eo *obj, Efl_Ui_Layout_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
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_efl_layout_signal_signal_process(Eo *obj, Efl_Ui_Layout_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 *
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_efl_part_part_get(const Eo *obj, Efl_Ui_Layout_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.
|
|
|
|
|
2018-07-17 20:10:17 -07:00
|
|
|
if (!elm_widget_is_legacy(obj))
|
2018-01-23 22:50:58 -08:00
|
|
|
{
|
2018-07-17 20:10:17 -07:00
|
|
|
if (eina_streq(part, "background"))
|
2018-01-23 22:50:58 -08:00
|
|
|
{
|
2018-07-17 20:10:17 -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"));
|
|
|
|
if (type != EFL_CANVAS_LAYOUT_PART_TYPE_SWALLOW)
|
2018-01-23 22:50:58 -08:00
|
|
|
{
|
2018-07-17 20:10:17 -07:00
|
|
|
if (type < EFL_CANVAS_LAYOUT_PART_TYPE_LAST &&
|
|
|
|
type > EFL_CANVAS_LAYOUT_PART_TYPE_NONE)
|
|
|
|
{
|
|
|
|
const char *file = NULL, *key = NULL;
|
2019-02-27 10:17:09 -08:00
|
|
|
efl_file_simple_get(wd->resize_obj, &file, &key);
|
2018-07-17 20:10:17 -07:00
|
|
|
WRN("Layout has a background but it's not a swallow: '%s'",
|
|
|
|
elm_widget_theme_element_get(obj));
|
|
|
|
}
|
|
|
|
return efl_part_get(efl_super(obj, MY_CLASS), part);
|
2018-01-23 22:50:58 -08:00
|
|
|
}
|
|
|
|
|
2018-07-17 20:10:17 -07:00
|
|
|
return ELM_PART_IMPLEMENT(EFL_UI_LAYOUT_PART_BG_CLASS, obj, part);
|
|
|
|
}
|
|
|
|
else if (eina_streq(part, "shadow"))
|
|
|
|
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 *
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_default_content_part_get(const Eo *obj, Efl_Ui_Layout_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 *
|
2019-02-27 10:17:16 -08:00
|
|
|
_efl_ui_layout_base_default_text_part_get(const Eo *obj, Efl_Ui_Layout_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;
|
|
|
|
}
|
|
|
|
|
2018-06-20 09:24:06 -07:00
|
|
|
#define CONTENT_FULL(part_typename, typename, CLASS, TYPENAME) \
|
|
|
|
ELM_PART_OVERRIDE_CONTENT_GET_FULL(part_typename, typename, ELM_PART_OVERRIDE_INTERNALS_FETCH(CLASS, TYPENAME)) \
|
|
|
|
ELM_PART_OVERRIDE_CONTENT_SET_FULL(part_typename, typename, ELM_PART_OVERRIDE_INTERNALS_FETCH(CLASS, TYPENAME)) \
|
|
|
|
ELM_PART_OVERRIDE_CONTENT_UNSET_FULL(part_typename, typename, ELM_PART_OVERRIDE_INTERNALS_FETCH(CLASS, TYPENAME))
|
|
|
|
|
|
|
|
|
|
|
|
#define TEXT_FULL(part_typename, typename, CLASS, TYPENAME) \
|
|
|
|
ELM_PART_OVERRIDE_TEXT_TEXT_GET_FULL(part_typename, typename, ELM_PART_OVERRIDE_INTERNALS_FETCH(CLASS, TYPENAME)) \
|
|
|
|
ELM_PART_OVERRIDE_TEXT_TEXT_SET_FULL(part_typename, typename, ELM_PART_OVERRIDE_INTERNALS_FETCH(CLASS, TYPENAME)) \
|
|
|
|
|
|
|
|
|
|
|
|
#define MARKUP_FULL(part_typename, typename, CLASS, TYPENAME) \
|
|
|
|
ELM_PART_OVERRIDE_TEXT_MARKUP_GET_FULL(part_typename, typename, ELM_PART_OVERRIDE_INTERNALS_FETCH(CLASS, TYPENAME)) \
|
|
|
|
ELM_PART_OVERRIDE_TEXT_MARKUP_SET_FULL(part_typename, typename, ELM_PART_OVERRIDE_INTERNALS_FETCH(CLASS, TYPENAME)) \
|
|
|
|
|
2018-11-16 01:45:05 -08:00
|
|
|
/* Efl.Ui.Layout_Part_Content */
|
2019-02-27 10:17:16 -08:00
|
|
|
CONTENT_FULL(efl_ui_layout_part_content, efl_ui_layout, EFL_UI_LAYOUT_BASE, Efl_Ui_Layout_Data)
|
2018-01-23 22:50:58 -08:00
|
|
|
|
2018-11-16 01:45:05 -08:00
|
|
|
/* Efl.Ui.Layout_Part_Text */
|
2019-02-27 10:17:16 -08:00
|
|
|
TEXT_FULL(efl_ui_layout_part_text, efl_ui_layout, EFL_UI_LAYOUT_BASE, Efl_Ui_Layout_Data)
|
|
|
|
MARKUP_FULL(efl_ui_layout_part_text, efl_ui_layout, EFL_UI_LAYOUT_BASE, Efl_Ui_Layout_Data)
|
2018-01-23 22:50:58 -08:00
|
|
|
|
|
|
|
EOLIAN static const char *
|
2018-12-21 14:46:10 -08:00
|
|
|
_efl_ui_layout_part_text_efl_ui_l10n_l10n_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
|
2018-12-21 14:46:10 -08:00
|
|
|
_efl_ui_layout_part_text_efl_ui_l10n_l10n_text_set(Eo *obj, void *_pd EINA_UNUSED, const char *label, 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);
|
|
|
|
elm_widget_part_translatable_text_set(pd->obj, pd->part, label, domain);
|
|
|
|
}
|
|
|
|
|
2018-11-16 01:45:05 -08:00
|
|
|
/* Efl.Ui.Layout_Part_Legacy */
|
2019-02-27 10:17:16 -08:00
|
|
|
CONTENT_FULL(efl_ui_layout_part_legacy, efl_ui_layout, EFL_UI_LAYOUT_BASE, Efl_Ui_Layout_Data)
|
|
|
|
TEXT_FULL(efl_ui_layout_part_legacy, efl_ui_layout, EFL_UI_LAYOUT_BASE, Efl_Ui_Layout_Data)
|
|
|
|
MARKUP_FULL(efl_ui_layout_part_legacy, efl_ui_layout, EFL_UI_LAYOUT_BASE, Efl_Ui_Layout_Data)
|
2018-01-23 22:50:58 -08:00
|
|
|
|
|
|
|
EOLIAN static const char *
|
2018-12-21 14:46:10 -08:00
|
|
|
_efl_ui_layout_part_legacy_efl_ui_l10n_l10n_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
|
2018-12-21 14:46:10 -08:00
|
|
|
_efl_ui_layout_part_legacy_efl_ui_l10n_l10n_text_set(Eo *obj, void *_pd EINA_UNUSED, const char *label, 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);
|
|
|
|
elm_widget_part_translatable_text_set(pd->obj, pd->part, label, domain);
|
|
|
|
}
|
|
|
|
|
2018-11-16 01:45:05 -08:00
|
|
|
/* Efl.Ui.Layout_Part_Bg (common) */
|
2018-01-23 22:50:58 -08:00
|
|
|
|
|
|
|
EOLIAN static Efl_Object *
|
|
|
|
_efl_ui_layout_part_bg_efl_object_finalize(Eo *obj, void *_pd EINA_UNUSED)
|
|
|
|
{
|
2018-11-16 01:45:05 -08:00
|
|
|
Efl_Ui_Layout_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;
|
|
|
|
}
|
|
|
|
|
2019-02-27 10:52:14 -08:00
|
|
|
EOLIAN static void
|
|
|
|
_efl_ui_layout_base_automatic_theme_rotation_set(Eo *obj, Efl_Ui_Layout_Data *pd, Eina_Bool automatic)
|
|
|
|
{
|
|
|
|
if (pd->automatic_orientation_apply == automatic) return;
|
|
|
|
pd->automatic_orientation_apply = automatic;
|
|
|
|
|
2019-03-04 10:36:47 -08:00
|
|
|
efl_ui_layout_theme_rotation_apply(obj, efl_ui_win_rotation_get(elm_widget_top_get(obj)));
|
2019-02-27 10:52:14 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_efl_ui_layout_base_automatic_theme_rotation_get(const Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *pd)
|
|
|
|
{
|
|
|
|
return pd->automatic_orientation_apply;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2019-05-20 08:52:10 -07:00
|
|
|
_efl_ui_layout_base_theme_rotation_apply(Eo *obj, Efl_Ui_Layout_Data *pd EINA_UNUSED, int orientation)
|
2019-02-27 10:52:14 -08:00
|
|
|
{
|
|
|
|
char prefix[4], buf[128];
|
|
|
|
|
|
|
|
if (elm_widget_is_legacy(obj))
|
|
|
|
snprintf(prefix, sizeof(prefix), "elm");
|
|
|
|
else
|
|
|
|
snprintf(prefix, sizeof(prefix), "efl");
|
|
|
|
snprintf(buf, sizeof(buf), "%s,state,orient,%d", prefix, (int)orientation);
|
|
|
|
efl_layout_signal_emit(obj, buf, prefix);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-11-16 01:45:05 -08:00
|
|
|
/* Efl.Ui.Layout_Part_Xxx includes */
|
2018-01-23 22:50:58 -08:00
|
|
|
#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 */
|
2019-10-14 06:30:10 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_efl_ui_layout_base_efl_object_event_callback_priority_add(Eo *obj, Efl_Ui_Layout_Data *pd, const Efl_Event_Description *desc, Efl_Callback_Priority priority, Efl_Event_Cb func, const void *user_data)
|
|
|
|
{
|
2019-11-26 07:48:42 -08:00
|
|
|
if (desc == EFL_UI_LAYOUT_EVENT_THEME_CHANGED)
|
2019-10-14 06:30:10 -07:00
|
|
|
{
|
|
|
|
pd->cb_theme_changed = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return efl_event_callback_priority_add(efl_super(obj, MY_CLASS), desc, priority, func, user_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_efl_ui_layout_base_efl_object_event_callback_array_priority_add(Eo *obj, Efl_Ui_Layout_Data *pd, const Efl_Callback_Array_Item *array, Efl_Callback_Priority priority, const void *user_data)
|
|
|
|
{
|
|
|
|
for (int i = 0; array[i].desc; ++i)
|
|
|
|
{
|
2019-11-26 07:48:42 -08:00
|
|
|
if (array[i].desc == EFL_UI_LAYOUT_EVENT_THEME_CHANGED)
|
2019-10-14 06:30:10 -07:00
|
|
|
{
|
|
|
|
pd->cb_theme_changed = EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return efl_event_callback_array_priority_add(efl_super(obj, MY_CLASS), array, priority, user_data);
|
|
|
|
}
|
2018-01-23 22:50:58 -08:00
|
|
|
|
2019-09-23 10:24:51 -07:00
|
|
|
EFL_FUNC_BODY_CONST(efl_ui_layout_text_aliases_get, const Elm_Layout_Part_Alias_Description *, NULL)
|
|
|
|
EFL_FUNC_BODY_CONST(efl_ui_layout_content_aliases_get, const Elm_Layout_Part_Alias_Description *, NULL)
|
2018-01-23 22:50:58 -08:00
|
|
|
|
2019-09-23 10:24:51 -07:00
|
|
|
EFL_UI_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX)
|
|
|
|
EFL_UI_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX)
|
2018-01-23 22:50:58 -08:00
|
|
|
|
2019-02-27 10:17:16 -08:00
|
|
|
#define EFL_UI_LAYOUT_BASE_EXTRA_OPS \
|
|
|
|
EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_ui_layout_base), \
|
|
|
|
ELM_PART_CONTENT_DEFAULT_OPS(efl_ui_layout_base), \
|
|
|
|
ELM_PART_TEXT_DEFAULT_OPS(efl_ui_layout_base), \
|
2019-09-23 10:24:51 -07:00
|
|
|
EFL_UI_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \
|
|
|
|
EFL_UI_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX), \
|
2019-10-14 06:30:10 -07:00
|
|
|
EFL_OBJECT_OP_FUNC(efl_event_callback_priority_add, _efl_ui_layout_base_efl_object_event_callback_priority_add), \
|
|
|
|
EFL_OBJECT_OP_FUNC(efl_event_callback_array_priority_add, _efl_ui_layout_base_efl_object_event_callback_array_priority_add), \
|
2019-02-27 10:17:16 -08:00
|
|
|
EFL_OBJECT_OP_FUNC(efl_dbg_info_get, _efl_ui_layout_base_efl_object_dbg_info_get)
|
2018-01-23 22:50:58 -08:00
|
|
|
|
2019-07-30 10:11:54 -07:00
|
|
|
|
2019-02-27 10:17:16 -08:00
|
|
|
#include "efl_ui_layout_base.eo.c"
|
2018-11-16 01:45:05 -08:00
|
|
|
#include "efl_ui_layout.eo.c"
|
2018-01-23 22:50:58 -08:00
|
|
|
|
2019-03-05 14:00:37 -08:00
|
|
|
#include "efl_ui_layout_legacy_eo.h"
|
2018-01-23 22:50:58 -08:00
|
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
2019-02-27 10:17:09 -08:00
|
|
|
return efl_file_simple_load((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)
|
|
|
|
{
|
2019-02-27 10:17:09 -08:00
|
|
|
efl_file_simple_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)
|
|
|
|
{
|
2019-02-27 10:17:09 -08:00
|
|
|
return efl_file_simple_mmap_load((Eo *) obj, file, group);
|
2016-11-07 14:42:04 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_layout_mmap_get(Eo *obj, const Eina_File **file, const char **group)
|
|
|
|
{
|
2019-02-27 10:17:09 -08:00
|
|
|
efl_file_simple_mmap_get((Eo *) obj, file, group);
|
2016-11-07 14:42:04 -08:00
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2019-03-14 08:11:32 -07:00
|
|
|
Eo *part_obj;
|
2019-03-14 14:16:50 -07:00
|
|
|
|
|
|
|
if (efl_invalidating_get(obj) || efl_invalidated_get(obj)) return EINA_FALSE;
|
|
|
|
|
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;
|
|
|
|
|
2019-03-14 08:11:32 -07:00
|
|
|
part_obj = efl_ref(efl_part(obj, part));
|
|
|
|
|
|
|
|
if (!efl_isa(part_obj, EFL_TEXT_INTERFACE) ||
|
|
|
|
!efl_isa(part_obj, EFL_UI_LAYOUT_PART_CLASS))
|
|
|
|
{
|
2019-03-20 10:55:29 -07:00
|
|
|
efl_unref(part_obj);
|
2019-03-14 08:11:32 -07:00
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
efl_text_set(part_obj, text);
|
|
|
|
|
|
|
|
efl_unref(part_obj);
|
|
|
|
|
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
|
|
|
{
|
2019-02-08 11:36:05 -08:00
|
|
|
Efl_Ui_Layout_Data *sd = efl_data_scope_get(obj, MY_CLASS);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(sd, EINA_FALSE);
|
|
|
|
return _efl_ui_layout_part_cursor_engine_only_set(sd, part, engine_only);
|
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_get(const Eo *obj, const char *part)
|
2017-08-02 03:41:47 -07:00
|
|
|
{
|
2019-02-08 11:36:05 -08:00
|
|
|
Efl_Ui_Layout_Data *sd = efl_data_scope_get(obj, MY_CLASS);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(sd, EINA_FALSE);
|
|
|
|
return _efl_ui_layout_part_cursor_engine_only_get(sd, part);
|
2017-08-02 03:41:47 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
{
|
2019-02-08 11:36:05 -08:00
|
|
|
Efl_Ui_Layout_Data *sd = efl_data_scope_get(obj, MY_CLASS);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(sd, EINA_FALSE);
|
|
|
|
return _efl_ui_layout_part_cursor_set(sd, part, cursor);
|
2017-08-02 03:41:47 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
{
|
2019-02-08 11:36:05 -08:00
|
|
|
Efl_Ui_Layout_Data *sd = efl_data_scope_get(obj, MY_CLASS);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(sd, NULL);
|
|
|
|
return _efl_ui_layout_part_cursor_get(sd, part);
|
2017-08-02 03:41:47 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
{
|
2019-02-08 11:36:05 -08:00
|
|
|
Efl_Ui_Layout_Data *sd = efl_data_scope_get(obj, MY_CLASS);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(sd, EINA_FALSE);
|
|
|
|
return _efl_ui_layout_part_cursor_style_set(sd, part, style);
|
2017-08-02 03:41:47 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
{
|
2019-02-08 11:36:05 -08:00
|
|
|
Efl_Ui_Layout_Data *sd = efl_data_scope_get(obj, MY_CLASS);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(sd, NULL);
|
|
|
|
return _efl_ui_layout_part_cursor_style_get(sd, part);
|
2017-08-02 03:41:47 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
{
|
2019-02-08 11:36:05 -08:00
|
|
|
Efl_Ui_Layout_Data *sd = efl_data_scope_get(obj, MY_CLASS);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(sd, EINA_FALSE);
|
|
|
|
return _efl_ui_layout_part_cursor_set(sd, part, NULL);
|
2017-08-02 03:41:47 -07:00
|
|
|
}
|
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);
|
|
|
|
|
2019-02-06 10:48:43 -08:00
|
|
|
edje_object_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-11-16 01:45:05 -08:00
|
|
|
Efl_Ui_Layout_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);
|
|
|
|
|
2019-02-06 10:48:43 -08:00
|
|
|
edje_object_signal_callback_del_full(edje, emission, source,
|
|
|
|
_edje_signal_callback, esd);
|
2017-08-03 01:24:50 -07:00
|
|
|
|
|
|
|
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-11-16 01:45:05 -08:00
|
|
|
Efl_Ui_Layout_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)
|
|
|
|
{
|
2019-03-04 10:37:07 -08:00
|
|
|
Eina_Error theme_apply_ret;
|
2017-08-09 00:13:06 -07:00
|
|
|
|
2018-11-19 20:56:37 -08:00
|
|
|
theme_apply_ret = efl_ui_layout_theme_set(obj, klass, group, style);
|
2019-03-04 10:36:41 -08:00
|
|
|
return (theme_apply_ret != EFL_UI_THEME_APPLY_ERROR_GENERIC);
|
2017-08-09 00:13:06 -07:00
|
|
|
}
|
|
|
|
|
2019-03-05 14:00:37 -08:00
|
|
|
#include "efl_ui_layout_legacy_eo.c"
|