1 #ifndef ELM_WIDGET_ICON_H
2 #define ELM_WIDGET_ICON_H
4 #include "elm_widget_image.h"
10 * @section elm-icon-class The Elementary Icon Class
12 * This class defines a common interface for @b icon objects having
13 * an icon as their basic graphics.
19 * Use this macro to cast whichever subclass of
20 * #Elm_Icon_Smart_Class into it, so to access its fields.
24 #define ELM_ICON_CLASS(x) ((Elm_Icon_Smart_Class *) x)
29 * Use this macro to cast whichever subdata of
30 * #Elm_Icon_Smart_Data into it, so to access its fields.
34 #define ELM_ICON_DATA(x) ((Elm_Icon_Smart_Data *) x)
37 * @def ELM_ICON_SMART_CLASS_VERSION
39 * Current version for Elementary icon @b base smart class, a value
40 * which goes to _Elm_Icon_Smart_Class::version.
44 #define ELM_ICON_SMART_CLASS_VERSION 1
47 * @def ELM_ICON_SMART_CLASS_INIT
49 * Initializer for a whole #Elm_Icon_Smart_Class structure, with
50 * @c NULL values on its specific fields.
52 * @param smart_class_init initializer to use for the "base" field
53 * (#Evas_Smart_Class).
55 * @see EVAS_SMART_CLASS_INIT_NULL
56 * @see EVAS_SMART_CLASS_INIT_NAME_VERSION
57 * @see ELM_ICON_SMART_CLASS_INIT_NULL
58 * @see ELM_ICON_SMART_CLASS_INIT_NAME_VERSION
62 #define ELM_ICON_SMART_CLASS_INIT(smart_class_init) \
63 {smart_class_init, ELM_ICON_SMART_CLASS_VERSION}
66 * @def ELM_ICON_SMART_CLASS_INIT_NULL
68 * Initializer to zero out a whole #Elm_Icon_Smart_Class structure.
70 * @see ELM_ICON_SMART_CLASS_INIT_NAME_VERSION
71 * @see ELM_ICON_SMART_CLASS_INIT
75 #define ELM_ICON_SMART_CLASS_INIT_NULL \
76 ELM_ICON_SMART_CLASS_INIT(EVAS_SMART_CLASS_INIT_NULL)
79 * @def ELM_ICON_SMART_CLASS_INIT_NAME_VERSION
81 * Initializer to zero out a whole #Elm_Icon_Smart_Class structure and
82 * set its name and version.
84 * This is similar to #ELM_ICON_SMART_CLASS_INIT_NULL, but it will
85 * also set the version field of #Elm_Icon_Smart_Class (base field)
86 * to the latest #ELM_ICON_SMART_CLASS_VERSION and name it to the
89 * It will keep a reference to the name field as a <c>"const char *"</c>,
90 * i.e., the name must be available while the structure is
91 * used (hint: static or global variable!) and must not be modified.
93 * @see ELM_ICON_SMART_CLASS_INIT_NULL
94 * @see ELM_ICON_SMART_CLASS_INIT
98 #define ELM_ICON_SMART_CLASS_INIT_NAME_VERSION(name) \
99 ELM_ICON_SMART_CLASS_INIT(ELM_IMAGE_SMART_CLASS_INIT_NAME_VERSION(name))
102 * Elementary icon base smart class. This inherits directly from
103 * #Elm_Image_Smart_Class and is meant to build widgets relying on an
104 * icon as the building block of its visuals.
106 typedef struct _Elm_Icon_Smart_Class
108 Elm_Image_Smart_Class base;
110 int version; /**< Version of this smart class definition */
111 } Elm_Icon_Smart_Class;
113 typedef struct _Elm_Icon_Smart_Data Elm_Icon_Smart_Data;
114 struct _Elm_Icon_Smart_Data
116 Elm_Image_Smart_Data base;
119 Elm_Icon_Lookup_Order lookup_order;
121 #ifdef HAVE_ELEMENTARY_ETHUMB
130 Ecore_Event_Handler *eeh;
132 Ethumb_Thumb_Format format;
134 Ethumb_Client_Async *request;
150 /* WARNING: to be deprecated */
151 Eina_List *edje_signals;
153 Eina_Bool is_video : 1;
160 EAPI extern const char ELM_ICON_SMART_NAME[];
161 EAPI const Elm_Icon_Smart_Class *elm_icon_smart_class_get(void);
163 #define ELM_ICON_DATA_GET(o, sd) \
164 Elm_Icon_Smart_Data * sd = evas_object_smart_data_get(o)
166 #define ELM_ICON_DATA_GET_OR_RETURN(o, ptr) \
167 ELM_ICON_DATA_GET(o, ptr); \
170 CRITICAL("No widget data for object %p (%s)", \
171 o, evas_object_type_get(o)); \
175 #define ELM_ICON_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
176 ELM_ICON_DATA_GET(o, ptr); \
179 CRITICAL("No widget data for object %p (%s)", \
180 o, evas_object_type_get(o)); \
184 #define ELM_ICON_CHECK(obj) \
185 if (!obj || !elm_widget_type_check((obj), ELM_ICON_SMART_NAME, __func__)) \