elementary/map - map supports language,changed
[framework/uifw/elementary.git] / src / lib / elm_widget_container.h
1 #ifndef ELM_WIDGET_CONTAINER_H
2 #define ELM_WIDGET_CONTAINER_H
3
4 #include <elm_widget.h>
5
6 /**
7  * @addtogroup Widget
8  * @{
9  *
10  * @section elm-container-class The Elementary Container Class
11  *
12  * @image html container_inheritance_tree.png
13  * @image latex container_inheritance_tree.eps
14  *
15  * This class defines a common interface for objects acting like
16  * containers, i.e. objects parenting others and displaying their
17  * childs "inside" of them somehow.
18  *
19  * The container must define "parts" (or spots) into which child
20  * objects will be placed, inside of it. This is a way of handling
21  * more the one content object, by naming content locations
22  * properly. This is the role of the @c name argument of the virtual
23  * functions in the class.
24  *
25  * The following object functions are meant to be used with all
26  * container objects and derived ones:
27  *
28  * - elm_object_part_content_set()
29  * - elm_object_part_content_get()
30  * - elm_object_part_content_unset()
31  */
32
33  /**
34   * @def ELM_CONTAINER_CLASS
35   *
36   * Use this macro to cast whichever subclass of
37   * #Elm_Container_Smart_Class into it, so to access its fields.
38   *
39   * @ingroup Widget
40   */
41  #define ELM_CONTAINER_CLASS(x) ((Elm_Container_Smart_Class *) x)
42
43 /**
44  * @def ELM_CONTAINER_SMART_CLASS_VERSION
45  *
46  * Current version for Elementary container @b base smart class, a value
47  * which goes to _Elm_Container_Smart_Class::version.
48  *
49  * @ingroup Widget
50  */
51 #define ELM_CONTAINER_SMART_CLASS_VERSION 1
52
53 /**
54  * @def ELM_CONTAINER_SMART_CLASS_INIT
55  *
56  * Initializer for a whole #Elm_Container_Smart_Class structure, with
57  * @c NULL values on its specific fields.
58  *
59  * @param smart_class_init initializer to use for the "base" field
60  * (#Evas_Smart_Class).
61  *
62  * @see EVAS_SMART_CLASS_INIT_NULL
63  * @see EVAS_SMART_CLASS_INIT_NAME_VERSION
64  * @see ELM_CONTAINER_SMART_CLASS_INIT_NULL
65  * @see ELM_CONTAINER_SMART_CLASS_INIT_NAME_VERSION
66  *
67  * @ingroup Widget
68  */
69 #define ELM_CONTAINER_SMART_CLASS_INIT(smart_class_init) \
70   {smart_class_init, ELM_CONTAINER_SMART_CLASS_VERSION, NULL, NULL, NULL}
71
72 /**
73  * @def ELM_CONTAINER_SMART_CLASS_INIT_NULL
74  *
75  * Initializer to zero out a whole #Elm_Container_Smart_Class structure.
76  *
77  * @see ELM_CONTAINER_SMART_CLASS_INIT_NAME_VERSION
78  * @see ELM_CONTAINER_SMART_CLASS_INIT
79  *
80  * @ingroup Widget
81  */
82 #define ELM_CONTAINER_SMART_CLASS_INIT_NULL \
83   ELM_CONTAINER_SMART_CLASS_INIT(EVAS_SMART_CLASS_INIT_NULL)
84
85 /**
86  * @def ELM_CONTAINER_SMART_CLASS_INIT_NAME_VERSION
87  *
88  * Initializer to zero out a whole #Elm_Container_Smart_Class structure and
89  * set its name and version.
90  *
91  * This is similar to #ELM_CONTAINER_SMART_CLASS_INIT_NULL, but it will
92  * also set the version field of #Elm_Container_Smart_Class (base field)
93  * to the latest #ELM_CONTAINER_SMART_CLASS_VERSION and name it to the
94  * specific value.
95  *
96  * It will keep a reference to the name field as a <c>"const char *"</c>,
97  * i.e., the name must be available while the structure is
98  * used (hint: static or global variable!) and must not be modified.
99  *
100  * @see ELM_CONTAINER_SMART_CLASS_INIT_NULL
101  * @see ELM_CONTAINER_SMART_CLASS_INIT
102  *
103  * @ingroup Widget
104  */
105 #define ELM_CONTAINER_SMART_CLASS_INIT_NAME_VERSION(name) \
106   ELM_CONTAINER_SMART_CLASS_INIT(ELM_WIDGET_SMART_CLASS_INIT_NAME_VERSION(name))
107
108 /**
109  * Elementary container base smart class. This inherits directly from
110  * #Elm_Widget_Smart_Class and is meant to build widgets exposing
111  * "parts" to hold child elements at.
112  */
113 typedef struct _Elm_Container_Smart_Class
114 {
115    Elm_Widget_Smart_Class base; /**< Base Elementary widget class struct, since we're inheriting from it */
116
117    int                    version; /**< Version of this smart class definition */
118    Eina_Bool            (*content_set)(Evas_Object *obj,
119                                        const char *part,
120                                        Evas_Object *content); /* 'Virtual' function on setting content on the object, at the given @a part part */
121    Evas_Object         *(*content_get)(const Evas_Object * obj,
122                                        const char *part); /* 'Virtual' function on retrieving content from the object, at the given @a part part */
123    Evas_Object         *(*content_unset)(Evas_Object * obj,
124                                          const char *part); /* 'Virtual' function on unsetting content from the object, at the given @a part part. Meant to return the content's pointer. */
125 } Elm_Container_Smart_Class;
126
127 typedef struct _Elm_Container_Smart_Data Elm_Container_Smart_Data;
128 struct _Elm_Container_Smart_Data
129 {
130    Elm_Widget_Smart_Data base;
131 };
132 /**
133  * @}
134  */
135
136 EAPI const Elm_Container_Smart_Class *elm_container_smart_class_get(void);
137
138 #endif