summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorGustavo Lima Chaves <glima@profusion.mobi>2011-07-06 18:46:58 +0000
committerGustavo Lima Chaves <glima@profusion.mobi>2011-07-06 18:46:58 +0000
commitc56c7c8b8971269c8785c52f74102c021c113805 (patch)
tree015b447089efe3f06fe52a5f3653e3556b84b9c0 /legacy
parent693af50513c19dbd5a31d3f78ba2652120750b7d (diff)
[evas] Documenting/exemplifying the following:
- evas_object_smart_type_check - evas_object_smart_type_check_ptr - evas_object_static_clip_get - evas_object_static_clip_set - evas_smart_class_get - evas_smart_class_new - evas_smart_data_get - evas_smart_free - evas_smart_objects_calculate SVN revision: 61096
Diffstat (limited to 'legacy')
-rw-r--r--legacy/evas/doc/examples.dox11
-rw-r--r--legacy/evas/src/examples/evas-smart-object.c10
-rw-r--r--legacy/evas/src/lib/Evas.h154
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_main.c20
4 files changed, 146 insertions, 49 deletions
diff --git a/legacy/evas/doc/examples.dox b/legacy/evas/doc/examples.dox
index 3c7fd2d336..e6d5367954 100644
--- a/legacy/evas/doc/examples.dox
+++ b/legacy/evas/doc/examples.dox
@@ -610,6 +610,17 @@
610 * the smart object and the children, if any, lie on their respective 610 * the smart object and the children, if any, lie on their respective
611 * quadrants. 611 * quadrants.
612 * 612 *
613 * After instantiating our smart object, we do some checks to exemplify
614 * some of the API on smart objects:
615 * @dontinclude evas-smart-object.c
616 * @skip ret = evas_object_smart_type_check
617 * @until "no"
618 * The evas_object_smart_type_check() one will assure we have the
619 * string naming our smart class really set to the live object. The
620 * evas_object_smart_clipped_clipper_get() exemplifyes usage of
621 * "static clippers" -- clipped smart objects have their global
622 * clippers flagged static.
623 *
613 * As in other examples, to interact with this one there's a command 624 * As in other examples, to interact with this one there's a command
614 * line interface, whose help string can be asked for with the 'h' key: 625 * line interface, whose help string can be asked for with the 'h' key:
615 * 626 *
diff --git a/legacy/evas/src/examples/evas-smart-object.c b/legacy/evas/src/examples/evas-smart-object.c
index a45b76f54b..792071ecbe 100644
--- a/legacy/evas/src/examples/evas-smart-object.c
+++ b/legacy/evas/src/examples/evas-smart-object.c
@@ -563,6 +563,8 @@ _on_keydown(void *data __UNUSED__,
563int 563int
564main(void) 564main(void)
565{ 565{
566 Eina_Bool ret;
567
566 srand(time(NULL)); 568 srand(time(NULL));
567 569
568 if (!ecore_evas_init()) 570 if (!ecore_evas_init())
@@ -592,7 +594,15 @@ main(void)
592 evas_object_resize(d.smt, WIDTH / 2, HEIGHT / 2); 594 evas_object_resize(d.smt, WIDTH / 2, HEIGHT / 2);
593 evas_object_show(d.smt); 595 evas_object_show(d.smt);
594 596
597 ret = evas_object_smart_type_check(d.smt, _evas_smart_example_type);
598 fprintf(stdout, "Adding smart object of type \"%s\" to the canvas: %s.\n",
599 _evas_smart_example_type, ret ? "success" : "failure");
600
595 d.clipper = evas_object_smart_clipped_clipper_get(d.smt); 601 d.clipper = evas_object_smart_clipped_clipper_get(d.smt);
602 fprintf(stdout, "Checking if clipped smart object's clipper is a "
603 "\"static\" one: %s\n", evas_object_static_clip_get(d.clipper) ?
604 "yes" : "no");
605
596 evas_object_color_set( 606 evas_object_color_set(
597 d.clipper, clipper_colors[cur_color].r, clipper_colors[cur_color].g, 607 d.clipper, clipper_colors[cur_color].r, clipper_colors[cur_color].g,
598 clipper_colors[cur_color].b, clipper_colors[cur_color].a); 608 clipper_colors[cur_color].b, clipper_colors[cur_color].a);
diff --git a/legacy/evas/src/lib/Evas.h b/legacy/evas/src/lib/Evas.h
index 7be26c92c8..162c306435 100644
--- a/legacy/evas/src/lib/Evas.h
+++ b/legacy/evas/src/lib/Evas.h
@@ -4996,7 +4996,36 @@ EAPI Evas_Render_Op evas_object_render_op_get (const Evas_Obje
4996 */ 4996 */
4997 EAPI Eina_Bool evas_object_precise_is_inside_get(const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; 4997 EAPI Eina_Bool evas_object_precise_is_inside_get(const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
4998 4998
4999/**
5000 * Set a hint flag on the given Evas object that it's used as a "static
5001 * clipper".
5002 *
5003 * @param obj The given object.
5004 * @param is_static_clip @c EINA_TRUE if it's to be used as a static
5005 * clipper, @c EINA_FALSE otherwise
5006 *
5007 * This is a hint to Evas that this object is used as a big static
5008 * clipper and shouldn't be moved with children and otherwise
5009 * considered specially. The default value for new objects is @c
5010 * EINA_FALSE.
5011 *
5012 * @see evas_object_static_clip_get()
5013 *
5014 * @ingroup Evas_Object_Group_Extras
5015 */
4999 EAPI void evas_object_static_clip_set (Evas_Object *obj, Eina_Bool is_static_clip) EINA_ARG_NONNULL(1); 5016 EAPI void evas_object_static_clip_set (Evas_Object *obj, Eina_Bool is_static_clip) EINA_ARG_NONNULL(1);
5017
5018/**
5019 * Get the "static clipper" hint flag for a given Evas object.
5020 *
5021 * @param obj The given object.
5022 * @returrn @c EINA_TRUE if it's set as a static clipper, @c
5023 * EINA_FALSE otherwise
5024 *
5025 * @see evas_object_static_clip_set() for more details
5026 *
5027 * @ingroup Evas_Object_Group_Extras
5028 */
5000 EAPI Eina_Bool evas_object_static_clip_get (const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; 5029 EAPI Eina_Bool evas_object_static_clip_get (const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
5001 5030
5002/** 5031/**
@@ -7743,16 +7772,24 @@ EAPI void evas_object_polygon_points_clear (Evas_Object *obj) EINA
7743/** 7772/**
7744 * @defgroup Evas_Smart_Group Smart Functions 7773 * @defgroup Evas_Smart_Group Smart Functions
7745 * 7774 *
7746 * Functions that deal with Evas_Smart's, creating definition 7775 * Functions that deal with #Evas_Smart structs, creating definition
7747 * (classes) of objects that will have customized behavior for methods 7776 * (classes) of objects that will have customized behavior for methods
7748 * like evas_object_move(), evas_object_resize(), 7777 * like evas_object_move(), evas_object_resize(),
7749 * evas_object_clip_set() and others. 7778 * evas_object_clip_set() and others.
7750 * 7779 *
7751 * These objects will accept the generic methods defined in @ref 7780 * These objects will accept the generic methods defined in @ref
7752 * Evas_Object_Group and the extensions defined in @ref 7781 * Evas_Object_Group and the extensions defined in @ref
7753 * Evas_Smart_Object_Group. There are couple of existent smart objects 7782 * Evas_Smart_Object_Group. There are a couple of existent smart
7754 * in Evas itself, see @ref Evas_Object_Box, @ref Evas_Object_Table 7783 * objects in Evas itself (see @ref Evas_Object_Box, @ref
7755 * and @ref Evas_Smart_Object_Clipped. 7784 * Evas_Object_Table and @ref Evas_Smart_Object_Clipped).
7785 *
7786 * See also some @ref Example_Evas_Smart_Objects "examples" of this
7787 * group of functions.
7788 */
7789
7790/**
7791 * @addtogroup Evas_Smart_Group
7792 * @{
7756 */ 7793 */
7757 7794
7758/** 7795/**
@@ -7967,6 +8004,11 @@ struct _Evas_Smart_Cb_Description
7967 * #Evas_Smart needed to create smart objects with this class, 8004 * #Evas_Smart needed to create smart objects with this class,
7968 * which should be passed to evas_object_smart_add(). 8005 * which should be passed to evas_object_smart_add().
7969 * 8006 *
8007 * @warning @p smart_name has to be a pointer to a globally available
8008 * string! The smart class created here will just have a pointer set
8009 * to that, and all object instances will depend on it for smart class
8010 * name lookup.
8011 *
7970 * @ingroup Evas_Smart_Group 8012 * @ingroup Evas_Smart_Group
7971 */ 8013 */
7972#define EVAS_SMART_SUBCLASS_NEW(smart_name, prefix, api_type, parent_type, parent_func, cb_desc) \ 8014#define EVAS_SMART_SUBCLASS_NEW(smart_name, prefix, api_type, parent_type, parent_func, cb_desc) \
@@ -8029,41 +8071,56 @@ struct _Evas_Smart_Cb_Description
8029 8071
8030 8072
8031/** 8073/**
8032 * Free an Evas_Smart 8074 * Free an #Evas_Smart struct
8033 * 8075 *
8034 * If this smart was created using evas_smart_class_new(), the associated 8076 * @param s the #Evas_Smart struct to free
8035 * Evas_Smart_Class will not be freed.
8036 * 8077 *
8037 * @param s the Evas_Smart to free 8078 * @warning If this smart handle was created using
8079 * evas_smart_class_new(), the associated #Evas_Smart_Class will not
8080 * be freed.
8038 * 8081 *
8082 * @note If you're using the #EVAS_SMART_SUBCLASS_NEW schema to create your
8083 * smart object, note that an #Evas_Smart handle will be shared amongst all
8084 * instances of the given smart class, through a static variable.
8085 * Evas will internally count references on #Evas_Smart handles and free them
8086 * when they are not referenced anymore. Thus, this function is of no use
8087 * for Evas users, most probably.
8039 */ 8088 */
8040EAPI void evas_smart_free (Evas_Smart *s) EINA_ARG_NONNULL(1); 8089EAPI void evas_smart_free (Evas_Smart *s) EINA_ARG_NONNULL(1);
8041 8090
8042/** 8091/**
8043 * Creates an Evas_Smart from an Evas_Smart_Class. 8092 * Creates a new #Evas_Smart from a given #Evas_Smart_Class struct
8044 * 8093 *
8045 * @param sc the smart class definition 8094 * @param sc the smart class definition
8046 * @return an Evas_Smart 8095 * @return a new #Evas_Smart pointer
8096 *
8097 * #Evas_Smart handles are necessary to create new @b instances of
8098 * smart objects belonging to the class described by @p sc. That
8099 * handle will contain, besides the smart class interface definition,
8100 * all its smart callbacks infrastructure set, too.
8101 *
8102 * @note If you are willing to subclass a given smart class to
8103 * construct yours, consider using the #EVAS_SMART_SUBCLASS_NEW macro,
8104 * which will make use of this function automatically for you.
8047 */ 8105 */
8048EAPI Evas_Smart *evas_smart_class_new (const Evas_Smart_Class *sc) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC; 8106EAPI Evas_Smart *evas_smart_class_new (const Evas_Smart_Class *sc) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC;
8049 8107
8050/** 8108/**
8051 * Get the Evas_Smart_Class of an Evas_Smart 8109 * Get the #Evas_Smart_Class handle of an #Evas_Smart struct
8052 * 8110 *
8053 * @param s the Evas_Smart 8111 * @param s a valid #Evas_Smart pointer
8054 * @return the Evas_Smart_Class 8112 * @return the #Evas_Smart_Class in it
8055 */ 8113 */
8056EAPI const Evas_Smart_Class *evas_smart_class_get (const Evas_Smart *s) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; 8114EAPI const Evas_Smart_Class *evas_smart_class_get (const Evas_Smart *s) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
8057 8115
8058 8116
8059/** 8117/**
8060 * @brief Get the data pointer set on an Evas_Smart. 8118 * @brief Get the data pointer set on an #Evas_Smart struct
8061 * 8119 *
8062 * @param s Evas_Smart 8120 * @param s a valid #Evas_Smart handle
8063 * 8121 *
8064 * This data pointer is set either as the final parameter to 8122 * This data pointer is set as the data field in the #Evas_Smart_Class
8065 * evas_smart_new or as the data field in the Evas_Smart_Class passed 8123 * passed in to evas_smart_class_new().
8066 * in to evas_smart_class_new
8067 */ 8124 */
8068EAPI void *evas_smart_data_get (const Evas_Smart *s) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; 8125EAPI void *evas_smart_data_get (const Evas_Smart *s) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
8069 8126
@@ -8168,6 +8225,10 @@ EAPI int evas_smart_usage_get(const Evas_Smart *s);
8168#define evas_smart_class_inherit(sc, parent_sc) evas_smart_class_inherit_full(sc, parent_sc, sizeof(*parent_sc)) 8225#define evas_smart_class_inherit(sc, parent_sc) evas_smart_class_inherit_full(sc, parent_sc, sizeof(*parent_sc))
8169 8226
8170/** 8227/**
8228 * @}
8229 */
8230
8231/**
8171 * @defgroup Evas_Smart_Object_Group Smart Object Functions 8232 * @defgroup Evas_Smart_Object_Group Smart Object Functions
8172 * 8233 *
8173 * Functions dealing with Evas smart objects (instances). 8234 * Functions dealing with Evas smart objects (instances).
@@ -8272,19 +8333,43 @@ EAPI Eina_List *evas_object_smart_members_get (const Evas_Object *obj
8272EAPI Evas_Object *evas_object_smart_parent_get (const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; 8333EAPI Evas_Object *evas_object_smart_parent_get (const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
8273 8334
8274/** 8335/**
8275 * Checks the Smart type of the object and its parents 8336 * Checks whether a given smart object or any of its smart object
8276 * @param obj the Evas_Object to check the type of 8337 * parents is of a given smart class.
8277 * @param type the type to check for 8338 *
8278 * @return EINA_TRUE if @a obj or any of its parents if of type @a type, EINA_FALSE otherwise 8339 * @param obj An Evas smart object to check the type of
8340 * @param type The @b name (type) of the smart class to check for
8341 * @return @c EINA_TRUE, if @a obj or any of its parents is of type @a
8342 * type, @c EINA_FALSE otherwise
8343 *
8344 * If @p obj is not a smart object, this call will fail
8345 * immediately. Otherwise, make sure evas_smart_class_inherit() or its
8346 * sibling functions were used correctly when creating the smart
8347 * object's class, so it has a valid @b parent smart class pointer
8348 * set.
8349 *
8350 * The checks use smart classes names and <b>string
8351 * comparison</b>. There is a version of this same check using
8352 * <b>pointer comparison</b>, since a smart class' name is a single
8353 * string in Evas.
8354 *
8355 * @see evas_object_smart_type_check_ptr()
8356 * @see #EVAS_SMART_SUBCLASS_NEW
8357 *
8279 * @ingroup Evas_Smart_Object_Group 8358 * @ingroup Evas_Smart_Object_Group
8280 */ 8359 */
8281EAPI Eina_Bool evas_object_smart_type_check (const Evas_Object *obj, const char *type) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1, 2) EINA_PURE; 8360EAPI Eina_Bool evas_object_smart_type_check (const Evas_Object *obj, const char *type) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1, 2) EINA_PURE;
8282 8361
8283/** 8362/**
8284 * Checks the Smart type of the object and its parents using pointer comparison 8363 * Checks whether a given smart object or any of its smart object
8285 * @param obj the Evas_Object to check the type of 8364 * parents is of a given smart class, <b>using pointer comparison</b>.
8286 * @param type the type to check for. Must be the name pointer in the smart class used to create the object 8365 *
8287 * @return EINA_TRUE if @a obj or any of its parents if of type @a type, EINA_FALSE otherwise 8366 * @param obj An Evas smart object to check the type of
8367 * @param type The type (name string) to check for. Must be the name
8368 * @return @c EINA_TRUE, if @a obj or any of its parents is of type @a
8369 * type, @c EINA_FALSE otherwise
8370 *
8371 * @see evas_object_smart_type_check() for more details
8372 *
8288 * @ingroup Evas_Smart_Object_Group 8373 * @ingroup Evas_Smart_Object_Group
8289 */ 8374 */
8290EAPI Eina_Bool evas_object_smart_type_check_ptr (const Evas_Object *obj, const char *type) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1, 2) EINA_PURE; 8375EAPI Eina_Bool evas_object_smart_type_check_ptr (const Evas_Object *obj, const char *type) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1, 2) EINA_PURE;
@@ -8482,6 +8567,10 @@ EAPI void evas_object_smart_changed (Evas_Object *obj) EINA
8482 * automatically call this function automatically, with @c 8567 * automatically call this function automatically, with @c
8483 * EINA_TRUE as parameter. 8568 * EINA_TRUE as parameter.
8484 * 8569 *
8570 * @see evas_object_smart_need_recalculate_get()
8571 * @see evas_object_smart_calculate()
8572 * @see evas_smart_objects_calculate()
8573 *
8485 * @ingroup Evas_Smart_Object_Group 8574 * @ingroup Evas_Smart_Object_Group
8486 */ 8575 */
8487EAPI void evas_object_smart_need_recalculate_set(Evas_Object *obj, Eina_Bool value) EINA_ARG_NONNULL(1); 8576EAPI void evas_object_smart_need_recalculate_set(Evas_Object *obj, Eina_Bool value) EINA_ARG_NONNULL(1);
@@ -8498,6 +8587,8 @@ EAPI void evas_object_smart_need_recalculate_set(Evas_Object *obj,
8498 * If it's not provided, then the flag will be left unchanged 8587 * If it's not provided, then the flag will be left unchanged
8499 * after the rendering phase. 8588 * after the rendering phase.
8500 * 8589 *
8590 * @see evas_object_smart_need_recalculate_set(), for more details
8591 *
8501 * @ingroup Evas_Smart_Object_Group 8592 * @ingroup Evas_Smart_Object_Group
8502 */ 8593 */
8503EAPI Eina_Bool evas_object_smart_need_recalculate_get(const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; 8594EAPI Eina_Bool evas_object_smart_need_recalculate_get(const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
@@ -8513,20 +8604,25 @@ EAPI Eina_Bool evas_object_smart_need_recalculate_get(const Evas_Object
8513 * flag on it telling it needs recalculation for the next rendering 8604 * flag on it telling it needs recalculation for the next rendering
8514 * phase. 8605 * phase.
8515 * 8606 *
8607 * @see evas_object_smart_need_recalculate_set()
8608 *
8516 * @ingroup Evas_Smart_Object_Group 8609 * @ingroup Evas_Smart_Object_Group
8517 */ 8610 */
8518EAPI void evas_object_smart_calculate (Evas_Object *obj) EINA_ARG_NONNULL(1); 8611EAPI void evas_object_smart_calculate (Evas_Object *obj) EINA_ARG_NONNULL(1);
8519 8612
8520/** 8613/**
8521 * Call user provided calculate() and unset need_calculate on all objects. 8614 * Call user-provided @c calculate() smart functions and unset the
8615 * flag signalling that the object needs to get recalculated to @b all
8616 * smart objects in the canvas.
8522 * 8617 *
8523 * @param e The canvas to calculate all objects in 8618 * @param e The canvas to calculate all smart objects in
8619 *
8620 * @see evas_object_smart_need_recalculate_set()
8524 * 8621 *
8525 * @ingroup Evas_Smart_Object_Group 8622 * @ingroup Evas_Smart_Object_Group
8526 */ 8623 */
8527EAPI void evas_smart_objects_calculate (Evas *e); 8624EAPI void evas_smart_objects_calculate (Evas *e);
8528 8625
8529
8530/** 8626/**
8531 * Moves all children objects of a given smart object relative to a 8627 * Moves all children objects of a given smart object relative to a
8532 * given offset. 8628 * given offset.
diff --git a/legacy/evas/src/lib/canvas/evas_object_main.c b/legacy/evas/src/lib/canvas/evas_object_main.c
index d49a5c9de7..3009224501 100644
--- a/legacy/evas/src/lib/canvas/evas_object_main.c
+++ b/legacy/evas/src/lib/canvas/evas_object_main.c
@@ -1282,17 +1282,6 @@ evas_object_precise_is_inside_get(const Evas_Object *obj)
1282 return obj->precise_is_inside; 1282 return obj->precise_is_inside;
1283} 1283}
1284 1284
1285/**
1286 * Set a hint flag on the object that this is used as a static "clipper".
1287 *
1288 * This is a hint to evas that this object is used as a big static clipper
1289 * and shouldn't be moved with children and otherwise considered specially. The
1290 * Default is off.
1291 *
1292 * @param obj The given object.
1293 * @param is_static_clip The static clip flag (on or off)
1294 * @ingroup Evas_Object_Group_Extras
1295 */
1296EAPI void 1285EAPI void
1297evas_object_static_clip_set(Evas_Object *obj, Eina_Bool is_static_clip) 1286evas_object_static_clip_set(Evas_Object *obj, Eina_Bool is_static_clip)
1298{ 1287{
@@ -1302,15 +1291,6 @@ evas_object_static_clip_set(Evas_Object *obj, Eina_Bool is_static_clip)
1302 obj->is_static_clip = is_static_clip; 1291 obj->is_static_clip = is_static_clip;
1303} 1292}
1304 1293
1305/**
1306 * Get static "clipper" hint flag.
1307 *
1308 * @see evas_object_static_clip_set()
1309 *
1310 * @param obj The given object.
1311 * @return The static clip flag (on or off)
1312 * @ingroup Evas_Object_Group_Extras
1313 */
1314EAPI Eina_Bool 1294EAPI Eina_Bool
1315evas_object_static_clip_get(const Evas_Object *obj) 1295evas_object_static_clip_get(const Evas_Object *obj)
1316{ 1296{