2013-04-25 22:13:00 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
2014-10-17 08:56:11 -07:00
|
|
|
#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
|
2016-04-20 05:07:38 -07:00
|
|
|
#define ELM_LAYOUT_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"
|
|
|
|
|
edje/elm: Rename _internal_ to _part_ (EO)
In Edje and Elementary, we have part objects, which are what is returned
by the interface efl_part(). Those objects can't be of an opaque type as
this doesn't work nicely with strongly typed languages such as C++ or
C#. In JS, Lua, C the types are weak and mostly runtime-based so it
doesn't matter much.
As a consequence, the documentation and the types need to look nice in
this EO API. Thus, we remove the abusive term "internal" and explicitly
call all those classes "part" something.
Eventually we want the types to be declared in the EO file so bindings
(C#, C++, ...) can generate the proper access methods, returning the
best possible types.
Note that right now a few of those part types are used in the legacy API
but don't actually need to be exposed externally.
This is kind of a mega commit that does all the renaming at once, but
it's really just a big sed operation. The power of good IDEs :)
Ref T5315
Ref T5306
2017-09-12 21:29:25 -07:00
|
|
|
#include "efl_ui_layout_part.eo.h"
|
2016-05-24 04:40:18 -07:00
|
|
|
#include "elm_part_helper.h"
|
|
|
|
|
2016-07-27 00:31:52 -07:00
|
|
|
#define EDJE_EDIT_IS_UNSTABLE_AND_I_KNOW_ABOUT_IT
|
|
|
|
#include <Edje_Edit.h>
|
|
|
|
|
2017-08-07 19:48:31 -07:00
|
|
|
#define MY_CLASS EFL_UI_LAYOUT_CLASS
|
|
|
|
#define MY_CLASS_PFX efl_ui_layout
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-08-17 03:36:17 -07:00
|
|
|
#define MY_CLASS_NAME "Efl.Ui.Layout"
|
2013-11-07 03:44:22 -08:00
|
|
|
#define MY_CLASS_NAME_LEGACY "elm_layout"
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2017-08-07 19:48:31 -07: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 *);
|
2017-08-07 21:28:50 -07: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
|
|
|
|
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}
|
|
|
|
};
|
|
|
|
|
2017-08-07 19:48:31 -07:00
|
|
|
static const char *_efl_ui_layout_swallow_parts[] = {
|
2016-02-12 11:59:44 -08:00
|
|
|
"elm.swallow.icon",
|
|
|
|
"elm.swallow.end",
|
|
|
|
"elm.swallow.background",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2012-05-03 15:41:26 -07:00
|
|
|
/* these are data operated by layout's class functions internally, and
|
|
|
|
* should not be messed up by inhering classes */
|
2017-08-07 21:28:50 -07:00
|
|
|
typedef struct _Efl_Ui_Layout_Sub_Object_Data Efl_Ui_Layout_Sub_Object_Data;
|
|
|
|
typedef struct _Efl_Ui_Layout_Sub_Object_Cursor Efl_Ui_Layout_Sub_Object_Cursor;
|
|
|
|
typedef struct _Efl_Ui_Layout_Sub_Iterator Efl_Ui_Layout_Sub_Iterator;
|
2017-09-06 20:07:08 -07:00
|
|
|
typedef struct _Efl_Ui_Layout_Sub_Connect Efl_Ui_Layout_Sub_Connect;
|
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;
|
2017-08-07 19:48:31 -07: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
|
|
|
};
|
|
|
|
|
2017-09-06 20:07:08 -07:00
|
|
|
struct _Efl_Ui_Layout_Sub_Connect
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
2017-09-06 20:07:08 -07:00
|
|
|
Eina_Stringshare *name;
|
|
|
|
Eina_Stringshare *property;
|
|
|
|
Eina_Bool is_signal;
|
|
|
|
Eo *obj;
|
|
|
|
Efl_Future *future;
|
2017-01-31 12:17:58 -08:00
|
|
|
};
|
|
|
|
|
2012-05-02 09:58:10 -07:00
|
|
|
static void
|
2012-05-03 15:41:26 -07:00
|
|
|
_on_sub_object_size_hint_change(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2012-05-02 09:58:10 -07:00
|
|
|
{
|
2013-10-05 00:36:33 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(data, wd);
|
2017-08-02 23:20:58 -07:00
|
|
|
elm_layout_sizing_eval(data);
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
2012-05-02 09:58:10 -07:00
|
|
|
|
2012-05-03 15:41:26 -07:00
|
|
|
static void
|
2017-08-07 21:28:50 -07:00
|
|
|
_part_cursor_free(Efl_Ui_Layout_Sub_Object_Cursor *pc)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
|
|
|
eina_stringshare_del(pc->part);
|
|
|
|
eina_stringshare_del(pc->style);
|
|
|
|
eina_stringshare_del(pc->cursor);
|
|
|
|
|
|
|
|
free(pc);
|
|
|
|
}
|
|
|
|
|
2011-02-08 04:08:28 -08:00
|
|
|
static void
|
2017-08-07 21:28:50 -07:00
|
|
|
_sizing_eval(Evas_Object *obj, Efl_Ui_Layout_Data *sd)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2013-03-18 09:07:38 -07:00
|
|
|
Evas_Coord minh = -1, minw = -1;
|
2013-10-25 09:51:33 -07:00
|
|
|
Evas_Coord rest_w = 0, rest_h = 0;
|
2013-10-05 00:36:33 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(sd->obj, wd);
|
|
|
|
|
2013-10-25 09:51:33 -07:00
|
|
|
if (sd->restricted_calc_w)
|
|
|
|
rest_w = wd->w;
|
|
|
|
if (sd->restricted_calc_h)
|
|
|
|
rest_h = wd->h;
|
|
|
|
|
|
|
|
edje_object_size_min_restricted_calc(wd->resize_obj, &minw, &minh,
|
|
|
|
rest_w, rest_h);
|
2012-05-03 15:41:26 -07:00
|
|
|
evas_object_size_hint_min_set(obj, minw, minh);
|
2013-10-25 09:51:33 -07:00
|
|
|
|
|
|
|
sd->restricted_calc_w = sd->restricted_calc_h = EINA_FALSE;
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* common content cases for layout objects: icon and text */
|
|
|
|
static inline void
|
2017-08-07 21:28:50 -07:00
|
|
|
_icon_signal_emit(Efl_Ui_Layout_Data *sd,
|
|
|
|
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-08-16 14:41:24 -07:00
|
|
|
char buf[1024];
|
2012-05-03 15:41:26 -07:00
|
|
|
const char *type;
|
2016-02-12 11:59:44 -08:00
|
|
|
int i;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
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;
|
|
|
|
for (i = 0;; i++)
|
|
|
|
{
|
2017-08-07 19:48:31 -07:00
|
|
|
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
|
|
|
|
2014-01-26 09:07:44 -08:00
|
|
|
if (!strncmp(sub_d->part, "elm.swallow.", strlen("elm.swallow.")))
|
|
|
|
type = sub_d->part + strlen("elm.swallow.");
|
2012-08-16 14:41:24 -07:00
|
|
|
else
|
|
|
|
type = sub_d->part;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,%s", type,
|
|
|
|
visible ? "visible" : "hidden");
|
|
|
|
|
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
|
|
|
edje_object_signal_emit(wd->resize_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 */
|
2012-11-25 22:32:53 -08:00
|
|
|
edje_object_message_signal_process(wd->resize_obj);
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
2017-08-07 21:28:50 -07:00
|
|
|
_text_signal_emit(Efl_Ui_Layout_Data *sd,
|
|
|
|
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
|
2014-12-15 00:35:01 -08:00
|
|
|
if ((sub_d->type != TEXT) ||
|
|
|
|
(!((!strcmp("elm.text", sub_d->part)) ||
|
|
|
|
(!strncmp("elm.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
|
|
|
|
2014-01-26 09:07:44 -08:00
|
|
|
if (!strncmp(sub_d->part, "elm.text.", strlen("elm.text.")))
|
|
|
|
type = sub_d->part + strlen("elm.text.");
|
2012-08-16 14:41:24 -07:00
|
|
|
else
|
|
|
|
type = sub_d->part;
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,%s", type,
|
|
|
|
visible ? "visible" : "hidden");
|
2012-11-25 22:32:53 -08:00
|
|
|
edje_object_signal_emit(wd->resize_obj, buf, "elm");
|
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
|
|
|
snprintf(buf, sizeof(buf),
|
|
|
|
visible ? "elm,state,text,visible" : "elm,state,text,hidden");
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
edje_object_signal_emit(wd->resize_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 */
|
2012-11-25 22:32:53 -08:00
|
|
|
edje_object_message_signal_process(wd->resize_obj);
|
2011-02-08 04:08:28 -08:00
|
|
|
}
|
|
|
|
|
2008-11-15 05:58:50 -08:00
|
|
|
static void
|
2017-08-07 21:28:50 -07: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
|
2017-08-07 21:28:50 -07: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
|
|
|
{
|
|
|
|
Evas_Object *obj = (Evas_Object *)edje_object_part_object_get
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, pc->part);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
|
|
|
if (!obj)
|
|
|
|
{
|
|
|
|
pc->obj = NULL;
|
|
|
|
WRN("no part '%s' in group '%s' of file '%s'. "
|
|
|
|
"Cannot set cursor '%s'",
|
|
|
|
pc->part, group, file, pc->cursor);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else if (evas_object_pass_events_get(obj))
|
|
|
|
{
|
|
|
|
pc->obj = NULL;
|
|
|
|
WRN("part '%s' in group '%s' of file '%s' has mouse_events: 0. "
|
|
|
|
"Cannot set cursor '%s'",
|
|
|
|
pc->part, group, file, pc->cursor);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
pc->obj = obj;
|
|
|
|
_part_cursor_part_apply(pc);
|
|
|
|
}
|
2010-10-28 08:54:35 -07:00
|
|
|
}
|
|
|
|
|
2010-10-29 11:21:58 -07:00
|
|
|
static void
|
2017-08-07 19:48:31 -07:00
|
|
|
_efl_ui_layout_highlight_in_theme(Evas_Object *obj)
|
2015-02-26 21:15:42 -08:00
|
|
|
{
|
|
|
|
const char *fh;
|
|
|
|
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
|
|
|
|
|
|
|
fh = edje_object_data_get
|
|
|
|
(wd->resize_obj, "focus_highlight");
|
|
|
|
if ((fh) && (!strcmp(fh, "on")))
|
|
|
|
elm_widget_highlight_in_theme_set(obj, EINA_TRUE);
|
|
|
|
else
|
|
|
|
elm_widget_highlight_in_theme_set(obj, EINA_FALSE);
|
|
|
|
|
|
|
|
fh = edje_object_data_get
|
|
|
|
(wd->resize_obj, "access_highlight");
|
|
|
|
if ((fh) && (!strcmp(fh, "on")))
|
|
|
|
elm_widget_access_highlight_in_theme_set(obj, EINA_TRUE);
|
|
|
|
else
|
|
|
|
elm_widget_access_highlight_in_theme_set(obj, EINA_FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2012-05-03 15:41:26 -07:00
|
|
|
_visuals_refresh(Evas_Object *obj,
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Data *sd)
|
2010-10-28 08:54:35 -07:00
|
|
|
{
|
2015-02-26 21:15:42 -08:00
|
|
|
Eina_Bool ret = EINA_FALSE;
|
2013-09-26 10:05:00 -07:00
|
|
|
|
2015-02-26 21:15:42 -08:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
2013-09-26 10:05:00 -07:00
|
|
|
|
2012-05-28 20:09:06 -07:00
|
|
|
_parts_signals_emit(sd);
|
2012-05-03 15:41:26 -07:00
|
|
|
_parts_cursors_apply(sd);
|
|
|
|
|
2015-02-26 21:15:42 -08:00
|
|
|
edje_object_mirrored_set
|
2017-06-13 03:41:15 -07:00
|
|
|
(wd->resize_obj, efl_ui_mirrored_get(obj));
|
2015-02-26 21:15:42 -08:00
|
|
|
|
|
|
|
edje_object_scale_set
|
|
|
|
(wd->resize_obj,
|
2017-06-09 00:47:42 -07:00
|
|
|
efl_ui_scale_get(obj) * elm_config_scale_get());
|
2015-02-26 21:15:42 -08:00
|
|
|
|
2017-08-07 19:48:31 -07:00
|
|
|
_efl_ui_layout_highlight_in_theme(obj);
|
2015-02-26 21:15:42 -08:00
|
|
|
|
2017-08-23 22:06:32 -07:00
|
|
|
ret = elm_obj_widget_on_disabled_update(obj, elm_widget_disabled_get(obj));
|
2015-02-26 21:15:42 -08:00
|
|
|
|
2017-08-02 23:20:58 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2015-02-26 21:15:42 -08:00
|
|
|
|
|
|
|
return ret;
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2017-08-23 22:06:32 -07:00
|
|
|
_efl_ui_layout_elm_widget_on_disabled_update(Eo *obj, Efl_Ui_Layout_Data *_pd EINA_UNUSED, Eina_Bool disabled)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2014-03-16 06:43:07 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-08-23 22:06:32 -07:00
|
|
|
// Not calling efl_super here: Elm.Widget simply returns false.
|
|
|
|
|
|
|
|
if (disabled)
|
2012-05-03 15:41:26 -07:00
|
|
|
edje_object_signal_emit
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, "elm,state,disabled", "elm");
|
2012-05-03 15:41:26 -07:00
|
|
|
else
|
|
|
|
edje_object_signal_emit
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, "elm,state,enabled", "elm");
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2010-10-28 08:54:35 -07:00
|
|
|
}
|
|
|
|
|
2017-08-09 00:13:06 -07:00
|
|
|
static Efl_Ui_Theme_Apply
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_theme_internal(Eo *obj, Efl_Ui_Layout_Data *sd)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2017-08-09 00:13:06 -07:00
|
|
|
Efl_Ui_Theme_Apply ret = EFL_UI_THEME_APPLY_FAILED;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-08-09 00:13:06 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_UI_THEME_APPLY_FAILED);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
|
|
|
/* function already prints error messages, if any */
|
[layout] support mirrored set for layout which is using elm_layout_file_set()
Summary: mirroed mode does not work, if layout uses elm_layout_file_set().
Test Plan:
the following is test code.
[test.edc]
collections {
group {
name: "layout/test";
parts {
part {
name: "bg";
type: RECT;
description {
state: "default" 0.0;
color: 255 255 0 100;
}
}
part {
name: "test.rect";
type: RECT;
description {
state: "default" 0.0;
color: 255 0 0 255;
rel1.to: bg;
rel1.relative: 0.2 0.1;
rel2.to: bg;
rel2.relative: 0.5 0.2;
}
}
} /* parts */
} /* group */
} /* collections */
[test.c]
//Compile with:
//gcc -g test.c -o test `pkg-config --cflags --libs elementary`
#include <Elementary.h>
#include <Ecore_X.h>
static void
_bt_click(void *data, Evas_Object *obj, void *event_info)
{
Eina_Bool mirrored;
Evas_Object *layout;
layout = data;
mirrored = elm_config_mirrored_get();
mirrored = !mirrored;
printf("mirred: %d\n", mirrored);
elm_config_mirrored_set(mirrored);
}
EAPI_MAIN int
elm_main(int argc, char **argv)
{
Evas_Object *win, *box, *layout, *bt, *check;
char buf[PATH_MAX];
elm_app_info_set(elm_main, "elementary", "./test.edj");
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
win = elm_win_add(NULL, "Layout", ELM_WIN_BASIC);
elm_win_autodel_set(win, EINA_TRUE);
box = elm_box_add(win);
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, box);
evas_object_show(box);
// Adding layout and filling it with widgets
layout = elm_layout_add(win);
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
snprintf(buf, sizeof(buf), "./test.edj");
elm_layout_file_set(layout, buf, "layout/test");
elm_box_pack_end(box, layout);
evas_object_show(layout);
bt = elm_button_add(win);
elm_object_text_set(bt, "mirrored");
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_smart_callback_add(bt, "clicked", _bt_click, layout);
elm_box_pack_end(box, bt);
evas_object_show(bt);
check = elm_check_add(win);
elm_object_text_set(check, "test");
evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(box, check);
evas_object_show(check);
evas_object_resize(win, 500, 500);
evas_object_show(win);
elm_run();
elm_shutdown();
return 0;
}
ELM_MAIN()
Reviewers: seoz, raster, tasn, Hermet
Subscribers: seoz, cedric
Differential Revision: https://phab.enlightenment.org/D2142
2015-06-09 06:05:58 -07:00
|
|
|
if (!sd->file_set)
|
|
|
|
{
|
|
|
|
ret = elm_widget_theme_object_set
|
|
|
|
(obj, wd->resize_obj, sd->klass, sd->group,
|
|
|
|
elm_widget_style_get(obj));
|
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
[layout] support mirrored set for layout which is using elm_layout_file_set()
Summary: mirroed mode does not work, if layout uses elm_layout_file_set().
Test Plan:
the following is test code.
[test.edc]
collections {
group {
name: "layout/test";
parts {
part {
name: "bg";
type: RECT;
description {
state: "default" 0.0;
color: 255 255 0 100;
}
}
part {
name: "test.rect";
type: RECT;
description {
state: "default" 0.0;
color: 255 0 0 255;
rel1.to: bg;
rel1.relative: 0.2 0.1;
rel2.to: bg;
rel2.relative: 0.5 0.2;
}
}
} /* parts */
} /* group */
} /* collections */
[test.c]
//Compile with:
//gcc -g test.c -o test `pkg-config --cflags --libs elementary`
#include <Elementary.h>
#include <Ecore_X.h>
static void
_bt_click(void *data, Evas_Object *obj, void *event_info)
{
Eina_Bool mirrored;
Evas_Object *layout;
layout = data;
mirrored = elm_config_mirrored_get();
mirrored = !mirrored;
printf("mirred: %d\n", mirrored);
elm_config_mirrored_set(mirrored);
}
EAPI_MAIN int
elm_main(int argc, char **argv)
{
Evas_Object *win, *box, *layout, *bt, *check;
char buf[PATH_MAX];
elm_app_info_set(elm_main, "elementary", "./test.edj");
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
win = elm_win_add(NULL, "Layout", ELM_WIN_BASIC);
elm_win_autodel_set(win, EINA_TRUE);
box = elm_box_add(win);
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, box);
evas_object_show(box);
// Adding layout and filling it with widgets
layout = elm_layout_add(win);
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
snprintf(buf, sizeof(buf), "./test.edj");
elm_layout_file_set(layout, buf, "layout/test");
elm_box_pack_end(box, layout);
evas_object_show(layout);
bt = elm_button_add(win);
elm_object_text_set(bt, "mirrored");
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_smart_callback_add(bt, "clicked", _bt_click, layout);
elm_box_pack_end(box, bt);
evas_object_show(bt);
check = elm_check_add(win);
elm_object_text_set(check, "test");
evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(box, check);
evas_object_show(check);
evas_object_resize(win, 500, 500);
evas_object_show(win);
elm_run();
elm_shutdown();
return 0;
}
ELM_MAIN()
Reviewers: seoz, raster, tasn, Hermet
Subscribers: seoz, cedric
Differential Revision: https://phab.enlightenment.org/D2142
2015-06-09 06:05:58 -07:00
|
|
|
if (ret)
|
2017-08-07 19:48:31 -07:00
|
|
|
efl_event_callback_legacy_call(obj, EFL_UI_LAYOUT_EVENT_THEME_CHANGED, NULL);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
theme: return enum from elm_widget_style_set instead of bool
Summary:
if trying to apply incorrect theme, widget apply default theme and return TRUE.
so there is no way to check it really apply correct theme.
To resolve this problem, _elm_theme_set return three type enum
* related history : 4ca3ef45146e05908a13d1010909abeba9693ad6
* elm_object_style_set is public api, so I didn't change it.
* typedef name [ Theme_Apply ] is temporarily, please suggest better one.
@fix
Reviewers: singh.amitesh, herb, Hermet, cedric, jpeg, raster
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4073
2016-06-30 23:09:42 -07:00
|
|
|
if (!_visuals_refresh(obj, sd))
|
2017-08-09 00:13:06 -07:00
|
|
|
ret = EFL_UI_THEME_APPLY_FAILED;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2014-01-09 03:33:30 -08:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2017-08-09 00:13:06 -07:00
|
|
|
EOLIAN static Efl_Ui_Theme_Apply
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_elm_widget_theme_apply(Eo *obj, Efl_Ui_Layout_Data *sd)
|
2014-01-09 03:33:30 -08:00
|
|
|
{
|
2017-08-09 00:13:06 -07:00
|
|
|
Efl_Ui_Theme_Apply theme_apply = EFL_UI_THEME_APPLY_FAILED;
|
2014-01-09 03:33:30 -08:00
|
|
|
|
2017-08-02 05:15:50 -07:00
|
|
|
theme_apply = elm_obj_widget_theme_apply(efl_super(obj, MY_CLASS));
|
2017-08-09 00:13:06 -07:00
|
|
|
if (!theme_apply) return EFL_UI_THEME_APPLY_FAILED;
|
theme: return enum from elm_widget_style_set instead of bool
Summary:
if trying to apply incorrect theme, widget apply default theme and return TRUE.
so there is no way to check it really apply correct theme.
To resolve this problem, _elm_theme_set return three type enum
* related history : 4ca3ef45146e05908a13d1010909abeba9693ad6
* elm_object_style_set is public api, so I didn't change it.
* typedef name [ Theme_Apply ] is temporarily, please suggest better one.
@fix
Reviewers: singh.amitesh, herb, Hermet, cedric, jpeg, raster
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4073
2016-06-30 23:09:42 -07:00
|
|
|
|
2017-08-07 19:48:31 -07:00
|
|
|
theme_apply &= _efl_ui_layout_theme_internal(obj, sd);
|
2017-08-02 05:15:50 -07:00
|
|
|
return theme_apply;
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
2010-10-28 08:54:35 -07:00
|
|
|
|
2010-09-24 07:47:59 -07:00
|
|
|
static void *
|
2017-08-07 19:48:31 -07:00
|
|
|
_efl_ui_layout_list_data_get(const Eina_List *list)
|
2010-09-24 07:47:59 -07:00
|
|
|
{
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Data *sub_d = eina_list_data_get(list);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
|
|
|
return sub_d->obj;
|
2010-09-24 07:47:59 -07:00
|
|
|
}
|
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2017-08-30 23:20:33 -07:00
|
|
|
_efl_ui_layout_elm_widget_on_focus_update(Eo *obj, Efl_Ui_Layout_Data *_pd EINA_UNUSED, Elm_Object_Item *item 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
|
|
|
|
|
|
|
if (elm_widget_focus_get(obj))
|
|
|
|
{
|
|
|
|
elm_layout_signal_emit(obj, "elm,action,focus", "elm");
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_object_focus_set(wd->resize_obj, EINA_TRUE);
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, ELM_WIDGET_EVENT_FOCUSED, NULL);
|
2015-05-13 02:38:20 -07:00
|
|
|
if (_elm_config->atspi_mode && !elm_widget_child_can_focus_get(obj))
|
2015-05-13 00:57:16 -07:00
|
|
|
elm_interface_atspi_accessible_state_changed_signal_emit(obj, ELM_ATSPI_STATE_FOCUSED, EINA_TRUE);
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
elm_layout_signal_emit(obj, "elm,action,unfocus", "elm");
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_object_focus_set(wd->resize_obj, EINA_FALSE);
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, ELM_WIDGET_EVENT_UNFOCUSED, NULL);
|
2015-05-13 02:38:20 -07:00
|
|
|
if (_elm_config->atspi_mode && !elm_widget_child_can_focus_get(obj))
|
2015-05-13 00:57:16 -07:00
|
|
|
elm_interface_atspi_accessible_state_changed_signal_emit(obj, ELM_ATSPI_STATE_FOCUSED, EINA_FALSE);
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
2016-08-15 06:44:41 -07:00
|
|
|
if (efl_isa(wd->resize_obj, EDJE_OBJECT_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
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *_pd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2013-07-11 01:47:25 -07:00
|
|
|
if (!elm_widget_can_focus_get(obj))
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2013-07-11 01:47:25 -07:00
|
|
|
else
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_FALSE;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2013-04-17 00:08:29 -07:00
|
|
|
|
|
|
|
static int
|
|
|
|
_access_focus_list_sort_cb(const void *data1, const void *data2)
|
|
|
|
{
|
|
|
|
Evas_Coord_Point p1, p2;
|
|
|
|
Evas_Object *obj1, *obj2;
|
|
|
|
|
2017-08-07 21:28:50 -07:00
|
|
|
obj1 = ((Efl_Ui_Layout_Sub_Object_Data *)data1)->obj;
|
|
|
|
obj2 = ((Efl_Ui_Layout_Sub_Object_Data *)data2)->obj;
|
2013-04-17 00:08:29 -07:00
|
|
|
|
|
|
|
evas_object_geometry_get(obj1, &p1.x, &p1.y, NULL, NULL);
|
|
|
|
evas_object_geometry_get(obj2, &p2.x, &p2.y, NULL, NULL);
|
|
|
|
|
|
|
|
if (p1.y == p2.y)
|
|
|
|
{
|
|
|
|
return p1.x - p2.x;
|
|
|
|
}
|
|
|
|
|
|
|
|
return p1.y - p2.y;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const Eina_List *
|
|
|
|
_access_focus_list_sort(Eina_List *origin)
|
|
|
|
{
|
|
|
|
Eina_List *l, *temp = NULL;
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Data *sub_d;
|
2013-04-17 00:08:29 -07:00
|
|
|
|
|
|
|
EINA_LIST_FOREACH(origin, l, sub_d)
|
|
|
|
temp = eina_list_sorted_insert(temp, _access_focus_list_sort_cb, sub_d);
|
|
|
|
|
|
|
|
return temp;
|
|
|
|
}
|
|
|
|
|
2012-05-03 15:41:26 -07:00
|
|
|
/* WARNING: if you're making a widget *not* supposed to have focusable
|
|
|
|
* child objects, but still inheriting from elm_layout, just set its
|
|
|
|
* focus_next smart function back to NULL */
|
2014-03-16 06:43:07 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_elm_widget_focus_next(Eo *obj, Efl_Ui_Layout_Data *sd, Elm_Focus_Direction dir, Evas_Object **next, Elm_Object_Item **next_item)
|
2010-09-24 07:47:59 -07:00
|
|
|
{
|
2010-10-06 13:24:19 -07:00
|
|
|
const Eina_List *items;
|
2012-05-03 15:41:26 -07:00
|
|
|
void *(*list_data_get)(const Eina_List *list);
|
2010-09-24 07:47:59 -07:00
|
|
|
|
2017-08-30 00:40:22 -07:00
|
|
|
if ((items = elm_obj_widget_focus_custom_chain_get(obj)))
|
2010-10-06 13:24:22 -07:00
|
|
|
list_data_get = eina_list_data_get;
|
|
|
|
else
|
2010-09-24 07:47:59 -07:00
|
|
|
{
|
2012-05-03 15:41:26 -07:00
|
|
|
items = sd->subs;
|
2017-08-07 19:48:31 -07:00
|
|
|
list_data_get = _efl_ui_layout_list_data_get;
|
2013-03-18 01:55:09 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
if (!items) return EINA_FALSE;
|
2013-04-17 00:08:29 -07:00
|
|
|
|
|
|
|
if (_elm_config->access_mode)
|
|
|
|
items = _access_focus_list_sort((Eina_List *)items);
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
2010-09-24 07:47:59 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return elm_widget_focus_list_next_get
|
2015-09-15 03:41:51 -07:00
|
|
|
(obj, items, list_data_get, dir, next, next_item);
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2017-08-23 04:41:37 -07:00
|
|
|
_efl_ui_layout_elm_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
|
2017-08-23 04:41:37 -07:00
|
|
|
_efl_ui_layout_elm_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
|
|
|
}
|
|
|
|
|
2017-08-02 23:20:58 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2010-09-24 07:47:59 -07:00
|
|
|
}
|
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_elm_widget_focus_direction_manager_is(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *_pd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2013-07-11 01:47:25 -07:00
|
|
|
if (!elm_widget_can_focus_get(obj))
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2013-07-11 01:47:25 -07:00
|
|
|
else
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_FALSE;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_elm_widget_focus_direction(Eo *obj, Efl_Ui_Layout_Data *sd, const Evas_Object *base, double degree, Evas_Object **direction, Elm_Object_Item **direction_item, double *weight)
|
2012-05-02 20:02:54 -07:00
|
|
|
{
|
|
|
|
const Eina_List *items;
|
2012-05-03 15:41:26 -07:00
|
|
|
void *(*list_data_get)(const Eina_List *list);
|
2012-05-02 20:02:54 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
if (!sd->subs) return EINA_FALSE;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2013-09-11 04:22:28 -07:00
|
|
|
/* Focus chain (This block is different from elm_win cycle) */
|
2017-08-30 00:40:22 -07:00
|
|
|
if ((items = elm_obj_widget_focus_custom_chain_get(obj)))
|
2012-05-02 20:02:54 -07:00
|
|
|
list_data_get = eina_list_data_get;
|
|
|
|
else
|
|
|
|
{
|
2012-05-03 15:41:26 -07:00
|
|
|
items = sd->subs;
|
2017-08-07 19:48:31 -07:00
|
|
|
list_data_get = _efl_ui_layout_list_data_get;
|
2012-05-02 20:02:54 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
if (!items) return EINA_FALSE;
|
2012-05-02 20:02:54 -07:00
|
|
|
}
|
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return elm_widget_focus_list_direction_get
|
2015-09-24 23:24:53 -07:00
|
|
|
(obj, base, items, list_data_get, degree, direction, direction_item, weight);
|
2012-05-02 20:02:54 -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
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
if (is_text)
|
2017-07-27 23:35:10 -07:00
|
|
|
aliases = elm_layout_text_aliases_get(obj);
|
2012-11-25 22:32:53 -08:00
|
|
|
else
|
2017-07-27 23:35:10 -07:00
|
|
|
aliases = elm_layout_content_aliases_get(obj);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2012-11-29 22:18:48 -08:00
|
|
|
while (aliases && aliases->alias && aliases->real_part)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
|
|
|
/* NULL matches the 1st */
|
|
|
|
if ((!*part) || (!strcmp(*part, aliases->alias)))
|
|
|
|
{
|
|
|
|
*part = aliases->real_part;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
aliases++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!*part)
|
|
|
|
{
|
|
|
|
ERR("no default content part set for object %p -- "
|
2017-06-29 03:32:19 -07:00
|
|
|
"part must not be NULL", obj);
|
2012-05-03 15:41:26 -07:00
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if no match, part goes on with the same value */
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2016-04-07 06:50:32 -07:00
|
|
|
static void
|
|
|
|
_eo_unparent_helper(Eo *child, Eo *parent)
|
|
|
|
{
|
2016-08-10 07:23:04 -07:00
|
|
|
if (efl_parent_get(child) == parent)
|
2016-04-07 06:50:32 -07:00
|
|
|
{
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_parent_set(child, evas_object_evas_get(parent));
|
2016-04-07 06:50:32 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
static void
|
2013-08-29 00:39:20 -07:00
|
|
|
_box_reference_del(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Data *sub_d = data;
|
2013-08-29 00:39:20 -07:00
|
|
|
sub_d->p.box.reference = NULL;
|
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
static Evas_Object *
|
|
|
|
_sub_box_remove(Evas_Object *obj,
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Data *sd,
|
|
|
|
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,
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Data *sd,
|
|
|
|
Efl_Ui_Layout_Sub_Object_Data *sub_d)
|
2013-08-29 00:39:20 -07:00
|
|
|
{
|
|
|
|
Evas_Object *child;
|
2013-10-05 00:36:33 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(sd->obj, wd, NULL);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-08-23 04:41:37 -07:00
|
|
|
child = sub_d->obj; /* sub_d will die in _efl_ui_layout_smart_widget_sub_object_del */
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
edje_object_part_table_unpack
|
|
|
|
(wd->resize_obj, sub_d->part, child);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2016-04-07 06:50:32 -07:00
|
|
|
_eo_unparent_helper(child, obj);
|
|
|
|
|
2016-05-29 17:47:39 -07:00
|
|
|
if (!_elm_widget_sub_object_redirect_to_top(obj, child))
|
2013-08-29 00:39:20 -07:00
|
|
|
{
|
|
|
|
ERR("could not remove sub object %p from %p", child, obj);
|
|
|
|
return NULL;
|
|
|
|
}
|
2012-06-25 22:54:45 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
return child;
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
static void
|
2013-08-29 00:39:20 -07:00
|
|
|
_on_size_evaluate_signal(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2017-08-02 23:20:58 -07:00
|
|
|
elm_layout_sizing_eval(data);
|
2013-08-29 00:39:20 -07:00
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
EOLIAN static void
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_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-09-24 21:33:39 -07:00
|
|
|
elm_widget_sub_object_parent_add(obj);
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
/* has to be there *before* parent's smart_add() */
|
|
|
|
edje = edje_object_add(evas_object_evas_get(obj));
|
2017-08-08 05:06:43 -07:00
|
|
|
elm_widget_resize_object_set(obj, edje);
|
2013-08-29 00:39:20 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_add(efl_super(obj, MY_CLASS));
|
2013-08-29 00:39:20 -07:00
|
|
|
|
|
|
|
elm_widget_can_focus_set(obj, EINA_FALSE);
|
|
|
|
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(edje, "size,eval", "elm", _on_size_evaluate_signal, obj);
|
|
|
|
|
2017-08-02 23:20:58 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
EOLIAN static void
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_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;
|
2017-09-06 20:07:08 -07:00
|
|
|
Efl_Ui_Layout_Sub_Connect *sc;
|
2013-08-29 00:39:20 -07:00
|
|
|
Edje_Signal_Data *esd;
|
|
|
|
Evas_Object *child;
|
|
|
|
Eina_List *l;
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2013-10-05 00:36:33 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
elm_layout_freeze(obj);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
EINA_LIST_FREE(sd->subs, sub_d)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2013-08-29 00:39:20 -07:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2017-01-31 12:17:58 -08:00
|
|
|
if(sd->model)
|
|
|
|
{
|
|
|
|
efl_event_callback_del(sd->model, EFL_MODEL_EVENT_PROPERTIES_CHANGED, _efl_model_properties_changed_cb, sd);
|
|
|
|
efl_unref(sd->model);
|
|
|
|
sd->model = NULL;
|
|
|
|
}
|
2017-09-06 20:07:08 -07:00
|
|
|
|
|
|
|
EINA_LIST_FREE(sd->prop_connect, sc)
|
|
|
|
{
|
|
|
|
if (sc->future) efl_future_cancel(sc->future);
|
|
|
|
sc->future = NULL;
|
|
|
|
eina_stringshare_del(sc->name);
|
|
|
|
eina_stringshare_del(sc->property);
|
|
|
|
free(sc);
|
|
|
|
}
|
2017-01-31 12:17:58 -08:00
|
|
|
sd->prop_connect = NULL;
|
|
|
|
eina_hash_free(sd->factories);
|
|
|
|
sd->factories = NULL;
|
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
eina_stringshare_del(sd->klass);
|
|
|
|
eina_stringshare_del(sd->group);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
/* let's make our Edje object the *last* to be processed, since it
|
|
|
|
* may (smart) parent other sub objects here */
|
|
|
|
EINA_LIST_FOREACH(wd->subobjs, l, child)
|
|
|
|
{
|
|
|
|
if (child == wd->resize_obj)
|
|
|
|
{
|
|
|
|
wd->subobjs =
|
|
|
|
eina_list_demote_list(wd->subobjs, l);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2014-05-13 20:02:10 -07:00
|
|
|
sd->destructed_is = EINA_TRUE;
|
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_del(efl_super(obj, MY_CLASS));
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
/* rewrite or extend this one on your derived class as to suit your
|
|
|
|
* needs */
|
2014-03-16 06:43:07 -07:00
|
|
|
EOLIAN static void
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Layout_Data *sd)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2013-08-29 00:39:20 -07:00
|
|
|
if (sd->needs_size_calc)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2013-08-29 00:39:20 -07:00
|
|
|
_sizing_eval(obj, sd);
|
|
|
|
sd->needs_size_calc = EINA_FALSE;
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-07 21:28:50 -07:00
|
|
|
static Efl_Ui_Layout_Sub_Object_Cursor *
|
|
|
|
_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
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_efl_file_file_set(Eo *obj, Efl_Ui_Layout_Data *sd, const char *file, const char *group)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2013-08-29 00:39:20 -07:00
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
int_ret =
|
|
|
|
edje_object_file_set(wd->resize_obj, file, group);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
[layout] support mirrored set for layout which is using elm_layout_file_set()
Summary: mirroed mode does not work, if layout uses elm_layout_file_set().
Test Plan:
the following is test code.
[test.edc]
collections {
group {
name: "layout/test";
parts {
part {
name: "bg";
type: RECT;
description {
state: "default" 0.0;
color: 255 255 0 100;
}
}
part {
name: "test.rect";
type: RECT;
description {
state: "default" 0.0;
color: 255 0 0 255;
rel1.to: bg;
rel1.relative: 0.2 0.1;
rel2.to: bg;
rel2.relative: 0.5 0.2;
}
}
} /* parts */
} /* group */
} /* collections */
[test.c]
//Compile with:
//gcc -g test.c -o test `pkg-config --cflags --libs elementary`
#include <Elementary.h>
#include <Ecore_X.h>
static void
_bt_click(void *data, Evas_Object *obj, void *event_info)
{
Eina_Bool mirrored;
Evas_Object *layout;
layout = data;
mirrored = elm_config_mirrored_get();
mirrored = !mirrored;
printf("mirred: %d\n", mirrored);
elm_config_mirrored_set(mirrored);
}
EAPI_MAIN int
elm_main(int argc, char **argv)
{
Evas_Object *win, *box, *layout, *bt, *check;
char buf[PATH_MAX];
elm_app_info_set(elm_main, "elementary", "./test.edj");
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
win = elm_win_add(NULL, "Layout", ELM_WIN_BASIC);
elm_win_autodel_set(win, EINA_TRUE);
box = elm_box_add(win);
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, box);
evas_object_show(box);
// Adding layout and filling it with widgets
layout = elm_layout_add(win);
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
snprintf(buf, sizeof(buf), "./test.edj");
elm_layout_file_set(layout, buf, "layout/test");
elm_box_pack_end(box, layout);
evas_object_show(layout);
bt = elm_button_add(win);
elm_object_text_set(bt, "mirrored");
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_smart_callback_add(bt, "clicked", _bt_click, layout);
elm_box_pack_end(box, bt);
evas_object_show(bt);
check = elm_check_add(win);
elm_object_text_set(check, "test");
evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(box, check);
evas_object_show(check);
evas_object_resize(win, 500, 500);
evas_object_show(win);
elm_run();
elm_shutdown();
return 0;
}
ELM_MAIN()
Reviewers: seoz, raster, tasn, Hermet
Subscribers: seoz, cedric
Differential Revision: https://phab.enlightenment.org/D2142
2015-06-09 06:05:58 -07:00
|
|
|
if (int_ret)
|
|
|
|
{
|
|
|
|
sd->file_set = EINA_TRUE;
|
|
|
|
_visuals_refresh(obj, sd);
|
|
|
|
}
|
2013-08-29 00:39:20 -07:00
|
|
|
else
|
|
|
|
ERR("failed to set edje file '%s', group '%s': %s",
|
|
|
|
file, group,
|
|
|
|
edje_load_error_str
|
|
|
|
(edje_object_load_error_get(wd->resize_obj)));
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return int_ret;
|
2013-08-29 00:39:20 -07:00
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2015-03-19 05:08:23 -07:00
|
|
|
EOLIAN static void
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_efl_file_file_get(Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED, const char **file, const char **group)
|
2015-03-19 05:08:23 -07:00
|
|
|
{
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
|
|
|
edje_object_file_get(wd->resize_obj, file, group);
|
|
|
|
}
|
|
|
|
|
2016-11-07 14:42:04 -08:00
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_efl_file_mmap_set(Eo *obj, Efl_Ui_Layout_Data *sd, const Eina_File *file, const char *group)
|
2016-11-07 14:42:04 -08:00
|
|
|
{
|
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
|
|
|
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
|
|
|
|
|
|
|
int_ret =
|
|
|
|
edje_object_mmap_set(wd->resize_obj, file, group);
|
|
|
|
|
|
|
|
if (int_ret)
|
|
|
|
{
|
|
|
|
sd->file_set = EINA_TRUE;
|
|
|
|
_visuals_refresh(obj, sd);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ERR("failed to set edje mmap file %p, group '%s': %s",
|
|
|
|
file, group,
|
|
|
|
edje_load_error_str
|
|
|
|
(edje_object_load_error_get(wd->resize_obj)));
|
|
|
|
|
|
|
|
return int_ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_efl_file_mmap_get(Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED, const Eina_File **file, const char **group)
|
2016-11-07 14:42:04 -08:00
|
|
|
{
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
|
|
|
efl_file_mmap_get(wd->resize_obj, file, group);
|
|
|
|
}
|
|
|
|
|
2017-08-09 00:13:06 -07:00
|
|
|
EOLIAN static Efl_Ui_Theme_Apply
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_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
|
|
|
{
|
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-09 00:22:48 -07:00
|
|
|
if (!wd->legacy && efl_finalized_get(obj))
|
|
|
|
{
|
|
|
|
ERR("Efl.Ui.Layout.theme can only be set before finalize!");
|
|
|
|
return EFL_UI_THEME_APPLY_FAILED;
|
|
|
|
}
|
|
|
|
|
[layout] support mirrored set for layout which is using elm_layout_file_set()
Summary: mirroed mode does not work, if layout uses elm_layout_file_set().
Test Plan:
the following is test code.
[test.edc]
collections {
group {
name: "layout/test";
parts {
part {
name: "bg";
type: RECT;
description {
state: "default" 0.0;
color: 255 255 0 100;
}
}
part {
name: "test.rect";
type: RECT;
description {
state: "default" 0.0;
color: 255 0 0 255;
rel1.to: bg;
rel1.relative: 0.2 0.1;
rel2.to: bg;
rel2.relative: 0.5 0.2;
}
}
} /* parts */
} /* group */
} /* collections */
[test.c]
//Compile with:
//gcc -g test.c -o test `pkg-config --cflags --libs elementary`
#include <Elementary.h>
#include <Ecore_X.h>
static void
_bt_click(void *data, Evas_Object *obj, void *event_info)
{
Eina_Bool mirrored;
Evas_Object *layout;
layout = data;
mirrored = elm_config_mirrored_get();
mirrored = !mirrored;
printf("mirred: %d\n", mirrored);
elm_config_mirrored_set(mirrored);
}
EAPI_MAIN int
elm_main(int argc, char **argv)
{
Evas_Object *win, *box, *layout, *bt, *check;
char buf[PATH_MAX];
elm_app_info_set(elm_main, "elementary", "./test.edj");
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
win = elm_win_add(NULL, "Layout", ELM_WIN_BASIC);
elm_win_autodel_set(win, EINA_TRUE);
box = elm_box_add(win);
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, box);
evas_object_show(box);
// Adding layout and filling it with widgets
layout = elm_layout_add(win);
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
snprintf(buf, sizeof(buf), "./test.edj");
elm_layout_file_set(layout, buf, "layout/test");
elm_box_pack_end(box, layout);
evas_object_show(layout);
bt = elm_button_add(win);
elm_object_text_set(bt, "mirrored");
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_smart_callback_add(bt, "clicked", _bt_click, layout);
elm_box_pack_end(box, bt);
evas_object_show(bt);
check = elm_check_add(win);
elm_object_text_set(check, "test");
evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(box, check);
evas_object_show(check);
evas_object_resize(win, 500, 500);
evas_object_show(win);
elm_run();
elm_shutdown();
return 0;
}
ELM_MAIN()
Reviewers: seoz, raster, tasn, Hermet
Subscribers: seoz, cedric
Differential Revision: https://phab.enlightenment.org/D2142
2015-06-09 06:05:58 -07:00
|
|
|
if (sd->file_set) sd->file_set = EINA_FALSE;
|
2013-08-29 00:39:20 -07:00
|
|
|
eina_stringshare_replace(&(sd->klass), klass);
|
|
|
|
eina_stringshare_replace(&(sd->group), group);
|
|
|
|
eina_stringshare_replace(&(wd->style), style);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-08-09 00:13:06 -07:00
|
|
|
return _efl_ui_layout_theme_internal(obj, sd);
|
2010-09-26 17:51:16 -07:00
|
|
|
}
|
|
|
|
|
2016-08-05 10:31:49 -07:00
|
|
|
EOLIAN static void
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_efl_canvas_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
|
2016-08-05 10:31:49 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2017-08-03 01:24:50 -07:00
|
|
|
efl_canvas_layout_signal_emit(wd->resize_obj, emission, source);
|
2013-08-29 00:39:20 -07:00
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-08-03 01:24:50 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_efl_canvas_layout_signal_signal_callback_add(Eo *obj, Efl_Ui_Layout_Data *_pd EINA_UNUSED, const char *emission, const char *source, Efl_Signal_Cb func, void *data)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2017-08-03 01:24:50 -07:00
|
|
|
// Don't do anything else than call forward here
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
|
|
|
return efl_canvas_layout_signal_callback_add(wd->resize_obj, emission, source, func, data);
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
|
2017-08-03 01:24:50 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_efl_canvas_layout_signal_signal_callback_del(Eo *obj, Efl_Ui_Layout_Data *_pd EINA_UNUSED, const char *emission, const char *source, Edje_Signal_Cb func, void *data)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2017-08-03 01:24:50 -07:00
|
|
|
// Don't do anything else than call forward here
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
|
|
|
return efl_canvas_layout_signal_callback_add(wd->resize_obj, emission, source, func, data);
|
2013-08-29 00:39:20 -07:00
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-08-03 01:24:50 -07:00
|
|
|
// TODO:
|
|
|
|
// - message_send
|
|
|
|
// - message_signal_process
|
|
|
|
// and also message handler (not implemented yet as an EO interface!)
|
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_layout_content_set(Evas_Object *obj,
|
|
|
|
const char *swallow,
|
|
|
|
Evas_Object *content)
|
|
|
|
{
|
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)
|
|
|
|
{
|
|
|
|
swallow = elm_widget_default_content_part_get(obj);
|
|
|
|
if (!swallow) 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
|
2017-08-07 21:28:50 -07: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;
|
2013-08-29 00:39:20 -07:00
|
|
|
const 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
|
|
|
|
2017-06-29 03:32:19 -07:00
|
|
|
if (!_elm_layout_part_aliasing_eval(obj, &part, EINA_FALSE))
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_FALSE;
|
2013-08-29 00:39:20 -07:00
|
|
|
|
|
|
|
EINA_LIST_FOREACH(sd->subs, l, sub_d)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2013-08-29 00:39:20 -07:00
|
|
|
if (sub_d->type == SWALLOW)
|
|
|
|
{
|
|
|
|
if (!strcmp(part, sub_d->part))
|
|
|
|
{
|
|
|
|
if (content == sub_d->obj) goto end;
|
2016-04-07 06:50:32 -07:00
|
|
|
_eo_unparent_helper(sub_d->obj, obj);
|
2013-08-29 00:39:20 -07:00
|
|
|
evas_object_del(sub_d->obj);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* was previously swallowed at another part -- mimic
|
|
|
|
* edje_object_part_swallow()'s behavior, then */
|
|
|
|
else if (content == sub_d->obj)
|
|
|
|
{
|
2016-05-29 17:47:39 -07:00
|
|
|
_elm_widget_sub_object_redirect_to_top(obj, content);
|
2013-08-29 00:39:20 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
if (content)
|
2012-05-03 15:41:26 -07:00
|
|
|
{
|
2013-08-29 00:39:20 -07:00
|
|
|
if (!elm_widget_sub_object_add(obj, content))
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_FALSE;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
if (!edje_object_part_swallow
|
|
|
|
(wd->resize_obj, part, content))
|
|
|
|
{
|
|
|
|
ERR("could not swallow %p into part '%s'", content, part);
|
2016-05-29 17:47:39 -07:00
|
|
|
_elm_widget_sub_object_redirect_to_top(obj, content);
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_FALSE;
|
2013-08-29 00:39:20 -07:00
|
|
|
}
|
|
|
|
|
2017-08-07 21:28:50 -07:00
|
|
|
sub_d = ELM_NEW(Efl_Ui_Layout_Sub_Object_Data);
|
2015-06-14 22:56:42 -07:00
|
|
|
if (!sub_d)
|
|
|
|
{
|
|
|
|
ERR("failed to allocate memory!");
|
2015-06-14 23:35:31 -07:00
|
|
|
edje_object_part_unswallow(wd->resize_obj, content);
|
2016-05-29 17:47:39 -07:00
|
|
|
_elm_widget_sub_object_redirect_to_top(obj, content);
|
2015-06-14 22:56:42 -07:00
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2013-08-29 00:39:20 -07:00
|
|
|
sub_d->type = SWALLOW;
|
|
|
|
sub_d->part = eina_stringshare_add(part);
|
|
|
|
sub_d->obj = content;
|
|
|
|
sd->subs = eina_list_append(sd->subs, sub_d);
|
|
|
|
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_parent_set(content, obj);
|
2013-08-29 00:39:20 -07:00
|
|
|
_icon_signal_emit(sd, sub_d, EINA_TRUE);
|
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-08-02 23:20:58 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
end:
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2010-09-26 17:51:16 -07:00
|
|
|
}
|
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
EAPI Evas_Object *
|
|
|
|
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;
|
2017-07-03 19:37:37 -07:00
|
|
|
if (!swallow)
|
|
|
|
{
|
|
|
|
swallow = elm_widget_default_content_part_get(obj);
|
|
|
|
if (!swallow) return NULL;
|
|
|
|
}
|
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*
|
2017-08-07 21:28:50 -07: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
|
|
|
|
2017-06-29 03:32:19 -07:00
|
|
|
if (!_elm_layout_part_aliasing_eval(obj, &part, EINA_FALSE))
|
2014-03-16 06:43:07 -07:00
|
|
|
return NULL;
|
2012-05-02 18:19:05 -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 *
|
|
|
|
elm_layout_content_unset(Evas_Object *obj,
|
|
|
|
const char *swallow)
|
|
|
|
{
|
2017-08-07 21:28:50 -07:00
|
|
|
EFL_UI_LAYOUT_CHECK(obj) 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*
|
2017-08-07 21:28:50 -07: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;
|
2013-08-29 00:39:20 -07:00
|
|
|
const 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
|
|
|
|
2017-06-29 03:32:19 -07:00
|
|
|
if (!_elm_layout_part_aliasing_eval(obj, &part, EINA_FALSE))
|
2014-03-16 06:43:07 -07:00
|
|
|
return 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);
|
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-05-24 04:40:18 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_efl_container_content_set(Eo *obj, Efl_Ui_Layout_Data *sd, Evas_Object *content)
|
2016-05-24 04:40:18 -07:00
|
|
|
{
|
2017-08-07 19:48:31 -07:00
|
|
|
return _efl_ui_layout_content_set(obj, sd, NULL, content);
|
2016-05-24 04:40:18 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Evas_Object*
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_efl_container_content_get(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *sd)
|
2016-05-24 04:40:18 -07:00
|
|
|
{
|
2017-08-07 19:48:31 -07:00
|
|
|
return _efl_ui_layout_content_get(obj, sd, NULL);
|
2016-05-24 04:40:18 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Evas_Object*
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_efl_container_content_unset(Eo *obj, Efl_Ui_Layout_Data *sd)
|
2016-05-24 04:40:18 -07:00
|
|
|
{
|
2017-08-07 19:48:31 -07:00
|
|
|
return _efl_ui_layout_content_unset(obj, sd, NULL);
|
2016-05-24 04:40:18 -07:00
|
|
|
}
|
|
|
|
|
2016-04-25 03:53:51 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_efl_container_content_remove(Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED,
|
2016-05-10 04:25:44 -07:00
|
|
|
Efl_Gfx *content)
|
2016-04-25 03:53:51 -07:00
|
|
|
{
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
|
|
|
|
2016-05-29 17:47:39 -07:00
|
|
|
if (!_elm_widget_sub_object_redirect_to_top(obj, content))
|
2016-04-25 03:53:51 -07:00
|
|
|
{
|
|
|
|
ERR("could not remove sub object %p from %p", content, obj);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
edje_object_part_unswallow(wd->resize_obj, content);
|
|
|
|
_eo_unparent_helper(content, obj);
|
|
|
|
|
2016-04-25 05:36:56 -07:00
|
|
|
return EINA_TRUE;
|
2016-04-25 03:53:51 -07:00
|
|
|
}
|
|
|
|
|
2016-03-28 21:30:13 -07:00
|
|
|
/* legacy only - eo is iterator */
|
2013-12-28 00:33:10 -08:00
|
|
|
EAPI Eina_List *
|
|
|
|
elm_layout_content_swallow_list_get(const Evas_Object *obj)
|
|
|
|
{
|
2017-08-07 21:28:50 -07:00
|
|
|
EFL_UI_LAYOUT_CHECK(obj) NULL;
|
2013-12-28 00:33:10 -08:00
|
|
|
Eina_List *ret = NULL;
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Data *sub_d = NULL;
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2017-08-07 19:48:31 -07: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 *
|
2017-08-07 21:28:50 -07: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 *
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_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
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_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
|
|
|
}
|
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_text_set(Eo *obj, Efl_Ui_Layout_Data *sd, const char *part, const char *text)
|
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
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
Eina_List *l;
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Sub_Object_Data *sub_d = NULL;
|
2017-09-06 20:07:08 -07:00
|
|
|
Efl_Ui_Layout_Sub_Connect *sc;
|
2011-06-29 02:30:56 -07:00
|
|
|
|
2017-06-29 03:32:19 -07:00
|
|
|
if (!_elm_layout_part_aliasing_eval(obj, &part, EINA_TRUE))
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_FALSE;
|
2011-06-29 02:30:56 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
EINA_LIST_FOREACH(sd->subs, l, sub_d)
|
2011-10-25 17:46:16 -07:00
|
|
|
{
|
2013-08-29 00:39:20 -07:00
|
|
|
if ((sub_d->type == TEXT) && (!strcmp(part, sub_d->part)))
|
2011-10-25 17:46:16 -07:00
|
|
|
{
|
2013-08-29 00:39:20 -07:00
|
|
|
if (!text)
|
|
|
|
{
|
2017-08-03 23:33:27 -07:00
|
|
|
_text_signal_emit(sd, sub_d, EINA_FALSE);
|
2013-08-29 00:39:20 -07:00
|
|
|
eina_stringshare_del(sub_d->part);
|
|
|
|
free(sub_d);
|
|
|
|
edje_object_part_text_escaped_set
|
|
|
|
(wd->resize_obj, part, NULL);
|
|
|
|
sd->subs = eina_list_remove_list(sd->subs, l);
|
2017-08-22 21:29:14 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2013-08-29 00:39:20 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
break;
|
2011-10-25 17:46:16 -07:00
|
|
|
}
|
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2016-06-29 22:20:44 -07:00
|
|
|
if (!text) return EINA_TRUE;
|
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
if (!edje_object_part_text_escaped_set
|
|
|
|
(wd->resize_obj, part, text))
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_FALSE;
|
2011-10-25 17:46:16 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
if (!sub_d)
|
2011-10-25 17:46:16 -07:00
|
|
|
{
|
2017-08-07 21:28:50 -07:00
|
|
|
sub_d = ELM_NEW(Efl_Ui_Layout_Sub_Object_Data);
|
2014-03-16 06:43:07 -07:00
|
|
|
if (!sub_d) return EINA_FALSE;
|
2013-08-29 00:39:20 -07:00
|
|
|
sub_d->type = TEXT;
|
|
|
|
sub_d->part = eina_stringshare_add(part);
|
|
|
|
sd->subs = eina_list_append(sd->subs, sub_d);
|
2011-10-25 17:46:16 -07:00
|
|
|
}
|
|
|
|
|
2017-08-03 23:33:27 -07:00
|
|
|
_text_signal_emit(sd, sub_d, EINA_TRUE);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-08-02 23:20:58 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2011-10-25 17:46:16 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON &&
|
2014-01-01 16:23:03 -08:00
|
|
|
sd->can_access && !(sub_d->obj))
|
2013-08-29 00:39:20 -07:00
|
|
|
sub_d->obj = _elm_access_edje_object_part_object_register
|
|
|
|
(obj, elm_layout_edje_get(obj), part);
|
|
|
|
|
2017-09-06 20:07:08 -07:00
|
|
|
if (sd->model)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
2017-09-06 20:07:08 -07:00
|
|
|
EINA_LIST_FOREACH(sd->prop_connect, l, sc)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
2017-09-06 20:07:08 -07:00
|
|
|
if (sc->name == sub_d->part && !sd->view_updated)
|
|
|
|
{
|
|
|
|
Eina_Value v;
|
|
|
|
eina_value_setup(&v, EINA_VALUE_TYPE_STRING);
|
|
|
|
eina_value_set(&v, text);
|
|
|
|
efl_model_property_set(sd->model, sc->property, &v);
|
|
|
|
eina_value_flush(&v);
|
|
|
|
break;
|
|
|
|
}
|
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-01-04 03:07:42 -08:00
|
|
|
EOLIAN static const char*
|
2017-08-07 21:28:50 -07: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
|
|
|
|
2017-06-29 03:32:19 -07:00
|
|
|
if (!_elm_layout_part_aliasing_eval(obj, &part, EINA_TRUE))
|
2014-03-16 06:43:07 -07:00
|
|
|
return NULL;
|
2008-10-06 23:55:11 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return edje_object_part_text_get(wd->resize_obj, part);
|
2010-10-13 19:36:37 -07:00
|
|
|
}
|
|
|
|
|
2016-04-07 06:50:32 -07:00
|
|
|
static void
|
2017-08-07 21:28:50 -07: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
|
2017-08-07 21:28:50 -07: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
|
|
|
|
2017-08-02 23:20:58 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2010-10-13 19:36:37 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
2010-10-13 19:36:37 -07:00
|
|
|
|
2016-04-25 05:36:56 -07:00
|
|
|
Eina_Bool
|
2017-08-07 21:28:50 -07: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
|
|
|
|
2017-08-02 23:20:58 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2013-08-29 00:39:20 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2010-10-13 19:36:37 -07:00
|
|
|
}
|
|
|
|
|
2016-04-25 05:36:56 -07:00
|
|
|
Eina_Bool
|
2017-08-07 21:28:50 -07: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
|
|
|
|
2017-08-02 23:20:58 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2012-03-06 12:25:29 -08:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2012-05-03 15:41:26 -07:00
|
|
|
}
|
2012-05-02 18:19:05 -07:00
|
|
|
|
2016-04-25 05:36:56 -07:00
|
|
|
Eina_Bool
|
2017-08-07 21:28:50 -07: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
|
|
|
|
2017-08-02 23:20:58 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2013-08-29 00:39:20 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2012-05-02 09:58:10 -07:00
|
|
|
}
|
2010-10-13 19:36:37 -07:00
|
|
|
|
2016-04-25 05:36:56 -07:00
|
|
|
Evas_Object *
|
2017-08-07 21:28:50 -07: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
|
2017-08-07 21:28:50 -07: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
|
2017-08-07 21:28:50 -07: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
|
|
|
|
2017-08-02 23:20:58 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2013-08-29 00:39:20 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2010-10-13 19:36:37 -07:00
|
|
|
}
|
|
|
|
|
2016-04-25 05:36:56 -07:00
|
|
|
Evas_Object *
|
2017-08-07 21:28:50 -07: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
|
2017-08-07 21:28:50 -07: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 *
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_efl_canvas_layout_group_group_data_get(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-08-03 02:22:29 -07:00
|
|
|
return efl_canvas_layout_group_data_get(wd->resize_obj, key);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_efl_canvas_layout_group_group_size_min_get(Eo *obj, Efl_Ui_Layout_Data *_pd EINA_UNUSED, int *w, int *h)
|
2017-08-03 02:22:29 -07:00
|
|
|
{
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
|
|
|
|
|
|
|
efl_canvas_layout_group_size_min_get(wd->resize_obj, w, h);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_efl_canvas_layout_group_group_size_max_get(Eo *obj, Efl_Ui_Layout_Data *_pd EINA_UNUSED, int *w, int *h)
|
2017-08-03 02:22:29 -07:00
|
|
|
{
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
|
|
|
|
|
|
|
efl_canvas_layout_group_size_max_get(wd->resize_obj, w, h);
|
2009-12-07 20:41:02 -08:00
|
|
|
}
|
2010-09-26 17:51:16 -07:00
|
|
|
|
2013-08-29 00:39:20 -07:00
|
|
|
/* layout's sizing evaluation is deferred. evaluation requests are
|
|
|
|
* queued up and only flag the object as 'changed'. when it comes to
|
|
|
|
* Evas's rendering phase, it will be addressed, finally (see
|
2017-08-07 19:48:31 -07:00
|
|
|
* _efl_ui_layout_smart_calculate()). */
|
2017-08-07 00:13:38 -07:00
|
|
|
static void
|
2017-08-07 21:28:50 -07:00
|
|
|
_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Layout_Data *sd)
|
2013-08-29 00:39:20 -07:00
|
|
|
{
|
2013-10-05 01:59:58 -07:00
|
|
|
if (sd->frozen) return;
|
2013-08-29 00:39:20 -07:00
|
|
|
if (sd->needs_size_calc) return;
|
|
|
|
sd->needs_size_calc = EINA_TRUE;
|
|
|
|
|
|
|
|
evas_object_smart_changed(obj);
|
|
|
|
}
|
|
|
|
|
2017-08-07 00:13:38 -07:00
|
|
|
EAPI void
|
|
|
|
elm_layout_sizing_restricted_eval(Eo *obj, Eina_Bool w, Eina_Bool h)
|
2013-10-25 09:51:33 -07:00
|
|
|
{
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Data *sd = efl_data_scope_safe_get(obj, MY_CLASS);
|
2017-08-07 00:13:38 -07:00
|
|
|
|
|
|
|
if (!sd) return;
|
2013-10-25 09:51:33 -07:00
|
|
|
sd->restricted_calc_w = !!w;
|
|
|
|
sd->restricted_calc_h = !!h;
|
|
|
|
|
|
|
|
evas_object_smart_changed(obj);
|
|
|
|
}
|
|
|
|
|
2016-06-27 11:18:02 -07:00
|
|
|
EOLIAN static int
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_efl_canvas_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);
|
2016-08-05 10:31:49 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
if ((sd->frozen)++ != 0) return sd->frozen;
|
2012-07-30 00:14:33 -07:00
|
|
|
|
2016-08-05 10:31:49 -07:00
|
|
|
edje_object_freeze(wd->resize_obj);
|
2012-07-30 00:14:33 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return 1;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2016-06-27 11:18:02 -07:00
|
|
|
EOLIAN static int
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_efl_canvas_layout_calc_calc_thaw(Eo *obj, Efl_Ui_Layout_Data *sd)
|
2016-06-27 11:18:02 -07:00
|
|
|
{
|
2016-08-05 10:31:49 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, 0);
|
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
if (--(sd->frozen) != 0) return sd->frozen;
|
2012-07-30 00:14:33 -07:00
|
|
|
|
2016-08-05 10:31:49 -07:00
|
|
|
edje_object_thaw(wd->resize_obj);
|
2012-07-30 00:14:33 -07:00
|
|
|
|
2017-08-02 23:20:58 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2012-07-30 00:14:33 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return 0;
|
2012-07-30 00:14:33 -07:00
|
|
|
}
|
|
|
|
|
2017-08-02 03:41:47 -07:00
|
|
|
static Eina_Bool
|
2017-08-07 21:28:50 -07: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
|
|
|
|
2012-05-03 15:41:26 -07:00
|
|
|
part_obj = (Evas_Object *)edje_object_part_object_get
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, part_name);
|
2010-09-26 17:51:16 -07:00
|
|
|
if (!part_obj)
|
|
|
|
{
|
|
|
|
const char *group, *file;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
edje_object_file_get(wd->resize_obj, &file, &group);
|
2012-05-03 15:41:26 -07:00
|
|
|
ERR("no part '%s' in group '%s' of file '%s'. Cannot set cursor '%s'",
|
2010-09-26 17:51:16 -07:00
|
|
|
part_name, group, file, cursor);
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_FALSE;
|
2010-09-26 17:51:16 -07:00
|
|
|
}
|
|
|
|
if (evas_object_pass_events_get(part_obj))
|
|
|
|
{
|
|
|
|
const char *group, *file;
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
edje_object_file_get(wd->resize_obj, &file, &group);
|
2012-05-03 15:41:26 -07:00
|
|
|
ERR("part '%s' in group '%s' of file '%s' has mouse_events: 0. "
|
2010-09-26 17:51:16 -07:00
|
|
|
"Cannot set cursor '%s'",
|
|
|
|
part_name, group, file, cursor);
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_FALSE;
|
2010-09-26 17:51:16 -07:00
|
|
|
}
|
|
|
|
|
2012-05-03 15:41:26 -07:00
|
|
|
pc = _parts_cursors_find(sd, part_name);
|
2010-09-26 17:51:16 -07:00
|
|
|
if (pc) eina_stringshare_replace(&pc->cursor, cursor);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pc = calloc(1, sizeof(*pc));
|
2015-06-14 23:39:02 -07:00
|
|
|
if (!pc)
|
|
|
|
{
|
|
|
|
ERR("failed to allocate memory!");
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2010-09-26 17:51:16 -07:00
|
|
|
pc->part = eina_stringshare_add(part_name);
|
|
|
|
pc->cursor = eina_stringshare_add(cursor);
|
2012-01-13 15:43:17 -08:00
|
|
|
pc->style = eina_stringshare_add("default");
|
2012-05-03 15:41:26 -07:00
|
|
|
sd->parts_cursors = eina_list_append(sd->parts_cursors, pc);
|
2010-09-26 17:51:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
pc->obj = part_obj;
|
|
|
|
elm_object_sub_cursor_set(part_obj, obj, pc->cursor);
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2014-03-16 06:43:07 -07:00
|
|
|
return EINA_TRUE;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2017-08-02 03:41:47 -07:00
|
|
|
static const char *
|
2017-08-07 21:28:50 -07: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
|
2017-08-07 21:28:50 -07: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
|
2017-08-07 21:28:50 -07: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*
|
2017-08-07 21:28:50 -07: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
|
2017-08-07 21:28:50 -07: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
|
2017-08-07 21:28:50 -07: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
|
|
|
{
|
2017-08-07 21:28:50 -07: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
|
|
|
{
|
2017-08-07 21:28:50 -07: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
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_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
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
if (wd->resize_obj && efl_isa(wd->resize_obj, EDJE_OBJECT_CLASS))
|
2013-02-19 08:23:27 -08:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
Efl_Dbg_Info *group = EFL_DBG_INFO_LIST_APPEND(root, MY_CLASS_NAME);
|
2013-04-08 22:48:42 -07:00
|
|
|
const char *file, *edje_group;
|
2013-02-19 08:23:27 -08:00
|
|
|
Evas_Object *edje_obj = wd->resize_obj;
|
2017-05-25 18:29:05 -07:00
|
|
|
Edje_Load_Error error;
|
2013-02-19 08:23:27 -08:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
efl_file_get(edje_obj, &file, &edje_group);
|
2016-08-15 06:44:41 -07:00
|
|
|
EFL_DBG_INFO_APPEND(group, "File", EINA_VALUE_TYPE_STRING, file);
|
|
|
|
EFL_DBG_INFO_APPEND(group, "Group", EINA_VALUE_TYPE_STRING, edje_group);
|
2013-02-19 08:23:27 -08:00
|
|
|
|
2017-05-25 18:29:05 -07:00
|
|
|
error = edje_object_load_error_get(edje_obj);
|
2013-02-19 08:23:27 -08:00
|
|
|
if (error != EDJE_LOAD_ERROR_NONE)
|
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
EFL_DBG_INFO_APPEND(group, "Error", EINA_VALUE_TYPE_STRING,
|
2013-04-08 22:48:42 -07:00
|
|
|
edje_load_error_str(error));
|
2013-02-19 08:23:27 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-31 12:17:58 -08:00
|
|
|
static void
|
|
|
|
_prop_future_error_cb(void* data, Efl_Event const*event EINA_UNUSED)
|
|
|
|
{
|
2017-09-06 20:07:08 -07:00
|
|
|
Efl_Ui_Layout_Sub_Connect *sc = data;
|
|
|
|
sc->future = NULL;
|
2017-01-31 12:17:58 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-09-06 20:07:08 -07:00
|
|
|
_view_update(Efl_Ui_Layout_Sub_Connect *sc, const char *property)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
|
|
|
Eina_Strbuf *buf;
|
|
|
|
|
2017-09-06 20:07:08 -07:00
|
|
|
if (sc->is_signal == EINA_FALSE)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
2017-09-06 20:07:08 -07:00
|
|
|
EFL_UI_LAYOUT_DATA_GET(sc->obj, pd);
|
|
|
|
pd->view_updated = EINA_TRUE;
|
|
|
|
elm_layout_text_set(sc->obj, sc->name, property);
|
|
|
|
pd->view_updated = EINA_FALSE;
|
2017-01-31 12:17:58 -08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
buf = eina_strbuf_new();
|
2017-09-06 20:07:08 -07:00
|
|
|
eina_strbuf_append(buf, sc->name);
|
2017-01-31 12:17:58 -08:00
|
|
|
eina_strbuf_replace_all(buf, "%v", property);
|
|
|
|
|
2017-09-06 20:07:08 -07:00
|
|
|
elm_layout_signal_emit(sc->obj, eina_strbuf_string_get(buf), "elm");
|
2017-01-31 12:17:58 -08:00
|
|
|
eina_strbuf_free(buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_prop_future_then_cb(void* data, Efl_Event const*event)
|
|
|
|
{
|
2017-09-06 20:07:08 -07:00
|
|
|
Efl_Ui_Layout_Sub_Connect *sc = data;
|
|
|
|
const Eina_Value_Type *vtype;
|
|
|
|
Eina_Value *value = (Eina_Value *)((Efl_Future_Event_Success*)event->info)->value;
|
2017-01-31 12:17:58 -08:00
|
|
|
char *text;
|
|
|
|
|
2017-09-06 20:07:08 -07:00
|
|
|
sc->future = NULL;
|
|
|
|
vtype= eina_value_type_get(value);
|
2017-01-31 12:17:58 -08:00
|
|
|
|
2017-09-06 20:07:08 -07:00
|
|
|
if (vtype == EINA_VALUE_TYPE_STRING || vtype == EINA_VALUE_TYPE_STRINGSHARE)
|
|
|
|
{
|
|
|
|
eina_value_get(value, &text);
|
|
|
|
_view_update(sc, text);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
text = eina_value_to_string(value);
|
|
|
|
_view_update(sc, text);
|
|
|
|
free(text);
|
2017-01-31 12:17:58 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_view_model_update(Efl_Ui_Layout_Data *pd)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
2017-09-06 20:07:08 -07:00
|
|
|
Efl_Ui_Layout_Sub_Connect *sc;
|
|
|
|
Eina_List *l;
|
2017-01-31 12:17:58 -08:00
|
|
|
|
2017-06-07 10:23:27 -07:00
|
|
|
if (!pd->prop_connect || !pd->model) return;
|
2017-01-31 12:17:58 -08:00
|
|
|
|
2017-09-06 20:07:08 -07:00
|
|
|
EINA_LIST_FOREACH(pd->prop_connect, l, sc)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
2017-09-06 20:07:08 -07:00
|
|
|
if (sc->future) efl_future_cancel(sc->future);
|
|
|
|
sc->future = efl_model_property_get(pd->model, sc->property);
|
|
|
|
efl_future_then(sc->future, &_prop_future_then_cb, &_prop_future_error_cb, NULL, sc);
|
2017-01-31 12:17:58 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_efl_model_properties_changed_cb(void *data, const Efl_Event *event)
|
|
|
|
{
|
2017-08-07 21:28:50 -07:00
|
|
|
Efl_Ui_Layout_Data *pd = data;
|
2017-01-31 12:17:58 -08:00
|
|
|
Efl_Model_Property_Event *evt = event->info;
|
|
|
|
Eina_Stringshare *ss_prop;
|
2017-09-06 20:07:08 -07:00
|
|
|
Efl_Ui_Layout_Sub_Connect *sc;
|
2017-01-31 12:17:58 -08:00
|
|
|
const char *prop;
|
|
|
|
Eina_Array_Iterator it;
|
|
|
|
unsigned int i;
|
2017-09-06 20:07:08 -07:00
|
|
|
Eina_List *l;
|
2017-01-31 12:17:58 -08:00
|
|
|
|
|
|
|
if (!evt->changed_properties || !pd->prop_connect) return;
|
|
|
|
|
|
|
|
EINA_ARRAY_ITER_NEXT(evt->changed_properties, i, prop, it)
|
|
|
|
{
|
|
|
|
ss_prop = eina_stringshare_add(prop);
|
2017-09-06 20:07:08 -07:00
|
|
|
EINA_LIST_FOREACH(pd->prop_connect, l, sc)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
2017-09-06 20:07:08 -07:00
|
|
|
if (sc->property == ss_prop)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
2017-09-06 20:07:08 -07:00
|
|
|
sc->future = efl_model_property_get(pd->model, sc->property);
|
|
|
|
efl_future_then(sc->future, &_prop_future_then_cb, &_prop_future_error_cb, NULL, sc);
|
2017-01-31 12:17:58 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
eina_stringshare_del(ss_prop);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_efl_ui_view_model_set(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *pd, Efl_Model *model)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
|
|
|
if (pd->model)
|
|
|
|
{
|
|
|
|
efl_event_callback_del(pd->model, EFL_MODEL_EVENT_PROPERTIES_CHANGED, _efl_model_properties_changed_cb, pd);
|
|
|
|
efl_unref(pd->model);
|
|
|
|
pd->model = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (model)
|
|
|
|
{
|
|
|
|
pd->model = model;
|
|
|
|
efl_ref(pd->model);
|
|
|
|
efl_event_callback_add(pd->model, EFL_MODEL_EVENT_PROPERTIES_CHANGED, _efl_model_properties_changed_cb, pd);
|
|
|
|
}
|
2017-06-07 10:23:27 -07:00
|
|
|
else
|
|
|
|
return;
|
2017-01-31 12:17:58 -08:00
|
|
|
|
|
|
|
if (pd->prop_connect)
|
2017-08-07 19:48:31 -07:00
|
|
|
_efl_ui_layout_view_model_update(pd);
|
2017-01-31 12:17:58 -08:00
|
|
|
|
|
|
|
if (pd->factories)
|
|
|
|
{
|
|
|
|
Eina_Hash_Tuple *tuple;
|
|
|
|
Eina_Stringshare *name;
|
|
|
|
Efl_Ui_Factory *factory;
|
2017-05-16 22:16:50 -07:00
|
|
|
Efl_Gfx *content;
|
2017-01-31 12:17:58 -08:00
|
|
|
|
|
|
|
Eina_Iterator *it_p = eina_hash_iterator_tuple_new(pd->factories);
|
|
|
|
while (eina_iterator_next(it_p, (void **)&tuple))
|
|
|
|
{
|
|
|
|
name = tuple->key;
|
|
|
|
factory = tuple->data;
|
|
|
|
content = elm_layout_content_get(pd->obj, name);
|
|
|
|
|
|
|
|
if (content && efl_isa(content, EFL_UI_VIEW_INTERFACE))
|
|
|
|
{
|
|
|
|
efl_ui_view_model_set(content, pd->model);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
efl_ui_factory_release(factory, content);
|
|
|
|
content = efl_ui_factory_create(factory, pd->model, pd->obj);
|
|
|
|
elm_layout_content_set(pd->obj, name, content);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
eina_iterator_free(it_p);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Efl_Model *
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_efl_ui_view_model_get(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *pd)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
|
|
|
return pd->model;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_efl_ui_model_connect_connect(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *pd, const char *name, const char *property)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(name);
|
2017-09-06 20:07:08 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(property);
|
|
|
|
Efl_Ui_Layout_Sub_Connect *sc, *fsc;
|
|
|
|
Eina_List *l;
|
2017-06-07 10:23:27 -07:00
|
|
|
|
2017-06-29 03:32:19 -07:00
|
|
|
if (!_elm_layout_part_aliasing_eval(obj, &name, EINA_TRUE))
|
2017-01-31 12:17:58 -08:00
|
|
|
return;
|
|
|
|
|
2017-09-06 20:07:08 -07:00
|
|
|
sc = calloc(1, sizeof(*sc));
|
|
|
|
sc->obj = obj;
|
|
|
|
sc->property = eina_stringshare_add(property);
|
|
|
|
|
|
|
|
if (strncmp(SIGNAL_PREFIX, name, sizeof(SIGNAL_PREFIX) -1) == 0)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
2017-09-06 20:07:08 -07:00
|
|
|
sc->name = eina_stringshare_add(name+sizeof(SIGNAL_PREFIX) -1);
|
|
|
|
sc->is_signal = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sc->name = eina_stringshare_add(name);
|
|
|
|
sc->is_signal = EINA_FALSE;
|
2017-01-31 12:17:58 -08:00
|
|
|
}
|
|
|
|
|
2017-09-06 20:07:08 -07:00
|
|
|
EINA_LIST_FOREACH(pd->prop_connect, l, fsc)
|
2017-01-31 12:17:58 -08:00
|
|
|
{
|
2017-09-06 20:07:08 -07:00
|
|
|
if (fsc->name == sc->name && fsc->property == sc->property)
|
|
|
|
{
|
|
|
|
eina_stringshare_del(sc->name);
|
|
|
|
eina_stringshare_del(sc->property);
|
|
|
|
free(sc);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2017-01-31 12:17:58 -08:00
|
|
|
|
2017-09-06 20:07:08 -07:00
|
|
|
pd->prop_connect = eina_list_append(pd->prop_connect, sc);
|
2017-01-31 12:17:58 -08:00
|
|
|
|
2017-09-06 20:07:08 -07:00
|
|
|
if (pd->model)
|
|
|
|
{
|
|
|
|
sc->future = efl_model_property_get(pd->model, sc->property);
|
|
|
|
efl_future_then(sc->future, &_prop_future_then_cb, &_prop_future_error_cb, NULL, sc);
|
2017-01-31 12:17:58 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_efl_ui_model_factory_connect_connect(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *pd,
|
2017-01-31 12:17:58 -08:00
|
|
|
const char *name, Efl_Ui_Factory *factory)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(name);
|
|
|
|
Eina_Stringshare *ss_name;
|
|
|
|
Efl_Ui_Factory *old_factory;
|
|
|
|
Evas_Object *new_ev, *old_ev;
|
|
|
|
|
2017-06-29 03:32:19 -07:00
|
|
|
if (!_elm_layout_part_aliasing_eval(obj, &name, EINA_TRUE))
|
2017-01-31 12:17:58 -08:00
|
|
|
return;
|
|
|
|
|
|
|
|
ss_name = eina_stringshare_add(name);
|
|
|
|
|
|
|
|
if (!pd->factories)
|
|
|
|
pd->factories = eina_hash_stringshared_new(EINA_FREE_CB(efl_unref));
|
|
|
|
|
|
|
|
new_ev = efl_ui_factory_create(factory, pd->model, obj);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(new_ev);
|
|
|
|
|
|
|
|
old_factory = eina_hash_set(pd->factories, ss_name, efl_ref(factory));
|
|
|
|
if (old_factory)
|
|
|
|
{
|
|
|
|
old_ev = elm_layout_content_get(obj, name);
|
|
|
|
if (old_ev)
|
|
|
|
efl_ui_factory_release(old_factory, old_ev);
|
|
|
|
efl_unref(old_factory);
|
|
|
|
}
|
|
|
|
|
|
|
|
elm_layout_content_set(obj, name, new_ev);
|
|
|
|
}
|
|
|
|
|
2012-05-03 15:41:26 -07:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_layout_add(Evas_Object *parent)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
2017-07-06 00:47:41 -07:00
|
|
|
return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added));
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_efl_object_constructor(Eo *obj, Efl_Ui_Layout_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
|
|
|
sd->obj = obj;
|
2016-08-15 06:44:41 -07:00
|
|
|
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
2016-06-20 21:26:15 -07:00
|
|
|
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
|
2016-06-16 22:12:02 -07:00
|
|
|
evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_atspi_accessible_role_set(obj, ELM_ATSPI_ROLE_FILLER);
|
2015-05-19 05:34:07 -07:00
|
|
|
|
|
|
|
return obj;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-03 15:41:26 -07:00
|
|
|
|
2017-08-07 19:48:31 -07:00
|
|
|
EOLIAN static void _efl_ui_layout_class_constructor(Efl_Class *klass)
|
2014-03-16 06:43:07 -07:00
|
|
|
{
|
2013-11-07 03:44:22 -08:00
|
|
|
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2017-08-07 03:11:31 -07:00
|
|
|
EOLIAN static void
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_efl_canvas_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);
|
|
|
|
efl_canvas_layout_signal_message_send(wd->resize_obj, id, msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_efl_canvas_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);
|
|
|
|
efl_canvas_layout_signal_process(wd->resize_obj, recurse);
|
|
|
|
}
|
2016-05-24 04:40:18 -07:00
|
|
|
|
|
|
|
|
2016-04-25 05:36:56 -07:00
|
|
|
/* Legacy APIs */
|
|
|
|
|
2014-07-22 08:29:37 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_layout_file_set(Eo *obj, const char *file, const char *group)
|
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
return efl_file_set((Eo *) obj, file, group);
|
2014-07-22 08:29:37 -07:00
|
|
|
}
|
|
|
|
|
2015-04-14 13:19:18 -07:00
|
|
|
EAPI void
|
|
|
|
elm_layout_file_get(Eo *obj, const char **file, const char **group)
|
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
efl_file_get((Eo *) obj, file, group);
|
2015-04-14 13:19:18 -07:00
|
|
|
}
|
|
|
|
|
2016-11-07 14:42:04 -08:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_layout_mmap_set(Eo *obj, const Eina_File *file, const char *group)
|
|
|
|
{
|
|
|
|
return efl_file_mmap_set((Eo *) obj, file, group);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_layout_mmap_get(Eo *obj, const Eina_File **file, const char **group)
|
|
|
|
{
|
|
|
|
efl_file_mmap_get((Eo *) obj, file, group);
|
|
|
|
}
|
|
|
|
|
2016-04-25 05:36:56 -07:00
|
|
|
EAPI Eina_Bool
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_box_append(Eo *obj, const char *part, Evas_Object *child)
|
2016-04-25 05:36:56 -07:00
|
|
|
{
|
2016-05-25 19:54:30 -07:00
|
|
|
return efl_pack(efl_part(obj, part), child);
|
2016-04-25 05:36:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_box_prepend(Eo *obj, const char *part, Evas_Object *child)
|
2016-04-25 05:36:56 -07:00
|
|
|
{
|
2016-05-25 19:54:30 -07:00
|
|
|
return efl_pack_begin(efl_part(obj, part), child);
|
2016-04-25 05:36:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_box_insert_before(Eo *obj, const char *part, Evas_Object *child, const Evas_Object *reference)
|
2016-04-25 05:36:56 -07:00
|
|
|
{
|
2016-05-25 19:54:30 -07:00
|
|
|
return efl_pack_before(efl_part(obj, part), child, reference);
|
2016-04-25 05:36:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_box_insert_at(Eo *obj, const char *part, Evas_Object *child, unsigned int pos)
|
2016-04-25 05:36:56 -07:00
|
|
|
{
|
2016-05-25 19:54:30 -07:00
|
|
|
return efl_pack_at(efl_part(obj, part), child, pos);
|
2016-04-25 05:36:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Evas_Object *
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_box_remove(Eo *obj, const char *part, Evas_Object *child)
|
2016-04-25 05:36:56 -07:00
|
|
|
{
|
2016-05-25 19:54:30 -07:00
|
|
|
if (!efl_pack_unpack(efl_part(obj, part), child))
|
2016-04-25 05:36:56 -07:00
|
|
|
return NULL;
|
|
|
|
return child;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_box_remove_all(Eo *obj, const char *part, Eina_Bool clear)
|
2016-04-25 05:36:56 -07:00
|
|
|
{
|
|
|
|
if (clear)
|
2016-05-25 19:54:30 -07:00
|
|
|
return efl_pack_clear(efl_part(obj, part));
|
2016-04-25 05:36:56 -07:00
|
|
|
else
|
2016-05-25 19:54:30 -07:00
|
|
|
return efl_pack_unpack_all(efl_part(obj, part));
|
2016-04-25 05:36:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_table_pack(Eo *obj, const char *part, Evas_Object *child, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan)
|
2016-04-25 05:36:56 -07:00
|
|
|
{
|
2016-05-25 19:54:30 -07:00
|
|
|
return efl_pack_grid(efl_part(obj, part), child, col, row, colspan, rowspan);
|
2016-04-25 05:36:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Evas_Object *
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_table_unpack(Eo *obj, const char *part, Evas_Object *child)
|
2016-04-25 05:36:56 -07:00
|
|
|
{
|
2016-05-25 19:54:30 -07:00
|
|
|
if (!efl_pack_unpack(efl_part(obj, part), child))
|
|
|
|
return NULL;
|
|
|
|
return child;
|
2016-04-25 05:36:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_table_clear(Eo *obj, const char *part, Eina_Bool clear)
|
2016-04-25 05:36:56 -07:00
|
|
|
{
|
|
|
|
if (clear)
|
2016-05-25 19:54:30 -07:00
|
|
|
return efl_pack_clear(efl_part(obj, part));
|
2016-04-25 05:36:56 -07:00
|
|
|
else
|
2016-05-25 19:54:30 -07:00
|
|
|
return efl_pack_unpack_all(efl_part(obj, part));
|
2016-04-25 05:36:56 -07:00
|
|
|
}
|
|
|
|
|
2017-06-04 07:25:36 -07:00
|
|
|
EAPI Eina_Bool
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_text_set(Eo *obj, const char *part, const char *text)
|
2017-06-04 07:25:36 -07:00
|
|
|
{
|
2017-07-04 02:54:44 -07:00
|
|
|
if (!part)
|
|
|
|
{
|
|
|
|
part = elm_widget_default_text_part_get(obj);
|
|
|
|
if (!part) return EINA_FALSE;
|
|
|
|
}
|
2017-06-04 07:25:36 -07:00
|
|
|
efl_text_set(efl_part(obj, part), text);
|
|
|
|
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
|
|
|
{
|
2017-07-04 02:54:44 -07:00
|
|
|
part = elm_widget_default_text_part_get(obj);
|
|
|
|
if (!part) return NULL;
|
2017-06-04 07:25:36 -07:00
|
|
|
}
|
2017-06-04 07:25:36 -07:00
|
|
|
return efl_text_get(efl_part(obj, part));
|
|
|
|
}
|
|
|
|
|
2017-08-02 03:41:47 -07:00
|
|
|
EAPI Eina_Bool
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_part_cursor_engine_only_set(Eo *obj, const char *part, Eina_Bool engine_only)
|
2017-08-02 03:41:47 -07:00
|
|
|
{
|
|
|
|
return efl_ui_cursor_theme_search_enabled_set(efl_part(obj, part), !engine_only);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_part_cursor_engine_only_get(const Eo *obj, const char *part)
|
2017-08-02 03:41:47 -07:00
|
|
|
{
|
|
|
|
return !efl_ui_cursor_theme_search_enabled_get(efl_part(obj, part));
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_part_cursor_set(Eo *obj, const char *part, const char *cursor)
|
2017-08-02 03:41:47 -07:00
|
|
|
{
|
|
|
|
return efl_ui_cursor_set(efl_part(obj, part), cursor);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI const char *
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_part_cursor_get(const Eo *obj, const char *part)
|
2017-08-02 03:41:47 -07:00
|
|
|
{
|
|
|
|
return efl_ui_cursor_get(efl_part(obj, part));
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_part_cursor_style_set(Eo *obj, const char *part, const char *style)
|
2017-08-02 03:41:47 -07:00
|
|
|
{
|
|
|
|
return efl_ui_cursor_style_set(efl_part(obj, part), style);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI const char *
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_part_cursor_style_get(const Eo *obj, const char *part)
|
2017-08-02 03:41:47 -07:00
|
|
|
{
|
|
|
|
return efl_ui_cursor_style_get(efl_part(obj, part));
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_part_cursor_unset(Eo *obj, const char *part)
|
2017-08-02 03:41:47 -07:00
|
|
|
{
|
|
|
|
return efl_ui_cursor_set(efl_part(obj, part), NULL);
|
|
|
|
}
|
2017-08-02 04:46:16 -07:00
|
|
|
|
|
|
|
EAPI int
|
|
|
|
elm_layout_freeze(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
return efl_canvas_layout_calc_freeze(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI int
|
|
|
|
elm_layout_thaw(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
return efl_canvas_layout_calc_thaw(obj);
|
|
|
|
}
|
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);
|
|
|
|
|
|
|
|
efl_canvas_layout_signal_callback_add(edje, emission, source,
|
|
|
|
_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
|
|
|
{
|
2017-08-07 21:28:50 -07: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);
|
|
|
|
|
|
|
|
efl_canvas_layout_signal_callback_del(edje, emission, source,
|
|
|
|
_edje_signal_callback, esd);
|
|
|
|
|
|
|
|
eina_stringshare_del(esd->emission);
|
|
|
|
eina_stringshare_del(esd->source);
|
|
|
|
data = esd->data;
|
|
|
|
free(esd);
|
|
|
|
|
|
|
|
return data; /* stop at 1st match */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void *
|
2017-08-07 19:48:31 -07:00
|
|
|
elm_layout_signal_callback_del(Eo *obj, const char *emission, const char *source, Edje_Signal_Cb func)
|
2017-08-03 01:24:50 -07:00
|
|
|
{
|
2017-08-07 21:28:50 -07: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
|
|
|
{
|
|
|
|
efl_canvas_layout_signal_emit(obj, emission, source);
|
|
|
|
}
|
2017-08-03 02:22:29 -07:00
|
|
|
|
|
|
|
EAPI const char *
|
|
|
|
elm_layout_data_get(const Evas_Object *obj, const char *key)
|
|
|
|
{
|
|
|
|
return efl_canvas_layout_group_data_get(obj, key);
|
|
|
|
}
|
2017-08-02 03:41:47 -07:00
|
|
|
|
2017-08-09 00:13:06 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_layout_theme_set(Evas_Object *obj, const char *klass, const char *group, const char *style)
|
|
|
|
{
|
|
|
|
Efl_Ui_Theme_Apply ta;
|
|
|
|
|
|
|
|
ta = efl_ui_layout_theme_set(obj, klass, group, style);
|
|
|
|
return (ta != EFL_UI_THEME_APPLY_FAILED);
|
|
|
|
}
|
|
|
|
|
2017-08-02 03:41:47 -07:00
|
|
|
/* End of legacy only */
|
|
|
|
|
|
|
|
|
2016-05-24 04:40:18 -07:00
|
|
|
/* Efl.Part implementation */
|
|
|
|
|
2016-08-10 07:23:04 -07:00
|
|
|
static EOLIAN Efl_Object *
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_efl_part_part(const Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED,
|
2016-05-25 19:54:30 -07:00
|
|
|
const char *part)
|
|
|
|
{
|
2016-07-27 00:31:52 -07:00
|
|
|
Edje_Part_Type type;
|
2016-05-25 19:54:30 -07:00
|
|
|
Elm_Part_Data *pd;
|
|
|
|
Eo *proxy;
|
|
|
|
|
2017-06-29 04:02:59 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL);
|
2016-05-25 19:54:30 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN((Eo *) obj, wd, NULL);
|
2016-05-25 22:06:52 -07:00
|
|
|
|
2016-07-27 00:31:52 -07:00
|
|
|
// Check part type with edje_edit, as edje_object_part_object_get()
|
|
|
|
// has side effects (it calls recalc, which may be really bad).
|
|
|
|
type = edje_edit_part_type_get(wd->resize_obj, part);
|
|
|
|
if ((type == EDJE_PART_TYPE_BOX) || (type == EDJE_PART_TYPE_TABLE))
|
2017-08-07 19:48:31 -07:00
|
|
|
return _efl_ui_layout_pack_proxy_get((Eo *) obj, type, part);
|
2016-05-25 19:54:30 -07:00
|
|
|
|
|
|
|
// Generic parts (text, anything, ...)
|
edje/elm: Rename _internal_ to _part_ (EO)
In Edje and Elementary, we have part objects, which are what is returned
by the interface efl_part(). Those objects can't be of an opaque type as
this doesn't work nicely with strongly typed languages such as C++ or
C#. In JS, Lua, C the types are weak and mostly runtime-based so it
doesn't matter much.
As a consequence, the documentation and the types need to look nice in
this EO API. Thus, we remove the abusive term "internal" and explicitly
call all those classes "part" something.
Eventually we want the types to be declared in the EO file so bindings
(C#, C++, ...) can generate the proper access methods, returning the
best possible types.
Note that right now a few of those part types are used in the legacy API
but don't actually need to be exposed externally.
This is kind of a mega commit that does all the renaming at once, but
it's really just a big sed operation. The power of good IDEs :)
Ref T5315
Ref T5306
2017-09-12 21:29:25 -07:00
|
|
|
proxy = efl_add(EFL_UI_LAYOUT_PART_CLASS, (Eo *) obj);
|
|
|
|
pd = efl_data_scope_get(proxy, EFL_UI_LAYOUT_PART_CLASS);
|
2016-05-25 19:54:30 -07:00
|
|
|
if (pd)
|
|
|
|
{
|
|
|
|
pd->obj = (Eo *) obj;
|
2017-08-07 19:48:31 -07:00
|
|
|
pd->sd = efl_data_xref(pd->obj, EFL_UI_LAYOUT_CLASS, proxy);
|
2017-07-05 04:12:14 -07:00
|
|
|
pd->part = strdup(part);
|
2016-05-25 19:54:30 -07:00
|
|
|
pd->temp = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return proxy;
|
|
|
|
}
|
|
|
|
|
2017-06-29 04:02:59 -07:00
|
|
|
static const char *
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_default_content_part_get(const Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED)
|
2017-06-29 04:02:59 -07:00
|
|
|
{
|
|
|
|
const char *part = NULL;
|
|
|
|
if (!_elm_layout_part_aliasing_eval(obj, &part, EINA_FALSE))
|
|
|
|
return NULL;
|
|
|
|
return part;
|
|
|
|
}
|
|
|
|
|
2017-07-04 02:54:44 -07:00
|
|
|
static const char *
|
2017-08-07 21:28:50 -07:00
|
|
|
_efl_ui_layout_default_text_part_get(const Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED)
|
2017-07-04 02:54:44 -07:00
|
|
|
{
|
|
|
|
const char *part = NULL;
|
|
|
|
if (!_elm_layout_part_aliasing_eval(obj, &part, EINA_TRUE))
|
|
|
|
return NULL;
|
|
|
|
return part;
|
|
|
|
}
|
|
|
|
|
2017-08-02 03:41:47 -07:00
|
|
|
EOLIAN static Eina_Bool
|
edje/elm: Rename _internal_ to _part_ (EO)
In Edje and Elementary, we have part objects, which are what is returned
by the interface efl_part(). Those objects can't be of an opaque type as
this doesn't work nicely with strongly typed languages such as C++ or
C#. In JS, Lua, C the types are weak and mostly runtime-based so it
doesn't matter much.
As a consequence, the documentation and the types need to look nice in
this EO API. Thus, we remove the abusive term "internal" and explicitly
call all those classes "part" something.
Eventually we want the types to be declared in the EO file so bindings
(C#, C++, ...) can generate the proper access methods, returning the
best possible types.
Note that right now a few of those part types are used in the legacy API
but don't actually need to be exposed externally.
This is kind of a mega commit that does all the renaming at once, but
it's really just a big sed operation. The power of good IDEs :)
Ref T5315
Ref T5306
2017-09-12 21:29:25 -07:00
|
|
|
_efl_ui_layout_part_efl_ui_cursor_cursor_set(Eo *obj, Elm_Part_Data *pd, const char *cursor)
|
2017-08-02 03:41:47 -07:00
|
|
|
{
|
2017-08-07 19:48:31 -07:00
|
|
|
ELM_PART_RETURN_VAL(_efl_ui_layout_part_cursor_set(pd->sd, pd->part, cursor));
|
2017-08-02 03:41:47 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static const char *
|
edje/elm: Rename _internal_ to _part_ (EO)
In Edje and Elementary, we have part objects, which are what is returned
by the interface efl_part(). Those objects can't be of an opaque type as
this doesn't work nicely with strongly typed languages such as C++ or
C#. In JS, Lua, C the types are weak and mostly runtime-based so it
doesn't matter much.
As a consequence, the documentation and the types need to look nice in
this EO API. Thus, we remove the abusive term "internal" and explicitly
call all those classes "part" something.
Eventually we want the types to be declared in the EO file so bindings
(C#, C++, ...) can generate the proper access methods, returning the
best possible types.
Note that right now a few of those part types are used in the legacy API
but don't actually need to be exposed externally.
This is kind of a mega commit that does all the renaming at once, but
it's really just a big sed operation. The power of good IDEs :)
Ref T5315
Ref T5306
2017-09-12 21:29:25 -07:00
|
|
|
_efl_ui_layout_part_efl_ui_cursor_cursor_get(Eo *obj, Elm_Part_Data *pd)
|
2017-08-02 03:41:47 -07:00
|
|
|
{
|
2017-08-07 19:48:31 -07:00
|
|
|
ELM_PART_RETURN_VAL(_efl_ui_layout_part_cursor_get(pd->sd, pd->part));
|
2017-08-02 03:41:47 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
edje/elm: Rename _internal_ to _part_ (EO)
In Edje and Elementary, we have part objects, which are what is returned
by the interface efl_part(). Those objects can't be of an opaque type as
this doesn't work nicely with strongly typed languages such as C++ or
C#. In JS, Lua, C the types are weak and mostly runtime-based so it
doesn't matter much.
As a consequence, the documentation and the types need to look nice in
this EO API. Thus, we remove the abusive term "internal" and explicitly
call all those classes "part" something.
Eventually we want the types to be declared in the EO file so bindings
(C#, C++, ...) can generate the proper access methods, returning the
best possible types.
Note that right now a few of those part types are used in the legacy API
but don't actually need to be exposed externally.
This is kind of a mega commit that does all the renaming at once, but
it's really just a big sed operation. The power of good IDEs :)
Ref T5315
Ref T5306
2017-09-12 21:29:25 -07:00
|
|
|
_efl_ui_layout_part_efl_ui_cursor_cursor_style_set(Eo *obj, Elm_Part_Data *pd, const char *style)
|
2017-08-02 03:41:47 -07:00
|
|
|
{
|
2017-08-07 19:48:31 -07:00
|
|
|
ELM_PART_RETURN_VAL(_efl_ui_layout_part_cursor_style_set(pd->sd, pd->part, style));
|
2017-08-02 03:41:47 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static const char *
|
edje/elm: Rename _internal_ to _part_ (EO)
In Edje and Elementary, we have part objects, which are what is returned
by the interface efl_part(). Those objects can't be of an opaque type as
this doesn't work nicely with strongly typed languages such as C++ or
C#. In JS, Lua, C the types are weak and mostly runtime-based so it
doesn't matter much.
As a consequence, the documentation and the types need to look nice in
this EO API. Thus, we remove the abusive term "internal" and explicitly
call all those classes "part" something.
Eventually we want the types to be declared in the EO file so bindings
(C#, C++, ...) can generate the proper access methods, returning the
best possible types.
Note that right now a few of those part types are used in the legacy API
but don't actually need to be exposed externally.
This is kind of a mega commit that does all the renaming at once, but
it's really just a big sed operation. The power of good IDEs :)
Ref T5315
Ref T5306
2017-09-12 21:29:25 -07:00
|
|
|
_efl_ui_layout_part_efl_ui_cursor_cursor_style_get(Eo *obj, Elm_Part_Data *pd)
|
2017-08-02 03:41:47 -07:00
|
|
|
{
|
2017-08-07 19:48:31 -07:00
|
|
|
ELM_PART_RETURN_VAL(_efl_ui_layout_part_cursor_style_get(pd->sd, pd->part));
|
2017-08-02 03:41:47 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
edje/elm: Rename _internal_ to _part_ (EO)
In Edje and Elementary, we have part objects, which are what is returned
by the interface efl_part(). Those objects can't be of an opaque type as
this doesn't work nicely with strongly typed languages such as C++ or
C#. In JS, Lua, C the types are weak and mostly runtime-based so it
doesn't matter much.
As a consequence, the documentation and the types need to look nice in
this EO API. Thus, we remove the abusive term "internal" and explicitly
call all those classes "part" something.
Eventually we want the types to be declared in the EO file so bindings
(C#, C++, ...) can generate the proper access methods, returning the
best possible types.
Note that right now a few of those part types are used in the legacy API
but don't actually need to be exposed externally.
This is kind of a mega commit that does all the renaming at once, but
it's really just a big sed operation. The power of good IDEs :)
Ref T5315
Ref T5306
2017-09-12 21:29:25 -07:00
|
|
|
_efl_ui_layout_part_efl_ui_cursor_cursor_theme_search_enabled_set(Eo *obj, Elm_Part_Data *pd, Eina_Bool allow)
|
2017-08-02 03:41:47 -07:00
|
|
|
{
|
2017-08-07 19:48:31 -07:00
|
|
|
ELM_PART_RETURN_VAL(_efl_ui_layout_part_cursor_engine_only_set(pd->sd, pd->part, !allow));
|
2017-08-02 03:41:47 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
edje/elm: Rename _internal_ to _part_ (EO)
In Edje and Elementary, we have part objects, which are what is returned
by the interface efl_part(). Those objects can't be of an opaque type as
this doesn't work nicely with strongly typed languages such as C++ or
C#. In JS, Lua, C the types are weak and mostly runtime-based so it
doesn't matter much.
As a consequence, the documentation and the types need to look nice in
this EO API. Thus, we remove the abusive term "internal" and explicitly
call all those classes "part" something.
Eventually we want the types to be declared in the EO file so bindings
(C#, C++, ...) can generate the proper access methods, returning the
best possible types.
Note that right now a few of those part types are used in the legacy API
but don't actually need to be exposed externally.
This is kind of a mega commit that does all the renaming at once, but
it's really just a big sed operation. The power of good IDEs :)
Ref T5315
Ref T5306
2017-09-12 21:29:25 -07:00
|
|
|
_efl_ui_layout_part_efl_ui_cursor_cursor_theme_search_enabled_get(Eo *obj, Elm_Part_Data *pd)
|
2017-08-02 03:41:47 -07:00
|
|
|
{
|
2017-08-07 19:48:31 -07:00
|
|
|
ELM_PART_RETURN_VAL(!_efl_ui_layout_part_cursor_engine_only_get(pd->sd, pd->part));
|
2017-08-02 03:41:47 -07:00
|
|
|
}
|
|
|
|
|
2017-08-07 21:28:50 -07:00
|
|
|
ELM_PART_IMPLEMENT_DESTRUCTOR(efl_ui_layout, EFL_UI_LAYOUT, Efl_Ui_Layout_Data, Elm_Part_Data)
|
|
|
|
ELM_PART_IMPLEMENT_CONTENT_SET(efl_ui_layout, EFL_UI_LAYOUT, Efl_Ui_Layout_Data, Elm_Part_Data)
|
|
|
|
ELM_PART_IMPLEMENT_CONTENT_GET(efl_ui_layout, EFL_UI_LAYOUT, Efl_Ui_Layout_Data, Elm_Part_Data)
|
|
|
|
ELM_PART_IMPLEMENT_CONTENT_UNSET(efl_ui_layout, EFL_UI_LAYOUT, Efl_Ui_Layout_Data, Elm_Part_Data)
|
|
|
|
ELM_PART_IMPLEMENT_TEXT_SET(efl_ui_layout, EFL_UI_LAYOUT, Efl_Ui_Layout_Data, Elm_Part_Data)
|
|
|
|
ELM_PART_IMPLEMENT_TEXT_GET(efl_ui_layout, EFL_UI_LAYOUT, Efl_Ui_Layout_Data, Elm_Part_Data)
|
edje/elm: Rename _internal_ to _part_ (EO)
In Edje and Elementary, we have part objects, which are what is returned
by the interface efl_part(). Those objects can't be of an opaque type as
this doesn't work nicely with strongly typed languages such as C++ or
C#. In JS, Lua, C the types are weak and mostly runtime-based so it
doesn't matter much.
As a consequence, the documentation and the types need to look nice in
this EO API. Thus, we remove the abusive term "internal" and explicitly
call all those classes "part" something.
Eventually we want the types to be declared in the EO file so bindings
(C#, C++, ...) can generate the proper access methods, returning the
best possible types.
Note that right now a few of those part types are used in the legacy API
but don't actually need to be exposed externally.
This is kind of a mega commit that does all the renaming at once, but
it's really just a big sed operation. The power of good IDEs :)
Ref T5315
Ref T5306
2017-09-12 21:29:25 -07:00
|
|
|
#include "efl_ui_layout_part.eo.c"
|
2016-05-24 04:40:18 -07:00
|
|
|
|
|
|
|
/* Efl.Part end */
|
|
|
|
|
2017-05-18 01:52:17 -07:00
|
|
|
|
|
|
|
/* Internal EO APIs and hidden overrides */
|
|
|
|
|
2017-08-07 00:13:38 -07:00
|
|
|
EAPI EFL_VOID_FUNC_BODY(elm_layout_sizing_eval)
|
2017-07-27 23:35:10 -07:00
|
|
|
EFL_FUNC_BODY_CONST(elm_layout_text_aliases_get, const Elm_Layout_Part_Alias_Description *, NULL)
|
|
|
|
EFL_FUNC_BODY_CONST(elm_layout_content_aliases_get, const Elm_Layout_Part_Alias_Description *, NULL)
|
|
|
|
|
2017-08-07 19:48:31 -07:00
|
|
|
ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX)
|
|
|
|
ELM_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX)
|
2017-07-27 23:35:10 -07:00
|
|
|
|
2017-08-07 19:48:31 -07:00
|
|
|
#define EFL_UI_LAYOUT_EXTRA_OPS \
|
|
|
|
EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_ui_layout), \
|
|
|
|
ELM_PART_CONTENT_DEFAULT_OPS(efl_ui_layout), \
|
|
|
|
ELM_PART_TEXT_DEFAULT_OPS(efl_ui_layout), \
|
|
|
|
ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \
|
|
|
|
ELM_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX), \
|
2017-08-07 00:13:38 -07:00
|
|
|
EFL_OBJECT_OP_FUNC(elm_layout_sizing_eval, _elm_layout_sizing_eval), \
|
2017-08-07 19:48:31 -07:00
|
|
|
EFL_OBJECT_OP_FUNC(efl_dbg_info_get, _efl_ui_layout_efl_object_dbg_info_get)
|
2017-04-21 08:58:38 -07:00
|
|
|
|
2017-08-07 19:48:31 -07:00
|
|
|
#include "efl_ui_layout.eo.c"
|