diff options
author | Rafael Antognolli <rafael.antognolli@linux.intel.com> | 2013-03-22 15:27:55 -0300 |
---|---|---|
committer | Rafael Antognolli <rafael.antognolli@linux.intel.com> | 2013-03-22 15:31:21 -0300 |
commit | 46be79a206bc90d844e7589605505e7ac8804307 (patch) | |
tree | fbdc75df15a50929b737899db459900dc1680d5c | |
parent | f9fbafae5846e7e45dce53345d47421b8008a703 (diff) |
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.
-rw-r--r-- | src/examples/evas/evas-smart-object.c | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/src/examples/evas/evas-smart-object.c b/src/examples/evas/evas-smart-object.c index 2a2bd256bb..7377c4731c 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) | |||
196 | { | 196 | { |
197 | EVAS_SMART_DATA_ALLOC(o, Evas_Smart_Example_Data); | 197 | EVAS_SMART_DATA_ALLOC(o, Evas_Smart_Example_Data); |
198 | 198 | ||
199 | /* call parent_sc->add() before member_adding the children, otherwise the | ||
200 | * smart object's clipper won't be created yet, and the children won't be | ||
201 | * clipped to it */ | ||
202 | _evas_smart_example_parent_sc->add(o); | ||
203 | |||
199 | /* this is a border around the smart object's area, delimiting it */ | 204 | /* this is a border around the smart object's area, delimiting it */ |
200 | priv->border = evas_object_image_filled_add(evas_object_evas_get(o)); | 205 | priv->border = evas_object_image_filled_add(evas_object_evas_get(o)); |
201 | evas_object_image_file_set(priv->border, border_img_path, NULL); | 206 | evas_object_image_file_set(priv->border, border_img_path, NULL); |
202 | evas_object_image_border_set(priv->border, 3, 3, 3, 3); | 207 | evas_object_image_border_set(priv->border, 3, 3, 3, 3); |
203 | evas_object_image_border_center_fill_set( | 208 | evas_object_image_border_center_fill_set( |
204 | priv->border, EVAS_BORDER_FILL_NONE); | 209 | priv->border, EVAS_BORDER_FILL_NONE); |
210 | evas_object_show(priv->border); | ||
205 | evas_object_smart_member_add(priv->border, o); | 211 | evas_object_smart_member_add(priv->border, o); |
206 | |||
207 | _evas_smart_example_parent_sc->add(o); | ||
208 | } | 212 | } |
209 | 213 | ||
210 | static void | 214 | static void |
@@ -228,30 +232,6 @@ _evas_smart_example_smart_del(Evas_Object *o) | |||
228 | } | 232 | } |
229 | 233 | ||
230 | static void | 234 | static void |
231 | _evas_smart_example_smart_show(Evas_Object *o) | ||
232 | { | ||
233 | EVAS_SMART_EXAMPLE_DATA_GET(o, priv); | ||
234 | |||
235 | if (priv->children[0]) evas_object_show(priv->children[0]); | ||
236 | if (priv->children[1]) evas_object_show(priv->children[1]); | ||
237 | evas_object_show(priv->border); | ||
238 | |||
239 | _evas_smart_example_parent_sc->show(o); | ||
240 | } | ||
241 | |||
242 | static void | ||
243 | _evas_smart_example_smart_hide(Evas_Object *o) | ||
244 | { | ||
245 | EVAS_SMART_EXAMPLE_DATA_GET(o, priv); | ||
246 | |||
247 | if (priv->children[0]) evas_object_hide(priv->children[0]); | ||
248 | if (priv->children[1]) evas_object_hide(priv->children[1]); | ||
249 | evas_object_hide(priv->border); | ||
250 | |||
251 | _evas_smart_example_parent_sc->hide(o); | ||
252 | } | ||
253 | |||
254 | static void | ||
255 | _evas_smart_example_smart_resize(Evas_Object *o, | 235 | _evas_smart_example_smart_resize(Evas_Object *o, |
256 | Evas_Coord w, | 236 | Evas_Coord w, |
257 | Evas_Coord h) | 237 | Evas_Coord h) |
@@ -296,8 +276,6 @@ _evas_smart_example_smart_set_user(Evas_Smart_Class *sc) | |||
296 | /* specializing these two */ | 276 | /* specializing these two */ |
297 | sc->add = _evas_smart_example_smart_add; | 277 | sc->add = _evas_smart_example_smart_add; |
298 | sc->del = _evas_smart_example_smart_del; | 278 | sc->del = _evas_smart_example_smart_del; |
299 | sc->show = _evas_smart_example_smart_show; | ||
300 | sc->hide = _evas_smart_example_smart_hide; | ||
301 | 279 | ||
302 | /* clipped smart object has no hook on resizes or calculations */ | 280 | /* clipped smart object has no hook on resizes or calculations */ |
303 | sc->resize = _evas_smart_example_smart_resize; | 281 | sc->resize = _evas_smart_example_smart_resize; |