elementary/common - exported Elm_Object_Item type and a few common item APIs.
authorChunEon Park <hermet@hermet.pe.kr>
Wed, 3 Aug 2011 09:34:00 +0000 (09:34 +0000)
committerChunEon Park <hermet@hermet.pe.kr>
Wed, 3 Aug 2011 09:34:00 +0000 (09:34 +0000)
SVN revision: 62047

src/lib/Elementary.h.in
src/lib/elm_main.c
src/lib/elm_widget.c
src/lib/elm_widget.h

index 67e9226..000e641 100644 (file)
@@ -328,6 +328,12 @@ extern "C" {
         ELM_WRAP_LAST
      } Elm_Wrap_Type;
 
+   /**
+    * @typedef Elm_Object_Item
+    * An Elementary Object item handle.
+    * @ingroup General
+    */
+   typedef struct _Elm_Widget_Item Elm_Object_Item;
 
    /**
     * Called back when a widget's tooltip is activated and needs content.
@@ -756,6 +762,80 @@ extern "C" {
 #define elm_object_content_unset(obj) elm_object_content_part_unset((obj), NULL)
 
    /**
+    * Set a content of an object item
+    *
+    * @param it The Elementary object item
+    * @param item The content id to unset (NULL for the default content)
+    * @param content The new content of the object item
+    *
+    * @note Elementary object items may have many contents
+    *
+    * @ingroup General
+    */
+   EAPI void elm_object_item_content_part_set(Elm_Object_Item *it, const char *item, Evas_Object *content);
+
+#define elm_object_item_content_set(it, content) elm_object_item_content_part_set((it), NULL, (content))
+
+   /**
+    * Get a content of an object item
+    *
+    * @param it The Elementary object item
+    * @param item The content id to unset (NULL for the default content)
+    * @return content of the object item or NULL for any error
+    *
+    * @note Elementary object items may have many contents
+    *
+    * @ingroup General
+    */
+   EAPI Evas_Object *elm_object_item_content_part_get(const Elm_Object_Item *it, const char *item);
+
+#define elm_object_item_content_get(it, content) elm_object_item_content_part_get((it), NULL, (content))
+
+   /**
+    * Unset a content of an object item
+    *
+    * @param it The Elementary object item
+    * @param item The content id to unset (NULL for the default content)
+    *
+    * @note Elementary object items may have many contents
+    *
+    * @ingroup General
+    */
+   EAPI Evas_Object *elm_object_item_content_part_unset(Elm_Object_Item *it, const char *item);
+
+#define elm_object_item_content_unset(it, content) elm_object_item_content_part_unset((it), (content))
+
+   /**
+    * Set a label of an objec itemt
+    *
+    * @param obj The Elementary object item
+    * @param item The label id to set (NULL for the default label)
+    * @param label The new text of the label
+    *
+    * @note Elementary object items may have many labels
+    *
+    * @ingroup General
+    */
+   EAPI void elm_object_item_text_part_set(Elm_Object_Item *it, const char *item, const char *label);
+
+#define elm_object_item_text_set(it, label) elm_object_item_text_part_set((it), NULL, (label))
+
+   /**
+    * Get a label of an object
+    *
+    * @param obj The Elementary object item
+    * @param item The label id to get (NULL for the default label)
+    * @return text of the label or NULL for any error
+    *
+    * @note Elementary object items may have many labels
+    *
+    * @ingroup General
+    */
+   EAPI const char *elm_object_item_text_part_get(const Elm_Object_Item *it, const char *item);
+
+#define elm_object_item_text_get(it) elm_object_item_part_text_get((it), NULL)
+
+   /**
     * @}
     */
 
index 9acd9bc..712879e 100644 (file)
@@ -3437,3 +3437,38 @@ elm_longpress_timeout_get(void)
 {
    return _elm_config->longpress_timeout;
 }
+
+EAPI void
+elm_object_item_content_part_set(Elm_Object_Item *it,
+                                 const char *item,
+                                 Evas_Object *content)
+{
+   elm_widget_item_content_part_set(it, item, content);
+}
+
+EAPI Evas_Object *
+elm_object_item_content_part_get(const Elm_Object_Item *it,
+                                 const char *item)
+{
+   return elm_widget_item_content_part_get(it, item);
+}
+
+EAPI Evas_Object *
+elm_object_item_content_part_unset(Elm_Object_Item *it, const char *item)
+{
+   return elm_widget_item_content_part_unset(it, item);
+}
+
+EAPI void
+elm_object_item_text_part_set(Elm_Object_Item *it,
+                              const char *item,
+                              const char *label)
+{
+   elm_widget_item_text_part_set(it, item, label);
+}
+
+EAPI const char *
+elm_object_item_text_part_get(const Elm_Object_Item *it, const char *item)
+{
+   return elm_widget_item_text_part_get(it, item);
+}
index cf9d8e3..ab91968 100644 (file)
@@ -2921,6 +2921,53 @@ _smart_reconfigure(Smart_Data *sd)
      }
 }
 
+EAPI void
+elm_widget_item_content_part_set(Elm_Widget_Item *it,
+                                 const char *item,
+                                 Evas_Object *content)
+{
+   ELM_WIDGET_ITEM_CHECK_OR_RETURN(it);
+   if (!it->on_content_set_func) return;
+   it->on_content_set_func(it, item, content);
+}
+
+EAPI Evas_Object *
+elm_widget_item_content_part_get(const Elm_Widget_Item *it,
+                                 const char *item)
+{
+   ELM_WIDGET_ITEM_CHECK_OR_RETURN(it, NULL);
+   if (!it->on_content_get_func) return NULL;
+   return it->on_content_get_func(it, item);
+}
+
+EAPI Evas_Object *
+elm_widget_item_content_part_unset(Elm_Widget_Item *it,
+                                   const char *item)
+{
+   ELM_WIDGET_ITEM_CHECK_OR_RETURN(it, NULL);
+   if (!it->on_content_unset_func) return NULL;
+   return it->on_content_unset_func(it, item);
+}
+
+EAPI void
+elm_widget_item_text_part_set(Elm_Widget_Item *it,
+                              const char *item,
+                              const char *label)
+{
+   ELM_WIDGET_ITEM_CHECK_OR_RETURN(it);
+   if (!it->on_text_set_func) return;
+   it->on_text_set_func(it, item, label);
+}
+
+EAPI const char *
+elm_widget_item_text_part_get(const Elm_Widget_Item *it,
+                              const char *item)
+{
+   ELM_WIDGET_ITEM_CHECK_OR_RETURN(it, NULL);
+   if (!it->on_text_get_func) return NULL;
+   return it->on_text_get_func(it, item);
+}
+
 static void
 _smart_add(Evas_Object *obj)
 {
index 32d85e1..e26c52a 100644 (file)
@@ -202,6 +202,18 @@ struct _Elm_Widget_Item
    Evas_Object   *view; /**< the base view object */
    const void    *data; /**< item specific data */
    Evas_Smart_Cb  del_cb; /**< used to notify the item is being deleted */
+   void         (*on_content_set_func)(Elm_Widget_Item *it,
+                                       const char *item,
+                                       Evas_Object *content);
+   Evas_Object *(*on_content_get_func)(const Elm_Widget_Item *it,
+                                       const char *item);
+   Evas_Object *(*on_content_unset_func)(Elm_Widget_Item *it,
+                                         const char *item);
+   void         (*on_text_set_func)(Elm_Widget_Item *it,
+                                    const char *item,
+                                    const char *label);
+   const char  *(*on_text_get_func)(const Elm_Widget_Item *it,
+                                    const char *item);
    /* widget variations should have data from here and on */
    /* @todo: TODO check if this is enough for 1.0 release, maybe add padding! */
 };
@@ -344,6 +356,12 @@ EAPI void             _elm_widget_item_cursor_style_set(Elm_Widget_Item *item, c
 EAPI const char      *_elm_widget_item_cursor_style_get(const Elm_Widget_Item *item);
 EAPI void             _elm_widget_item_cursor_engine_only_set(Elm_Widget_Item *item, Eina_Bool engine_only);
 EAPI Eina_Bool        _elm_widget_item_cursor_engine_only_get(const Elm_Widget_Item *item);
+EAPI void             elm_widget_item_content_part_set(Elm_Object_Item *it, const char *item, Evas_Object *content);
+EAPI Evas_Object     *elm_widget_item_content_part_get(const Elm_Object_Item *it, const char *item);
+EAPI Evas_Object     *elm_widget_item_content_part_unset(Elm_Object_Item *it, const char *item);
+EAPI void             elm_widget_item_text_part_set(Elm_Object_Item *it, const char *item, const char *label);
+EAPI const char      *elm_widget_item_text_part_get(const Elm_Object_Item *it, const char *item);
+
 
 /* debug function. don't use it unless you are tracking parenting issues */
 EAPI void             elm_widget_tree_dump(const Evas_Object *top);