elm progressbar: add the elm_object_text_set/get hooks.
authortasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 4 Jul 2011 10:13:53 +0000 (10:13 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 4 Jul 2011 10:13:53 +0000 (10:13 +0000)
deprecate: elm_progressbar_indicator_label_set/get.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@60989 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/Elementary.h.in
src/lib/elm_progressbar.c

index bd3310a..ff3a1d9 100644 (file)
@@ -4627,8 +4627,8 @@ extern "C" {
    EAPI void         elm_progressbar_pulse(Evas_Object *obj, Eina_Bool state) EINA_ARG_NONNULL(1);
    EAPI void         elm_progressbar_value_set(Evas_Object *obj, double val) EINA_ARG_NONNULL(1);
    EAPI double       elm_progressbar_value_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
-   EAPI void         elm_progressbar_label_set(Evas_Object *obj, const char *label) EINA_ARG_NONNULL(1);
-   EAPI const char  *elm_progressbar_label_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
+   EINA_DEPRECATED EAPI void         elm_progressbar_label_set(Evas_Object *obj, const char *label) EINA_ARG_NONNULL(1);
+   EINA_DEPRECATED EAPI const char  *elm_progressbar_label_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
    EAPI void         elm_progressbar_icon_set(Evas_Object *obj, Evas_Object *icon) EINA_ARG_NONNULL(1);
    EAPI Evas_Object *elm_progressbar_icon_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
    EAPI Evas_Object *elm_progressbar_icon_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
index 95c4e15..7486045 100644 (file)
@@ -187,6 +187,38 @@ _units_set(Evas_Object *obj)
      edje_object_part_text_set(wd->progressbar, "elm.text.status", NULL);
 }
 
+static void
+_elm_progressbar_label_set(Evas_Object *obj, const char *item, const char *label)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (item) return;
+   if (!wd) return;
+   eina_stringshare_replace(&wd->label, label);
+   if (label)
+     {
+        edje_object_signal_emit(wd->progressbar, "elm,state,text,visible", "elm");
+        edje_object_message_signal_process(wd->progressbar);
+     }
+   else
+     {
+        edje_object_signal_emit(wd->progressbar, "elm,state,text,hidden", "elm");
+        edje_object_message_signal_process(wd->progressbar);
+     }
+   edje_object_part_text_set(wd->progressbar, "elm.text", label);
+   _sizing_eval(obj);
+}
+
+static const char *
+_elm_progressbar_label_get(const Evas_Object *obj, const char *item)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (item) return NULL;
+   if (!wd) return NULL;
+   return wd->label;
+}
+
 /**
  * Add a new progressbar to the parent
  *
@@ -211,6 +243,8 @@ elm_progressbar_add(Evas_Object *parent)
    elm_widget_del_hook_set(obj, _del_hook);
    elm_widget_theme_hook_set(obj, _theme_hook);
    elm_widget_can_focus_set(obj, EINA_FALSE);
+   elm_widget_text_set_hook_set(obj, _elm_progressbar_label_set);
+   elm_widget_text_get_hook_set(obj, _elm_progressbar_label_get);
 
    wd->horizontal = EINA_TRUE;
    wd->inverted = EINA_FALSE;
@@ -349,26 +383,12 @@ elm_progressbar_value_get(const Evas_Object *obj)
  * @param label The text label string in UTF-8
  *
  * @ingroup Progressbar
+ * @deprecated use elm_object_text_set() instead.
  */
 EAPI void
 elm_progressbar_label_set(Evas_Object *obj, const char *label)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype);
-   Widget_Data *wd = elm_widget_data_get(obj);
-   if (!wd) return;
-   eina_stringshare_replace(&wd->label, label);
-   if (label)
-     {
-        edje_object_signal_emit(wd->progressbar, "elm,state,text,visible", "elm");
-        edje_object_message_signal_process(wd->progressbar);
-     }
-   else
-     {
-        edje_object_signal_emit(wd->progressbar, "elm,state,text,hidden", "elm");
-        edje_object_message_signal_process(wd->progressbar);
-     }
-   edje_object_part_text_set(wd->progressbar, "elm.text", label);
-   _sizing_eval(obj);
+   _elm_progressbar_label_set(obj, NULL, label);
 }
 
 /**
@@ -378,14 +398,12 @@ elm_progressbar_label_set(Evas_Object *obj, const char *label)
  * @return The text label string in UTF-8
  *
  * @ingroup Progressbar
+ * @deprecated use elm_object_text_set() instead.
  */
 EAPI const char *
 elm_progressbar_label_get(const Evas_Object *obj)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype) NULL;
-   Widget_Data *wd = elm_widget_data_get(obj);
-   if (!wd) return NULL;
-   return wd->label;
+   return _elm_progressbar_label_get(obj, NULL);
 }
 
 /**