Refactor elm_web API.
authorsanjeev <sanjeev@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 7 Mar 2012 15:56:01 +0000 (15:56 +0000)
committersanjeev <sanjeev@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 7 Mar 2012 15:56:01 +0000 (15:56 +0000)
Signed-off-by: Sanjeev BA <eflelev8@gmail.com>
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@68977 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/elm_deprecated.h
src/lib/elm_web.c
src/lib/elm_web.h

index 9eb499c..3d8b8ec 100644 (file)
@@ -6115,6 +6115,37 @@ EINA_DEPRECATED EAPI void                         elm_list_always_select_mode_se
  */
 EINA_DEPRECATED EAPI Eina_Bool                    elm_list_always_select_mode_get(const Evas_Object *obj);
 
+/*
+ * Queries whether it's possible to go back in history
+ *
+ * @param obj The web object
+ *
+ * @return EINA_TRUE if it's possible to back in history, EINA_FALSE
+ * otherwise
+ * @deprecated elm_web_back_possible_get();
+ */
+EINA_DEPRECATED EAPI Eina_Bool         elm_web_backward_possible(Evas_Object *obj);
+
+/**
+ * Queries whether it's possible to go forward in history
+ *
+ * @param obj The web object
+ *
+ * @return EINA_TRUE if it's possible to forward in history, EINA_FALSE
+ * otherwise
+ *
+ * @deprecated elm_web_forward_possible_get();
+ */
+EINA_DEPRECATED EAPI Eina_Bool         elm_web_forward_possible(Evas_Object *obj);
+
+/**
+ * Queries whether it's possible to jump the given number of steps
+ *
+ * @deprecated elm_web_navigate_possible_get();
+ *
+ */
+EINA_DEPRECATED EAPI Eina_Bool         elm_web_navigate_possible(Evas_Object *obj, int steps);
+
 /**
  * @}
  */
index c13d388..ff711d7 100644 (file)
@@ -1550,9 +1550,15 @@ elm_web_navigate(Evas_Object *obj, int steps)
 #endif
 }
 
-EAPI Eina_Bool
+EINA_DEPRECATED EAPI Eina_Bool
 elm_web_back_possible(Evas_Object *obj)
 {
+   return elm_web_back_possible_get(obj);
+}
+
+EAPI Eina_Bool
+elm_web_back_possible_get(Evas_Object *obj)
+{
    ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
 #ifdef HAVE_ELEMENTARY_WEB
    Widget_Data *wd = elm_widget_data_get(obj);
@@ -1563,6 +1569,12 @@ elm_web_back_possible(Evas_Object *obj)
 #endif
 }
 
+EINA_DEPRECATED EAPI Eina_Bool
+elm_web_forward_possible(Evas_Object *obj)
+{
+   return elm_web_forward_possible_get(obj);
+}
+
 EAPI Eina_Bool
 elm_web_forward_possible(Evas_Object *obj)
 {
@@ -1860,14 +1872,43 @@ elm_web_window_features_unref(Elm_Web_Window_Features *wf)
 }
 
 EAPI void
-elm_web_window_features_bool_property_get(const Elm_Web_Window_Features *wf, Eina_Bool *toolbar_visible, Eina_Bool *statusbar_visible, Eina_Bool *scrollbars_visible, Eina_Bool *menubar_visible, Eina_Bool *locationbar_visible, Eina_Bool *fullscreen)
+elm_web_window_features_bool_property_get(const Elm_Web_Window_Features *wf, Elm_Web_Window_Feature_Flag flag)
 {
 #ifdef HAVE_ELEMENTARY_WEB
+   Eina_Bool toolbar_visible, statusbar_visible;
+   Eina_Bool scrollbars_visible, menubar_visible;
+   Eina_Bool locationbar_visible, fullscreen;
+
    ewk_window_features_bool_property_get((const Ewk_Window_Features *)wf,
-                                         toolbar_visible, statusbar_visible,
-                                         scrollbars_visible, menubar_visible,
-                                         locationbar_visible, fullscreen);
+                                         &toolbar_visible, &statusbar_visible,
+                                         &scrollbars_visible, &menubar_visible,
+                                         &locationbar_visible, &fullscreen);
+
+   //TODO : Improve ewk API usage to get one value.
+   //
+   switch(flag)
+     {
+        case ELM_WEB_WINDOW_FEATURE_TOOLBAR:
+            return toolbar_visible;
+            break;
+        case ELM_WEB_WINDOW_FEATURE_STATUSBAR:
+            return statusbar_visible;
+            break;
+        case ELM_WEB_WINDOW_FEATURE_SCROLLBARS:
+            return scrollbars_visible;
+            break;
+        case ELM_WEB_WINDOW_FEATURE_MENUBAR:
+            return menubar_visible;
+            break;
+        case ELM_WEB_WINDOW_FEATURE_LOCATIONBAR:
+            return locationbar_visible;
+            break;
+        case ELM_WEB_WINDOW_FEATURE_FULLSCREEN:
+            return fullscreen;
+            break;
 #else
+   /* What to do with these ?
+    
    (void)wf;
    (void)toolbar_visible;
    (void)statusbar_visible;
@@ -1875,21 +1916,30 @@ elm_web_window_features_bool_property_get(const Elm_Web_Window_Features *wf, Ein
    (void)menubar_visible;
    (void)locationbar_visible;
    (void)fullscreen;
+
+   */
+
 #endif
 }
 
 EAPI void
-elm_web_window_features_int_property_get(const Elm_Web_Window_Features *wf, int *x, int *y, int *w, int *h)
+elm_web_window_features_region_get(const Elm_Web_Window_Features *wf, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
 {
 #ifdef HAVE_ELEMENTARY_WEB
    ewk_window_features_int_property_get((const Ewk_Window_Features *)wf,
                                         x, y, w, h);
 #else
+
+   /* What to do with these ?
+    
    (void)wf;
    (void)x;
    (void)y;
    (void)w;
    (void)h;
+
+   */
+
 #endif
 }
 
index cb142ad..9980238 100644 (file)
@@ -210,6 +210,21 @@ typedef enum
  */
 typedef struct _Elm_Web_Window_Features Elm_Web_Window_Features;
 
+
+/**
+ * Definitions of web window features.
+ *
+ */
+typedef enum
+{
+   ELM_WEB_WINDOW_FEATURE_TOOLBAR,
+   ELM_WEB_WINDOW_FEATURE_STATUSBAR,
+   ELM_WEB_WINDOW_FEATURE_SCROLLBARS,
+   ELM_WEB_WINDOW_FEATURE_MENUBAR,
+   ELM_WEB_WINDOW_FEATURE_LOCATIONBAR,
+   ELM_WEB_WINDOW_FEATURE_FULLSCREEN
+} Elm_Web_Window_Feature_Flag;
+
 /**
  * Callback type for the create_window hook.
  *
@@ -505,7 +520,7 @@ EAPI void              elm_web_tab_propagate_set(Evas_Object *obj, Eina_Bool pro
  *
  * @param obj The web object
  * @param uri The URI to set
- * @return EINA_TRUE if the URI could be, EINA_FALSE if an error occurred
+ * @return EINA_TRUE if the URI could be set, EINA_FALSE if an error occurred
  */
 EAPI Eina_Bool         elm_web_uri_set(Evas_Object *obj, const char *uri);
 
@@ -763,7 +778,7 @@ EAPI Eina_Bool         elm_web_navigate(Evas_Object *obj, int steps);
  * @return EINA_TRUE if it's possible to back in history, EINA_FALSE
  * otherwise
  */
-EAPI Eina_Bool         elm_web_back_possible(Evas_Object *obj);
+EAPI Eina_Bool         elm_web_back_possible_get(Evas_Object *obj);
 
 /**
  * Queries whether it's possible to go forward in history
@@ -773,7 +788,7 @@ EAPI Eina_Bool         elm_web_back_possible(Evas_Object *obj);
  * @return EINA_TRUE if it's possible to forward in history, EINA_FALSE
  * otherwise
  */
-EAPI Eina_Bool         elm_web_forward_possible(Evas_Object *obj);
+EAPI Eina_Bool         elm_web_forward_possible_get(Evas_Object *obj);
 
 /**
  * Queries whether it's possible to jump the given number of steps
@@ -787,7 +802,7 @@ EAPI Eina_Bool         elm_web_forward_possible(Evas_Object *obj);
  * @return EINA_TRUE if enough history exists to perform the given jump,
  * EINA_FALSE otherwise
  */
-EAPI Eina_Bool         elm_web_navigate_possible(Evas_Object *obj, int steps);
+EAPI Eina_Bool         elm_web_navigate_possible_get(Evas_Object *obj, int steps);
 
 /**
  * Gets whether browsing history is enabled for the given object
@@ -911,8 +926,27 @@ EAPI Eina_Bool         elm_web_inwin_mode_get(const Evas_Object *obj);
 
 EAPI void              elm_web_window_features_ref(Elm_Web_Window_Features *wf);
 EAPI void              elm_web_window_features_unref(Elm_Web_Window_Features *wf);
-EAPI void              elm_web_window_features_bool_property_get(const Elm_Web_Window_Features *wf, Eina_Bool *toolbar_visible, Eina_Bool *statusbar_visible, Eina_Bool *scrollbars_visible, Eina_Bool *menubar_visible, Eina_Bool *locationbar_visble, Eina_Bool *fullscreen);
-EAPI void              elm_web_window_features_int_property_get(const Elm_Web_Window_Features *wf, int *x, int *y, int *w, int *h);
+
+/**
+ * Gets boolean properties from Elm_Web_Window_Features
+ * (such as statusbar, menubar, etc) that are on a window.
+ *
+ * @param obj The web window features object
+ * @param flag The web window feature flag whose value is required.
+ *
+ * @return EINA_TRUE if the flag is set, EINA_FALSE otherwise
+ */
+EAPI Eina_Bool              elm_web_window_features_property_get(const Elm_Web_Window_Features *wf, Elm_Web_Window_Feature_Flag flag);
+
+/**
+ *
+ * TODO : Add documentation.
+ *
+ * @param obj The web window features object
+ * @param x, y, w, h - the co-ordinates of the web view window.
+ *
+ */
+EAPI void              elm_web_window_features_region_get(const Elm_Web_Window_Features *wf, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
 
 /**
  * @}