forked from enlightenment/efl
elementary/conformant - content_set/get/unset
SVN revision: 64489
This commit is contained in:
parent
5c4fd67f87
commit
213873a6c0
|
@ -3690,7 +3690,7 @@
|
||||||
* @until evas_object_show
|
* @until evas_object_show
|
||||||
*
|
*
|
||||||
* Finally, we'll set the box as conformant's content, just like this:
|
* Finally, we'll set the box as conformant's content, just like this:
|
||||||
* @skipline elm_conformant_content_set
|
* @skipline elm_object_content_set
|
||||||
*
|
*
|
||||||
* Compare both examples code:
|
* Compare both examples code:
|
||||||
* @ref conformant_example_01.c "conformant_example_01.c"
|
* @ref conformant_example_01.c "conformant_example_01.c"
|
||||||
|
|
|
@ -37,6 +37,6 @@ evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
evas_object_show(en);
|
evas_object_show(en);
|
||||||
elm_box_pack_end(bx, en);
|
elm_box_pack_end(bx, en);
|
||||||
|
|
||||||
elm_conformant_content_set(conform, bx);
|
elm_object_content_set(conform, bx);
|
||||||
|
|
||||||
#include "widget_preview_tmpl_foot.c"
|
#include "widget_preview_tmpl_foot.c"
|
||||||
|
|
|
@ -80,7 +80,7 @@ test_conformant(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event
|
||||||
evas_object_show(en);
|
evas_object_show(en);
|
||||||
elm_box_pack_end(bx, en);
|
elm_box_pack_end(bx, en);
|
||||||
|
|
||||||
elm_conformant_content_set(conform, bx);
|
elm_object_content_set(conform, bx);
|
||||||
evas_object_show(bx);
|
evas_object_show(bx);
|
||||||
|
|
||||||
evas_object_resize(win, 240, 240);
|
evas_object_resize(win, 240, 240);
|
||||||
|
@ -169,7 +169,7 @@ test_conformant2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event
|
||||||
|
|
||||||
evas_object_smart_callback_add(btn, "clicked", popobj, pg);
|
evas_object_smart_callback_add(btn, "clicked", popobj, pg);
|
||||||
|
|
||||||
elm_conformant_content_set(conform, bx);
|
elm_object_content_set(conform, bx);
|
||||||
evas_object_show(bx);
|
evas_object_show(bx);
|
||||||
|
|
||||||
conform = elm_conformant_add(win);
|
conform = elm_conformant_add(win);
|
||||||
|
@ -201,7 +201,7 @@ test_conformant2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event
|
||||||
|
|
||||||
evas_object_smart_callback_add(btn, "clicked", popobj, pg);
|
evas_object_smart_callback_add(btn, "clicked", popobj, pg);
|
||||||
|
|
||||||
elm_conformant_content_set(conform, bx);
|
elm_object_content_set(conform, bx);
|
||||||
evas_object_show(bx);
|
evas_object_show(bx);
|
||||||
|
|
||||||
evas_object_resize(win, 240, 480);
|
evas_object_resize(win, 240, 480);
|
||||||
|
|
|
@ -73,7 +73,7 @@ elm_main(int argc __UNUSED__, char **argv __UNUSED__)
|
||||||
elm_box_pack_end(bx, btn);
|
elm_box_pack_end(bx, btn);
|
||||||
evas_object_show(btn);
|
evas_object_show(btn);
|
||||||
|
|
||||||
elm_conformant_content_set(conform, bx);
|
elm_object_content_set(conform, bx);
|
||||||
evas_object_show(bx);
|
evas_object_show(bx);
|
||||||
|
|
||||||
evas_object_resize(win, 240, 480);
|
evas_object_resize(win, 240, 480);
|
||||||
|
|
|
@ -24349,6 +24349,10 @@ extern "C" {
|
||||||
* Available styles for it:
|
* Available styles for it:
|
||||||
* - @c "default"
|
* - @c "default"
|
||||||
*
|
*
|
||||||
|
* Default contents parts of the conformant widget that you can use for are:
|
||||||
|
*
|
||||||
|
* @li "elm.swallow.content" - A content of the conformant
|
||||||
|
*
|
||||||
* See how to use this widget in this example:
|
* See how to use this widget in this example:
|
||||||
* @ref conformant_example
|
* @ref conformant_example
|
||||||
*/
|
*/
|
||||||
|
@ -24384,14 +24388,14 @@ extern "C" {
|
||||||
*
|
*
|
||||||
* Once the content object is set, a previously set one will be deleted.
|
* Once the content object is set, a previously set one will be deleted.
|
||||||
* If you want to keep that old content object, use the
|
* If you want to keep that old content object, use the
|
||||||
* elm_conformat_content_unset() function.
|
* elm_object_content_unset() function.
|
||||||
*
|
*
|
||||||
* @see elm_conformant_content_unset()
|
* @see elm_object_content_unset()
|
||||||
* @see elm_conformant_content_get()
|
* @see elm_object_content_get()
|
||||||
*
|
*
|
||||||
* @ingroup Conformant
|
* @ingroup Conformant
|
||||||
*/
|
*/
|
||||||
EAPI void elm_conformant_content_set(Evas_Object *obj, Evas_Object *content) EINA_ARG_NONNULL(1);
|
EINA_DEPRECATED EAPI void elm_conformant_content_set(Evas_Object *obj, Evas_Object *content) EINA_ARG_NONNULL(1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the content of the conformant widget.
|
* Get the content of the conformant widget.
|
||||||
|
@ -24401,14 +24405,14 @@ extern "C" {
|
||||||
*
|
*
|
||||||
* Return the content object which is set for this widget.
|
* Return the content object which is set for this widget.
|
||||||
* It won't be unparent from conformant. For that, use
|
* It won't be unparent from conformant. For that, use
|
||||||
* elm_conformant_content_unset().
|
* elm_object_content_unset().
|
||||||
*
|
*
|
||||||
* @see elm_conformant_content_set() for more details.
|
* @see elm_object_content_set().
|
||||||
* @see elm_conformant_content_unset()
|
* @see elm_object_content_unset()
|
||||||
*
|
*
|
||||||
* @ingroup Conformant
|
* @ingroup Conformant
|
||||||
*/
|
*/
|
||||||
EAPI Evas_Object *elm_conformant_content_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
EINA_DEPRECATED EAPI Evas_Object *elm_conformant_content_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unset the content of the conformant widget.
|
* Unset the content of the conformant widget.
|
||||||
|
@ -24418,11 +24422,11 @@ extern "C" {
|
||||||
*
|
*
|
||||||
* Unparent and return the content object which was set for this widget.
|
* Unparent and return the content object which was set for this widget.
|
||||||
*
|
*
|
||||||
* @see elm_conformant_content_set() for more details.
|
* @see elm_object_content_set().
|
||||||
*
|
*
|
||||||
* @ingroup Conformant
|
* @ingroup Conformant
|
||||||
*/
|
*/
|
||||||
EAPI Evas_Object *elm_conformant_content_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
|
EINA_DEPRECATED EAPI Evas_Object *elm_conformant_content_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Evas_Object that represents the content area.
|
* Returns the Evas_Object that represents the content area.
|
||||||
|
|
|
@ -47,6 +47,12 @@ static void _del_pre_hook(Evas_Object *obj);
|
||||||
static void _del_hook(Evas_Object *obj);
|
static void _del_hook(Evas_Object *obj);
|
||||||
static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
|
static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
|
||||||
static void _theme_hook(Evas_Object *obj);
|
static void _theme_hook(Evas_Object *obj);
|
||||||
|
static void _content_set_hook(Evas_Object *obj,
|
||||||
|
const char *part,
|
||||||
|
Evas_Object *content);
|
||||||
|
static Evas_Object *_content_get_hook(const Evas_Object *obj,
|
||||||
|
const char *part);
|
||||||
|
static Evas_Object *_content_unset_hook(Evas_Object *obj, const char *part);
|
||||||
static void _swallow_conformant_parts(Evas_Object *obj);
|
static void _swallow_conformant_parts(Evas_Object *obj);
|
||||||
static void _conformant_part_size_set(Evas_Object *obj,
|
static void _conformant_part_size_set(Evas_Object *obj,
|
||||||
Evas_Object *sobj,
|
Evas_Object *sobj,
|
||||||
|
@ -56,11 +62,15 @@ static void _conformant_part_size_set(Evas_Object *obj,
|
||||||
Evas_Coord sh);
|
Evas_Coord sh);
|
||||||
static void _conformant_part_sizing_eval(Evas_Object *obj,
|
static void _conformant_part_sizing_eval(Evas_Object *obj,
|
||||||
Conformant_Part_Type part_type);
|
Conformant_Part_Type part_type);
|
||||||
static void
|
static void _conformant_move_resize_event_cb(void *data,
|
||||||
_conformant_move_resize_event_cb(void *data, Evas *e, Evas_Object *obj,
|
Evas *e,
|
||||||
void *event_info);
|
Evas_Object *obj,
|
||||||
|
void *event_info);
|
||||||
static void _sizing_eval(Evas_Object *obj);
|
static void _sizing_eval(Evas_Object *obj);
|
||||||
static Eina_Bool _prop_change(void *data, int type, void *event);
|
static Eina_Bool _prop_change(void *data, int type, void *event);
|
||||||
|
static void _changed_size_hints(void *data, Evas *e,
|
||||||
|
Evas_Object *obj,
|
||||||
|
void *event_info);
|
||||||
|
|
||||||
/* local functions */
|
/* local functions */
|
||||||
static void
|
static void
|
||||||
|
@ -110,6 +120,51 @@ _theme_hook(Evas_Object *obj)
|
||||||
_sizing_eval(obj);
|
_sizing_eval(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_content_set_hook(Evas_Object *obj, const char *part __UNUSED__, Evas_Object *content)
|
||||||
|
{
|
||||||
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||||
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
|
|
||||||
|
if (!wd) return;
|
||||||
|
if (wd->content == content) return;
|
||||||
|
if (wd->content) evas_object_del(wd->content);
|
||||||
|
wd->content = content;
|
||||||
|
if (content)
|
||||||
|
{
|
||||||
|
elm_widget_sub_object_add(obj, content);
|
||||||
|
evas_object_event_callback_add(content,
|
||||||
|
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
||||||
|
_changed_size_hints, obj);
|
||||||
|
edje_object_part_swallow(wd->base, "elm.swallow.content", content);
|
||||||
|
}
|
||||||
|
_sizing_eval(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Evas_Object *
|
||||||
|
_content_get_hook(const Evas_Object *obj, const char *part __UNUSED__)
|
||||||
|
{
|
||||||
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
||||||
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
|
if (!wd) return NULL;
|
||||||
|
return wd->content;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Evas_Object *
|
||||||
|
_content_unset_hook(Evas_Object *obj, const char *part __UNUSED__)
|
||||||
|
{
|
||||||
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
||||||
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
|
Evas_Object *content;
|
||||||
|
|
||||||
|
if ((!wd) || (!wd->content)) return NULL;
|
||||||
|
content = wd->content;
|
||||||
|
elm_widget_sub_object_del(obj, wd->content);
|
||||||
|
edje_object_part_unswallow(wd->base, wd->content);
|
||||||
|
wd->content = NULL;
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_sizing_eval(Evas_Object *obj)
|
_sizing_eval(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
|
@ -543,48 +598,19 @@ elm_conformant_add(Evas_Object *parent)
|
||||||
EAPI void
|
EAPI void
|
||||||
elm_conformant_content_set(Evas_Object *obj, Evas_Object *content)
|
elm_conformant_content_set(Evas_Object *obj, Evas_Object *content)
|
||||||
{
|
{
|
||||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
_content_set_hook(obj, NULL, content);
|
||||||
Widget_Data *wd = elm_widget_data_get(obj);
|
|
||||||
|
|
||||||
if (!wd) return;
|
|
||||||
if (wd->content == content) return;
|
|
||||||
if (wd->content) evas_object_del(wd->content);
|
|
||||||
wd->content = content;
|
|
||||||
if (content)
|
|
||||||
{
|
|
||||||
elm_widget_sub_object_add(obj, content);
|
|
||||||
evas_object_event_callback_add(content,
|
|
||||||
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
||||||
_changed_size_hints, obj);
|
|
||||||
edje_object_part_swallow(wd->base, "elm.swallow.content", content);
|
|
||||||
}
|
|
||||||
_sizing_eval(obj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Evas_Object *
|
EAPI Evas_Object *
|
||||||
elm_conformant_content_get(const Evas_Object *obj)
|
elm_conformant_content_get(const Evas_Object *obj)
|
||||||
{
|
{
|
||||||
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
return _content_get_hook(obj, NULL);
|
||||||
Widget_Data *wd = elm_widget_data_get(obj);
|
|
||||||
|
|
||||||
if (!wd) return NULL;
|
|
||||||
return wd->content;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Evas_Object *
|
EAPI Evas_Object *
|
||||||
elm_conformant_content_unset(Evas_Object *obj)
|
elm_conformant_content_unset(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
return _content_unset_hook(obj, NULL);
|
||||||
Widget_Data *wd = elm_widget_data_get(obj);
|
|
||||||
Evas_Object *content;
|
|
||||||
|
|
||||||
if (!wd) return NULL;
|
|
||||||
if (!wd->content) return NULL;
|
|
||||||
content = wd->content;
|
|
||||||
elm_widget_sub_object_del(obj, wd->content);
|
|
||||||
edje_object_part_unswallow(wd->base, wd->content);
|
|
||||||
wd->content = NULL;
|
|
||||||
return content;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Evas_Object *
|
EAPI Evas_Object *
|
||||||
|
|
Loading…
Reference in New Issue