elementary/theme, widget, win, toolbar, thumb, toggle, util, box - removed white...
[framework/uifw/elementary.git] / src / lib / elm_theme.c
index 19a794b..628a058 100644 (file)
@@ -26,21 +26,21 @@ _elm_theme_clear(Elm_Theme *th)
       eina_stringshare_del(p);
    if (th->cache)
      {
-       eina_hash_free(th->cache);
-       th->cache = NULL;
+        eina_hash_free(th->cache);
+        th->cache = NULL;
      }
    if (th->theme)
      {
         eina_stringshare_del(th->theme);
         th->theme = NULL;
      }
-  if (th->ref_theme)
-    {
-      th->ref_theme->referrers = 
-        eina_list_remove(th->ref_theme->referrers, th);
-      elm_theme_free(th->ref_theme);
-      th->ref_theme = NULL;
-    }
+   if (th->ref_theme)
+     {
+        th->ref_theme->referrers =
+           eina_list_remove(th->ref_theme->referrers, th);
+        elm_theme_free(th->ref_theme);
+        th->ref_theme = NULL;
+     }
 }
 
 static const char *
@@ -50,12 +50,12 @@ _elm_theme_find_try(Elm_Theme *th, const char *f, const char *group)
 
    if (edje_file_group_exists(f, group))
      {
-       file = eina_stringshare_add(f);
-       if (file)
-         {
-            eina_hash_add(th->cache, group, file);
-            return file;
-         }
+        file = eina_stringshare_add(f);
+        if (file)
+          {
+             eina_hash_add(th->cache, group, file);
+             return file;
+          }
      }
    return NULL;
 }
@@ -72,8 +72,8 @@ _elm_theme_theme_element_try(Elm_Theme *th, const char *home, const char *f, con
      return _elm_theme_find_try(th, f, group);
    else if (((f[0] == '~') && (f[1] == '/')))
      {
-       snprintf(buf, sizeof(buf), "%s/%s", home, f + 2);
-       return _elm_theme_find_try(th, buf, group);
+        snprintf(buf, sizeof(buf), "%s/%s", home, f + 2);
+        return _elm_theme_find_try(th, buf, group);
      }
    snprintf(buf, sizeof(buf), "%s/.elementary/themes/%s.edj", home, f);
    file = _elm_theme_find_try(th, buf, group);
@@ -94,23 +94,23 @@ _elm_theme_group_file_find(Elm_Theme *th, const char *group)
    if (file) return file;
    if (!home)
      {
-       home = getenv("HOME");
-       if (!home) home = "";
+        home = getenv("HOME");
+        if (!home) home = "";
      }
    EINA_LIST_FOREACH(th->overlay, l, f)
      {
-       file = _elm_theme_theme_element_try(th, home, f, group);
-       if (file) return file;
+        file = _elm_theme_theme_element_try(th, home, f, group);
+        if (file) return file;
      }
    EINA_LIST_FOREACH(th->themes, l, f)
      {
-       file = _elm_theme_theme_element_try(th, home, f, group);
-       if (file) return file;
+        file = _elm_theme_theme_element_try(th, home, f, group);
+        if (file) return file;
      }
    EINA_LIST_FOREACH(th->extension, l, f)
      {
-       file = _elm_theme_theme_element_try(th, home, f, group);
-       if (file) return file;
+        file = _elm_theme_theme_element_try(th, home, f, group);
+        if (file) return file;
      }
    if (th->ref_theme) return _elm_theme_group_file_find(th->ref_theme, group);
    return NULL;
@@ -144,8 +144,8 @@ _elm_theme_set(Elm_Theme *th, Evas_Object *o, const char *clas, const char *grou
    file = _elm_theme_group_file_find(th, buf2);
    if (file)
      {
-       ok = edje_object_file_set(o, file, buf2);
-       if (ok) return EINA_TRUE;
+        ok = edje_object_file_set(o, file, buf2);
+        if (ok) return EINA_TRUE;
         else
           DBG("could not set theme group '%s' from file '%s': %s",
               buf2, file, edje_load_error_str(edje_object_load_error_get(o)));
@@ -172,9 +172,9 @@ _elm_theme_icon_set(Elm_Theme *th, Evas_Object *o, const char *group, const char
    file = _elm_theme_group_file_find(th, buf2);
    if (file)
      {
-       _els_smart_icon_file_edje_set(o, file, buf2);
-       _els_smart_icon_size_get(o, &w, &h);
-       if (w > 0) return EINA_TRUE;
+        _els_smart_icon_file_edje_set(o, file, buf2);
+        _els_smart_icon_size_get(o, &w, &h);
+        if (w > 0) return EINA_TRUE;
      }
    snprintf(buf2, sizeof(buf2), "elm/icon/%s/default", group);
    file = _elm_theme_group_file_find(th, buf2);
@@ -224,8 +224,8 @@ _elm_theme_parse(Elm_Theme *th, const char *theme)
    p = eina_list_data_get(eina_list_last(names));
    if ((!p) || ((p) && (strcmp(p, "default"))))
      {
-       p = eina_stringshare_add("default");
-       if (p) names = eina_list_append(names, p);
+        p = eina_stringshare_add("default");
+        if (p) names = eina_list_append(names, p);
      }
    if (th->cache) eina_hash_free(th->cache);
    th->cache = eina_hash_string_superfast_new(EINA_FREE_CB(eina_stringshare_del));
@@ -244,7 +244,7 @@ _elm_theme_shutdown(void)
 
 /**
  * Create a new specific theme
- * 
+ *
  * This creates an empty specific theme that only uses the default theme. A
  * specific theme has its own private set of extensions and overlays too
  * (which are empty by default). Specific themes do not fall back to themes
@@ -256,7 +256,7 @@ _elm_theme_shutdown(void)
  * actually apply it yet. The child of the scroller will have a specific
  * theme set to show this preview before the user decides to apply it to all
  * applications).
- * 
+ *
  * @ingroup Theme
  */
 EAPI Elm_Theme *
@@ -272,11 +272,11 @@ elm_theme_new(void)
 
 /**
  * Free a specific theme
- * 
+ *
  * @param th The theme to free
- * 
+ *
  * This frees a theme created with elm_theme_new().
- * 
+ *
  * @ingroup Theme
  */
 EAPI void
@@ -294,10 +294,10 @@ elm_theme_free(Elm_Theme *th)
 
 /**
  * Copy the theme fom the source to the destination theme
- * 
+ *
  * @param th The source theme to copy from
  * @param thdst The destination theme to copy data to
- * 
+ *
  * This makes a one-time static copy of all the theme config, extensions
  * and overlays from @p th to @p thdst. If @p th references a theme, then
  * @p thdst is also set to reference it, with all the theme settings,
@@ -308,31 +308,31 @@ elm_theme_copy(Elm_Theme *th, Elm_Theme *thdst)
 {
    const Eina_List *l;
    const char *f;
-   
+
    if (!th) th = &(theme_default);
    if (!thdst) thdst = &(theme_default);
    _elm_theme_clear(thdst);
    if (th->ref_theme)
      {
-       thdst->ref_theme = th->ref_theme;
-       thdst->ref_theme->referrers = 
-         eina_list_append(thdst->ref_theme->referrers, thdst);
-       thdst->ref_theme->ref++;
+        thdst->ref_theme = th->ref_theme;
+        thdst->ref_theme->referrers =
+           eina_list_append(thdst->ref_theme->referrers, thdst);
+        thdst->ref_theme->ref++;
      }
    EINA_LIST_FOREACH(th->overlay, l, f)
      {
-       const char *s = eina_stringshare_add(f);
-       if (s) thdst->overlay = eina_list_append(thdst->overlay, s);
+        const char *s = eina_stringshare_add(f);
+        if (s) thdst->overlay = eina_list_append(thdst->overlay, s);
      }
    EINA_LIST_FOREACH(th->themes, l, f)
      {
-       const char *s = eina_stringshare_add(f);
-       if (s) thdst->themes = eina_list_append(thdst->themes, s);
+        const char *s = eina_stringshare_add(f);
+        if (s) thdst->themes = eina_list_append(thdst->themes, s);
      }
    EINA_LIST_FOREACH(th->extension, l, f)
      {
-       const char *s = eina_stringshare_add(f);
-       if (s) thdst->extension = eina_list_append(thdst->extension, s);
+        const char *s = eina_stringshare_add(f);
+        if (s) thdst->extension = eina_list_append(thdst->extension, s);
      }
    if (th->theme) thdst->theme = eina_stringshare_add(th->theme);
    elm_theme_flush(thdst);
@@ -340,10 +340,10 @@ elm_theme_copy(Elm_Theme *th, Elm_Theme *thdst)
 
 /**
  * Tell the source theme to reference the ref theme
- * 
+ *
  * @param th The theme that will do the referencing
  * @param thref The theme that is the reference source
- * 
+ *
  * This clears @p th to be empty and then sets it to refer to @p thref
  * so @p th acts as an override to @p thdst, but where its overrides
  * don't apply, it will fall through to @pthref for configuration.
@@ -357,8 +357,8 @@ elm_theme_ref_set(Elm_Theme *th, Elm_Theme *thref)
    _elm_theme_clear(th);
    if (thref)
      {
-       thref->referrers = eina_list_append(thref->referrers, th);
-       thref->ref++;
+        thref->referrers = eina_list_append(thref->referrers, th);
+        thref->ref++;
      }
    th->ref_theme = thref;
    elm_theme_flush(th);
@@ -366,10 +366,10 @@ elm_theme_ref_set(Elm_Theme *th, Elm_Theme *thref)
 
 /**
  * Return the theme referred to
- * 
+ *
  * @param th The theme to get the reference from
  * @return The referenced theme handle
- * 
+ *
  * This gets the theme set as the reference theme by elm_theme_ref_set().
  * If no theme is set as a reference, NULL is returned.
  */
@@ -382,9 +382,9 @@ elm_theme_ref_get(Elm_Theme *th)
 
 /**
  * Return the default theme
- * 
+ *
  * @return The default theme handle
- * 
+ *
  * This returns the internal default theme setup handle that all widgets
  * use implicitly unless a specific theme is set. This is also often use
  * as a shorthand of NULL.
@@ -400,7 +400,7 @@ elm_theme_default_get(void)
  *
  * @param th The theme to add to, or if NULL, the default theme
  * @param item The Edje file path to be used
- * 
+ *
  * Use this if your application needs to provide some custom overlay theme
  * (An Edje file that replaces some default styles of widgets) where adding
  * new styles, or changing system theme configuration is not possible. Do
@@ -429,7 +429,7 @@ elm_theme_overlay_add(Elm_Theme *th, const char *item)
  * @param item The name of the theme overlay
  *
  * See elm_theme_overlay_add().
- * 
+ *
  * @ingroup Theme
  */
 EAPI void
@@ -441,12 +441,12 @@ elm_theme_overlay_del(Elm_Theme *th, const char *item)
    if (!th) th = &(theme_default);
    s = eina_stringshare_add(item);
    EINA_LIST_FOREACH(th->overlay, l, f)
-     if (f == s)
-       {
-         eina_stringshare_del(f);
-         th->overlay = eina_list_remove_list(th->overlay, (Eina_List *)l);
-         break;
-       }
+      if (f == s)
+        {
+           eina_stringshare_del(f);
+           th->overlay = eina_list_remove_list(th->overlay, (Eina_List *)l);
+           break;
+        }
    eina_stringshare_del(s);
    elm_theme_flush(th);
 }
@@ -467,7 +467,7 @@ elm_theme_overlay_del(Elm_Theme *th, const char *item)
  * path to be search after the default theme. The use of this call is
  * encouraged when default styles do not meet the needs of the application.
  * Use this call instead of elm_theme_overlay_add() for almost all cases.
- * 
+ *
  * @ingroup Theme
  */
 EAPI void
@@ -485,7 +485,7 @@ elm_theme_extension_add(Elm_Theme *th, const char *item)
  *
  * @param th The theme to delete from, or if NULL, the default theme
  * @param item The name of the theme extension
- * 
+ *
  * See elm_theme_extension_add().
  *
  * @ingroup Theme
@@ -499,29 +499,29 @@ elm_theme_extension_del(Elm_Theme *th, const char *item)
    if (!th) th = &(theme_default);
    s = eina_stringshare_add(item);
    EINA_LIST_FOREACH(th->extension, l, f)
-     if (f == s)
-       {
-         eina_stringshare_del(f);
-         th->extension = eina_list_remove_list(th->extension, (Eina_List *)l);
-         break;
-       }
+      if (f == s)
+        {
+           eina_stringshare_del(f);
+           th->extension = eina_list_remove_list(th->extension, (Eina_List *)l);
+           break;
+        }
    eina_stringshare_del(s);
    elm_theme_flush(th);
 }
 
 /**
  * Set the theme search order for the given theme
- * 
+ *
  * @param th The theme to set the search order, or if NULL, the default theme
  * @param theme Theme search string
- * 
+ *
  * This sets the search string for the theme in path-notation from first
  * theme to search, to last, delimited by the : character. Example:
- * 
+ *
  * "shiny:/path/to/file.edj:default"
- * 
+ *
  * See the ELM_THEME environment variable for more information.
- * 
+ *
  * @ingroup Theme
  */
 EAPI void
@@ -539,12 +539,12 @@ elm_theme_set(Elm_Theme *th, const char *theme)
 
 /**
  * Return the theme search order
- * 
+ *
  * @param th The theme to get the search order, or if NULL, the default theme
  * @return The internal search order path
- * 
+ *
  * See elm_theme_set() for more information.
- * 
+ *
  * @ingroup Theme
  */
 EAPI const char *
@@ -578,10 +578,10 @@ elm_theme_get(Elm_Theme *th)
 
 /**
  * Return a list of theme elements to be used in a theme.
- * 
+ *
  * @param th Theme to get the list of theme elements from.
  * @return The internal list of theme elements
- * 
+ *
  * This returns the internal list of theme elements (will only be valid as
  * long as the theme is not modified by elm_theme_set() or theme is not
  * freed by elm_theme_free(). This is a list of strings which must not be
@@ -597,11 +597,11 @@ elm_theme_list_get(const Elm_Theme *th)
 
 /**
  * Return the full patrh for a theme element
- * 
+ *
  * @param f The theme element name
  * @param in_search_path Pointer to a boolean to indicate if item is in the search path or not
  * @return The full path to the file found.
- * 
+ *
  * This returns a string you should free with free() on success, NULL on
  * failure. This will search for the given theme element, and if it is a
  * full or relative path element or a simple searchable name. The returned
@@ -616,19 +616,19 @@ elm_theme_list_item_path_get(const char *f, Eina_Bool *in_search_path)
 {
    static const char *home = NULL;
    char buf[PATH_MAX];
-   
+
    if (!f)
      {
         if (in_search_path) *in_search_path = EINA_FALSE;
         return NULL;
      }
-   
+
    if (!home)
      {
-       home = getenv("HOME");
-       if (!home) home = "";
+        home = getenv("HOME");
+        if (!home) home = "";
      }
-   
+
    if ((f[0] == '/') || ((f[0] == '.') && (f[1] == '/')) ||
        ((f[0] == '.') && (f[1] == '.') && (f[2] == '/')) ||
        ((isalpha(f[0])) && (f[1] == ':')))
@@ -639,7 +639,7 @@ elm_theme_list_item_path_get(const char *f, Eina_Bool *in_search_path)
    else if (((f[0] == '~') && (f[1] == '/')))
      {
         if (in_search_path) *in_search_path = EINA_FALSE;
-       snprintf(buf, sizeof(buf), "%s/%s", home, f + 2);
+        snprintf(buf, sizeof(buf), "%s/%s", home, f + 2);
         return strdup(buf);
      }
    snprintf(buf, sizeof(buf), "%s/.elementary/themes/%s.edj", home, f);
@@ -648,23 +648,23 @@ elm_theme_list_item_path_get(const char *f, Eina_Bool *in_search_path)
         if (in_search_path) *in_search_path = EINA_TRUE;
         return strdup(buf);
      }
-   
+
    snprintf(buf, sizeof(buf), "%s/themes/%s.edj", _elm_data_dir, f);
    if (ecore_file_exists(buf))
      {
         if (in_search_path) *in_search_path = EINA_TRUE;
         return strdup(buf);
      }
-   
+
    if (in_search_path) *in_search_path = EINA_FALSE;
    return NULL;
 }
 
 /**
  * Flush the current theme.
- * 
+ *
  * @param th Theme to flush
- * 
+ *
  * This flushes caches that let elementary know where to find theme elements
  * in the given theme. If @p th is NULL, then the default theme is flushed.
  * Call this call if source theme data has changed in such a way as to
@@ -690,10 +690,10 @@ elm_theme_flush(Elm_Theme *th)
 
 /**
  * This flushes all themes (default and specific ones).
- * 
+ *
  * This will flush all themes in the current application context, by calling
  * elm_theme_flush() on each of them.
- * 
+ *
  * @ingroup Theme
  */
 EAPI void
@@ -701,7 +701,7 @@ elm_theme_full_flush(void)
 {
    Eina_List *l;
    Elm_Theme *th;
-   
+
    EINA_LIST_FOREACH(themes, l, th)
      {
         elm_theme_flush(th);
@@ -722,7 +722,7 @@ elm_theme_all_set(const char *theme)
 {
 #ifdef HAVE_ELEMENTARY_X
    static Ecore_X_Atom atom = 0;
-   
+
    if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_THEME");
    ecore_x_window_prop_string_set(ecore_x_window_root_first_get(),
                                   atom, theme);
@@ -732,12 +732,12 @@ elm_theme_all_set(const char *theme)
 
 /**
  * Return a list of theme elements in the theme search path
- * 
+ *
  * @return A list of strings that are the theme element names.
- * 
+ *
  * This lists all available theme files in the standard Elementary search path
  * for theme elements, and returns them in alphabetical order as theme
- * element names in a list of strings. Free this with 
+ * element names in a list of strings. Free this with
  * elm_theme_name_available_list_free() when you are done with the list.
  */
 EAPI Eina_List *
@@ -747,13 +747,13 @@ elm_theme_name_available_list_new(void)
    Eina_List *dir, *l;
    char buf[PATH_MAX], *file, *s, *th;
    static const char *home = NULL;
-   
+
    if (!home)
      {
         home = getenv("HOME");
         if (!home) home = "";
      }
-   
+
    snprintf(buf, sizeof(buf), "%s/.elementary/themes", home);
    dir = ecore_file_ls(buf);
    EINA_LIST_FREE(dir, file)
@@ -784,7 +784,7 @@ elm_theme_name_available_list_new(void)
              if ((s) && (!strcasecmp(s, ".edj")))
                {
                   int dup;
-                  
+
                   th = strdup(file);
                   s = strchr(th, '.');
                   *s = 0;
@@ -809,8 +809,8 @@ elm_theme_name_available_list_new(void)
 
 /**
  * Free the list returned by elm_theme_name_available_list_new()
- * 
- * This frees the list of themes returned by 
+ *
+ * This frees the list of themes returned by
  * elm_theme_name_available_list_new(). Once freed the list should no longer
  * be used. a new list mys be created.
  */
@@ -823,19 +823,19 @@ elm_theme_name_available_list_free(Eina_List *list)
 
 /**
  * Set a specific theme to be used for this object and its children
- * 
+ *
  * @param obj The object to set the theme on
  * @param th The theme to set
- * 
+ *
  * This sets a specific theme that will be used for the given object and any
  * child objects it has. If @p th is NULL then the theme to be used is
  * cleared and the object will inherit its theme from its parent (which
  * ultimately will use the default theme if no specific themes are set).
- * 
+ *
  * Use special themes with great care as this will annoy users and make
  * configuration difficult. Avoid any custom themes at all if it can be
  * helped.
- * 
+ *
  * @ingroup Theme
  */
 EAPI void
@@ -847,15 +847,15 @@ elm_object_theme_set(Evas_Object *obj, Elm_Theme *th)
 
 /**
  * Get the specific theme to be used
- * 
+ *
  * @param obj The object to get the specific theme from
  * @return The specifc theme set.
- * 
+ *
  * This will return a specific theme set, or NULL if no specific theme is
  * set on that object. It will not return inherited themes from parents, only
  * the specific theme set for that specific object. See elm_object_theme_set()
  * for more information.
- * 
+ *
  * @ingroup Theme
  */
 EAPI Elm_Theme *