elementary/ctxpopup - one more API elm_ctxpopup_dismiss
authorhermet <hermet@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 7 Mar 2012 05:58:38 +0000 (05:58 +0000)
committerhermet <hermet@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 7 Mar 2012 05:58:38 +0000 (05:58 +0000)
requested by discomfitor

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

src/lib/elc_ctxpopup.c
src/lib/elc_ctxpopup.h

index 37943ec..d0a628a 100644 (file)
@@ -1023,7 +1023,9 @@ static void
 _bg_clicked_cb(void *data, Evas_Object *obj __UNUSED__,
                const char *emission __UNUSED__, const char *source __UNUSED__)
 {
-   evas_object_hide(data);
+   Widget_Data *wd = elm_widget_data_get(data);
+   if (!wd) return;
+   _hide_signal_emit(data, wd->dir);
 }
 
 static void
@@ -1061,8 +1063,15 @@ _hide_finished(void *data, Evas_Object *obj __UNUSED__,
 static void
 _hide(Evas_Object *obj)
 {
-   Widget_Data *wd = elm_widget_data_get(obj);
+   _ctxpopup_hide(NULL, NULL, obj, NULL);
+   evas_object_smart_callback_call(obj, SIG_DISMISSED, NULL);
+}
 
+static void
+_ctxpopup_hide(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
+               void *event_info __UNUSED__)
+{
+   Widget_Data *wd = elm_widget_data_get(obj);
    if ((!wd) || (!wd->visible)) return;
 
    evas_object_hide(wd->bg);
@@ -1072,16 +1081,6 @@ _hide(Evas_Object *obj)
    _scroller_size_reset(wd);
 
    wd->visible = EINA_FALSE;
-   evas_object_smart_callback_call(obj, SIG_DISMISSED, NULL);
-}
-
-static void
-_ctxpopup_hide(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
-               void *event_info __UNUSED__)
-{
-   Widget_Data *wd = elm_widget_data_get(obj);
-   if (!wd) return;
-   _hide_signal_emit(obj, wd->dir);
 }
 
 static void
@@ -1591,3 +1590,12 @@ elm_ctxpopup_direction_get(const Evas_Object *obj)
    if (!wd) return ELM_CTXPOPUP_DIRECTION_UNKNOWN;
    return wd->dir;
 }
+
+EAPI void
+elm_ctxpopup_dismiss(Evas_Object *obj)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+   _hide_signal_emit(obj, wd->dir);
+}
index 240501b..8695bda 100644 (file)
@@ -191,5 +191,15 @@ EAPI void                         elm_ctxpopup_direction_priority_get(Evas_Objec
 EAPI Elm_Ctxpopup_Direction       elm_ctxpopup_direction_get(const Evas_Object *obj);
 
 /**
+ * @brief Dismiss a ctxpopup object
+ *
+ * @param obj The ctxpopup object
+ * Use this function to simulate clicking outside the ctxpopup to dismiss it.
+ * In this way, the ctxpopup will be hidden and the "clicked" signal will be
+ * emitted.
+ */
+EAPI void                         elm_ctxpopup_dismiss(Evas_Object *obj);
+
+/**
  * @}
  */