forked from enlightenment/efl
edje: Remove external param_set from EO
As Dave pointed out, those are meant for internal use by Edje and the plugins implementation, rather than for apps. This removes ugly and complex code. Makes me happy :) Note that I've kept the composition for now. We can remove it as efl_content_get() must work on the part handle anyway. But it can be used as a quick solution.
This commit is contained in:
parent
2b57acda33
commit
8f7fc307f2
|
@ -75,18 +75,19 @@ static Eina_Bool
|
|||
_timer_cb(void *data)
|
||||
{
|
||||
Evas_Object *edje = data;
|
||||
Evas_Object *bt1, *bt2, *bt3, *pb1, *pb2, *pb5;
|
||||
Evas_Object *bt1, *bt2, *bt3, *pb1, *pb2, *pb4, *pb5;
|
||||
Edje_External_Param param;
|
||||
double progress;
|
||||
Ecore_Timer *t;
|
||||
Eina_Value v;
|
||||
|
||||
pb1 = edje_object_part_external_object_get(edje, "ext_pbar1");
|
||||
pb2 = edje_object_part_external_object_get(edje, "ext_pbar2");
|
||||
pb4 = edje_object_part_external_object_get(edje, "ext_pbar4");
|
||||
progress = elm_progressbar_value_get(pb1) + 0.0123;
|
||||
|
||||
elm_progressbar_value_set(pb1, progress);
|
||||
elm_progressbar_value_set(pb2, progress);
|
||||
elm_progressbar_value_set(pb4, progress);
|
||||
|
||||
/* Test external parameter API */
|
||||
param.name = "value";
|
||||
|
@ -99,12 +100,6 @@ _timer_cb(void *data)
|
|||
param.i = EINA_TRUE;
|
||||
edje_object_part_external_param_set(edje, "ext_pbar7", ¶m);
|
||||
|
||||
/* Test EO API for external parameters */
|
||||
eina_value_setup(&v, EINA_VALUE_TYPE_DOUBLE);
|
||||
eina_value_set(&v, progress);
|
||||
efl_canvas_layout_external_param_set(efl_part(edje, "ext_pbar4"), "value", &v);
|
||||
eina_value_flush(&v);
|
||||
|
||||
/* Test EO API for direct function calls */
|
||||
efl_ui_progress_value_set(efl_part(edje, "ext_pbar3"), progress);
|
||||
|
||||
|
@ -144,9 +139,8 @@ static void
|
|||
_bt_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
Evas_Object *edje = data;
|
||||
Evas_Object *bt1, *bt2, *bt3, *pb1, *pb2, *pb3, *pb5;
|
||||
Evas_Object *bt1, *bt2, *bt3, *pb1, *pb2, *pb3, *pb4, *pb5;
|
||||
Edje_External_Param param;
|
||||
Eina_Value v;
|
||||
Ecore_Timer *t;
|
||||
|
||||
/* Test direct API calls on embedded objects */
|
||||
|
@ -160,10 +154,12 @@ _bt_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUS
|
|||
pb1 = edje_object_part_external_object_get(edje, "ext_pbar1");
|
||||
pb2 = edje_object_part_external_object_get(edje, "ext_pbar2");
|
||||
pb3 = edje_object_part_external_object_get(edje, "ext_pbar3");
|
||||
pb4 = edje_object_part_external_object_get(edje, "ext_pbar4");
|
||||
pb5 = edje_object_part_external_object_get(edje, "ext_pbar5");
|
||||
|
||||
elm_progressbar_value_set(pb1, 0.0);
|
||||
elm_progressbar_value_set(pb3, 0.0);
|
||||
elm_progressbar_value_set(pb4, 0.0);
|
||||
|
||||
elm_progressbar_pulse(pb2, EINA_TRUE);
|
||||
elm_progressbar_pulse(pb5, EINA_TRUE);
|
||||
|
@ -179,12 +175,6 @@ _bt_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUS
|
|||
param.i = EINA_TRUE;
|
||||
edje_object_part_external_param_set(edje, "ext_pbar7", ¶m);
|
||||
|
||||
/* Test EO API for external parameters */
|
||||
eina_value_setup(&v, EINA_VALUE_TYPE_DOUBLE);
|
||||
eina_value_set(&v, 0.0);
|
||||
efl_canvas_layout_external_param_set(efl_part(edje, "ext_pbar4"), "value", &v);
|
||||
eina_value_flush(&v);
|
||||
|
||||
/* Test EO API for direct function calls */
|
||||
efl_ui_progress_value_set(efl_part(edje, "ext_pbar3"), 0.0);
|
||||
|
||||
|
|
|
@ -65,44 +65,7 @@ EAPI Eina_Bool
|
|||
edje_object_part_external_param_set(Eo *obj, const char *part, const Edje_External_Param *param)
|
||||
{
|
||||
Edje *ed = _edje_fetch(obj);
|
||||
|
||||
if (!ed || !param || !part) return EINA_FALSE;
|
||||
|
||||
#if 0
|
||||
/* validate EO API - disabled for performance */
|
||||
Eina_Value *v;
|
||||
Eina_Bool ok;
|
||||
|
||||
switch (param->type)
|
||||
{
|
||||
case EDJE_EXTERNAL_PARAM_TYPE_INT:
|
||||
case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
|
||||
v = eina_value_new(EINA_VALUE_TYPE_INT);
|
||||
eina_value_set(v, param->i);
|
||||
break;
|
||||
|
||||
case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
|
||||
v = eina_value_new(EINA_VALUE_TYPE_DOUBLE);
|
||||
eina_value_set(v, param->d);
|
||||
break;
|
||||
|
||||
case EDJE_EXTERNAL_PARAM_TYPE_STRING:
|
||||
case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
|
||||
v = eina_value_new(EINA_VALUE_TYPE_STRING);
|
||||
eina_value_set(v, param->s);
|
||||
break;
|
||||
|
||||
default: return EINA_FALSE;
|
||||
}
|
||||
|
||||
ok = efl_canvas_layout_external_param_set(efl_part(obj, part), param->name, v);
|
||||
eina_value_free(v);
|
||||
|
||||
return ok;
|
||||
|
||||
#else
|
||||
return _edje_object_part_external_param_set(ed, part, param);
|
||||
#endif
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
|
|
|
@ -15,123 +15,6 @@ _external_compose(Eo *obj, Edje *ed, const char *part)
|
|||
efl_composite_attach(obj, ext_obj);
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_canvas_layout_external_external_param_set(Eo *obj, void *_pd EINA_UNUSED,
|
||||
const char *name, const Eina_Value *value)
|
||||
{
|
||||
Edje_External_Param_Type type;
|
||||
Edje_External_Param param = {};
|
||||
const Eina_Value_Type *vtype;
|
||||
|
||||
PROXY_DATA_GET(obj, pd);
|
||||
type = _edje_object_part_external_param_type_get(pd->ed, pd->part, name);
|
||||
|
||||
param.name = name;
|
||||
param.type = type;
|
||||
vtype = eina_value_type_get(value);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case EDJE_EXTERNAL_PARAM_TYPE_INT:
|
||||
case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
|
||||
if (vtype == EINA_VALUE_TYPE_INT)
|
||||
eina_value_get(value, ¶m.i);
|
||||
else
|
||||
{
|
||||
Eina_Value v2;
|
||||
|
||||
eina_value_setup(&v2, EINA_VALUE_TYPE_INT);
|
||||
eina_value_convert(value, &v2);
|
||||
eina_value_get(&v2, ¶m.i);
|
||||
eina_value_flush(&v2);
|
||||
}
|
||||
break;
|
||||
|
||||
case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
|
||||
if (vtype == EINA_VALUE_TYPE_DOUBLE)
|
||||
eina_value_get(value, ¶m.d);
|
||||
else
|
||||
{
|
||||
Eina_Value v2;
|
||||
|
||||
eina_value_setup(&v2, EINA_VALUE_TYPE_DOUBLE);
|
||||
eina_value_convert(value, &v2);
|
||||
eina_value_get(&v2, ¶m.d);
|
||||
eina_value_flush(&v2);
|
||||
}
|
||||
break;
|
||||
|
||||
case EDJE_EXTERNAL_PARAM_TYPE_STRING:
|
||||
case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
|
||||
// Should we use eina_value_to_string() here and not complain?
|
||||
if ((vtype != EINA_VALUE_TYPE_STRING) && (vtype != EINA_VALUE_TYPE_STRINGSHARE))
|
||||
{
|
||||
ERR("External parameter '%s' of object '%p' expects a string, "
|
||||
"got a '%s'.", name, pd->ed->obj, eina_value_type_name_get(vtype));
|
||||
RETURN_VAL(EINA_FALSE);
|
||||
}
|
||||
eina_value_get(value, ¶m.s);
|
||||
break;
|
||||
|
||||
default:
|
||||
ERR("Unsupported type for parameter '%s' of object '%p'", name, pd->ed->obj);
|
||||
RETURN_VAL(EINA_FALSE);
|
||||
}
|
||||
|
||||
RETURN_VAL(_edje_object_part_external_param_set(pd->ed, pd->part, ¶m));
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Value *
|
||||
_efl_canvas_layout_external_external_param_get(Eo *obj, void *_pd EINA_UNUSED,
|
||||
const char *name)
|
||||
{
|
||||
Edje_External_Param param = {};
|
||||
Eina_Value *v;
|
||||
|
||||
PROXY_DATA_GET(obj, pd);
|
||||
|
||||
param.name = name;
|
||||
param.type = _edje_object_part_external_param_type_get(pd->ed, pd->part, name);
|
||||
if (param.type == EDJE_EXTERNAL_PARAM_TYPE_MAX)
|
||||
RETURN_VAL(NULL);
|
||||
if (!_edje_object_part_external_param_get(pd->ed, pd->part, ¶m))
|
||||
RETURN_VAL(NULL);
|
||||
|
||||
switch (param.type)
|
||||
{
|
||||
case EDJE_EXTERNAL_PARAM_TYPE_INT:
|
||||
case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
|
||||
v = eina_value_new(EINA_VALUE_TYPE_INT);
|
||||
eina_value_set(v, param.i);
|
||||
break;
|
||||
|
||||
case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
|
||||
v = eina_value_new(EINA_VALUE_TYPE_DOUBLE);
|
||||
eina_value_set(v, param.d);
|
||||
break;
|
||||
|
||||
case EDJE_EXTERNAL_PARAM_TYPE_STRING:
|
||||
case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
|
||||
v = eina_value_new(EINA_VALUE_TYPE_STRING);
|
||||
eina_value_set(v, param.s);
|
||||
break;
|
||||
|
||||
default:
|
||||
ERR("Unsupported type for parameter '%s' of object '%p'", name, pd->ed->obj);
|
||||
RETURN_VAL(NULL);
|
||||
}
|
||||
|
||||
RETURN_VAL(v);
|
||||
}
|
||||
|
||||
EOLIAN static Edje_External_Param_Type
|
||||
_efl_canvas_layout_external_external_param_type_get(Eo *obj, void *_pd EINA_UNUSED,
|
||||
const char *name)
|
||||
{
|
||||
PROXY_DATA_GET(obj, pd);
|
||||
RETURN_VAL(_edje_object_part_external_param_type_get(pd->ed, pd->part, name));
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Gfx *
|
||||
_efl_canvas_layout_external_efl_container_content_get(Eo *obj, void *_pd EINA_UNUSED)
|
||||
{
|
||||
|
|
|
@ -6,89 +6,27 @@ class Efl.Canvas.Layout.External (Efl.Canvas.Layout_Internal, Efl.Container,
|
|||
[[Class representing an external part in Edje layouts.
|
||||
|
||||
An object of this type is an Efl.Part object, which means its lifecycle
|
||||
is limited to one and only one function call. This being said, since
|
||||
this special part represents exactly one standard @Efl.Canvas.Object all
|
||||
the functions of that object can be called on this proxy object.
|
||||
is limited to one and only one function call.
|
||||
|
||||
Thus, it is possible to do the following, in pseudo-C++:
|
||||
An external part contains one object, which can be retrieved with
|
||||
@Efl.Container.content.get(). Do not delete this object. Just like for
|
||||
other parts, Edje is in charge of the visibility, geometry, clip, etc...
|
||||
|
||||
Common usage is then, in pseudo-C:
|
||||
Eo *widget = efl_content_get(efl_part(layout, "extpartname"));
|
||||
efl_text_set(widget, "hello");
|
||||
|
||||
Note that as a shortcut the widget's functions can be called directly on
|
||||
this part object. In pseudo-C++:
|
||||
dynamic_cast<efl::Text>(layout.part("title")).text_set("hello");
|
||||
Or in pseudo-C:
|
||||
efl_text_set(efl_part(layout, "title"), "hello");
|
||||
|
||||
The real widget represented by this part can be retrieved by calling
|
||||
@Efl.Container.content.get.
|
||||
Or in pseudo-script:
|
||||
layout["title"].text = "hello";
|
||||
|
||||
@since 1.20
|
||||
]]
|
||||
data: null;
|
||||
methods {
|
||||
@property external_param {
|
||||
[[This represents a parameter for an external object.
|
||||
|
||||
Parts of type external may carry extra properties that have
|
||||
meanings defined by the external plugin. For instance, it may be a
|
||||
string that defines a button label and setting this property will
|
||||
change that label on the fly.
|
||||
|
||||
Parameters have a $name and a value which can be a boolean, an
|
||||
integer, a floating-point number or a string. Some string parameters
|
||||
only accept a certain set of values, like an enum.
|
||||
]]
|
||||
set {
|
||||
[[Sets the parameter for the external part.
|
||||
|
||||
Note: external parts have parameters set when they change
|
||||
states. Those parameters will never be changed by this
|
||||
function. The interpretation of how state_set parameters and
|
||||
param_set will interact is up to the external plugin.
|
||||
|
||||
Note: this function will not check if parameter value is valid
|
||||
using minimum, maximum, valid choices and others. However these
|
||||
should be checked by the underlying implementation provided by
|
||||
the external plugin. This is done for performance reasons.
|
||||
]]
|
||||
return: bool; [[May return $false in case of failure.]]
|
||||
}
|
||||
get {
|
||||
[[Gets the parameter for the external part.
|
||||
|
||||
This function asks the external plugin what is the current value,
|
||||
independent on how it was set. This may return $null in case of
|
||||
failure (eg. no such parameter exists).
|
||||
]]
|
||||
values {
|
||||
value: own(ptr(generic_value)); [[A pointer to a generic value
|
||||
holding a bool, int, float or string.]]
|
||||
}
|
||||
}
|
||||
keys {
|
||||
name: string; [[The name of the parameter.]]
|
||||
}
|
||||
values {
|
||||
value: const(ptr(generic_value)); [[A pointer to a generic value
|
||||
holding a bool, int, float or string.]]
|
||||
}
|
||||
}
|
||||
@property external_param_type {
|
||||
[[The type of a given parameter for this part (read only).]]
|
||||
get {}
|
||||
keys {
|
||||
name: string; [[The name of the parameter.]]
|
||||
}
|
||||
values {
|
||||
/* FIXME: Type name with "Edje" is no good! */
|
||||
type: Edje.External.Param_Type; [[The type of parameter.]]
|
||||
}
|
||||
}
|
||||
/*
|
||||
external_param_choices {
|
||||
[[Enumerates the possible values a choice-type parameter supports.]]
|
||||
return: own(free(iterator<string>, eina_iterator_free));
|
||||
[[An iterator over the accepted string values. Returns $null if
|
||||
the parameter is not a choice parameter.]]
|
||||
}
|
||||
*/
|
||||
}
|
||||
implements {
|
||||
Efl.Container.content { get; }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue