1 #ifndef ELM_WIDGET_PROGRESSBAR_H
2 #define ELM_WIDGET_PROGRESSBAR_H
4 #include "elm_widget_layout.h"
11 * @section elm-progressbar-class The Elementary Progressbar Class
13 * Elementary, besides having the @ref Progressbar widget, exposes its
14 * foundation -- the Elementary Progressbar Class -- in order to create other
15 * widgets which are a progressbar with some more logic on top.
19 * @def ELM_PROGRESSBAR_CLASS
21 * Use this macro to cast whichever subclass of
22 * #Elm_Progressbar_Smart_Class into it, so to access its fields.
26 #define ELM_PROGRESSBAR_CLASS(x) ((Elm_Progressbar_Smart_Class *)x)
29 * @def ELM_PROGRESSBAR_DATA
31 * Use this macro to cast whichever subdata of
32 * #Elm_Progressbar_Smart_Data into it, so to access its fields.
36 #define ELM_PROGRESSBAR_DATA(x) ((Elm_Progressbar_Smart_Data *)x)
39 * @def ELM_PROGRESSBAR_SMART_CLASS_VERSION
41 * Current version for Elementary progressbar @b base smart class, a value
42 * which goes to _Elm_Progressbar_Smart_Class::version.
46 #define ELM_PROGRESSBAR_SMART_CLASS_VERSION 1
49 * @def ELM_PROGRESSBAR_SMART_CLASS_INIT
51 * Initializer for a whole #Elm_Progressbar_Smart_Class structure, with
52 * @c NULL values on its specific fields.
54 * @param smart_class_init initializer to use for the "base" field
55 * (#Evas_Smart_Class).
57 * @see EVAS_SMART_CLASS_INIT_NULL
58 * @see EVAS_SMART_CLASS_INIT_NAME_VERSION
59 * @see ELM_PROGRESSBAR_SMART_CLASS_INIT_NULL
60 * @see ELM_PROGRESSBAR_SMART_CLASS_INIT_NAME_VERSION
64 #define ELM_PROGRESSBAR_SMART_CLASS_INIT(smart_class_init) \
65 {smart_class_init, ELM_PROGRESSBAR_SMART_CLASS_VERSION}
68 * @def ELM_PROGRESSBAR_SMART_CLASS_INIT_NULL
70 * Initializer to zero out a whole #Elm_Progressbar_Smart_Class structure.
72 * @see ELM_PROGRESSBAR_SMART_CLASS_INIT_NAME_VERSION
73 * @see ELM_PROGRESSBAR_SMART_CLASS_INIT
77 #define ELM_PROGRESSBAR_SMART_CLASS_INIT_NULL \
78 ELM_PROGRESSBAR_SMART_CLASS_INIT(EVAS_SMART_CLASS_INIT_NULL)
81 * @def ELM_PROGRESSBAR_SMART_CLASS_INIT_NAME_VERSION
83 * Initializer to zero out a whole #Elm_Progressbar_Smart_Class structure and
84 * set its name and version.
86 * This is similar to #ELM_PROGRESSBAR_SMART_CLASS_INIT_NULL, but it will
87 * also set the version field of #Elm_Progressbar_Smart_Class (base field)
88 * to the latest #ELM_PROGRESSBAR_SMART_CLASS_VERSION and name it to the
91 * It will keep a reference to the name field as a <c>"const char *"</c>,
92 * i.e., the name must be available while the structure is
93 * used (hint: static or global variable!) and must not be modified.
95 * @see ELM_PROGRESSBAR_SMART_CLASS_INIT_NULL
96 * @see ELM_PROGRESSBAR_SMART_CLASS_INIT
100 #define ELM_PROGRESSBAR_SMART_CLASS_INIT_NAME_VERSION(name) \
101 ELM_PROGRESSBAR_SMART_CLASS_INIT \
102 (ELM_LAYOUT_SMART_CLASS_INIT_NAME_VERSION(name))
105 * Elementary progressbar base smart class. This inherits directly from
106 * #Elm_Layout_Smart_Class and is meant to build widgets extending the
107 * behavior of a progressbar.
109 * All of the functions listed on @ref Progressbar namespace will work for
110 * objects deriving from #Elm_Progressbar_Smart_Class.
112 typedef struct _Elm_Progressbar_Smart_Class
114 Elm_Layout_Smart_Class base;
116 int version; /**< Version of this smart class definition */
117 } Elm_Progressbar_Smart_Class;
120 * Base layout smart data extended with progressbar instance data.
122 typedef struct _Elm_Progressbar_Smart_Data Elm_Progressbar_Smart_Data;
123 struct _Elm_Progressbar_Smart_Data
125 Elm_Layout_Smart_Data base;
133 Eina_Bool horizontal : 1;
134 Eina_Bool inverted : 1;
136 Eina_Bool pulse_state : 1;
138 char *(*unit_format_func)(double val);
139 void (*unit_format_free)(char *str);
146 EAPI extern const char ELM_PROGRESSBAR_SMART_NAME[];
147 EAPI const Elm_Progressbar_Smart_Class *elm_progressbar_smart_class_get(void);
149 #define ELM_PROGRESSBAR_DATA_GET(o, sd) \
150 Elm_Progressbar_Smart_Data * sd = evas_object_smart_data_get(o)
152 #define ELM_PROGRESSBAR_DATA_GET_OR_RETURN(o, ptr) \
153 ELM_PROGRESSBAR_DATA_GET(o, ptr); \
156 CRITICAL("No widget data for object %p (%s)", \
157 o, evas_object_type_get(o)); \
161 #define ELM_PROGRESSBAR_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
162 ELM_PROGRESSBAR_DATA_GET(o, ptr); \
165 CRITICAL("No widget data for object %p (%s)", \
166 o, evas_object_type_get(o)); \
170 #define ELM_PROGRESSBAR_CHECK(obj) \
171 if (!obj || !elm_widget_type_check((obj), ELM_PROGRESSBAR_SMART_NAME, \