antognolli pushed a commit to branch master.
commit 46be79a206bc90d844e7589605505e7ac8804307
Author: Rafael Antognolli <[email protected]>
Date: Fri Mar 22 15:27:55 2013 -0300
evas/examples: Fix clipped smart object show/hide example.
Make the children get clipped to its smart object's clipper, so there's
no need to reimplement smart_show() and smart_hide() methods.
---
src/examples/evas/evas-smart-object.c | 34 ++++++----------------------------
1 file changed, 6 insertions(+), 28 deletions(-)
diff --git a/src/examples/evas/evas-smart-object.c
b/src/examples/evas/evas-smart-object.c
index 2a2bd25..7377c47 100644
--- a/src/examples/evas/evas-smart-object.c
+++ b/src/examples/evas/evas-smart-object.c
@@ -196,15 +196,19 @@ _evas_smart_example_smart_add(Evas_Object *o)
{
EVAS_SMART_DATA_ALLOC(o, Evas_Smart_Example_Data);
+ /* call parent_sc->add() before member_adding the children, otherwise the
+ * smart object's clipper won't be created yet, and the children won't be
+ * clipped to it */
+ _evas_smart_example_parent_sc->add(o);
+
/* this is a border around the smart object's area, delimiting it */
priv->border = evas_object_image_filled_add(evas_object_evas_get(o));
evas_object_image_file_set(priv->border, border_img_path, NULL);
evas_object_image_border_set(priv->border, 3, 3, 3, 3);
evas_object_image_border_center_fill_set(
priv->border, EVAS_BORDER_FILL_NONE);
+ evas_object_show(priv->border);
evas_object_smart_member_add(priv->border, o);
-
- _evas_smart_example_parent_sc->add(o);
}
static void
@@ -228,30 +232,6 @@ _evas_smart_example_smart_del(Evas_Object *o)
}
static void
-_evas_smart_example_smart_show(Evas_Object *o)
-{
- EVAS_SMART_EXAMPLE_DATA_GET(o, priv);
-
- if (priv->children[0]) evas_object_show(priv->children[0]);
- if (priv->children[1]) evas_object_show(priv->children[1]);
- evas_object_show(priv->border);
-
- _evas_smart_example_parent_sc->show(o);
-}
-
-static void
-_evas_smart_example_smart_hide(Evas_Object *o)
-{
- EVAS_SMART_EXAMPLE_DATA_GET(o, priv);
-
- if (priv->children[0]) evas_object_hide(priv->children[0]);
- if (priv->children[1]) evas_object_hide(priv->children[1]);
- evas_object_hide(priv->border);
-
- _evas_smart_example_parent_sc->hide(o);
-}
-
-static void
_evas_smart_example_smart_resize(Evas_Object *o,
Evas_Coord w,
Evas_Coord h)
@@ -296,8 +276,6 @@ _evas_smart_example_smart_set_user(Evas_Smart_Class *sc)
/* specializing these two */
sc->add = _evas_smart_example_smart_add;
sc->del = _evas_smart_example_smart_del;
- sc->show = _evas_smart_example_smart_show;
- sc->hide = _evas_smart_example_smart_hide;
/* clipped smart object has no hook on resizes or calculations */
sc->resize = _evas_smart_example_smart_resize;
--
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar