Eolian: Integration of Plug
This commit is contained in:
parent
246e0f4934
commit
7d263085fd
|
@ -626,7 +626,9 @@ BUILT_SOURCES = \
|
|||
elm_photo.eo.c \
|
||||
elm_photo.eo.h \
|
||||
elc_player.eo.c \
|
||||
elc_player.eo.h
|
||||
elc_player.eo.h \
|
||||
elm_plug.eo.c \
|
||||
elm_plug.eo.h
|
||||
|
||||
EXTRA_DIST += \
|
||||
elm_widget.eo \
|
||||
|
@ -679,7 +681,8 @@ EXTRA_DIST += \
|
|||
elm_photocam.eo \
|
||||
elm_photocam_pan.eo \
|
||||
elm_photo.eo \
|
||||
elc_player.eo
|
||||
elc_player.eo \
|
||||
elm_plug.eo
|
||||
|
||||
nodist_includesunstable_HEADERS = \
|
||||
elm_widget.eo.h \
|
||||
|
@ -732,5 +735,6 @@ nodist_includesunstable_HEADERS = \
|
|||
elm_photocam.eo.h \
|
||||
elm_photocam_pan.eo.h \
|
||||
elm_photo.eo.h \
|
||||
elc_player.eo.h
|
||||
elc_player.eo.h \
|
||||
elm_plug.eo.h
|
||||
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
#include "elm_priv.h"
|
||||
#include "elm_widget_plug.h"
|
||||
|
||||
EAPI Eo_Op ELM_OBJ_PLUG_BASE_ID = EO_NOOP;
|
||||
|
||||
#define MY_CLASS ELM_OBJ_PLUG_CLASS
|
||||
|
||||
#define MY_CLASS_NAME "Elm_Plug"
|
||||
|
@ -58,18 +56,15 @@ _elm_plug_resized(Ecore_Evas *ee)
|
|||
evas_object_smart_callback_call(plug, SIG_IMAGE_RESIZED, &size);
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_plug_smart_on_focus(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
|
||||
EOLIAN static Eina_Bool
|
||||
_elm_plug_elm_widget_on_focus(Eo *obj, void *sd EINA_UNUSED)
|
||||
{
|
||||
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
|
||||
Eina_Bool int_ret = EINA_FALSE;
|
||||
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
|
||||
if (ret) *ret = EINA_FALSE;
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
||||
|
||||
eo_do_super(obj, MY_CLASS, elm_obj_widget_on_focus(&int_ret));
|
||||
if (!int_ret) return;
|
||||
if (!int_ret) return EINA_FALSE;
|
||||
|
||||
if (elm_widget_focus_get(obj))
|
||||
{
|
||||
|
@ -80,22 +75,19 @@ _elm_plug_smart_on_focus(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
|
|||
evas_object_focus_set(wd->resize_obj, EINA_FALSE);
|
||||
}
|
||||
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_plug_smart_theme(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
|
||||
EOLIAN static Eina_Bool
|
||||
_elm_plug_elm_widget_theme_apply(Eo *obj, void *sd EINA_UNUSED)
|
||||
{
|
||||
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
|
||||
if (ret) *ret = EINA_FALSE;
|
||||
Eina_Bool int_ret = EINA_FALSE;
|
||||
|
||||
eo_do_super(obj, MY_CLASS, elm_obj_widget_theme_apply(&int_ret));
|
||||
if (!int_ret) return;
|
||||
if (!int_ret) return EINA_FALSE;
|
||||
|
||||
_sizing_eval(obj);
|
||||
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -112,8 +104,8 @@ _on_mouse_up(void *data,
|
|||
evas_object_smart_callback_call(data, SIG_CLICKED, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_plug_smart_add(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
|
||||
EOLIAN static void
|
||||
_elm_plug_evas_smart_add(Eo *obj, void *sd EINA_UNUSED)
|
||||
{
|
||||
Evas_Object *p_obj;
|
||||
Ecore_Evas *ee;
|
||||
|
@ -147,8 +139,8 @@ elm_plug_add(Evas_Object *parent)
|
|||
return obj;
|
||||
}
|
||||
|
||||
static void
|
||||
_constructor(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
|
||||
EOLIAN static void
|
||||
_elm_plug_eo_base_constructor(Eo *obj, void *sd EINA_UNUSED)
|
||||
{
|
||||
eo_do_super(obj, MY_CLASS, eo_constructor());
|
||||
eo_do(obj,
|
||||
|
@ -156,100 +148,42 @@ _constructor(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
|
|||
evas_obj_smart_callbacks_descriptions_set(_smart_callbacks, NULL));
|
||||
}
|
||||
|
||||
EAPI Evas_Object *
|
||||
elm_plug_image_object_get(const Evas_Object *obj)
|
||||
EOLIAN static Evas_Object*
|
||||
_elm_plug_image_object_get(Eo *obj, void *sd EINA_UNUSED)
|
||||
{
|
||||
ELM_PLUG_CHECK(obj) NULL;
|
||||
Evas_Object *ret = NULL;
|
||||
eo_do((Eo *) obj, elm_obj_plug_image_object_get(&ret));
|
||||
return ret;
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
||||
return wd->resize_obj;
|
||||
}
|
||||
|
||||
static void
|
||||
_image_object_get(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
|
||||
EOLIAN static Eina_Bool
|
||||
_elm_plug_connect(Eo *obj, void *sd EINA_UNUSED, const char *svcname, int svcnum, Eina_Bool svcsys)
|
||||
{
|
||||
Evas_Object **ret = va_arg(*list, Evas_Object **);
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
*ret = wd->resize_obj;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
elm_plug_connect(Evas_Object *obj,
|
||||
const char *svcname,
|
||||
int svcnum,
|
||||
Eina_Bool svcsys)
|
||||
{
|
||||
Eina_Bool ret = EINA_FALSE;
|
||||
eo_do(obj, elm_obj_plug_connect(svcname, svcnum, svcsys, &ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
_connect(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
|
||||
{
|
||||
const char *svcname = va_arg(*list, const char *);
|
||||
int svcnum = va_arg(*list, int);
|
||||
Eina_Bool svcsys = va_arg(*list, int);
|
||||
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
|
||||
if (ret) *ret = EINA_FALSE;
|
||||
|
||||
Evas_Object *plug_img = NULL;
|
||||
|
||||
ELM_PLUG_CHECK(obj);
|
||||
ELM_PLUG_CHECK(obj) EINA_FALSE;
|
||||
|
||||
plug_img = elm_plug_image_object_get(obj);
|
||||
if (!plug_img) return;
|
||||
if (!plug_img) return EINA_FALSE;
|
||||
|
||||
if (ecore_evas_extn_plug_connect(plug_img, svcname, svcnum, svcsys))
|
||||
{
|
||||
Ecore_Evas *ee = NULL;
|
||||
ee = ecore_evas_object_ecore_evas_get(plug_img);
|
||||
if (!ee) return;
|
||||
if (!ee) return EINA_FALSE;
|
||||
|
||||
ecore_evas_data_set(ee, PLUG_KEY, obj);
|
||||
ecore_evas_callback_delete_request_set(ee, _elm_plug_disconnected);
|
||||
ecore_evas_callback_resize_set(ee, _elm_plug_resized);
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
_class_constructor(Eo_Class *klass)
|
||||
EOLIAN static void
|
||||
_elm_plug_class_constructor(Eo_Class *klass)
|
||||
{
|
||||
const Eo_Op_Func_Description func_desc[] = {
|
||||
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
|
||||
|
||||
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_ADD), _elm_plug_smart_add),
|
||||
|
||||
EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_THEME_APPLY), _elm_plug_smart_theme),
|
||||
|
||||
EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_ON_FOCUS),
|
||||
_elm_plug_smart_on_focus),
|
||||
|
||||
EO_OP_FUNC(ELM_OBJ_PLUG_ID(ELM_OBJ_PLUG_SUB_ID_IMAGE_OBJECT_GET), _image_object_get),
|
||||
EO_OP_FUNC(ELM_OBJ_PLUG_ID(ELM_OBJ_PLUG_SUB_ID_CONNECT), _connect),
|
||||
|
||||
EO_OP_FUNC_SENTINEL
|
||||
};
|
||||
eo_class_funcs_set(klass, func_desc);
|
||||
|
||||
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
||||
}
|
||||
|
||||
static const Eo_Op_Description op_desc[] = {
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_PLUG_SUB_ID_IMAGE_OBJECT_GET, "Get the basic Evas_Image object from this object (widget)."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_PLUG_SUB_ID_CONNECT, "Connect a plug widget to service provided by socket image."),
|
||||
EO_OP_DESCRIPTION_SENTINEL
|
||||
};
|
||||
|
||||
static const Eo_Class_Description class_desc = {
|
||||
EO_VERSION,
|
||||
MY_CLASS_NAME,
|
||||
EO_CLASS_TYPE_REGULAR,
|
||||
EO_CLASS_DESCRIPTION_OPS(&ELM_OBJ_PLUG_BASE_ID, op_desc, ELM_OBJ_PLUG_SUB_ID_LAST),
|
||||
NULL,
|
||||
0,
|
||||
_class_constructor,
|
||||
NULL
|
||||
};
|
||||
EO_DEFINE_CLASS(elm_obj_plug_class_get, &class_desc, ELM_OBJ_WIDGET_CLASS, NULL);
|
||||
#include "elm_plug.eo.c"
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
class Elm_Plug (Elm_Widget)
|
||||
{
|
||||
eo_prefix: elm_obj_plug;
|
||||
data: null;
|
||||
properties {
|
||||
image_object {
|
||||
get {
|
||||
/*@
|
||||
Get the basic Evas_Image object from this object (widget).
|
||||
|
||||
@return The inlined image object, or NULL if none exists
|
||||
|
||||
This function allows one to get the underlying @c Evas_Object of type
|
||||
Image from this elementary widget. It can be useful to do things like get
|
||||
the pixel data, save the image to a file, etc.
|
||||
|
||||
@note Be careful to not manipulate it, as it is under control of
|
||||
elementary.
|
||||
|
||||
@ingroup Plug */
|
||||
return Evas_Object *;
|
||||
}
|
||||
}
|
||||
}
|
||||
methods {
|
||||
connect {
|
||||
/*@
|
||||
Connect a plug widget to service provided by socket image.
|
||||
|
||||
@return (@c EINA_TRUE = success, @c EINA_FALSE = error)
|
||||
|
||||
@ingroup Plug */
|
||||
|
||||
return Eina_Bool;
|
||||
params {
|
||||
@in const char *svcname; /*@ The service name to connect to set up by the socket. */
|
||||
@in int svcnum; /*@ The service number to connect to (set up by socket). */
|
||||
@in Eina_Bool svcsys; /*@ Boolean to set if the service is a system one or not (set up by socket). */
|
||||
}
|
||||
}
|
||||
}
|
||||
implements {
|
||||
class::constructor;
|
||||
Eo_Base::constructor;
|
||||
Evas_Smart::add;
|
||||
Elm_Widget::theme_apply;
|
||||
Elm_Widget::on_focus;
|
||||
}
|
||||
events {
|
||||
clicked;
|
||||
image,deleted;
|
||||
image,resized; /*@ ii */
|
||||
}
|
||||
|
||||
}
|
|
@ -1,3 +1,6 @@
|
|||
#include "elm_plug.eo.h"
|
||||
|
||||
#if 0
|
||||
#define ELM_OBJ_PLUG_CLASS elm_obj_plug_class_get()
|
||||
|
||||
const Eo_Class *elm_obj_plug_class_get(void) EINA_CONST;
|
||||
|
@ -44,3 +47,4 @@ enum
|
|||
* @ingroup Plug
|
||||
*/
|
||||
#define elm_obj_plug_connect(svcname, svcnum, svcsys, ret) ELM_OBJ_PLUG_ID(ELM_OBJ_PLUG_SUB_ID_CONNECT), EO_TYPECHECK(const char *, svcname), EO_TYPECHECK(int, svcnum), EO_TYPECHECK(Eina_Bool, svcsys), EO_TYPECHECK(Eina_Bool *, ret)
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue