elm_icon: move lookup_order and standard feature from eo to legacy

This commit is contained in:
Ji-Youn Park 2016-04-26 17:24:51 +08:30
parent ff8ee01432
commit 3279d4fae8
7 changed files with 168 additions and 150 deletions

View File

@ -644,6 +644,13 @@ _elm_icon_eo_base_constructor(Eo *obj, Elm_Icon_Data *sd)
return obj;
}
static void
_elm_icon_class_constructor(Eo_Class *klass)
{
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
}
/* Legacy deprecated functions */
EAPI Eina_Bool
elm_icon_memfile_set(Evas_Object *obj,
const void *img,
@ -731,45 +738,6 @@ elm_icon_animated_play_get(const Evas_Object *obj)
return elm_image_animated_play_get(obj);
}
EOLIAN static Eina_Bool
_elm_icon_standard_set(Eo *obj, Elm_Icon_Data *_pd EINA_UNUSED, const char *name)
{
Eina_Bool fdo = EINA_FALSE;
if (!name) return EINA_FALSE;
evas_object_event_callback_del_full
(obj, EVAS_CALLBACK_RESIZE, _elm_icon_standard_resize_cb, obj);
Eina_Bool int_ret = _internal_elm_icon_standard_set(obj, name, &fdo);
if (fdo)
evas_object_event_callback_add
(obj, EVAS_CALLBACK_RESIZE, _elm_icon_standard_resize_cb, obj);
return int_ret;
}
EOLIAN static const char*
_elm_icon_standard_get(Eo *obj EINA_UNUSED, Elm_Icon_Data *sd)
{
return sd->stdicon;
}
EINA_DEPRECATED EOLIAN static void
_elm_icon_order_lookup_set(Eo *obj EINA_UNUSED, Elm_Icon_Data *sd EINA_UNUSED,
Elm_Icon_Lookup_Order order EINA_UNUSED)
{
// this method's behaviour has been overridden by elm_config_icon_theme_set
}
EINA_DEPRECATED EOLIAN static Elm_Icon_Lookup_Order
_elm_icon_order_lookup_get(Eo *obj EINA_UNUSED, Elm_Icon_Data *sd EINA_UNUSED)
{
return ELM_ICON_LOOKUP_FDO_THEME;
}
EAPI void
elm_icon_smooth_set(Evas_Object *obj,
Eina_Bool smooth)
@ -902,12 +870,6 @@ elm_icon_aspect_fixed_get(const Evas_Object *obj)
return elm_image_aspect_fixed_get(obj);
}
static void
_elm_icon_class_constructor(Eo_Class *klass)
{
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
}
EAPI void
elm_icon_thumb_set(Evas_Object *obj, const char *file, const char *group)
{
@ -938,4 +900,47 @@ elm_icon_thumb_set(Evas_Object *obj, const char *file, const char *group)
}
}
EAPI Eina_Bool
elm_icon_standard_set(Evas_Object *obj, const char *name)
{
Eina_Bool fdo = EINA_FALSE;
ELM_ICON_CHECK(obj) EINA_FALSE;
if (!name) return EINA_FALSE;
evas_object_event_callback_del_full
(obj, EVAS_CALLBACK_RESIZE, _elm_icon_standard_resize_cb, obj);
Eina_Bool int_ret = _internal_elm_icon_standard_set(obj, name, &fdo);
if (fdo)
evas_object_event_callback_add
(obj, EVAS_CALLBACK_RESIZE, _elm_icon_standard_resize_cb, obj);
return int_ret;
}
EAPI const char*
elm_icon_standard_get(const Evas_Object *obj)
{
ELM_ICON_CHECK(obj) NULL;
ELM_ICON_DATA_GET(obj, sd);
return sd->stdicon;
}
EAPI void
elm_icon_order_lookup_set(Evas_Object *obj EINA_UNUSED,
Elm_Icon_Lookup_Order order EINA_UNUSED)
{
// this method's behaviour has been overridden by elm_config_icon_theme_set
}
EAPI Elm_Icon_Lookup_Order
elm_icon_order_lookup_get(const Evas_Object *obj EINA_UNUSED)
{
return ELM_ICON_LOOKUP_FDO_THEME;
}
#include "elm_icon.eo.c"

View File

@ -6,83 +6,10 @@ enum Elm.Icon.Type
standard
}
enum Elm.Icon.Lookup_Order
{
[[Lookup order used by elm_icon_standard_set(). Should look for icons in
the theme, FDO paths, or both?
Warning: This enum will be removed as the lookup_order is deprecated.
]]
legacy: elm_icon_lookup;
fdo_theme, [[Icon look up order: freedesktop, theme.]]
theme_fdo, [[Icon look up order: theme, freedesktop.]]
fdo, [[Icon look up order: freedesktop.]]
theme [[Icon look up order: theme.]]
}
class Elm.Icon (Elm.Image)
{
eo_prefix: elm_obj_icon;
methods {
@property order_lookup {
[[Warning: the order_lookup property is deprecated.
See elm_config_icon_theme_set instead.]]
set {
[[Sets the icon lookup order used by elm_icon_standard_set().
See also @.order_lookup.get, @Elm.Icon.Lookup_Order.
]]
}
get {
[[Get the icon lookup order.
See also @.order_lookup.set, @Elm.Icon.Lookup_Order.
]]
}
values {
order: Elm.Icon.Lookup_Order(Elm.Icon.Lookup_Order.theme_fdo); [[The icon lookup order (can be
one of ELM_ICON_LOOKUP_FDO_THEME,
ELM_ICON_LOOKUP_THEME_FDO,
ELM_ICON_LOOKUP_FDO or
ELM_ICON_LOOKUP_THEME)
]]
}
}
@property standard {
set {
[[Set the icon by icon standards names.
For example, freedesktop.org defines standard icon names such
as "home", "network", etc. There can be different icon sets to
match those icon keys. The "name" given as parameter is one of
these "keys", and will be used to look in the freedesktop.org
paths and elementary theme. One can change the lookup order
with @.order_lookup.set.
If name is not found in any of the expected locations and it is
the absolute path of an image file, this image will be used.
Note: The icon image set by this function can be changed by
@Efl.File.file.set.
Note: This function does not accept relative icon path.
See also @.standard.get.
]]
return: bool; [[true on success, false on error]]
}
get {
[[Get the icon name set by icon standard names.
If the icon image was set using elm_image_file_set() instead of
@.standard.set, then this function will return null.
]]
}
values {
name: const(char)*; [[The icon name]]
}
}
}
implements {
class.constructor;

View File

@ -1,3 +1,16 @@
/** Lookup order used by elm_icon_standard_set(). Should look for icons in the
* theme, FDO paths, or both?
*
* @ingroup Elm_Icon
*/
typedef enum
{
ELM_ICON_LOOKUP_FDO_THEME = 0, /** Icon look up order: freedesktop, theme. */
ELM_ICON_LOOKUP_THEME_FDO, /** Icon look up order: theme, freedesktop. */
ELM_ICON_LOOKUP_FDO, /** Icon look up order: freedesktop. */
ELM_ICON_LOOKUP_THEME /** Icon look up order: theme. */
} Elm_Icon_Lookup_Order;
/**
* Add a new icon object to the parent.
*
@ -24,5 +37,69 @@ EAPI Evas_Object *elm_icon_add(Evas_Object *parent);
* @ingroup Elm_Icon
*/
EAPI void elm_icon_thumb_set(Evas_Object *obj, const char *file, const char *group);
/**
* @brief Sets the icon lookup order used by elm_icon_standard_set().
*
* See also @ref elm_icon_order_lookup_get, @ref Elm_Icon_Lookup_Order.
*
* @param[in] order The icon lookup order (can be one of
* ELM_ICON_LOOKUP_FDO_THEME, ELM_ICON_LOOKUP_THEME_FDO, ELM_ICON_LOOKUP_FDO or
* ELM_ICON_LOOKUP_THEME)
*
* @ingroup Elm_Icon
*/
#include "elm_icon.eo.legacy.h"
EAPI void elm_icon_order_lookup_set(Evas_Object *obj EINA_UNUSED, Elm_Icon_Lookup_Order order EINA_UNUSED);
/**
* @brief Get the icon lookup order.
*
* See also @ref elm_icon_order_lookup_set, @ref Elm_Icon_Lookup_Order.
*
* @return The icon lookup order (can be one of ELM_ICON_LOOKUP_FDO_THEME,
* ELM_ICON_LOOKUP_THEME_FDO, ELM_ICON_LOOKUP_FDO or ELM_ICON_LOOKUP_THEME)
*
* @ingroup Elm_Icon
*/
EAPI Elm_Icon_Lookup_Order elm_icon_order_lookup_get(const Evas_Object *obj EINA_UNUSED);
/**
* @brief Set the icon by icon standards names.
*
* For example, freedesktop.org defines standard icon names such as "home",
* "network", etc. There can be different icon sets to match those icon keys.
* The "name" given as parameter is one of these "keys", and will be used to
* look in the freedesktop.org paths and elementary theme. One can change the
* lookup order with @ref elm_icon_order_lookup_set.
*
* If name is not found in any of the expected locations and it is the absolute
* path of an image file, this image will be used.
*
* @note The icon image set by this function can be changed by
* @ref Efl.File.file.set.
*
* @note This function does not accept relative icon path.
*
* See also @ref elm_icon_standard_get.
*
* @param[in] name The icon name
*
* @return true on success, false on error
*
* @ingroup Elm_Icon
*/
EAPI Eina_Bool elm_icon_standard_set(Evas_Object *obj, const char *name);
/**
* @brief Get the icon name set by icon standard names.
*
* If the icon image was set using elm_image_file_set() instead of
* @ref elm_icon_standard_set, then this function will return null.
*
* @return The icon name
*
* @ingroup Elm_Icon
*/
EAPI const char *elm_icon_standard_get(const Evas_Object *obj);
#include "elm_icon.eo.legacy.h"

View File

@ -3810,19 +3810,6 @@ _elm_toolbar_item_state_prev(Eo *eo_item EINA_UNUSED, Elm_Toolbar_Item_Data *ite
return eina_list_data_get(prev_state);
}
EINA_DEPRECATED EOLIAN static void
_elm_toolbar_icon_order_lookup_set(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd EINA_UNUSED,
Elm_Icon_Lookup_Order order EINA_UNUSED)
{
// this method's behaviour has been overridden by elm_config_icon_theme_set
}
EINA_DEPRECATED EOLIAN static Elm_Icon_Lookup_Order
_elm_toolbar_icon_order_lookup_get(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd EINA_UNUSED)
{
return ELM_ICON_LOOKUP_FDO_THEME;
}
EOLIAN static void
_elm_toolbar_horizontal_set(Eo *obj, Elm_Toolbar_Data *sd, Eina_Bool horizontal)
{
@ -4105,6 +4092,19 @@ _elm_toolbar_evas_object_smart_calculate(Eo *obj, Elm_Toolbar_Data *pd EINA_UNUS
_sizing_eval(obj);
}
/* Legacy deprecated functions */
EAPI void
elm_toolbar_icon_order_lookup_set(Evas_Object *obj EINA_UNUSED,
Elm_Icon_Lookup_Order order EINA_UNUSED)
{
// this method's behaviour has been overridden by elm_config_icon_theme_set
}
EAPI Elm_Icon_Lookup_Order
elm_toolbar_icon_order_lookup_get(const Evas_Object *obj EINA_UNUSED)
{
return ELM_ICON_LOOKUP_FDO_THEME;
}
#include "elm_toolbar.eo.c"
#include "elm_toolbar_item.eo.c"

View File

@ -102,22 +102,6 @@ class Elm.Toolbar (Elm.Widget, Elm.Interface_Scrollable,
horizontal: bool; [[If $true, the toolbar is horizontal.]]
}
}
@property icon_order_lookup {
[[Sets icon lookup order, for toolbar items' icons.
Icons added before calling this function will not be affected.
The default lookup order is #ELM_ICON_LOOKUP_THEME_FDO.
Warning: the icon_order_lookup property is deprecated.
See elm_config_icon_theme_set instead.]]
set {
}
get {
}
values {
order: Elm.Icon.Lookup_Order(1); [[The icon lookup order. (If getting the icon order loopup fails, it returns #ELM_ICON_LOOKUP_THEME_FDO)]]
}
}
@property shrink_mode {
[[Control the item displaying mode of a given toolbar widget $obj.

View File

@ -102,7 +102,7 @@ class Elm.Toolbar_Item(Elm.Widget_Item)
Toolbar will load icon image from fdo or current theme.
This behavior can be set by
@Elm.Toolbar.icon_order_lookup.set function.
elm_toolbar_icon_order_lookup_set function.
If an absolute path is provided it will load it direct
from a file.
@ -217,7 +217,7 @@ class Elm.Toolbar_Item(Elm.Widget_Item)
[[Add a new state to $item.
Toolbar will load icon image from fdo or current theme.
This behavior can be set by @Elm.Toolbar.icon_order_lookup.set
This behavior can be set by elm_toolbar_icon_order_lookup_set
function. If an absolute path is provided it will load it
direct from a file.

View File

@ -60,5 +60,30 @@ EAPI void elm_toolbar_transverse_expanded_set(Evas_Objec
*/
EAPI Eina_Bool elm_toolbar_transverse_expanded_get(const Evas_Object *obj);
/**
* Sets icon lookup order, for toolbar items' icons.
*
* Icons added before calling this function will not be affected. The default
* lookup order is #ELM_ICON_LOOKUP_THEME_FDO.
*
* @param[in] order The icon lookup order. (If getting the icon order loopup
* fails, it returns #ELM_ICON_LOOKUP_THEME_FDO)
*
* @ingroup Elm_Toolbar
*/
EAPI void elm_toolbar_icon_order_lookup_set(Evas_Object *obj EINA_UNUSED, Elm_Icon_Lookup_Order order EINA_UNUSED);
/**
* Gets icon lookup order, for toolbar items' icons.
*
* Icons added before calling this function will not be affected. The default
* lookup order is #ELM_ICON_LOOKUP_THEME_FDO.
*
* @return The icon lookup order. (If getting the icon order loopup fails, it
* returns #ELM_ICON_LOOKUP_THEME_FDO)
*
* @ingroup Elm_Toolbar
*/
EAPI Elm_Icon_Lookup_Order elm_toolbar_icon_order_lookup_get(const Evas_Object *obj EINA_UNUSED);
#include "elm_toolbar_item.eo.legacy.h"
#include "elm_toolbar.eo.legacy.h"