1 #ifndef _EVAS_H 2 # error You shall not include this header directly 3 #endif 4 5 /** 6 * @def EVAS_VERSION_MAJOR 7 * The major number of evas version 8 */ 9 #define EVAS_VERSION_MAJOR EFL_VERSION_MAJOR 10 11 /** 12 * @def EVAS_VERSION_MINOR 13 * The minor number of evas version 14 */ 15 #define EVAS_VERSION_MINOR EFL_VERSION_MINOR 16 17 /** 18 * @typedef Evas_Version 19 * 20 * This is the Evas version information structure that can be used at 21 * runtime to detect which version of evas is being used and adapt 22 * appropriately as follows for example: 23 * 24 * @code 25 * #if defined(EVAS_VERSION_MAJOR) && (EVAS_VERSION_MAJOR >= 1) && defined(EVAS_VERSION_MINOR) && (EVAS_VERSION_MINOR > 0) 26 * printf("Evas version: %i.%i.%i\n", 27 * evas_version->major, 28 * evas_version->minor, 29 * evas_version->micro); 30 * if (evas_version->revision > 0) 31 * { 32 * printf(" Built from Git revision # %i\n", evas_version->revision); 33 * } 34 * #endif 35 * @endcode 36 * 37 */ 38 39 typedef struct _Evas_Version 40 { 41 int major; /**< major (binary or source incompatible changes) */ 42 int minor; /**< minor (new features, bugfixes, major improvements version) */ 43 int micro; /**< micro (bugfix, internal improvements, no new features version) */ 44 int revision; /**< git revision (0 if a proper release or the git revision number Evas is built from) */ 45 } Evas_Version; 46 47 /** 48 * Evas Version Information 49 * @ingroup Evas_Main_Group 50 */ 51 52 EAPI extern Evas_Version * evas_version; 53 54 /** 55 * @file 56 * @brief These routines are used for Evas library interaction. 57 * 58 * @todo check boolean return values and convert to Eina_Bool 59 * @todo change all api to use EINA_SAFETY_* 60 * @todo finish api documentation 61 */ 62 63 /** 64 * @def EVAS_CALLBACK_PRIORITY_BEFORE 65 * Slightly more prioritized than default. 66 * @since 1.1 67 */ 68 #define EVAS_CALLBACK_PRIORITY_BEFORE -100 69 70 /** 71 * @def EVAS_CALLBACK_PRIORITY_DEFAULT 72 * Default callback priority level 73 * @since 1.1 74 */ 75 #define EVAS_CALLBACK_PRIORITY_DEFAULT 0 76 77 /** 78 * @def EVAS_CALLBACK_PRIORITY_AFTER 79 * Slightly less prioritized than default. 80 * @since 1.1 81 */ 82 #define EVAS_CALLBACK_PRIORITY_AFTER 100 83 84 /** 85 * @typedef Evas_Callback_Priority 86 * 87 * Callback priority value. Range is -32k - 32k. The lower the number, the 88 * bigger the priority. 89 * 90 * @see EVAS_CALLBACK_PRIORITY_AFTER 91 * @see EVAS_CALLBACK_PRIORITY_BEFORE 92 * @see EVAS_CALLBACK_PRIORITY_DEFAULT 93 * 94 * @since 1.1 95 */ 96 // Support not having eo available 97 #ifdef EFL_BETA_API_SUPPORT 98 typedef Efl_Callback_Priority Evas_Callback_Priority; 99 #else 100 typedef short Evas_Callback_Priority; 101 #endif 102 103 // TODO: Mark as EINA_DEPRECATED 104 typedef struct _Evas_Coord_Rectangle Evas_Coord_Rectangle; /**< A generic rectangle handle. @deprecated Use Eina_Rectangle instead */ 105 typedef struct _Evas_Point Evas_Point; /**< integer point */ 106 107 typedef struct _Evas_Coord_Point Evas_Coord_Point; /**< Evas_Coord point */ 108 typedef struct _Evas_Coord_Precision_Point Evas_Coord_Precision_Point; /**< Evas_Coord point with sub-pixel precision */ 109 110 typedef struct _Evas_Coord_Size Evas_Coord_Size; /**< Evas_Coord size @since 1.8 */ 111 typedef struct _Evas_Coord_Precision_Size Evas_Coord_Precision_Size; /**< Evas_Coord size with sub-pixel precision @since 1.8 */ 112 113 typedef struct _Evas_Position Evas_Position; /**< associates given point in Canvas and Output */ 114 typedef struct _Evas_Precision_Position Evas_Precision_Position; /**< associates given point in Canvas and Output, with sub-pixel precision */ 115 116 typedef int Evas_Coord; /**< Type used for coordinates (in pixels, int). */ 117 typedef int Evas_Font_Size; /**< Type used for font sizes (int). */ 118 119 /** 120 * @typedef Evas_Smart_Class 121 * 122 * A smart object's @b base class definition 123 * 124 * @ingroup Evas_Smart_Group 125 */ 126 typedef struct _Evas_Smart_Class Evas_Smart_Class; 127 128 /** 129 * @typedef Evas_Smart_Interface 130 * 131 * A smart object's @b base interface definition 132 * 133 * An Evas interface is exactly like the OO-concept: a 'contract' or 134 * API a given object is declared to support. A smart object may have 135 * more than one interface, thus extending the behavior it gets from 136 * sub-classing. 137 * 138 * @since 1.7 139 * 140 * @ingroup Evas_Smart_Group 141 */ 142 typedef struct _Evas_Smart_Interface Evas_Smart_Interface; 143 144 /** 145 * @typedef Evas_Smart_Cb_Description 146 * 147 * A smart object callback description, used to provide introspection 148 * 149 * @ingroup Evas_Smart_Group 150 */ 151 typedef struct _Evas_Smart_Cb_Description Evas_Smart_Cb_Description; 152 153 /** 154 * @typedef Evas 155 * 156 * An opaque handle to an Evas canvas. 157 * 158 * @see evas_new() 159 * @see evas_free() 160 * 161 * @ingroup Evas_Canvas 162 */ 163 typedef Eo Evas; 164 165 /** 166 * @typedef Evas_Public_Data 167 * Public data for an Evas. 168 * @ingroup Evas_Canvas 169 */ 170 typedef struct _Evas_Public_Data Evas_Public_Data; 171 172 /** 173 * @typedef Efl_Canvas_Object 174 * An Evas Object handle 175 * @see Evas_Object 176 * @ingroup Evas_Object_Group 177 */ 178 typedef Eo Efl_Canvas_Object; 179 180 /** 181 * @typedef Evas_Object 182 * An Evas Object handle. 183 * @ingroup Evas_Object_Group 184 */ 185 typedef Efl_Canvas_Object Evas_Object; 186 187 /* These defines are used in H files generated by Eolian to avoid 188 * redefinition of types */ 189 #define _EFL_CANVAS_OBJECT_EO_CLASS_TYPE 190 191 /** 192 * Type of abstract VG node 193 */ 194 typedef Eo Efl_VG; 195 196 typedef void Evas_Performance; /**< An Evas Performance handle */ 197 typedef struct _Evas_Smart Evas_Smart; /**< An Evas Smart Object handle */ 198 typedef int Evas_Angle; /**< A type for angle */ 199 200 // FIXME: This can be a simple alias to Eina_Rectangle instead. 201 struct _Evas_Coord_Rectangle /** A rectangle in Evas_Coord */ 202 { 203 Evas_Coord x; /**< top-left x co-ordinate of rectangle */ 204 Evas_Coord y; /**< top-left y co-ordinate of rectangle */ 205 Evas_Coord w; /**< width of rectangle */ 206 Evas_Coord h; /**< height of rectangle */ 207 }; 208 209 struct _Evas_Coord_Point /** A Point in Evas_Coord */ 210 { 211 Evas_Coord x; /**< x co-ordinate */ 212 Evas_Coord y; /**< y co-ordinate */ 213 }; 214 215 struct _Evas_Coord_Size /** A size in Evas_Coord */ 216 { 217 Evas_Coord w; /**< width */ 218 Evas_Coord h; /**< height */ 219 }; 220 221 222 struct _Evas_Coord_Precision_Size /** A size in Evas_Coord with subpixel precision*/ 223 { 224 Evas_Coord w; /**< width */ 225 Evas_Coord h; /**< height */ 226 double wsub; /**< subpixel precision for width */ 227 double ysub; /**< subpixel precision for height */ 228 }; 229 230 struct _Evas_Coord_Precision_Point /** A point in Evas_Coord with subpixel precision*/ 231 { 232 Evas_Coord x; /**< x co-ordinate */ 233 Evas_Coord y; /**< y co-ordinate */ 234 double xsub; /**< subpixel precision for x */ 235 double ysub; /**< subpixel precision for y */ 236 }; 237 238 struct _Evas_Point /** A point */ 239 { 240 int x; /**< x co-ordinate */ 241 int y; /**< y co-ordinate */ 242 }; 243 244 struct _Evas_Position /** A position */ 245 { 246 Evas_Point output; /**< position on the output */ 247 Evas_Coord_Point canvas; /**< position on the canvas */ 248 }; 249 250 struct _Evas_Precision_Position /** A position with precision*/ 251 { 252 Evas_Point output; /**< position on the output */ 253 Evas_Coord_Precision_Point canvas; /**< position on the canvas */ 254 }; 255 256 typedef struct _Evas_Pixel_Import_Source Evas_Pixel_Import_Source; /**< A source description of pixels for importing pixels */ 257 258 /* Opaque types */ 259 typedef Eo Evas_Device; /**< A source device handle - where the event came from */ 260 261 typedef enum _Evas_Image_Content_Hint 262 { 263 EVAS_IMAGE_CONTENT_HINT_NONE = 0, /**< No hint at all */ 264 EVAS_IMAGE_CONTENT_HINT_DYNAMIC = 1, /**< The contents will change over time */ 265 EVAS_IMAGE_CONTENT_HINT_STATIC = 2 /**< The contents won't change over time */ 266 } Evas_Image_Content_Hint; /**< How an image's data is to be treated by Evas, for optimization */ 267 268 typedef enum _Evas_Alloc_Error 269 { 270 EVAS_ALLOC_ERROR_NONE = 0, /**< No allocation error */ 271 EVAS_ALLOC_ERROR_FATAL = 1, /**< Allocation failed despite attempts to free up memory */ 272 EVAS_ALLOC_ERROR_RECOVERED = 2 /**< Allocation succeeded after freeing up speculative resource memory */ 273 } Evas_Alloc_Error; /**< Possible allocation errors returned by evas_alloc_error() */ 274 275 typedef enum _Evas_Pixel_Import_Pixel_Format 276 { 277 EVAS_PIXEL_FORMAT_NONE = 0, /**< No pixel format */ 278 EVAS_PIXEL_FORMAT_ARGB32 = 1, /**< ARGB 32bit pixel format with A in the high byte per 32bit pixel word */ 279 EVAS_PIXEL_FORMAT_YUV420P_601 = 2 /**< YUV 420 Planar format with CCIR 601 color encoding with contiguous planes in the order Y, U and V */ 280 } Evas_Pixel_Import_Pixel_Format; /**< Pixel format for import call. See evas_object_image_pixels_import() */ 281 282 struct _Evas_Pixel_Import_Source 283 { 284 Evas_Pixel_Import_Pixel_Format format; /**< pixel format type ie ARGB32, YUV420P_601 etc. */ 285 int w, h; /**< width and height of source in pixels */ 286 void **rows; /**< an array of pointers (size depends on format) pointing to left edge of each scanline */ 287 }; 288 289 #define EVAS_LAYER_MIN -32768 /**< bottom-most layer number */ 290 #define EVAS_LAYER_MAX 32767 /**< top-most layer number */ 291 292 #define EVAS_COLOR_SPACE_ARGB 0 /**< Not used for anything */ 293 #define EVAS_COLOR_SPACE_AHSV 1 /**< Not used for anything */ 294 #define EVAS_TEXT_INVALID -1 /**< Not used for anything */ 295 #define EVAS_TEXT_SPECIAL -2 /**< Not used for anything */ 296 297 #define EVAS_HINT_EXPAND 1.0 /**< Use with evas_object_size_hint_weight_set(), evas_object_size_hint_weight_get(), evas_object_size_hint_expand_set(), evas_object_size_hint_expand_get() */ 298 #define EVAS_HINT_FILL -1.0 /**< Use with evas_object_size_hint_align_set(), evas_object_size_hint_align_get(), evas_object_size_hint_fill_set(), evas_object_size_hint_fill_get() */ 299 #define evas_object_size_hint_fill_set evas_object_size_hint_align_set /**< Convenience macro to make it easier to understand that align is also used for fill properties (as fill is mutually exclusive to align) */ 300 #define evas_object_size_hint_fill_get evas_object_size_hint_align_get /**< Convenience macro to make it easier to understand that align is also used for fill properties (as fill is mutually exclusive to align) */ 301 #define evas_object_size_hint_expand_set evas_object_size_hint_weight_set /**< Convenience macro to make it easier to understand that weight is also used for expand properties */ 302 #define evas_object_size_hint_expand_get evas_object_size_hint_weight_get /**< Convenience macro to make it easier to understand that weight is also used for expand properties */ 303 304 typedef enum _Evas_Engine_Render_Mode 305 { 306 EVAS_RENDER_MODE_BLOCKING = 0, /**< The rendering is blocking mode*/ 307 EVAS_RENDER_MODE_NONBLOCKING = 1, /**< The rendering is non blocking mode*/ 308 } Evas_Engine_Render_Mode; /**< behaviour of the renderer*/ 309 310 typedef struct _Evas_Event_Render_Post Evas_Event_Render_Post; /**< Event info sent after a frame was rendered. @since 1.18 */ 311 struct _Evas_Event_Render_Post 312 { 313 Eina_List *updated_area; /**< A list of rectangles that were updated in the 314 * canvas. */ 315 }; 316 317 typedef enum _Evas_Device_Class 318 { 319 EVAS_DEVICE_CLASS_NONE, /**< Not a device @since 1.8 */ 320 EVAS_DEVICE_CLASS_SEAT, /**< The user/seat (the user themselves) @since 1.8 */ 321 EVAS_DEVICE_CLASS_KEYBOARD, /**< A regular keyboard, numberpad or attached buttons @since 1.8 */ 322 EVAS_DEVICE_CLASS_MOUSE, /**< A mouse, trackball or touchpad relative motion device @since 1.8 */ 323 EVAS_DEVICE_CLASS_TOUCH, /**< A touchscreen with fingers or stylus @since 1.8 */ 324 EVAS_DEVICE_CLASS_PEN, /**< A special pen device @since 1.8 */ 325 #define EVAS_DEVICE_CLASS_WAND EVAS_DEVICE_CLASS_POINTER 326 EVAS_DEVICE_CLASS_POINTER, /**< A laser pointer, wii-style or "minority report" pointing device @since 1.8 */ 327 EVAS_DEVICE_CLASS_GAMEPAD /**< A gamepad controller or joystick @since 1.8 */ 328 } Evas_Device_Class; /**< A general class of device @since 1.8 */ 329 330 /** 331 * @brief Specific type of input device. 332 * 333 * Note: Currently not used inside EFL. 334 * 335 * @since 1.8 336 */ 337 typedef enum 338 { 339 EVAS_DEVICE_SUBCLASS_NONE = 0, /**< Not a device. */ 340 EVAS_DEVICE_SUBCLASS_FINGER, /**< The normal flat of your finger. */ 341 EVAS_DEVICE_SUBCLASS_FINGERNAIL, /**< A fingernail. */ 342 EVAS_DEVICE_SUBCLASS_KNUCKLE, /**< A Knuckle. */ 343 EVAS_DEVICE_SUBCLASS_PALM, /**< The palm of a users hand. */ 344 EVAS_DEVICE_SUBCLASS_HAND_SIZE, /**< The side of your hand. */ 345 EVAS_DEVICE_SUBCLASS_HAND_FLAT, /**< The flat of your hand. */ 346 EVAS_DEVICE_SUBCLASS_PEN_TIP, /**< The tip of a pen. */ 347 EVAS_DEVICE_SUBCLASS_TRACKPAD, /**< A trackpad style mouse. */ 348 EVAS_DEVICE_SUBCLASS_TRACKPOINT, /**< A trackpoint style mouse. */ 349 EVAS_DEVICE_SUBCLASS_TRACKBALL /**< A trackball style mouse. */ 350 } Evas_Device_Subclass; 351 352 /** 353 * Flags for Mouse Button events 354 */ 355 typedef enum _Evas_Button_Flags 356 { 357 EVAS_BUTTON_NONE = 0, /**< No extra mouse button data */ 358 EVAS_BUTTON_DOUBLE_CLICK = (1 << 0), /**< This mouse button press was the 2nd press of a double click */ 359 EVAS_BUTTON_TRIPLE_CLICK = (1 << 1) /**< This mouse button press was the 3rd press of a triple click */ 360 } Evas_Button_Flags; /**< Flags for Mouse Button events */ 361 362 /** 363 * Flags for Events 364 */ 365 typedef enum _Evas_Event_Flags 366 { 367 EVAS_EVENT_FLAG_NONE = 0, /**< No fancy flags set */ 368 EVAS_EVENT_FLAG_ON_HOLD = (1 << 0), /**< This event is being delivered but should be put "on hold" until the on hold flag is unset. The event should be used for informational purposes and maybe some indications visually, but not actually perform anything */ 369 EVAS_EVENT_FLAG_ON_SCROLL = (1 << 1) /**< This event flag indicates the event occurs while scrolling; for example, DOWN event occurs during scrolling; the event should be used for informational purposes and maybe some indications visually, but not actually perform anything */ 370 } Evas_Event_Flags; /**< Flags for Events */ 371 372 typedef enum _Evas_Aspect_Control 373 { 374 EVAS_ASPECT_CONTROL_NONE = 0, /**< Preference on scaling unset */ 375 EVAS_ASPECT_CONTROL_NEITHER = 1, /**< Same effect as unset preference on scaling */ 376 EVAS_ASPECT_CONTROL_HORIZONTAL = 2, /**< Use all horizontal container space to place an object, using the given aspect */ 377 EVAS_ASPECT_CONTROL_VERTICAL = 3, /**< Use all vertical container space to place an object, using the given aspect */ 378 EVAS_ASPECT_CONTROL_BOTH = 4 /**< Use all horizontal @b and vertical container spaces to place an object (never growing it out of those bounds), using the given aspect */ 379 } Evas_Aspect_Control; /**< Aspect types/policies for scaling size hints, used for evas_object_size_hint_aspect_set() */ 380 381 typedef Efl_Text_Bidirectional_Type Evas_BiDi_Direction; 382 #define EVAS_BIDI_DIRECTION_NEUTRAL EFL_TEXT_BIDIRECTIONAL_TYPE_NEUTRAL 383 #define EVAS_BIDI_DIRECTION_NATURAL EFL_TEXT_BIDIRECTIONAL_TYPE_NATURAL 384 #define EVAS_BIDI_DIRECTION_LTR EFL_TEXT_BIDIRECTIONAL_TYPE_LTR 385 #define EVAS_BIDI_DIRECTION_RTL EFL_TEXT_BIDIRECTIONAL_TYPE_RTL 386 #define EVAS_BIDI_DIRECTION_INHERIT EFL_TEXT_BIDIRECTIONAL_TYPE_INHERIT 387 388 typedef enum _Evas_Font_Data_Cache 389 { 390 EVAS_FONT_DATA_CACHE_TEXTURE = 0x01,/**< Texture caching (in case of accelerated rendering) */ 391 } Evas_Font_Data_Cache; /**< font caching options, used for evas_font_data_cache_set()/evas_font_data_cache_get()*/ 392 393 394 /** 395 * How the mouse pointer should be handled by Evas. 396 * 397 * In the mode #EVAS_OBJECT_POINTER_MODE_AUTOGRAB, when a mouse button 398 * is pressed down over an object and held, with the mouse pointer 399 * being moved outside of it, the pointer still behaves as being bound 400 * to that object, albeit out of its drawing region. When the button 401 * is released, the event will be fed to the object, that may check if 402 * the final position is over it or not and do something about it. 403 * 404 * In the mode #EVAS_OBJECT_POINTER_MODE_NOGRAB, the pointer will 405 * always be bound to the object right below it. 406 * 407 * @ingroup Evas_Object_Group_Extras 408 */ 409 typedef enum _Evas_Object_Pointer_Mode 410 { 411 EVAS_OBJECT_POINTER_MODE_AUTOGRAB, /**< default, X11-like */ 412 EVAS_OBJECT_POINTER_MODE_NOGRAB, /**< pointer always bound to the object right below it */ 413 EVAS_OBJECT_POINTER_MODE_NOGRAB_NO_REPEAT_UPDOWN /**< useful on object with "repeat events" enabled, where mouse/touch up and down events WONT be repeated to objects and these objects wont be auto-grabbed. @since 1.2 */ 414 } Evas_Object_Pointer_Mode; /**< How the mouse pointer should be handled by Evas. */ 415 416 // FIXME: Move to Evas_Legacy.h 417 /** Identifier of callbacks to be set for Evas canvases or Evas objects. */ 418 typedef enum 419 { 420 EVAS_CALLBACK_MOUSE_IN = 0, /**< Mouse In Event */ 421 EVAS_CALLBACK_MOUSE_OUT, /**< Mouse Out Event */ 422 EVAS_CALLBACK_MOUSE_DOWN, /**< Mouse Button Down Event */ 423 EVAS_CALLBACK_MOUSE_UP, /**< Mouse Button Up Event */ 424 EVAS_CALLBACK_MOUSE_MOVE, /**< Mouse Move Event */ 425 EVAS_CALLBACK_MOUSE_WHEEL, /**< Mouse Wheel Event */ 426 EVAS_CALLBACK_MULTI_DOWN, /**< Multi-touch Down Event */ 427 EVAS_CALLBACK_MULTI_UP, /**< Multi-touch Up Event */ 428 EVAS_CALLBACK_MULTI_MOVE, /**< Multi-touch Move Event */ 429 EVAS_CALLBACK_FREE, /**< Object Being Freed (Called after Del) */ 430 EVAS_CALLBACK_KEY_DOWN, /**< Key Press Event */ 431 EVAS_CALLBACK_KEY_UP, /**< Key Release Event */ 432 EVAS_CALLBACK_FOCUS_IN, /**< Focus In Event */ 433 EVAS_CALLBACK_FOCUS_OUT, /**< Focus Out Event */ 434 EVAS_CALLBACK_SHOW, /**< Show Event */ 435 EVAS_CALLBACK_HIDE, /**< Hide Event */ 436 EVAS_CALLBACK_MOVE, /**< Move Event */ 437 EVAS_CALLBACK_RESIZE, /**< Resize Event */ 438 EVAS_CALLBACK_RESTACK, /**< Restack Event */ 439 EVAS_CALLBACK_DEL, /**< Object Being Deleted (called before Free) */ 440 EVAS_CALLBACK_HOLD, /**< Events go on/off hold */ 441 EVAS_CALLBACK_CHANGED_SIZE_HINTS, /**< Size hints changed event */ 442 EVAS_CALLBACK_IMAGE_PRELOADED, /**< Image has been preloaded */ 443 EVAS_CALLBACK_CANVAS_FOCUS_IN, /**< Canvas got focus as a whole */ 444 EVAS_CALLBACK_CANVAS_FOCUS_OUT, /**< Canvas lost focus as a whole */ 445 EVAS_CALLBACK_RENDER_FLUSH_PRE, /**< Called after render update regions have 446 * been calculated, but only if update regions exist */ 447 EVAS_CALLBACK_RENDER_FLUSH_POST, /**< Called after render update regions have 448 * been sent to the display server, but only 449 * if update regions existed for the most recent frame */ 450 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN, /**< Canvas object got focus */ 451 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT, /**< Canvas object lost focus */ 452 EVAS_CALLBACK_IMAGE_UNLOADED, /**< Image data has been unloaded (by some mechanism in Evas that throw out original image data) */ 453 EVAS_CALLBACK_RENDER_PRE, /**< Called just before rendering starts on the canvas target. @since 1.2 */ 454 EVAS_CALLBACK_RENDER_POST, /**< Called just after rendering stops on the canvas target. @since 1.2 */ 455 EVAS_CALLBACK_IMAGE_RESIZE, /**< Image size is changed. @since 1.8 */ 456 EVAS_CALLBACK_DEVICE_CHANGED, /**< Devices added, removed or changed on canvas. @since 1.8 */ 457 EVAS_CALLBACK_AXIS_UPDATE, /**< Input device changed value on some axis. @since 1.13 */ 458 EVAS_CALLBACK_CANVAS_VIEWPORT_RESIZE, /**< Canvas viewport resized. @since 1.15 */ 459 EVAS_CALLBACK_LAST /**< Sentinel value to indicate last enum field during 460 * iteration */ 461 } Evas_Callback_Type; 462 463 typedef void (*Evas_Smart_Cb)(void *data, Evas_Object *obj, void *event_info); /**< Evas smart objects' "smart callback" function signature */ 464 typedef void (*Evas_Event_Cb)(void *data, Evas *e, void *event_info); /**< Evas event callback function signature */ 465 typedef Eina_Bool (*Evas_Object_Event_Post_Cb)(void *data, Evas *e); /**< Evas object event (post) callback function signature */ 466 typedef void (*Evas_Object_Event_Cb)(void *data, Evas *e, Evas_Object *obj, void *event_info); /**< Evas object event callback function signature */ 467 typedef void (*Evas_Async_Events_Put_Cb)(void *target, Evas_Callback_Type type, void *event_info); /**< Evas async callback function signature */ 468 469 /** 470 * @defgroup Evas_Main_Group Top Level Functions 471 * @ingroup Evas 472 * 473 * Functions that affect Evas as a whole. 474 */ 475 476 /** 477 * @deprecated This function now returns NULL as cserve2 support has been removed 478 * 479 * Get the path for the cserve binary to execute 480 * 481 * There is little need for anyone except a desktop environment to call this. 482 * This can be called before evas_init() has been called. It will try and find 483 * the full path to the to the cserve binary to run to provide cserve image 484 * and font caching services for evas. 485 * 486 * @return NULL if error, or a string with the full path to the cserve binary. 487 * 488 * @since 1.8 489 */ 490 EINA_DEPRECATED 491 EAPI const char *evas_cserve_path_get(void); 492 493 /** 494 * @brief Directly initialize Evas and its required dependencies. 495 * 496 * @return The number of times evas_init() has been called. 497 * 498 * Permits use of Evas independently from @ref Ecore. This can be 499 * useful in certain types of examples and test programs, as well as by 500 * Ecore-Evas' @c ecore_evas_init() itself (which is what most EFL 501 * applications will be using instead). 502 * 503 * The @ref Example_Evas_Buffer_Simple "evas-buffer-simple.c" example 504 * demonstrates use of evas_init(), and then manually setting up the 505 * canvas: 506 * 507 * @dontinclude evas-buffer-simple.c 508 * @skip int main 509 * @until return -1; 510 * 511 * The canvas is set up using the example's create_canvas() routine, 512 * which forces selection of Evas' "buffer" rendering engine. The 513 * buffer engine simply renders to a memory buffer with no hardware 514 * acceleration. 515 * 516 * @skip static Evas *create_canvas 517 * @until evas_output_viewport_set(canvas, 518 * 519 * @see evas_shutdown(). 520 * 521 * @ingroup Evas_Main_Group 522 */ 523 EAPI int evas_init(void); 524 525 /** 526 * @brief Directly shutdown Evas. 527 * 528 * @return The (decremented) init reference counter. 529 * 530 * Low level routine to finalize Evas. Decrements a counter of the 531 * number of times evas_init() has been called, and, if appropriate, 532 * shuts down associated dependency modules and libraries. A return 533 * value of 0 indicates that everything has been properly shut down. 534 * 535 * Ecore-Evas applications will typically use ecore_evas_shutdown() 536 * instead, as described in evas_init(). 537 * 538 * The @ref Example_Evas_Buffer_Simple "evas-buffer-simple.c" example 539 * shows use of evas_shutdown() in its destroy_canvas() routine: 540 * 541 * @dontinclude evas-buffer-simple.c 542 * @skip static void destroy_canvas 543 * @until evas_free(canvas) 544 * 545 * @see evas_init(). 546 * 547 * @ingroup Evas_Main_Group 548 */ 549 EAPI int evas_shutdown(void); 550 551 /** 552 * @brief Get the error status of the most recent memory allocation call 553 * 554 * @return Allocation error codes EVAS_ALLOC_ERROR_NONE, 555 * EVAS_ALLOC_ERROR_FATAL or EVAS_ALLOC_ERROR_RECOVERED. 556 * 557 * Accesses the current error status for memory allocation, or 558 * EVAS_ALLOC_ERROR_NONE if allocation succeeded with no errors. 559 * 560 * EVAS_ALLOC_ERROR_FATAL means that no memory allocation was possible, but 561 * the function call exited as cleanly as possible. This is a sign of very low 562 * memory, and indicates the caller should attempt a safe recovery and possibly 563 * re-try after freeing up additional memory. 564 * 565 * EVAS_ALLOC_ERROR_RECOVERED indicates that Evas was able to free up 566 * sufficient memory internally to perform the requested memory 567 * allocation and the program will continue to function normally, but 568 * memory is in a low state and the program should strive to free memory 569 * itself. Evas' approach to free memory internally may reduce the 570 * resolution of images, free cached fonts or images, throw out 571 * pre-rendered data, or reduce the complexity of change lists. 572 * 573 * Example: 574 * @code 575 * extern Evas_Object *object; 576 * void callback (void *data, Evas *e, Evas_Object *obj, void *event_info); 577 * 578 * evas_object_event_callback_add(object, EVAS_CALLBACK_MOUSE_DOWN, callback, NULL); 579 * if (evas_alloc_error() == EVAS_ALLOC_ERROR_FATAL) 580 * { 581 * fprintf(stderr, "ERROR: Failed to attach callback. Out of memory.\n"); 582 * fprintf(stderr, " Must destroy object now as it cannot be used.\n"); 583 * evas_object_del(object); 584 * object = NULL; 585 * fprintf(stderr, "WARNING: Cleaning out RAM.\n"); 586 * my_memory_cleanup(); 587 * } 588 * if (evas_alloc_error() == EVAS_ALLOC_ERROR_RECOVERED) 589 * { 590 * fprintf(stderr, "WARNING: Memory is really low. Cleaning out RAM.\n"); 591 * my_memory_cleanup(); 592 * } 593 * @endcode 594 * 595 * @ingroup Evas_Main_Group 596 */ 597 EAPI Evas_Alloc_Error evas_alloc_error(void); 598 599 /** 600 * @brief Access the canvas' asynchronous event queue. 601 * 602 * @return A file descriptor to the asynchronous events. 603 * 604 * Normally, Evas handles asynchronous events internally, particularly 605 * in Evas-using modules that are part of the EFL infrastructure. 606 * Notably, ecore-evas takes care of processing these events for 607 * canvases instantiated through it. 608 * 609 * However, when asynchronous calculations need to be done outside the 610 * main thread (in some other mainloop) with some followup action, this 611 * function permits accessing the events. An example would be 612 * asynchronous image preloading. 613 * 614 * @ingroup Evas_Main_Group 615 */ 616 EAPI int evas_async_events_fd_get(void) EINA_WARN_UNUSED_RESULT; 617 618 /** 619 * @brief Process the asynchronous event queue. 620 * 621 * @return The number of events processed. 622 * 623 * Triggers the callback functions for asynchronous events that were 624 * queued up by evas_async_events_put(). The callbacks are called in 625 * the same order that they were queued. 626 * 627 * @ingroup Evas_Main_Group 628 */ 629 EAPI int evas_async_events_process(void); 630 631 /** 632 * @brief Insert asynchronous events on the canvas. 633 * 634 * @param target The target to be affected by the events. 635 * @param type The type of callback function. 636 * @param event_info Information about the event. 637 * @param func The callback function pointer. 638 * 639 * @return EINA_FALSE if an error occurred, EINA_TRUE otherwise. 640 * 641 * Allows routines running outside Evas' main thread to report an 642 * asynchronous event. The target, type, and event info will be passed 643 * to the callback function when evas_async_events_process() is called. 644 * 645 * @ingroup Evas_Main_Group 646 */ 647 EAPI Eina_Bool evas_async_events_put(const void *target, Evas_Callback_Type type, void *event_info, Evas_Async_Events_Put_Cb func) EINA_ARG_NONNULL(1, 4); 648 649 /** 650 * @defgroup Evas_Canvas Canvas Functions 651 * @ingroup Evas 652 * 653 * Low level Evas canvas functions. Sub groups will present more high 654 * level ones, though. 655 * 656 * Most of these functions deal with low level Evas actions, like: 657 * @li create/destroy raw canvases, not bound to any displaying engine 658 * @li tell a canvas i got focused (in a windowing context, for example) 659 * @li tell a canvas a region should not be calculated anymore in rendering 660 * @li tell a canvas to render its contents, immediately 661 * 662 * Most users will be using Evas by means of the @c Ecore_Evas 663 * wrapper, which deals with all the above mentioned issues 664 * automatically for them. Thus, you'll be looking at this section 665 * only if you're building low level stuff. 666 * 667 * The groups within present you functions that deal with the canvas 668 * directly, too, and not yet with its @b objects. They are the 669 * functions you need to use at a minimum to get a working canvas. 670 * 671 * Some of the functions in this group are exemplified @ref 672 * Example_Evas_Events "here". 673 */ 674 /** 675 * @} 676 */ 677 678 /** 679 * @defgroup Evas_Output_Method Render Engine Functions 680 * 681 * Functions that are used to set the render engine for a given 682 * function, and then get that engine working. 683 * 684 * The following code snippet shows how they can be used to 685 * initialise an evas that uses the X11 software engine: 686 * @code 687 * Evas *evas; 688 * Evas_Engine_Info_Software_X11 *einfo; 689 * extern Display *display; 690 * extern Window win; 691 * 692 * evas_init(); 693 * 694 * evas = evas_new(); 695 * evas_output_method_set(evas, evas_render_method_lookup("software_x11")); 696 * evas_output_size_set(evas, 640, 480); 697 * evas_output_viewport_set(evas, 0, 0, 640, 480); 698 * einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(evas); 699 * einfo->info.display = display; 700 * einfo->info.visual = DefaultVisual(display, DefaultScreen(display)); 701 * einfo->info.colormap = DefaultColormap(display, DefaultScreen(display)); 702 * einfo->info.drawable = win; 703 * einfo->info.depth = DefaultDepth(display, DefaultScreen(display)); 704 * evas_engine_info_set(evas, (Evas_Engine_Info *)einfo); 705 * @endcode 706 * 707 * @ingroup Evas_Canvas 708 */ 709 710 /** 711 * Look up a numeric ID from a string name of a rendering engine. 712 * 713 * @param name the name string of an engine 714 * @return A numeric (opaque) ID for the rendering engine 715 * @ingroup Evas_Output_Method 716 * 717 * This function looks up a numeric return value for the named engine 718 * in the string @p name. This is a normal C string, NUL byte 719 * terminated. The name is case sensitive. If the rendering engine is 720 * available, a numeric ID for that engine is returned that is not 721 * 0. If the engine is not available, 0 is returned, indicating an 722 * invalid engine. 723 * 724 * The programmer should NEVER rely on the numeric ID of an engine 725 * unless it is returned by this function. Programs should NOT be 726 * written accessing render method ID's directly, without first 727 * obtaining it from this function. 728 * 729 * @attention it is mandatory that one calls evas_init() before 730 * looking up the render method. 731 * 732 * Example: 733 * @code 734 * int engine_id; 735 * Evas *evas; 736 * 737 * evas_init(); 738 * 739 * evas = evas_new(); 740 * if (!evas) 741 * { 742 * fprintf(stderr, "ERROR: Canvas creation failed. Fatal error.\n"); 743 * exit(-1); 744 * } 745 * engine_id = evas_render_method_lookup("software_x11"); 746 * if (!engine_id) 747 * { 748 * fprintf(stderr, "ERROR: Requested rendering engine is absent.\n"); 749 * exit(-1); 750 * } 751 * evas_output_method_set(evas, engine_id); 752 * @endcode 753 */ 754 EAPI int evas_render_method_lookup(const char *name) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); 755 756 /** 757 * List all the rendering engines compiled into the copy of the Evas library 758 * 759 * @return A linked list whose data members are C strings of engine names 760 * @ingroup Evas_Output_Method 761 * 762 * Calling this will return a handle (pointer) to an Evas linked 763 * list. Each node in the linked list will have the data pointer be a 764 * (char *) pointer to the name string of the rendering engine 765 * available. The strings should never be modified, neither should the 766 * list be modified. This list should be cleaned up as soon as the 767 * program no longer needs it using evas_render_method_list_free(). If 768 * no engines are available from Evas, @c NULL will be returned. 769 * 770 * Example: 771 * @code 772 * Eina_List *engine_list, *l; 773 * char *engine_name; 774 * 775 * engine_list = evas_render_method_list(); 776 * if (!engine_list) 777 * { 778 * fprintf(stderr, "ERROR: Evas supports no engines! Exit.\n"); 779 * exit(-1); 780 * } 781 * printf("Available Evas Engines:\n"); 782 * EINA_LIST_FOREACH(engine_list, l, engine_name) 783 * printf("%s\n", engine_name); 784 * evas_render_method_list_free(engine_list); 785 * @endcode 786 */ 787 EAPI Eina_List *evas_render_method_list(void) EINA_WARN_UNUSED_RESULT; 788 789 /** 790 * This function should be called to free a list of engine names 791 * 792 * @param list The Eina_List base pointer for the engine list to be freed 793 * @ingroup Evas_Output_Method 794 * 795 * When this function is called it will free the engine list passed in 796 * as @p list. The list should only be a list of engines generated by 797 * calling evas_render_method_list(). If @p list is NULL, nothing will 798 * happen. 799 * 800 * Example: 801 * @code 802 * Eina_List *engine_list, *l; 803 * char *engine_name; 804 * 805 * engine_list = evas_render_method_list(); 806 * if (!engine_list) 807 * { 808 * fprintf(stderr, "ERROR: Evas supports no engines! Exit.\n"); 809 * exit(-1); 810 * } 811 * printf("Available Evas Engines:\n"); 812 * EINA_LIST_FOREACH(engine_list, l, engine_name) 813 * printf("%s\n", engine_name); 814 * evas_render_method_list_free(engine_list); 815 * @endcode 816 */ 817 EAPI void evas_render_method_list_free(Eina_List *list); 818 819 /** 820 * @} 821 */ 822 823 /** 824 * @defgroup Evas_Coord_Mapping_Group Coordinate Mapping Functions 825 * 826 * Functions that are used to map coordinates from the canvas to the 827 * screen or the screen to the canvas. 828 * 829 * @ingroup Evas_Canvas 830 */ 831 832 /** 833 * @defgroup Evas_Output_Size Output and Viewport Resizing Functions 834 * 835 * Functions that set and retrieve the output and viewport size of an 836 * evas. 837 * 838 * @ingroup Evas_Canvas 839 */ 840 841 /** 842 * @defgroup Evas_Canvas_Events Canvas Events 843 * 844 * Functions relating to canvas events that report on changes of 845 * its internal states (an object got focused, the rendering 846 * is updated, etc). 847 * 848 * Some of the functions in this group are exemplified @ref 849 * Example_Evas_Events "here". 850 * 851 * @ingroup Evas_Canvas 852 */ 853 854 /** 855 * Free the rectangles returned by evas_render_updates(). 856 * 857 * @param updates The list of updated rectangles of the canvas. 858 * 859 * This function removes the region from the render updates list. It 860 * makes the region doesn't be render updated anymore. 861 * 862 * @see evas_render_updates() for an example 863 * 864 * @ingroup Evas_Canvas 865 */ 866 EAPI void evas_render_updates_free(Eina_List *updates); 867 868 869 /** 870 * @defgroup Evas_Event_Freezing_Group Input Events Freezing Functions 871 * 872 * Functions that deal with the freezing of input event processing of 873 * an Evas canvas. 874 * 875 * There might be scenarios during a graphical user interface 876 * program's use when the developer wishes the users wouldn't be able 877 * to deliver input events to this application. It may, for example, 878 * be the time for it to populate a view or to change some 879 * layout. Assuming proper behavior with user interaction during this 880 * exact time would be hard, as things are in a changing state. The 881 * programmer can then tell the canvas to ignore input events, 882 * bringing it back to normal behavior when he/she wants. 883 * 884 * Most of the time use of freezing events is done like this: 885 * @code 886 * evas_event_freeze(my_evas_canvas); 887 * function_that_does_work_that_cant_be_interrupted_by_events(); 888 * evas_event_thaw(my_evas_canvas); 889 * @endcode 890 * 891 * Some of the functions in this group are exemplified @ref 892 * Example_Evas_Events "here". 893 * 894 * @ingroup Evas_Canvas_Events 895 */ 896 897 /** 898 * @defgroup Evas_Event_Feeding_Group Input Events Feeding Functions 899 * 900 * Functions to tell Evas that input events happened and should be 901 * processed. 902 * 903 * @warning Most of the time these functions are @b not what you're looking for. 904 * These functions should only be used if you're not working with ecore evas (or 905 * another input handling system). If you're not using ecore evas please 906 * consider using it, in most situation it will make life a lot easier. 907 * 908 * As explained in @ref intro_not_evas, Evas does not know how to poll 909 * for input events, so the developer should do it and then feed such 910 * events to the canvas to be processed. This is only required if 911 * operating Evas directly. Modules such as Ecore_Evas do that for 912 * you. 913 * 914 * Some of the functions in this group are exemplified @ref 915 * Example_Evas_Events "here". 916 * 917 * @ingroup Evas_Canvas_Events 918 */ 919 920 /** 921 * @addtogroup Evas_Event_Feeding_Group 922 * @{ 923 */ 924 925 /** 926 * Add a new device type 927 * 928 * @param e The canvas to create the device node for. 929 * 930 * Adds a new device node to the given canvas @p e. All devices created as 931 * part of the canvas @p e will automatically be deleted when the canvas 932 * is freed. 933 * 934 * @return the device node created or NULL if an error occurred. 935 * 936 * @see evas_device_del 937 * @see evas_device_add_full 938 * @since 1.8 939 */ 940 EAPI Evas_Device *evas_device_add(Evas *e); 941 942 /** 943 * Add a new device type 944 * 945 * @param e The canvas to create the device node for. 946 * @param name The name of the device. 947 * @param desc The description of the device. 948 * @param parent_dev The parent device. 949 * @param emulation_dev The source device. 950 * @param clas The device class. 951 * @param sub_class The device subclass. 952 * 953 * Adds a new device node to the given canvas @p e. All devices created as 954 * part of the canvas @p e will automatically be deleted when the canvas 955 * is freed. 956 * 957 * @return the device node created or NULL if an error occurred. 958 * 959 * @see evas_device_del 960 * @since 1.19 961 */ 962 EAPI Evas_Device *evas_device_add_full(Evas *e, const char *name, 963 const char *desc, 964 Evas_Device *parent_dev, 965 Evas_Device *emulation_dev, 966 Evas_Device_Class clas, 967 Evas_Device_Subclass sub_class); 968 969 /** 970 * Delete a new device type 971 * 972 * @param dev The device node you want to delete. 973 * 974 * @see evas_device_add 975 * @see evas_device_push 976 * @see evas_device_pop 977 * @since 1.8 978 */ 979 EAPI void evas_device_del(Evas_Device *dev); 980 981 /** 982 * Push the current context device onto the device stack 983 * 984 * @param e The canvas to push the device on to 985 * @param dev The device to push. 986 * 987 * This pushes the given device @p dev onto the stack for the canvas @p e 988 * resulting in the dev pointer in all events that get fed to the canvas 989 * being the device at the top of the device stack for that canvas. 990 * 991 * If a device is pushed onto the device stack, it will not be deleted 992 * until a canvas free OR until it has been popped from the stack even if 993 * evas_device_del() is called. 994 * 995 * The device @p dev must have been created as a device for the canvas it 996 * is pushed onto (and not another canvas). 997 * 998 * Example: 999 * @code 1000 * evas_device_push(canvas, dev); 1001 * evas_event_feed_mouse_move(canvas, 20, 30, 0, NULL); 1002 * evas_device_pop(canvas); 1003 * @endcode 1004 * 1005 * @see evas_device_pop 1006 * @since 1.8 1007 */ 1008 EAPI void evas_device_push(Evas *e, Evas_Device *dev); 1009 1010 /** 1011 * This pops the top of the device stack for the canvas 1012 * 1013 * @param e The canvas to pop the device stack from 1014 * 1015 * This pops the top of the device stack making the current device context 1016 * used for device events being what is now at the top of the stack after 1017 * popping. 1018 * 1019 * @see evas_device_push 1020 * @since 1.8 1021 */ 1022 EAPI void evas_device_pop(Evas *e); 1023 1024 /** 1025 * List all current devices attached to the given canvas and/or device 1026 * 1027 * @param e The canvas to query for a device list 1028 * @param dev A specific device inside the canvas to query for child devices or NULL if just querying the base canvas devices 1029 * @return An internal list of Evas_Device pointers, or NULL if no devices are found 1030 * 1031 * This will list all devices belonging to a specific evas canvas @p e, at the 1032 * top-level in the device tree if @p dev passed in is NULL. If @p dev is 1033 * a valid device for the given canvas @p e, then a list of child devices 1034 * of @p dev will be returned, allowing you to walk the device tree. 1035 * 1036 * The list returned is only valid so long as no changes are made to the 1037 * device tree in the given canvas @p e. If there are no devices or children 1038 * then NULL is returned. 1039 * 1040 * @see evas_device_parent_get 1041 * @see evas_device_name_get 1042 * @see evas_device_description_get 1043 * @see evas_device_class_get 1044 * @see evas_device_subclass_get 1045 * @see evas_device_emulation_source_get 1046 * @since 1.8 1047 */ 1048 EAPI const Eina_List *evas_device_list(Evas *e, const Evas_Device *dev); 1049 1050 /** 1051 * Get a device by its name 1052 * 1053 * @param e The canvas to find the device on 1054 * @param name The name of the device. 1055 * 1056 * Gets the first occurrence of a device named as @p name 1057 * on Evas @p e list of devices. 1058 * 1059 * @return the device or NULL if an error occurred, no name was provided, 1060 * or no device with a matching name was found. 1061 * 1062 * @since 1.19 1063 */ 1064 EAPI Evas_Device *evas_device_get(Evas *e, const char *name); 1065 1066 /** 1067 * Get a device by its seat id 1068 * 1069 * @param eo_e The canvas to find the device on 1070 * @param id The seat id of the device. 1071 * 1072 * Gets the device with id @p id on Evas @p e list of devices. 1073 * 1074 * @return the device or NULL if no device with a matching id was found. 1075 * 1076 * @since 1.20 1077 */ 1078 EAPI Evas_Device *evas_device_get_by_seat_id(Evas *eo_e, unsigned int id); 1079 1080 /** 1081 * Set the name of a device as a string 1082 * 1083 * @p dev The device to set the name of 1084 * @p name The name string as a readable C UTF8 string 1085 * 1086 * @since 1.8 1087 */ 1088 EAPI void evas_device_name_set(Evas_Device *dev, const char *name); 1089 1090 /** 1091 * Get the name of a device 1092 * 1093 * @p dev The device to query 1094 * @return The device name string or NULL if none is set 1095 * 1096 * This gets the name set by evas_device_name_set(). This is a readable UTF8 1097 * C string, or NULL if no name is set. 1098 * 1099 * The name should be a short name like "Wireless Mouse", "Joystick", 1100 * "Finger", "Keyboard" or "Numberpad" etc. 1101 * 1102 * @since 1.8 1103 */ 1104 EAPI const char *evas_device_name_get(const Evas_Device *dev); 1105 1106 /** 1107 * Set the seat id of a device 1108 * 1109 * @p dev The device to set the seat id of 1110 * @p name The seat id 1111 * 1112 * @since 1.20 1113 */ 1114 EAPI void evas_device_seat_id_set(Evas_Device *dev, unsigned int id); 1115 1116 /** 1117 * Get the seat id of a device 1118 * 1119 * @p dev The device to query 1120 * @return The device seat id or 0 if none is set 1121 * 1122 * This gets the seat id set by evas_device_seat id_set(). 1123 * 1124 * A seat id is the hardware id of the seat. 1125 * 1126 * @since 1.20 1127 */ 1128 EAPI unsigned int evas_device_seat_id_get(const Evas_Device *dev); 1129 1130 /** 1131 * Set the description of a device as a string 1132 * 1133 * @p dev The device to set the description of 1134 * @p name The description string as a readable C UTF8 string 1135 * 1136 * @since 1.8 1137 */ 1138 EAPI void evas_device_description_set(Evas_Device *dev, const char *desc); 1139 1140 /** 1141 * Get the description of a device 1142 * 1143 * @p dev The device to query 1144 * @return The device description string or NULL if none is set 1145 * 1146 * This gets the description set by evas_device_description_set(). This is 1147 * a readable UTF8 C string, or NULL if no description is set. 1148 * 1149 * A description is meant to be a longer string describing the device so a 1150 * human may make sense of it. For example "Wireless 6 button mouse in Black 1151 * with red buttons" would be a good description, so a user may identify 1152 * precisely which device is being talked about. 1153 * 1154 * @since 1.8 1155 */ 1156 EAPI const char *evas_device_description_get(const Evas_Device *dev); 1157 1158 /** 1159 * Set the parent of a device 1160 * 1161 * @p dev The device to set the parent of 1162 * @p parent The new parent device 1163 * 1164 * This sets the parent of a device @p dev to the parent given by @p parent. 1165 * If the device already has a parent, it is removed from that parent's list. 1166 * If @p parent is NULL then the device is unparented and placed back as a 1167 * root device in the canvas. 1168 * 1169 * When a device is deleted with evas_device_del(), all children are also 1170 * deleted along with it. 1171 * 1172 * @see evas_device_del 1173 * @see evas_device_parent_get 1174 * @see evas_device_list 1175 * 1176 * @since 1.8 1177 */ 1178 EAPI void evas_device_parent_set(Evas_Device *dev, Evas_Device *parent) EINA_DEPRECATED; 1179 1180 /** 1181 * Get the parent of a device 1182 * 1183 * @param dev The device to query 1184 * @return The parent device or NULL if it is a toplevel 1185 * 1186 * This returns the parent device of any given device entry, or NULL if no 1187 * parent device exists (is a toplevel device). 1188 * 1189 * @since 1.8 1190 */ 1191 EAPI const Evas_Device *evas_device_parent_get(const Evas_Device *dev); 1192 1193 /** 1194 * Set the major class of device 1195 * 1196 * @param dev The device whose class to set 1197 * @param clas The class to set it to 1198 * 1199 * This sets the "primary" class of device (a broad thing like mouse, keyboard, 1200 * touch, pen etc.). 1201 * 1202 * @deprecated The class of a device can not be changed after creation. 1203 * 1204 * @since 1.8 1205 */ 1206 EAPI void evas_device_class_set(Evas_Device *dev, Evas_Device_Class clas) EINA_DEPRECATED; 1207 1208 /** 1209 * Get the major class of a device 1210 * 1211 * @param dev The devise to query 1212 * @return The device class to set 1213 * 1214 * This gets the device class set by evas_device_class_set(). 1215 * 1216 * @since 1.8 1217 */ 1218 EAPI Evas_Device_Class evas_device_class_get(const Evas_Device *dev); 1219 1220 /** 1221 * Set the sub-class of a device 1222 * 1223 * @param dev The device to modify 1224 * @param clas The sub-class to set 1225 * 1226 * This sets the sub-class of a device, giving much more detailed usage 1227 * within a broader category. 1228 * 1229 * @since 1.8 1230 */ 1231 EAPI void evas_device_subclass_set(Evas_Device *dev, Evas_Device_Subclass clas); 1232 1233 /** 1234 * Get the device sub-class 1235 * 1236 * @param dev The device to query 1237 * @return The device sub-class set by evas_device_subclass_set(). 1238 * 1239 * @since 1.8 1240 */ 1241 EAPI Evas_Device_Subclass evas_device_subclass_get(const Evas_Device *dev); 1242 1243 /** 1244 * Set the emulation source device 1245 * 1246 * @param dev The device being emulated 1247 * @param src The primary source device producing events in the emulated device 1248 * 1249 * Devices may not be real, but may be emulated by listening to input on other 1250 * devices and modifying or interpeting it to generate output on an emulated 1251 * device (example a finger on a touchscreen will often emulate a mouse when 1252 * it presses). This allows you to set which device primarily emulates @p dev 1253 * so the user can choose to ignore events from emulated devices if they also 1254 * pay attention to source device events for example. 1255 * 1256 * @since 1.8 1257 */ 1258 EAPI void evas_device_emulation_source_set(Evas_Device *dev, Evas_Device *src); 1259 1260 /** 1261 * Get the emulation source device 1262 * 1263 * @param dev The device to query 1264 * @return The source emulation device set by evas_device_emulation_source_set(). 1265 * 1266 * @since 1.8 1267 */ 1268 EAPI const Evas_Device *evas_device_emulation_source_get(const Evas_Device *dev); 1269 1270 /** 1271 * @} 1272 */ 1273 1274 /** 1275 * @defgroup Evas_Image Image Functions 1276 * 1277 * Functions that deal with images at canvas level. Compare with 1278 * @ref Evas_Object_Image functions which deal with images at the object level. 1279 * 1280 * @ingroup Evas_Canvas 1281 */ 1282 1283 /** 1284 * @defgroup Evas_Font_Group Font Functions 1285 * 1286 * Functions that deal with fonts. 1287 * 1288 * @ingroup Evas_Canvas 1289 */ 1290 1291 /** 1292 * @defgroup Evas_Object_Group Generic Object Functions 1293 * @ingroup Evas 1294 * 1295 * Functions that manipulate generic Evas objects. 1296 * 1297 * All Evas displaying units are Evas objects. One handles them all by 1298 * means of the handle ::Evas_Object. Besides Evas treats their 1299 * objects equally, they have @b types that define their specific 1300 * behavior (and individual API). 1301 * 1302 * Evas comes with a set of built-in object types: 1303 * - rectangle, 1304 * - line, 1305 * - polygon, 1306 * - text, 1307 * - textblock, 1308 * - textgrid and 1309 * - image. 1310 * 1311 * These functions apply to @b any Evas object, whatever type they 1312 * may have. 1313 * 1314 * @note The built-in types that are most used are rectangles, text 1315 * and images. In fact, with these one can create 2D interfaces 1316 * of arbitrary complexity and EFL makes it easy. 1317 */ 1318 1319 /** 1320 * @defgroup Evas_Object_Group_Basic Basic Object Manipulation 1321 * 1322 * Almost every evas object created will have some generic function used to 1323 * manipulate it. That's because there are a number of basic actions to be done 1324 * to objects that are irrespective of the object's type, things like: 1325 * @li Showing/Hiding 1326 * @li Setting (and getting) geometry 1327 * @li Bring up or down a layer 1328 * @li Color management 1329 * @li Handling focus 1330 * @li Clipping 1331 * @li Reference counting 1332 * 1333 * All of these issues are handled through the functions grouped here. Examples 1334 * of these function can be seen in @ref Example_Evas_Object_Manipulation(which 1335 * deals with the most common ones) and in @ref Example_Evas_Stacking (which 1336 * deals with stacking functions). 1337 * 1338 * @ingroup Evas_Object_Group 1339 */ 1340 1341 /** 1342 * @defgroup Evas_Object_Group_Events Object Events 1343 * 1344 * Objects generate events when they are moved, resized, when their 1345 * visibility change, when they are deleted and so on. These methods 1346 * allow one to be notified about and to handle such events. 1347 * 1348 * Objects also generate events on input (keyboard and mouse), if they 1349 * accept them (are visible, focused, etc). 1350 * 1351 * For each of those events, Evas provides a way for one to register 1352 * callback functions to be issued just after they happen. 1353 * 1354 * The following figure illustrates some Evas (event) callbacks: 1355 * 1356 * @image html evas-callbacks.png 1357 * @image rtf evas-callbacks.png 1358 * @image latex evas-callbacks.eps 1359 * 1360 * These events have their values in the #Evas_Callback_Type 1361 * enumeration, which has also ones happening on the canvas level (see 1362 * @ref Evas_Canvas_Events ). 1363 * 1364 * Examples on this group of functions can be found @ref 1365 * Example_Evas_Stacking "here" and @ref Example_Evas_Events "here". 1366 * 1367 * @ingroup Evas_Object_Group 1368 */ 1369 1370 /** 1371 * @defgroup Evas_Object_Group_Size_Hints Size Hints 1372 * 1373 * Objects may carry hints, so that another object that acts as a 1374 * manager (see @ref Evas_Smart_Object_Group) may know how to properly 1375 * position and resize its subordinate objects. The Size Hints provide 1376 * a common interface that is recommended as the protocol for such 1377 * information. 1378 * 1379 * For example, box objects use alignment hints to align its 1380 * lines/columns inside its container, padding hints to set the 1381 * padding between each individual child, etc. 1382 * 1383 * Examples on their usage: 1384 * - @ref Example_Evas_Size_Hints "evas-hints.c" 1385 * - @ref Example_Evas_Aspect_Hints "evas-aspect-hints.c" 1386 * 1387 * @ingroup Evas_Object_Group 1388 */ 1389 1390 /** 1391 * @defgroup Evas_Object_Group_Extras Extra Object Manipulation 1392 * 1393 * Miscellaneous functions that also apply to any object, but are less 1394 * used or not implemented by all objects. 1395 * 1396 * Examples of this group of functions can be found @ref 1397 * Example_Evas_Stacking "here" and @ref Example_Evas_Events "here". 1398 * 1399 * @ingroup Evas_Object_Group 1400 */ 1401 1402 /** 1403 * @defgroup Evas_Object_Group_Find Finding Objects 1404 * 1405 * Functions that allows finding objects by their position, name or 1406 * other properties. 1407 * 1408 * @ingroup Evas_Object_Group 1409 */ 1410 1411 /** 1412 * @defgroup Evas_Object_Specific Specific Object Functions 1413 * @ingroup Evas 1414 * 1415 * Functions that work on specific objects. 1416 * 1417 */ 1418 1419 /** 1420 * @defgroup Evas_Object_Rectangle Rectangle Object Functions 1421 * 1422 * @brief Function to create evas rectangle objects. 1423 * 1424 * There is only one function to deal with rectangle objects, this may make this 1425 * function seem useless given there are no functions to manipulate the created 1426 * rectangle, however the rectangle is actually very useful and should be 1427 * manipulated using the generic @ref Evas_Object_Group "evas object functions". 1428 * 1429 * The evas rectangle serves a number of key functions when working on evas 1430 * programs: 1431 * @li Background 1432 * @li Debugging 1433 * @li Clipper 1434 * 1435 * @section Background 1436 * 1437 * One extremely common requirement of evas programs is to have a solid color 1438 * background, this can be accomplished with the following very simple code: 1439 * @code 1440 * Evas_Object *bg = evas_object_rectangle_add(evas_canvas); 1441 * //Here we set the rectangles red, green, blue and opacity levels 1442 * evas_object_color_set(bg, 255, 255, 255, 255); // opaque white background 1443 * evas_object_resize(bg, WIDTH, HEIGHT); // covers full canvas 1444 * evas_object_show(bg); 1445 * @endcode 1446 * 1447 * This will have issues if the @c evas_canvas is resized, however most 1448 * windows are created using ecore evas and that has a solution to using the 1449 * rectangle as a background: 1450 * @code 1451 * Evas_Object *bg = evas_object_rectangle_add(ecore_evas_get(ee)); 1452 * //Here we set the rectangles red, green, blue and opacity levels 1453 * evas_object_color_set(bg, 255, 255, 255, 255); // opaque white background 1454 * evas_object_resize(bg, WIDTH, HEIGHT); // covers full canvas 1455 * evas_object_show(bg); 1456 * ecore_evas_object_associate(ee, bg, ECORE_EVAS_OBJECT_ASSOCIATE_BASE); 1457 * @endcode 1458 * So this gives us a white background to our window that will be resized 1459 * together with it. 1460 * 1461 * @section Debugging 1462 * 1463 * Debugging is a major part of any programmers task and when debugging visual 1464 * issues with evas programs the rectangle is an extremely useful tool. The 1465 * rectangle's simplicity means that it's easier to pinpoint issues with it than 1466 * with more complex objects. Therefore a common technique to use when writing 1467 * an evas program and not getting the desired visual result is to replace the 1468 * misbehaving object for a solid color rectangle and seeing how it interacts 1469 * with the other elements, this often allows us to notice clipping, parenting 1470 * or positioning issues. Once the issues have been identified and corrected the 1471 * rectangle can be replaced for the original part and in all likelihood any 1472 * remaining issues will be specific to that object's type. 1473 * 1474 * @section clipping Clipping 1475 * 1476 * Clipping serves two main functions: 1477 * @li Limiting visibility(i.e. hiding portions of an object). 1478 * @li Applying a layer of color to an object. 1479 * 1480 * @subsection hiding Limiting visibility 1481 * 1482 * It is often necessary to show only parts of an object, while it may be 1483 * possible to create an object that corresponds only to the part that must be 1484 * shown(and it isn't always possible) it's usually easier to use a a clipper. A 1485 * clipper is a rectangle that defines what's visible and what is not. The way 1486 * to do this is to create a solid white rectangle(which is the default, no need 1487 * to call evas_object_color_set()) and give it a position and size of what 1488 * should be visible. The following code exemplifies showing the center half of 1489 * @c my_evas_object: 1490 * @code 1491 * Evas_Object *clipper = evas_object_rectangle_add(evas_canvas); 1492 * evas_object_move(clipper, my_evas_object_x / 4, my_evas_object_y / 4); 1493 * evas_object_resize(clipper, my_evas_object_width / 2, my_evas_object_height / 2); 1494 * evas_object_clip_set(my_evas_object, clipper); 1495 * evas_object_show(clipper); 1496 * @endcode 1497 * 1498 * @subsection color Layer of color 1499 * 1500 * In the @ref clipping section we used a solid white clipper that produced no 1501 * change in the color of the clipped object, it just hid what was outside the 1502 * clippers area. It is however sometimes desirable to change the color of an 1503 * object, this can be accomplished using a clipper that has a non-white color. 1504 * Clippers with color work by multiplying the colors of clipped object. The 1505 * following code will show how to remove all the red from an object: 1506 * @code 1507 * Evas_Object *clipper = evas_object_rectangle_add(evas); 1508 * evas_object_move(clipper, my_evas_object_x, my_evas_object_y); 1509 * evas_object_resize(clipper, my_evas_object_width, my_evas_object_height); 1510 * evas_object_color_set(clipper, 0, 255, 255, 255); 1511 * evas_object_clip_set(obj, clipper); 1512 * evas_object_show(clipper); 1513 * @endcode 1514 * 1515 * @warning We don't guarantee any proper results if you create a Rectangle 1516 * object without setting the evas engine. 1517 * 1518 * For an example that more fully exercise the use of an evas object rectangle 1519 * see @ref Example_Evas_Object_Manipulation. 1520 * 1521 * @ingroup Evas_Object_Specific 1522 */ 1523 1524 /** 1525 * @defgroup Evas_Object_Image Image Object Functions 1526 * 1527 * Here are grouped together functions used to create and manipulate 1528 * image objects. They are available to whichever occasion one needs 1529 * complex imagery on a GUI that could not be achieved by the other 1530 * Evas' primitive object types, or to make image manipulations. 1531 * 1532 * Evas will support whatever image file types it was compiled with 1533 * support to (its image loaders) -- check your software packager for 1534 * that information and see 1535 * evas_object_image_extension_can_load_get(). 1536 * 1537 * @section Evas_Object_Image_Basics Image object basics 1538 * 1539 * The most common use of image objects -- to display an image on the 1540 * canvas -- is achieved by a common function triplet: 1541 * @code 1542 * img = evas_object_image_add(canvas); 1543 * evas_object_image_file_set(img, "path/to/img", NULL); 1544 * evas_object_image_fill_set(img, 0, 0, w, h); 1545 * @endcode 1546 * The first function, naturally, is creating the image object. Then, 1547 * one must set a source file on it, so that it knows where to fetch 1548 * image data from. Next, one must set <b>how to fill the image 1549 * object's area</b> with that given pixel data. One could use just a 1550 * sub-region of the original image or even have it tiled repeatedly 1551 * on the image object. For the common case of having the whole source 1552 * image to be displayed on the image object, stretched to the 1553 * destination's size, there's also a function helper, to be used 1554 * instead of evas_object_image_fill_set(): 1555 * @code 1556 * evas_object_image_filled_set(img, EINA_TRUE); 1557 * @endcode 1558 * See those functions' documentation for more details. 1559 * 1560 * @section Evas_Object_Image_Scale Scale and resizing 1561 * 1562 * Resizing of image objects will scale their respective source images 1563 * to their areas, if they are set to "fill" the object's area 1564 * (evas_object_image_filled_set()). If the user wants any control on 1565 * the aspect ratio of an image for different sizes, he/she has to 1566 * take care of that themselves. There are functions to make images to 1567 * get loaded scaled (up or down) in memory, already, if the user is 1568 * going to use them at pre-determined sizes and wants to save 1569 * computations. 1570 * 1571 * Evas has even a scale cache that will take care of caching scaled 1572 * versions of images with more often usage/hits. Finally, one can 1573 * have images being rescaled @b smoothly by Evas (more 1574 * computationally expensive) or not. 1575 * 1576 * @section Evas_Object_Image_Performance Performance hints 1577 * 1578 * When dealing with image objects, there are some tricks to boost the 1579 * performance of your application, if it does intense image loading 1580 * and/or manipulations, as in animations on a UI. 1581 * 1582 * @subsection Evas_Object_Image_Load Load hints 1583 * 1584 * In image viewer applications, for example, the user will be looking 1585 * at a given image, at full size, and will desire that the navigation 1586 * to the adjacent images on his/her album be fluid and fast. Thus, 1587 * while displaying a given image, the program can be in the 1588 * background loading the next and previous images already, so that 1589 * displaying them in sequence is just a matter of repainting the 1590 * screen (and not decoding image data). 1591 * 1592 * Evas addresses this issue with <b>image pre-loading</b>. The code 1593 * for the situation above would be something like the following: 1594 * @code 1595 * prev = evas_object_image_filled_add(canvas); 1596 * evas_object_image_file_set(prev, "/path/to/prev", NULL); 1597 * evas_object_image_preload(prev, EINA_TRUE); 1598 * 1599 * next = evas_object_image_filled_add(canvas); 1600 * evas_object_image_file_set(next, "/path/to/next", NULL); 1601 * evas_object_image_preload(next, EINA_TRUE); 1602 * @endcode 1603 * 1604 * If you're loading images that are too big, consider setting 1605 * previously it's loading size to something smaller, in case you 1606 * won't expose them in real size. It may speed up the loading 1607 * considerably: 1608 * @code 1609 * //to load a scaled down version of the image in memory, if that's 1610 * //the size you'll be displaying it anyway 1611 * evas_object_image_load_scale_down_set(img, zoom); 1612 * 1613 * //optional: if you know you'll be showing a sub-set of the image's 1614 * //pixels, you can avoid loading the complementary data 1615 * evas_object_image_load_region_set(img, x, y, w, h); 1616 * @endcode 1617 * Refer to Elementary's Photocam widget for a high level (smart) 1618 * object that does lots of loading speed-ups for you. 1619 * 1620 * @subsection Evas_Object_Image_Animation Animation hints 1621 * 1622 * If you want to animate image objects on a UI (what you'd get by 1623 * concomitant usage of other libraries, like Ecore and Edje), there 1624 * are also some tips on how to boost the performance of your 1625 * application. If the animation involves resizing of an image (thus, 1626 * re-scaling), you'd better turn off smooth scaling on it @b during 1627 * the animation, turning it back on afterwards, for less 1628 * computations. Also, in this case you'd better flag the image object 1629 * in question not to cache scaled versions of it: 1630 * @code 1631 * evas_object_image_scale_hint_set(wd->img, EVAS_IMAGE_SCALE_HINT_DYNAMIC); 1632 * 1633 * // resizing takes place in between 1634 * 1635 * evas_object_image_scale_hint_set(wd->img, EVAS_IMAGE_SCALE_HINT_STATIC); 1636 * @endcode 1637 * 1638 * Finally, movement of opaque images through the canvas is less 1639 * expensive than of translucid ones, because of blending 1640 * computations. 1641 * 1642 * @section Evas_Object_Image_Borders Borders 1643 * 1644 * Evas provides facilities for one to specify an image's region to be 1645 * treated specially -- as "borders". This will make those regions be 1646 * treated specially on resizing scales, by keeping their aspect. This 1647 * makes setting frames around other objects on UIs easy. 1648 * See the following figures for a visual explanation:\n 1649 * @image rtf image-borders.png 1650 * @image html image-borders.png 1651 * @image latex image-borders.eps width=\textwidth 1652 * @image rtf border-effect.png 1653 * @image html border-effect.png 1654 * @image latex border-effect.eps width=\textwidth 1655 * 1656 * @section Evas_Object_Image_Manipulation Manipulating pixels 1657 * 1658 * Evas image objects can be used to manipulate raw pixels in many 1659 * ways. The meaning of the data in the pixel arrays will depend on 1660 * the image's color space, be warned (see next section). You can set 1661 * your own data as an image's pixel data, fetch an image's pixel data 1662 * for saving/altering, convert images between different color spaces 1663 * and even advanced operations like setting a native surface as image 1664 * objects' data. 1665 * 1666 * @section Evas_Object_Image_Color_Spaces Color spaces 1667 * 1668 * Image objects may return or accept "image data" in multiple 1669 * formats. This is based on the color space of an object. Here is a 1670 * rundown on formats: 1671 * 1672 * - #EVAS_COLORSPACE_ARGB8888: 1673 * This pixel format is a linear block of pixels, starting at the 1674 * top-left row by row until the bottom right of the image or pixel 1675 * region. All pixels are 32-bit unsigned int's with the high-byte 1676 * being alpha and the low byte being blue in the format ARGB. Alpha 1677 * may or may not be used by evas depending on the alpha flag of the 1678 * image, but if not used, should be set to 0xff anyway. 1679 * \n\n 1680 * This colorspace uses premultiplied alpha. That means that R, G 1681 * and B cannot exceed A in value. The conversion from 1682 * non-premultiplied colorspace is: 1683 * \n\n 1684 * R = (r * a) / 255; G = (g * a) / 255; B = (b * a) / 255; 1685 * \n\n 1686 * So 50% transparent blue will be: 0x80000080. This will not be 1687 * "dark" - just 50% transparent. Values are 0 == black, 255 == 1688 * solid or full red, green or blue. 1689 * . 1690 * - #EVAS_COLORSPACE_YCBCR422P601_PL: 1691 * This is a pointer-list indirected set of YUV (YCbCr) pixel 1692 * data. This means that the data returned or set is not actual 1693 * pixel data, but pointers TO lines of pixel data. The list of 1694 * pointers will first be N rows of pointers to the Y plane - 1695 * pointing to the first pixel at the start of each row in the Y 1696 * plane. N is the height of the image data in pixels. Each pixel in 1697 * the Y, U and V planes is 1 byte exactly, packed. The next N / 2 1698 * pointers will point to rows in the U plane, and the next N / 2 1699 * pointers will point to the V plane rows. U and V planes are half 1700 * the horizontal and vertical resolution of the Y plane. 1701 * \n\n 1702 * Row order is top to bottom and row pixels are stored left to 1703 * right. 1704 * \n\n 1705 * There is a limitation that these images MUST be a multiple of 2 1706 * pixels in size horizontally or vertically. This is due to the U 1707 * and V planes being half resolution. Also note that this assumes 1708 * the itu601 YUV colorspace specification. This is defined for 1709 * standard television and mpeg streams. HDTV may use the itu709 1710 * specification. 1711 * \n\n 1712 * Values are 0 to 255, indicating full or no signal in that plane 1713 * respectively. 1714 * . 1715 * - #EVAS_COLORSPACE_YCBCR422P709_PL: 1716 * Not implemented yet. 1717 * . 1718 * - #EVAS_COLORSPACE_RGB565_A5P: 1719 * In the process of being implemented in 1 engine only. This may 1720 * change. 1721 * \n\n 1722 * This is a pointer to image data for 16-bit half-word pixel data 1723 * in 16bpp RGB 565 format (5 bits red, 6 bits green, 5 bits blue), 1724 * with the high-byte containing red and the low byte containing 1725 * blue, per pixel. This data is packed row by row from the top-left 1726 * to the bottom right. 1727 * \n\n 1728 * If the image has an alpha channel enabled there will be an extra 1729 * alpha plane after the color pixel plane. If not, then this data 1730 * will not exist and should not be accessed in any way. This plane 1731 * is a set of pixels with 1 byte per pixel defining the alpha 1732 * values of all pixels in the image from the top-left to the bottom 1733 * right of the image, row by row. Even though the values of the 1734 * alpha pixels can be 0 to 255, only values 0 through to 32 are 1735 * used, 32 being solid and 0 being transparent. 1736 * \n\n 1737 * RGB values can be 0 to 31 for red and blue and 0 to 63 for green, 1738 * with 0 being black and 31 or 63 being full red, green or blue 1739 * respectively. This colorspace is also pre-multiplied like 1740 * EVAS_COLORSPACE_ARGB8888 so: 1741 * \n\n 1742 * R = (r * a) / 32; G = (g * a) / 32; B = (b * a) / 32; 1743 * . 1744 * - #EVAS_COLORSPACE_GRY8: 1745 * The image is just an alpha mask (8 bit's per pixel). This is used 1746 * for alpha masking. 1747 * 1748 * @warning We don't guarantee any proper results if you create an Image object 1749 * without setting the evas engine. 1750 * 1751 * Some examples of this group of functions can be found @ref 1752 * Example_Evas_Images "here". 1753 * 1754 * @ingroup Evas_Object_Specific 1755 * @{ 1756 */ 1757 1758 /** 1759 * Function signature for the evas object pixels get callback function 1760 * @see evas_object_image_pixels_get() 1761 * 1762 * By @a data it will be passed the private data. By @a o it will be passed the 1763 * Evas_Object image on which the pixels are requested. 1764 * 1765 */ 1766 typedef void (*Evas_Object_Image_Pixels_Get_Cb)(void *data, Evas_Object *o); 1767 1768 /** 1769 * Check if a file extension may be supported by @ref Evas_Object_Image. 1770 * 1771 * @param file The file to check 1772 * @return @c EINA_TRUE if we may be able to open it, @c EINA_FALSE if it's 1773 * unlikely. 1774 * @since 1.1 1775 * 1776 * If file is an Eina_Stringshare, use directly @ref evas_object_image_extension_can_load_fast_get. 1777 * 1778 * This functions is threadsafe. 1779 */ 1780 EAPI Eina_Bool evas_object_image_extension_can_load_get(const char *file); 1781 1782 /** 1783 * Check if a file extension may be supported by @ref Evas_Object_Image. 1784 * 1785 * @param file The file to check, it should be an Eina_Stringshare. 1786 * @return @c EINA_TRUE if we may be able to open it, @c EINA_FALSE if it's 1787 * unlikely. 1788 * @since 1.1 1789 * 1790 * This functions is threadsafe. 1791 */ 1792 EAPI Eina_Bool evas_object_image_extension_can_load_fast_get(const char *file); 1793 /** 1794 * @} 1795 */ 1796 1797 /** 1798 * @defgroup Evas_Object_Text_Group Text Object Functions 1799 * 1800 * Functions that operate on single line, single style text objects. 1801 * 1802 * For multiline and multiple style text, see @ref Evas_Object_Textblock_Group. 1803 * 1804 * See some @ref Example_Evas_Text "examples" on this group of functions. 1805 * 1806 * @warning We don't guarantee any proper results if you create a Text object 1807 * without setting the evas engine. 1808 * 1809 * @ingroup Evas_Object_Specific 1810 * @{ 1811 */ 1812 1813 /* basic styles (4 bits allocated use 0->10 now, 5 left) */ 1814 #define EVAS_TEXT_STYLE_MASK_BASIC 0xf 1815 1816 /** 1817 * Text style type creation macro. Use style types on the 's' 1818 * arguments, being 'x' your style variable. 1819 */ 1820 #define EVAS_TEXT_STYLE_BASIC_SET(x, s) \ 1821 do { x = ((x) & ~EVAS_TEXT_STYLE_MASK_BASIC) | (s); } while (0) 1822 1823 #define EVAS_TEXT_STYLE_MASK_SHADOW_DIRECTION (0x7 << 4) 1824 1825 /** 1826 * Text style type creation macro. This one will impose shadow 1827 * directions on the style type variable -- use the @c 1828 * EVAS_TEXT_STYLE_SHADOW_DIRECTION_* values on 's', incrementally. 1829 */ 1830 #define EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(x, s) \ 1831 do { x = ((x) & ~EVAS_TEXT_STYLE_MASK_SHADOW_DIRECTION) | (s); } while (0) 1832 1833 /** 1834 * @} 1835 */ 1836 1837 /** 1838 * @defgroup Evas_Object_Textgrid_Group Textgrid Object Functions 1839 * 1840 * Textgrid objects manage chunks of text as a 2D grid of cells, each of 1841 * which contains a single unicode character with color and style 1842 * formatting information. The object's text can be interacted with 1843 * character-by-character or by row. 1844 * 1845 * @todo put here some usage examples 1846 * 1847 * @since 1.7 1848 * 1849 * @ingroup Evas_Object_Specific 1850 * 1851 * @{ 1852 */ 1853 1854 /** 1855 * @struct _Evas_Textgrid_Cell 1856 * 1857 * A cell contains a single unicode character, with associated formatting 1858 * data including style, color, and color palette. Double-wide characters 1859 * are flagged to permit visually merging the cell to the right. 1860 * 1861 * @since 1.7 1862 */ 1863 struct _Evas_Textgrid_Cell 1864 { 1865 Eina_Unicode codepoint; /**< the UNICODE value of the character */ 1866 unsigned char fg; /**< the index of the palette for the foreground color */ 1867 unsigned char bg; /**< the index of the palette for the background color */ 1868 unsigned short bold : 1; /**< whether the character is bold */ 1869 unsigned short italic : 1; /**< whether the character is oblique */ 1870 unsigned short underline : 1; /**< whether the character is underlined */ 1871 unsigned short strikethrough : 1; /**< whether the character is strikethrough'ed */ 1872 unsigned short fg_extended : 1; /**< whether the extended palette is used for the foreground color */ 1873 unsigned short bg_extended : 1; /**< whether the extended palette is used for the background color */ 1874 unsigned short double_width : 1; /**< if the codepoint is merged with the following cell to the right visually (cells must be in pairs with 2nd cell being a duplicate in all ways except codepoint is 0) */ 1875 }; 1876 1877 /** 1878 * @} 1879 */ 1880 1881 /** 1882 * @defgroup Evas_Object_Line_Group Line Object Functions 1883 * 1884 * Functions used to deal with evas line objects. 1885 * 1886 * @warning We don't guarantee any proper results if you create a Line object 1887 * without setting the evas engine. 1888 * 1889 * @ingroup Evas_Object_Specific 1890 * 1891 */ 1892 1893 /** 1894 * @defgroup Evas_Object_Polygon Polygon Object Functions 1895 * 1896 * Functions that operate on evas polygon objects. 1897 * 1898 * Hint: as evas does not provide ellipse, smooth paths or circle, one 1899 * can calculate points and convert these to a polygon. 1900 * 1901 * @warning We don't guarantee any proper results if you create a Polygon 1902 * object without setting the evas engine. 1903 * 1904 * @ingroup Evas_Object_Specific 1905 * 1906 */ 1907 1908 /** 1909 * @defgroup Evas_Smart_Group Smart Functions 1910 * @ingroup Evas 1911 * 1912 * Functions that deal with #Evas_Smart structs, creating definition 1913 * (classes) of objects that will have customized behavior for methods 1914 * like evas_object_move(), evas_object_resize(), 1915 * evas_object_clip_set() and others. 1916 * 1917 * These objects will accept the generic methods defined in @ref 1918 * Evas_Object_Group and the extensions defined in @ref 1919 * Evas_Smart_Object_Group. There are a couple of existent smart 1920 * objects in Evas itself (see @ref Evas_Object_Box, @ref 1921 * Evas_Object_Table_Group and @ref Evas_Smart_Object_Clipped). 1922 * 1923 * See also some @ref Example_Evas_Smart_Objects "examples" of this 1924 * group of functions. 1925 * 1926 * @{ 1927 */ 1928 1929 /** 1930 * @def EVAS_SMART_CLASS_VERSION 1931 * 1932 * The version you have to put into the version field in the 1933 * #Evas_Smart_Class struct. Used to safeguard from binaries with old 1934 * smart object intefaces running with newer ones. 1935 * 1936 * @ingroup Evas_Smart_Group 1937 */ 1938 #define EVAS_SMART_CLASS_VERSION 4 1939 1940 /** 1941 * @struct _Evas_Smart_Class 1942 * 1943 * A smart object's @b base class definition 1944 * 1945 * @ingroup Evas_Smart_Group 1946 */ 1947 struct _Evas_Smart_Class 1948 { 1949 const char *name; /**< the name string of the class */ 1950 int version; 1951 void (*add)(Evas_Object *o); /**< code to be run when adding object to a canvas */ 1952 void (*del)(Evas_Object *o); /**< code to be run when removing object from a canvas */ 1953 void (*move)(Evas_Object *o, Evas_Coord x, Evas_Coord y); /**< code to be run when moving object on a canvas. @a x and @a y will be new coordinates one applied to the object. use evas_object_geometry_get() if you need the old values, during this call. after that, the old values will be lost. */ 1954 void (*resize)(Evas_Object *o, Evas_Coord w, Evas_Coord h); /**< code to be run when resizing object on a canvas. @a w and @a h will be new dimensions one applied to the object. use evas_object_geometry_get() if you need the old values, during this call. after that, the old values will be lost. */ 1955 void (*show)(Evas_Object *o); /**< code to be run when showing object on a canvas */ 1956 void (*hide)(Evas_Object *o); /**< code to be run when hiding object on a canvas */ 1957 void (*color_set)(Evas_Object *o, int r, int g, int b, int a); /**< code to be run when setting color of object on a canvas. @a r, @a g, @a b and @a a will be new color components one applied to the object. use evas_object_color_get() if you need the old values, during this call. after that, the old values will be lost. */ 1958 void (*clip_set)(Evas_Object *o, Evas_Object *clip); /**< code to be run when setting clipper of object on a canvas. @a clip will be new clipper one applied to the object. use evas_object_clip_get() if you need the old one, during this call. after that, the old (object pointer) value will be lost. */ 1959 void (*clip_unset)(Evas_Object *o); /**< code to be run when unsetting clipper of object on a canvas. if you need the pointer to a previous set clipper, during this call, use evas_object_clip_get(). after that, the old (object pointer) value will be lost. */ 1960 void (*calculate)(Evas_Object *o); /**< code to be run when object has rendering updates on a canvas */ 1961 void (*member_add)(Evas_Object *o, Evas_Object *child); /**< code to be run when a child member is added to object */ 1962 void (*member_del)(Evas_Object *o, Evas_Object *child); /**< code to be run when a child member is removed from object */ 1963 1964 const Evas_Smart_Class *parent; /**< this class inherits from this parent */ 1965 const Evas_Smart_Cb_Description *callbacks; /**< callbacks at this level, @c NULL terminated */ 1966 const Evas_Smart_Interface **interfaces; /**< #Evas_Smart_Interface pointers array, @c NULL terminated. These will be the interfaces supported at this level for an object (parents may have others) @since 1.7 */ 1967 const void *data; 1968 }; 1969 1970 /** 1971 * @struct _Evas_Smart_Interface 1972 * 1973 * A smart object's @b base interface definition 1974 * 1975 * Every Evas interface must have a name field, pointing to a global, 1976 * constant string variable. This string pointer will be the only way 1977 * of retrieving back a given interface from a smart object. Two 1978 * function pointers must be defined, too, which will be called at 1979 * object creation and deletion times. 1980 * 1981 * See also some @ref Example_Evas_Smart_Interfaces "examples" on 1982 * smart interfaces. 1983 * 1984 * @since 1.7 1985 * 1986 * @ingroup Evas_Smart_Group 1987 */ 1988 struct _Evas_Smart_Interface 1989 { 1990 const char *name; /**< Name of the given interface */ 1991 unsigned private_size; /**< Size, in bytes, of the interface's private dada blob. This will be allocated and freed automatically for you. Get it with evas_object_smart_interface_data_get(). */ 1992 Eina_Bool (*add)(Evas_Object *obj); /**< Function to be called at object creation time. This will take place @b before the object's smart @c add() function. */ 1993 void (*del)(Evas_Object *obj); /**< Function to be called at object deletion time. This will take place @b after the object's smart @c del() function. */ 1994 }; 1995 1996 /** 1997 * @struct _Evas_Smart_Cb_Description 1998 * 1999 * Describes a callback issued by a smart object 2000 * (evas_object_smart_callback_call()), as defined in its smart object 2001 * class. This is particularly useful to explain to end users and 2002 * their code (i.e., introspection) what the parameter @c event_info 2003 * will point to. 2004 * 2005 * @ingroup Evas_Smart_Group 2006 */ 2007 struct _Evas_Smart_Cb_Description 2008 { 2009 const char *name; /**< callback name ("changed", for example) */ 2010 2011 /** 2012 * @brief Hint on the type of @c event_info parameter's contents on 2013 * a #Evas_Smart_Cb callback. 2014 * 2015 * The type string uses the pattern similar to 2016 * http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-signatures, 2017 * but extended to optionally include variable names within 2018 * brackets preceding types. Example: 2019 * 2020 * @li Structure with two integers: 2021 * @c "(ii)" 2022 * 2023 * @li Structure called 'x' with two integers named 'a' and 'b': 2024 * @c "[x]([a]i[b]i)" 2025 * 2026 * @li Array of integers: 2027 * @c "ai" 2028 * 2029 * @li Array called 'x' of struct with two integers: 2030 * @c "[x]a(ii)" 2031 * 2032 * @note This type string is used as a hint and is @b not validated 2033 * or enforced in any way. Implementors should make the best 2034 * use of it to help bindings, documentation and other users 2035 * of introspection features. 2036 */ 2037 const char *type; 2038 }; 2039 2040 /** 2041 * @def EVAS_SMART_CLASS_INIT_NULL 2042 * Initialize to zero a whole Evas_Smart_Class structure. 2043 * 2044 * @see EVAS_SMART_CLASS_INIT_VERSION 2045 * @see EVAS_SMART_CLASS_INIT_NAME_VERSION 2046 * @see EVAS_SMART_CLASS_INIT_NAME_VERSION_PARENT 2047 * @see EVAS_SMART_CLASS_INIT_NAME_VERSION_PARENT_CALLBACKS 2048 * @ingroup Evas_Smart_Group 2049 */ 2050 #define EVAS_SMART_CLASS_INIT_NULL {NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL} 2051 2052 /** 2053 * @def EVAS_SMART_CLASS_INIT_VERSION 2054 * Initialize to zero a whole Evas_Smart_Class structure and set version. 2055 * 2056 * Similar to EVAS_SMART_CLASS_INIT_NULL, but will set version field to 2057 * latest EVAS_SMART_CLASS_VERSION. 2058 * 2059 * @see EVAS_SMART_CLASS_INIT_NULL 2060 * @see EVAS_SMART_CLASS_INIT_NAME_VERSION 2061 * @see EVAS_SMART_CLASS_INIT_NAME_VERSION_PARENT 2062 * @see EVAS_SMART_CLASS_INIT_NAME_VERSION_PARENT_CALLBACKS 2063 * @ingroup Evas_Smart_Group 2064 */ 2065 #define EVAS_SMART_CLASS_INIT_VERSION {NULL, EVAS_SMART_CLASS_VERSION, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL} 2066 2067 /** 2068 * @def EVAS_SMART_CLASS_INIT_NAME_VERSION 2069 * Initialize to zero a whole Evas_Smart_Class structure and set name 2070 * and version. 2071 * 2072 * Similar to EVAS_SMART_CLASS_INIT_NULL, but will set version field to 2073 * latest EVAS_SMART_CLASS_VERSION and name to the specified value. 2074 * 2075 * It will keep a reference to name field as a "const char *", that is, 2076 * name must be available while the structure is used (hint: static or global!) 2077 * and will not be modified. 2078 * 2079 * @see EVAS_SMART_CLASS_INIT_NULL 2080 * @see EVAS_SMART_CLASS_INIT_VERSION 2081 * @see EVAS_SMART_CLASS_INIT_NAME_VERSION_PARENT 2082 * @see EVAS_SMART_CLASS_INIT_NAME_VERSION_PARENT_CALLBACKS 2083 * @ingroup Evas_Smart_Group 2084 */ 2085 #define EVAS_SMART_CLASS_INIT_NAME_VERSION(name) {name, EVAS_SMART_CLASS_VERSION, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL} 2086 2087 /** 2088 * @def EVAS_SMART_CLASS_INIT_NAME_VERSION_PARENT 2089 * Initialize to zero a whole Evas_Smart_Class structure and set name, 2090 * version and parent class. 2091 * 2092 * Similar to EVAS_SMART_CLASS_INIT_NULL, but will set version field to 2093 * latest EVAS_SMART_CLASS_VERSION, name to the specified value and 2094 * parent class. 2095 * 2096 * It will keep a reference to name field as a "const char *", that is, 2097 * name must be available while the structure is used (hint: static or global!) 2098 * and will not be modified. Similarly, parent reference will be kept. 2099 * 2100 * @see EVAS_SMART_CLASS_INIT_NULL 2101 * @see EVAS_SMART_CLASS_INIT_VERSION 2102 * @see EVAS_SMART_CLASS_INIT_NAME_VERSION 2103 * @see EVAS_SMART_CLASS_INIT_NAME_VERSION_PARENT_CALLBACKS 2104 * @ingroup Evas_Smart_Group 2105 */ 2106 #define EVAS_SMART_CLASS_INIT_NAME_VERSION_PARENT(name, parent) {name, EVAS_SMART_CLASS_VERSION, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, parent, NULL, NULL} 2107 2108 /** 2109 * @def EVAS_SMART_CLASS_INIT_NAME_VERSION_PARENT_CALLBACKS 2110 * Initialize to zero a whole Evas_Smart_Class structure and set name, 2111 * version, parent class and callbacks definition. 2112 * 2113 * Similar to EVAS_SMART_CLASS_INIT_NULL, but will set version field to 2114 * latest EVAS_SMART_CLASS_VERSION, name to the specified value, parent 2115 * class and callbacks at this level. 2116 * 2117 * It will keep a reference to name field as a "const char *", that is, 2118 * name must be available while the structure is used (hint: static or global!) 2119 * and will not be modified. Similarly, parent and callbacks reference 2120 * will be kept. 2121 * 2122 * @see EVAS_SMART_CLASS_INIT_NULL 2123 * @see EVAS_SMART_CLASS_INIT_VERSION 2124 * @see EVAS_SMART_CLASS_INIT_NAME_VERSION 2125 * @see EVAS_SMART_CLASS_INIT_NAME_VERSION_PARENT 2126 * @ingroup Evas_Smart_Group 2127 */ 2128 #define EVAS_SMART_CLASS_INIT_NAME_VERSION_PARENT_CALLBACKS(name, parent, callbacks) {name, EVAS_SMART_CLASS_VERSION, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, parent, callbacks, NULL} 2129 2130 /** 2131 * @def EVAS_SMART_SUBCLASS_NEW 2132 * 2133 * Convenience macro to subclass a given Evas smart class. 2134 * 2135 * @param smart_name The name used for the smart class. e.g: 2136 * @c "Evas_Object_Box". 2137 * @param prefix Prefix used for all variables and functions defined 2138 * and referenced by this macro. 2139 * @param api_type Type of the structure used as API for the smart 2140 * class. Either #Evas_Smart_Class or something derived from it. 2141 * @param parent_type Type of the parent class API. 2142 * @param parent_func Function that gets the parent class. e.g: 2143 * evas_object_box_smart_class_get(). 2144 * @param cb_desc Array of callback descriptions for this smart class. 2145 * 2146 * This macro saves some typing when writing a smart class derived 2147 * from another one. In order for this to work, the user @b must provide some 2148 * functions adhering to the following guidelines: 2149 * - @<prefix@>_smart_set_user(): the @b internal @c _smart_set 2150 * function (defined by this macro) will call this one, provided by 2151 * the user, after inheriting everything from the parent, which 2152 * should <b>take care of setting the right member functions for 2153 * the class</b>, both overrides and extensions, if any. 2154 * - If this new class should be subclassable as well, a @b public 2155 * @c _smart_set() function is desirable to fill in the class used as 2156 * parent by the children. It's up to the user to provide this 2157 * interface, which will most likely call @<prefix@>_smart_set() to 2158 * get the job done. 2159 * 2160 * After the macro's usage, the following will be defined for use: 2161 * - @<prefix@>_parent_sc: A pointer to the @b parent smart 2162 * class. When calling parent functions from overloaded ones, use 2163 * this global variable. 2164 * - @<prefix@>_smart_class_new(): this function returns the 2165 * #Evas_Smart needed to create smart objects with this class, 2166 * which should be passed to evas_object_smart_add(). 2167 * 2168 * @warning @p smart_name has to be a pointer to a globally available 2169 * string! The smart class created here will just have a pointer set 2170 * to that, and all object instances will depend on it for smart class 2171 * name lookup. 2172 * 2173 * @ingroup Evas_Smart_Group 2174 */ 2175 #define EVAS_SMART_SUBCLASS_NEW(smart_name, prefix, api_type, parent_type, parent_func, cb_desc) \ 2176 static const parent_type * prefix##_parent_sc = NULL; \ 2177 static void prefix##_smart_set_user(api_type * api); \ 2178 static void prefix##_smart_set(api_type * api) \ 2179 { \ 2180 Evas_Smart_Class *sc; \ 2181 if (!(sc = (Evas_Smart_Class *)api)) \ 2182 return; \ 2183 if (!prefix##_parent_sc) \ 2184 prefix##_parent_sc = parent_func(); \ 2185 evas_smart_class_inherit(sc, prefix##_parent_sc); \ 2186 prefix##_smart_set_user(api); \ 2187 } \ 2188 static Evas_Smart *prefix##_smart_class_new(void) \ 2189 { \ 2190 static Evas_Smart *smart = NULL; \ 2191 static api_type api; \ 2192 if (!smart) \ 2193 { \ 2194 Evas_Smart_Class *sc = (Evas_Smart_Class *)&api; \ 2195 memset(&api, 0, sizeof(api_type)); \ 2196 sc->version = EVAS_SMART_CLASS_VERSION; \ 2197 sc->name = smart_name; \ 2198 sc->callbacks = cb_desc; \ 2199 prefix##_smart_set(&api); \ 2200 smart = evas_smart_class_new(sc); \ 2201 } \ 2202 return smart; \ 2203 } 2204 2205 /** 2206 * @def EVAS_SMART_SUBCLASS_IFACE_NEW 2207 * 2208 * @since 1.7 2209 * 2210 * Convenience macro to subclass a given Evas smart class. This is the 2211 * same as #EVAS_SMART_SUBCLASS_NEW, but now <b>declaring smart 2212 * interfaces</b> besides the smart callbacks. 2213 * 2214 * @param smart_name The name used for the smart class. e.g: 2215 * @c "Evas_Object_Box". 2216 * @param prefix Prefix used for all variables and functions defined 2217 * and referenced by this macro. 2218 * @param api_type Type of the structure used as API for the smart 2219 * class. Either #Evas_Smart_Class or something 2220 * derived from it. 2221 * @param parent_type Type of the parent class API. 2222 * @param parent_func Function that gets the parent class. e.g: 2223 * evas_object_box_smart_class_get(). 2224 * @param cb_desc Array of smart callback descriptions for this smart 2225 * class. 2226 * @param ifaces Array of Evas smart interafaces for this smart 2227 * class. 2228 * 2229 * This macro saves some typing when writing a smart class derived 2230 * from another one. In order for this to work, the user @b must provide some 2231 * functions adhering to the following guidelines: 2232 * - @<prefix@>_smart_set_user(): the @b internal @c _smart_set 2233 * function (defined by this macro) will call this one, provided by 2234 * the user, after inheriting everything from the parent, which 2235 * should <b>take care of setting the right member functions for 2236 * the class</b>, both overrides and extensions, if any. 2237 * - If this new class should be subclassable as well, a @b public 2238 * @c _smart_set() function is desirable to fill in the class used as 2239 * parent by the children. It's up to the user to provide this 2240 * interface, which will most likely call @<prefix@>_smart_set() to 2241 * get the job done. 2242 * 2243 * After the macro's usage, the following will be defined for use: 2244 * - @<prefix@>_parent_sc: A pointer to the @b parent smart 2245 * class. When calling parent functions from overloaded ones, use 2246 * this global variable. 2247 * - @<prefix@>_smart_class_new(): this function returns the 2248 * #Evas_Smart needed to create smart objects with this class, 2249 * which should be passed to evas_object_smart_add(). 2250 * 2251 * @warning @p smart_name has to be a pointer to a globally available 2252 * string! The smart class created here will just have a pointer set 2253 * to that, and all object instances will depend on it for smart class 2254 * name lookup. 2255 * 2256 * @ingroup Evas_Smart_Group 2257 */ 2258 #define EVAS_SMART_SUBCLASS_IFACE_NEW(smart_name, \ 2259 prefix, \ 2260 api_type, \ 2261 parent_type, \ 2262 parent_func, \ 2263 cb_desc, \ 2264 ifaces) \ 2265 static const parent_type * prefix##_parent_sc = NULL; \ 2266 static void prefix##_smart_set_user(api_type * api); \ 2267 static void prefix##_smart_set(api_type * api) \ 2268 { \ 2269 Evas_Smart_Class *sc; \ 2270 if (!(sc = (Evas_Smart_Class *)api)) \ 2271 return; \ 2272 if (!prefix##_parent_sc) \ 2273 prefix##_parent_sc = parent_func(); \ 2274 evas_smart_class_inherit(sc, prefix##_parent_sc); \ 2275 prefix##_smart_set_user(api); \ 2276 } \ 2277 static Evas_Smart *prefix##_smart_class_new(void) \ 2278 { \ 2279 static Evas_Smart *smart = NULL; \ 2280 static api_type api; \ 2281 if (!smart) \ 2282 { \ 2283 Evas_Smart_Class *sc = (Evas_Smart_Class *)&api; \ 2284 memset(&api, 0, sizeof(api_type)); \ 2285 sc->version = EVAS_SMART_CLASS_VERSION; \ 2286 sc->name = smart_name; \ 2287 sc->callbacks = cb_desc; \ 2288 sc->interfaces = ifaces; \ 2289 prefix##_smart_set(&api); \ 2290 smart = evas_smart_class_new(sc); \ 2291 } \ 2292 return smart; \ 2293 } 2294 2295 /** 2296 * @def EVAS_SMART_DATA_ALLOC 2297 * 2298 * Convenience macro to allocate smart data only if needed. 2299 * 2300 * When writing a subclassable smart object, the @c .add() function 2301 * will need to check if the smart private data was already allocated 2302 * by some child object or not. This macro makes it easier to do it. 2303 * 2304 * @note This is an idiom used when one calls the parent's @c .add() 2305 * after the specialized code. Naturally, the parent's base smart data 2306 * has to be contemplated as the specialized one's first member, for 2307 * things to work. 2308 * 2309 * @param o Evas object passed to the @c .add() function 2310 * @param priv_type The type of the data to allocate 2311 * 2312 * @ingroup Evas_Smart_Group 2313 */ 2314 #define EVAS_SMART_DATA_ALLOC(o, priv_type) \ 2315 priv_type * priv; \ 2316 priv = evas_object_smart_data_get(o); \ 2317 if (!priv) { \ 2318 priv = (priv_type *)calloc(1, sizeof(priv_type)); \ 2319 if (!priv) return; \ 2320 evas_object_smart_data_set(o, priv); \ 2321 } 2322 2323 /** 2324 * Free an #Evas_Smart struct 2325 * 2326 * @param s the #Evas_Smart struct to free 2327 * 2328 * @warning If this smart handle was created using 2329 * evas_smart_class_new(), the associated #Evas_Smart_Class will not 2330 * be freed. 2331 * 2332 * @note If you're using the #EVAS_SMART_SUBCLASS_NEW schema to create your 2333 * smart object, note that an #Evas_Smart handle will be shared amongst all 2334 * instances of the given smart class, through a static variable. 2335 * Evas will internally count references on #Evas_Smart handles and free them 2336 * when they are not referenced anymore. Thus, this function is of no use 2337 * for Evas users, most probably. 2338 */ 2339 EAPI void evas_smart_free(Evas_Smart *s) EINA_ARG_NONNULL(1); 2340 2341 /** 2342 * Creates a new #Evas_Smart from a given #Evas_Smart_Class struct 2343 * 2344 * @param sc the smart class definition 2345 * @return a new #Evas_Smart pointer 2346 * 2347 * #Evas_Smart handles are necessary to create new @b instances of 2348 * smart objects belonging to the class described by @p sc. That 2349 * handle will contain, besides the smart class interface definition, 2350 * all its smart callbacks infrastructure set, too. 2351 * 2352 * @note If you are willing to subclass a given smart class to 2353 * construct yours, consider using the #EVAS_SMART_SUBCLASS_NEW macro, 2354 * which will make use of this function automatically for you. 2355 */ 2356 EAPI Evas_Smart *evas_smart_class_new(const Evas_Smart_Class *sc) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC; 2357 2358 /** 2359 * Get the #Evas_Smart_Class handle of an #Evas_Smart struct 2360 * 2361 * @param s a valid #Evas_Smart pointer 2362 * @return the #Evas_Smart_Class in it 2363 */ 2364 EAPI const Evas_Smart_Class *evas_smart_class_get(const Evas_Smart *s) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); 2365 2366 /** 2367 * @brief Get the data pointer set on an #Evas_Smart struct 2368 * 2369 * @param s a valid #Evas_Smart handle 2370 * 2371 * This data pointer is set as the data field in the #Evas_Smart_Class 2372 * passed in to evas_smart_class_new(). 2373 */ 2374 EAPI void *evas_smart_data_get(const Evas_Smart *s) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); 2375 2376 /** 2377 * Get the smart callbacks known by this #Evas_Smart handle's smart 2378 * class hierarchy. 2379 * 2380 * @param s A valid #Evas_Smart handle. 2381 * @param[out] count Returns the number of elements in the returned 2382 * array. 2383 * 2384 * @return The array with callback descriptions known by this smart 2385 * class, with its size returned in @a count parameter. It 2386 * should not be modified in any way. If no callbacks are 2387 * known, @c NULL is returned. The array is sorted by event 2388 * names and elements refer to the original values given to 2389 * evas_smart_class_new()'s Evas_Smart_Class::callbacks 2390 * (pointer to them). 2391 * 2392 * This is likely different from 2393 * evas_object_smart_callbacks_descriptions_get() as it will contain 2394 * the callbacks of @b all this class hierarchy sorted, while the 2395 * direct smart class member refers only to that specific class and 2396 * should not include parent's. 2397 * 2398 * If no callbacks are known, this function returns @c NULL. 2399 * 2400 * The array elements and thus their contents will be @b references to 2401 * original values given to evas_smart_class_new() as 2402 * Evas_Smart_Class::callbacks. 2403 * 2404 * The array is sorted by Evas_Smart_Cb_Description::name. The last 2405 * array element is a @c NULL pointer and is not accounted for in @a 2406 * count. Loop iterations can check any of these size indicators. 2407 * 2408 * @note objects may provide per-instance callbacks, use 2409 * evas_object_smart_callbacks_descriptions_get() to get those 2410 * as well. 2411 * @see evas_object_smart_callbacks_descriptions_get() 2412 */ 2413 EAPI const Evas_Smart_Cb_Description **evas_smart_callbacks_descriptions_get(const Evas_Smart *s, unsigned int *count) EINA_ARG_NONNULL(1, 1); 2414 2415 /** 2416 * Find a callback description for the callback named @a name. 2417 * 2418 * @param s The #Evas_Smart where to search for class registered smart 2419 * event callbacks. 2420 * @param name Name of the desired callback, which must @b not be @c 2421 * NULL. The search has a special case for @a name being the 2422 * same pointer as registered with #Evas_Smart_Cb_Description. 2423 * One can use it to avoid excessive use of strcmp(). 2424 * @return A reference to the description if found, or @c NULL, otherwise 2425 * 2426 * @see evas_smart_callbacks_descriptions_get() 2427 */ 2428 EAPI const Evas_Smart_Cb_Description *evas_smart_callback_description_find(const Evas_Smart *s, const char *name) EINA_ARG_NONNULL(1, 2); 2429 2430 /** 2431 * Sets one class to inherit from the other. 2432 * 2433 * Copy all function pointers, set @c parent to @a parent_sc and copy 2434 * everything after sizeof(Evas_Smart_Class) present in @a parent_sc, 2435 * using @a parent_sc_size as reference. 2436 * 2437 * This is recommended instead of a single memcpy() since it will take 2438 * care to not modify @a sc name, version, callbacks and possible 2439 * other members. 2440 * 2441 * @param sc child class. 2442 * @param parent_sc parent class, will provide attributes. 2443 * @param parent_sc_size size of parent_sc structure, child should be at least 2444 * this size. Everything after @c Evas_Smart_Class size is copied 2445 * using regular memcpy(). 2446 */ 2447 EAPI Eina_Bool evas_smart_class_inherit_full(Evas_Smart_Class *sc, const Evas_Smart_Class *parent_sc, unsigned int parent_sc_size) EINA_ARG_NONNULL(1, 2); 2448 2449 /** 2450 * Get the number of uses of the smart instance 2451 * 2452 * @param s The Evas_Smart to get the usage count of 2453 * @return The number of uses of the smart instance 2454 * 2455 * This function tells you how many more uses of the smart instance are in 2456 * existence. This should be used before freeing/clearing any of the 2457 * Evas_Smart_Class that was used to create the smart instance. The smart 2458 * instance will refer to data in the Evas_Smart_Class used to create it and 2459 * thus you cannot remove the original data until all users of it are gone. 2460 * When the usage count goes to 0, you can evas_smart_free() the smart 2461 * instance @p s and remove from memory any of the Evas_Smart_Class that 2462 * was used to create the smart instance, if you desire. Removing it from 2463 * memory without doing this will cause problems (crashes, undefined 2464 * behavior, etc.), so either never remove the original 2465 * Evas_Smart_Class data from memory (have it be a constant structure and 2466 * data), or use this API call and be very careful. 2467 */ 2468 EAPI int evas_smart_usage_get(const Evas_Smart *s); 2469 2470 /** 2471 * @def evas_smart_class_inherit 2472 * Easy to use version of evas_smart_class_inherit_full(). 2473 * 2474 * This version will use sizeof(parent_sc), copying everything. 2475 * 2476 * @param sc child class, will have methods copied from @a parent_sc 2477 * @param parent_sc parent class, will provide contents to be copied. 2478 * @return 1 on success, 0 on failure. 2479 * @ingroup Evas_Smart_Group 2480 */ 2481 #define evas_smart_class_inherit(sc, parent_sc) evas_smart_class_inherit_full(sc, (Evas_Smart_Class *)parent_sc, sizeof(*parent_sc)) 2482 /** 2483 * @} 2484 */ 2485 2486 /** 2487 * @defgroup Evas_Smart_Object_Group Smart Object Functions 2488 * @ingroup Evas 2489 * 2490 * Functions dealing with Evas smart objects (instances). 2491 * 2492 * Smart objects are groupings of primitive Evas objects that behave 2493 * as a cohesive group. For instance, a file manager icon may be a 2494 * smart object composed of an image object, a text label and two 2495 * rectangles that appear behind the image and text when the icon is 2496 * selected. As a smart object, the normal Evas object API could be 2497 * used on the icon object. 2498 * 2499 * Besides that, generally smart objects implement a <b>specific 2500 * API</b>, so that users interact with its own custom features. The 2501 * API takes form of explicit exported functions one may call and 2502 * <b>smart callbacks</b>. 2503 * 2504 * @section Evas_Smart_Object_Group_Callbacks Smart events and callbacks 2505 * 2506 * Smart objects can elect events (smart events, from now on) occurring 2507 * inside of them to be reported back to their users via callback 2508 * functions (smart callbacks). This way, you can extend Evas' own 2509 * object events. They are defined by an <b>event string</b> that 2510 * identifies them uniquely. There's also a function prototype 2511 * definition for the callback functions: #Evas_Smart_Cb. 2512 * 2513 * When defining an #Evas_Smart_Class, smart object implementors are 2514 * strongly encouraged to properly set the Evas_Smart_Class::callbacks 2515 * callbacks description array, so that the users of the smart object 2516 * can have introspection on its events API <b>at run time</b>. 2517 * 2518 * See some @ref Example_Evas_Smart_Objects "examples" of this group 2519 * of functions. 2520 * 2521 * @see @ref Evas_Smart_Group for class definitions. 2522 */ 2523 2524 /** 2525 * @addtogroup Evas_Smart_Object_Group 2526 * @{ 2527 */ 2528 /** 2529 * Registers an object type and its associated class. LEGACY MECHANISM SUPPORT. 2530 * 2531 * This function is invoked in the class constructor of smart classes. It will 2532 * add the type and the class into a hash table that will then be used to check 2533 * the type of an object. 2534 * This function has been implemented to support legacy mechanism that checks 2535 * objects types by name. 2536 * USE IT ONLY FOR LEGACY SUPPORT. 2537 * Otherwise, it is HIGHLY recommended to use efl_isa. 2538 * 2539 * @param type The type (name string) to add. 2540 * @param klass The class to associate to the type. 2541 * 2542 * @see efl_isa 2543 * 2544 * @ingroup Evas_Smart_Object_Group 2545 */ 2546 EAPI void evas_smart_legacy_type_register(const char *type, const Efl_Class *klass) EINA_ARG_NONNULL(1, 2); 2547 2548 /** 2549 * @} 2550 */ 2551 2552 /** 2553 * @defgroup Evas_Smart_Object_Clipped Clipped Smart Object 2554 * 2555 * Clipped smart object is a base to construct other smart objects 2556 * based on the concept of having an internal clipper that is applied 2557 * to all children objects. This clipper will control the visibility, 2558 * clipping and color of sibling objects (remember that the clipping 2559 * is recursive, and clipper color modulates the color of its 2560 * clippees). By default, this base will also move children relative 2561 * to the parent, and delete them when parent is deleted. In other 2562 * words, it is the base for simple object grouping. 2563 * 2564 * See some @ref Example_Evas_Smart_Objects "examples" of this group 2565 * of functions. 2566 * 2567 * @see evas_object_smart_clipped_smart_set() 2568 * 2569 * @ingroup Evas_Smart_Object_Group 2570 * 2571 * @{ 2572 */ 2573 2574 /** 2575 * Every subclass should provide this at the beginning of their own 2576 * data set with evas_object_smart_data_set(). 2577 */ 2578 typedef struct _Evas_Object_Smart_Clipped_Data Evas_Object_Smart_Clipped_Data; 2579 struct _Evas_Object_Smart_Clipped_Data 2580 { 2581 Evas_Object *clipper; 2582 Evas *evas; 2583 }; 2584 2585 /** 2586 * Set a given smart class' callbacks so it implements the <b>clipped smart 2587 * object"</b>'s interface. 2588 * 2589 * @param sc The smart class handle to operate on 2590 * 2591 * This call will assign all the required methods of the @p sc 2592 * #Evas_Smart_Class instance to the implementations set for clipped 2593 * smart objects. If one wants to "subclass" it, call this function 2594 * and then override desired values. If one wants to call any original 2595 * method, save it somewhere. Example: 2596 * 2597 * @code 2598 * static Evas_Smart_Class parent_sc = EVAS_SMART_CLASS_INIT_NULL; 2599 * 2600 * static void my_class_smart_add(Evas_Object *o) 2601 * { 2602 * parent_sc.add(o); 2603 * evas_object_color_set(evas_object_smart_clipped_clipper_get(o), 2604 * 255, 0, 0, 255); 2605 * } 2606 * 2607 * Evas_Smart_Class *my_class_new(void) 2608 * { 2609 * static Evas_Smart_Class sc = EVAS_SMART_CLASS_INIT_NAME_VERSION("MyClass"); 2610 * if (!parent_sc.name) 2611 * { 2612 * evas_object_smart_clipped_smart_set(&sc); 2613 * parent_sc = sc; 2614 * sc.add = my_class_smart_add; 2615 * } 2616 * return ≻ 2617 * } 2618 * @endcode 2619 * 2620 * Default behavior for each of #Evas_Smart_Class functions on a 2621 * clipped smart object are: 2622 * - @c add: creates a hidden clipper with "infinite" size, to clip 2623 * any incoming members; 2624 * - @c del: delete all children objects; 2625 * - @c move: move all objects relative relatively; 2626 * - @c resize: <b>not defined</b>; 2627 * - @c show: if there are children objects, show clipper; 2628 * - @c hide: hides clipper; 2629 * - @c color_set: set the color of clipper; 2630 * - @c clip_set: set clipper of clipper; 2631 * - @c clip_unset: unset the clipper of clipper; 2632 * 2633 * @note There are other means of assigning parent smart classes to 2634 * child ones, like the #EVAS_SMART_SUBCLASS_NEW macro or the 2635 * evas_smart_class_inherit_full() function. 2636 */ 2637 EAPI void evas_object_smart_clipped_smart_set(Evas_Smart_Class *sc) EINA_ARG_NONNULL(1); 2638 2639 /** 2640 * Get a pointer to the <b>clipped smart object's</b> class, to use 2641 * for proper inheritance 2642 * 2643 * @see #Evas_Smart_Object_Clipped for more information on this smart 2644 * class 2645 */ 2646 EAPI const Evas_Smart_Class *evas_object_smart_clipped_class_get(void) EINA_CONST; 2647 /** 2648 * @} 2649 */ 2650 2651 /** 2652 * @defgroup Evas_Object_Box_Group Box Smart Object 2653 * 2654 * A box is a convenience smart object that packs children inside it 2655 * in @b sequence, using a layouting function specified by the 2656 * user. There are a couple of pre-made layouting functions <b>built-in 2657 * in Evas</b>, all of them using children size hints to define their 2658 * size and alignment inside their cell space. 2659 * 2660 * Examples on this smart object's usage: 2661 * - @ref Example_Evas_Box 2662 * - @ref Example_Evas_Size_Hints 2663 * 2664 * @see @ref Evas_Object_Group_Size_Hints 2665 * 2666 * @ingroup Evas_Smart_Object_Group 2667 * 2668 * @{ 2669 */ 2670 2671 /** 2672 * @typedef Evas_Object_Box_Api 2673 * 2674 * Smart class extension, providing extra box object requirements. 2675 * 2676 * @ingroup Evas_Object_Box_Group 2677 */ 2678 typedef struct _Evas_Object_Box_Api Evas_Object_Box_Api; 2679 2680 /** 2681 * @typedef Evas_Object_Box_Data 2682 * 2683 * Smart object instance data, providing box object requirements. 2684 * 2685 * @ingroup Evas_Object_Box_Group 2686 */ 2687 typedef struct _Evas_Object_Box_Data Evas_Object_Box_Data; 2688 2689 /** 2690 * @typedef Evas_Object_Box_Option 2691 * 2692 * The base structure for a box option. Box options are a way of 2693 * extending box items properties, which will be taken into account 2694 * for layouting decisions. The box layouting functions provided by 2695 * Evas will only rely on objects' canonical size hints to layout 2696 * them, so the basic box option has @b no (custom) property set. 2697 * 2698 * Users creating their own layouts, but not depending on extra child 2699 * items' properties, would be fine just using 2700 * evas_object_box_layout_set(). But if one desires a layout depending 2701 * on extra child properties, he/she has to @b subclass the box smart 2702 * object. Thus, by using evas_object_box_smart_class_get() and 2703 * evas_object_box_smart_set(), the @c option_new() and @c 2704 * option_free() smart class functions should be properly 2705 * redefined/extended. 2706 * 2707 * Object properties are bound to an integer identifier and must have 2708 * a name string. Their values are open to any data. See the API on 2709 * option properties for more details. 2710 * 2711 * @ingroup Evas_Object_Box_Group 2712 */ 2713 typedef struct _Evas_Object_Box_Option Evas_Object_Box_Option; 2714 2715 /** 2716 * @typedef Evas_Object_Box_Layout 2717 * 2718 * Function signature for an Evas box object layouting routine. By 2719 * @a o it will be passed the box object in question, by @a priv it will 2720 * be passed the box's internal data and, by @a user_data, it will be 2721 * passed any custom data one could have set to a given box layouting 2722 * function, with evas_object_box_layout_set(). 2723 * 2724 * @ingroup Evas_Object_Box_Group 2725 */ 2726 typedef void (*Evas_Object_Box_Layout)(Evas_Object *o, Evas_Object_Box_Data *priv, void *user_data); 2727 2728 /** 2729 * @def EVAS_OBJECT_BOX_API_VERSION 2730 * 2731 * Current version for Evas box object smart class, a value that goes 2732 * to _Evas_Object_Box_Api::version. 2733 * 2734 * @ingroup Evas_Object_Box_Group 2735 */ 2736 #define EVAS_OBJECT_BOX_API_VERSION 1 2737 2738 /** 2739 * @struct _Evas_Object_Box_Api 2740 * 2741 * This structure should be used by any smart class inheriting from 2742 * the box's one, to provide custom box behavior that could not be 2743 * achieved only by providing a layout function, with 2744 * evas_object_box_layout_set(). 2745 * 2746 * @extends Evas_Smart_Class 2747 * @ingroup Evas_Object_Box_Group 2748 */ 2749 struct _Evas_Object_Box_Api 2750 { 2751 Evas_Smart_Class base; /**< Base smart class struct, need for all smart objects */ 2752 int version; /**< Version of this smart class definition */ 2753 Evas_Object_Box_Option *(*append)(Evas_Object * o, Evas_Object_Box_Data * priv, Evas_Object * child); /**< Smart function to append child elements in boxes */ 2754 Evas_Object_Box_Option *(*prepend)(Evas_Object * o, Evas_Object_Box_Data * priv, Evas_Object * child); /**< Smart function to prepend child elements in boxes */ 2755 Evas_Object_Box_Option *(*insert_before)(Evas_Object * o, Evas_Object_Box_Data * priv, Evas_Object * child, const Evas_Object * reference); /**< Smart function to insert a child element before another in boxes */ 2756 Evas_Object_Box_Option *(*insert_after)(Evas_Object * o, Evas_Object_Box_Data * priv, Evas_Object * child, const Evas_Object * reference); /**< Smart function to insert a child element after another in boxes */ 2757 Evas_Object_Box_Option *(*insert_at)(Evas_Object * o, Evas_Object_Box_Data * priv, Evas_Object * child, unsigned int pos); /**< Smart function to insert a child element at a given position on boxes */ 2758 Evas_Object *(*remove)(Evas_Object * o, Evas_Object_Box_Data * priv, Evas_Object * child); /**< Smart function to remove a child element from boxes */ 2759 Evas_Object *(*remove_at)(Evas_Object * o, Evas_Object_Box_Data * priv, unsigned int pos); /**< Smart function to remove a child element from boxes, by its position */ 2760 Eina_Bool (*property_set)(Evas_Object *o, Evas_Object_Box_Option *opt, int property, va_list args); /**< Smart function to set a custom property on a box child */ 2761 Eina_Bool (*property_get)(const Evas_Object *o, Evas_Object_Box_Option *opt, int property, va_list args); /**< Smart function to retrieve a custom property from a box child */ 2762 const char *(*property_name_get)(const Evas_Object * o, int property); /**< Smart function to get the name of a custom property of box children */ 2763 int (*property_id_get)(const Evas_Object *o, const char *name); /**< Smart function to get the numerical ID of a custom property of box children */ 2764 Evas_Object_Box_Option *(*option_new)(Evas_Object * o, Evas_Object_Box_Data * priv, Evas_Object * child); /**< Smart function to create a new box option struct */ 2765 void (*option_free)(Evas_Object *o, Evas_Object_Box_Data *priv, Evas_Object_Box_Option *opt); /**< Smart function to delete a box option struct */ 2766 }; 2767 2768 /** 2769 * @def EVAS_OBJECT_BOX_API_INIT 2770 * 2771 * Initializer for a whole #Evas_Object_Box_Api structure, with 2772 * @c NULL values on its specific fields. 2773 * 2774 * @param smart_class_init initializer to use for the "base" field 2775 * (#Evas_Smart_Class). 2776 * 2777 * @see EVAS_SMART_CLASS_INIT_NULL 2778 * @see EVAS_SMART_CLASS_INIT_VERSION 2779 * @see EVAS_SMART_CLASS_INIT_NAME_VERSION 2780 * @see EVAS_OBJECT_BOX_API_INIT_NULL 2781 * @see EVAS_OBJECT_BOX_API_INIT_VERSION 2782 * @see EVAS_OBJECT_BOX_API_INIT_NAME_VERSION 2783 * @ingroup Evas_Object_Box_Group 2784 */ 2785 #define EVAS_OBJECT_BOX_API_INIT(smart_class_init) {smart_class_init, EVAS_OBJECT_BOX_API_VERSION, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL} 2786 2787 /** 2788 * @def EVAS_OBJECT_BOX_API_INIT_NULL 2789 * 2790 * Initialize to zero out a whole #Evas_Object_Box_Api structure. 2791 * 2792 * @see EVAS_OBJECT_BOX_API_INIT_VERSION 2793 * @see EVAS_OBJECT_BOX_API_INIT_NAME_VERSION 2794 * @see EVAS_OBJECT_BOX_API_INIT 2795 * @ingroup Evas_Object_Box_Group 2796 */ 2797 #define EVAS_OBJECT_BOX_API_INIT_NULL EVAS_OBJECT_BOX_API_INIT(EVAS_SMART_CLASS_INIT_NULL) 2798 2799 /** 2800 * @def EVAS_OBJECT_BOX_API_INIT_VERSION 2801 * 2802 * Initialize to zero out a whole #Evas_Object_Box_Api structure and 2803 * set a specific version on it. 2804 * 2805 * This is similar to #EVAS_OBJECT_BOX_API_INIT_NULL, but it will set 2806 * the version field of #Evas_Smart_Class (base field) to the latest 2807 * #EVAS_SMART_CLASS_VERSION. 2808 * 2809 * @see EVAS_OBJECT_BOX_API_INIT_NULL 2810 * @see EVAS_OBJECT_BOX_API_INIT_NAME_VERSION 2811 * @see EVAS_OBJECT_BOX_API_INIT 2812 * @ingroup Evas_Object_Box_Group 2813 */ 2814 #define EVAS_OBJECT_BOX_API_INIT_VERSION EVAS_OBJECT_BOX_API_INIT(EVAS_SMART_CLASS_INIT_VERSION) 2815 2816 /** 2817 * @def EVAS_OBJECT_BOX_API_INIT_NAME_VERSION 2818 * 2819 * Initialize to zero out a whole #Evas_Object_Box_Api structure and 2820 * set its name and version. 2821 * 2822 * This is similar to #EVAS_OBJECT_BOX_API_INIT_NULL, but it will also 2823 * set the version field of #Evas_Smart_Class (base field) to the 2824 * latest #EVAS_SMART_CLASS_VERSION and name it to the specific value. 2825 * 2826 * It will keep a reference to the name field as a <c>"const char *"</c>, 2827 * i.e., the name must be available while the structure is 2828 * used (hint: static or global variable!) and must not be modified. 2829 * 2830 * @see EVAS_OBJECT_BOX_API_INIT_NULL 2831 * @see EVAS_OBJECT_BOX_API_INIT_VERSION 2832 * @see EVAS_OBJECT_BOX_API_INIT 2833 * @ingroup Evas_Object_Box_Group 2834 */ 2835 #define EVAS_OBJECT_BOX_API_INIT_NAME_VERSION(name) EVAS_OBJECT_BOX_API_INIT(EVAS_SMART_CLASS_INIT_NAME_VERSION(name)) 2836 2837 /** 2838 * @struct _Evas_Object_Box_Data 2839 * 2840 * This structure augments clipped smart object's instance data, 2841 * providing extra members required by generic box implementation. If 2842 * a subclass inherits from #Evas_Object_Box_Api, then it may augment 2843 * #Evas_Object_Box_Data to fit its own needs. 2844 * 2845 * @extends Evas_Object_Smart_Clipped_Data 2846 * @ingroup Evas_Object_Box_Group 2847 */ 2848 struct _Evas_Object_Box_Data 2849 { 2850 Evas_Object_Smart_Clipped_Data base; 2851 const Evas_Object_Box_Api *api; 2852 struct 2853 { 2854 double h, v; 2855 } align; 2856 struct 2857 { 2858 Evas_Coord h, v; 2859 } pad; 2860 Eina_List *children; 2861 struct 2862 { 2863 Evas_Object_Box_Layout cb; 2864 void *data; 2865 void (*free_data)(void *data); 2866 } layout; 2867 Eina_Bool layouting : 1; 2868 Eina_Bool children_changed : 1; 2869 }; 2870 2871 struct _Evas_Object_Box_Option 2872 { 2873 Evas_Object *obj; /**< Pointer to the box child object, itself */ 2874 Eina_Bool max_reached : 1; 2875 Eina_Bool min_reached : 1; 2876 Evas_Coord alloc_size; 2877 }; /**< #Evas_Object_Box_Option struct fields */ 2878 2879 /** 2880 * Set the default box @a api struct (Evas_Object_Box_Api) 2881 * with the default values. May be used to extend that API. 2882 * 2883 * @param api The box API struct to set back, most probably with 2884 * overridden fields (on class extensions scenarios) 2885 */ 2886 EAPI void evas_object_box_smart_set(Evas_Object_Box_Api *api) EINA_ARG_NONNULL(1); 2887 2888 /** 2889 * Get the Evas box smart class, for inheritance purposes. 2890 * 2891 * @return the (canonical) Evas box smart class. 2892 * 2893 * The returned value is @b not to be modified, just use it as your 2894 * parent class. 2895 */ 2896 EAPI const Evas_Object_Box_Api *evas_object_box_smart_class_get(void) EINA_CONST; 2897 2898 /** 2899 * @} 2900 */ 2901 2902 /** 2903 * @defgroup Evas_Object_Table_Group Table Smart Object. 2904 * 2905 * Convenience smart object that packs children using a tabular 2906 * layout using children size hints to define their size and 2907 * alignment inside their cell space. 2908 * 2909 * @ref tutorial_table shows how to use this Evas_Object. 2910 * 2911 * @see @ref Evas_Object_Group_Size_Hints 2912 * 2913 * @ingroup Evas_Smart_Object_Group 2914 * 2915 */ 2916 2917 /** 2918 * @defgroup Evas_Object_Grid_Group Grid Smart Object. 2919 * 2920 * Convenience smart object that packs children under a regular grid 2921 * layout, using their virtual grid location and size to determine 2922 * children's positions inside the grid object's area. 2923 * 2924 * @ingroup Evas_Smart_Object_Group 2925 * @since 1.1 2926 */ 2927 2928 /** 2929 * @defgroup Evas_Cserve Shared Image Cache Server 2930 * @ingroup Evas 2931 * 2932 * Evas has an (optional) module that provides client-server 2933 * infrastructure to <b>share bitmaps across multiple processes</b>, 2934 * saving data and processing power. 2935 * 2936 * Be warned that it @b doesn't work when <b>threaded image 2937 * preloading</b> is enabled for Evas, though. 2938 */ 2939 typedef struct _Evas_Cserve_Stats Evas_Cserve_Stats; 2940 typedef struct _Evas_Cserve_Image_Cache Evas_Cserve_Image_Cache; 2941 typedef struct _Evas_Cserve_Image Evas_Cserve_Image; 2942 typedef struct _Evas_Cserve_Config Evas_Cserve_Config; 2943 2944 /** 2945 * Statistics about the server that shares cached bitmaps. 2946 * @ingroup Evas_Cserve 2947 */ 2948 struct _Evas_Cserve_Stats 2949 { 2950 int saved_memory; /**< current amount of saved memory, in bytes */ 2951 int wasted_memory; /**< current amount of wasted memory, in bytes */ 2952 int saved_memory_peak; /**< peak amount of saved memory, in bytes */ 2953 int wasted_memory_peak; /**< peak amount of wasted memory, in bytes */ 2954 double saved_time_image_header_load; /**< time, in seconds, saved in header loads by sharing cached loads instead */ 2955 double saved_time_image_data_load; /**< time, in seconds, saved in data loads by sharing cached loads instead */ 2956 }; 2957 2958 /** 2959 * A handle of a cache of images shared by a server. 2960 * @ingroup Evas_Cserve 2961 */ 2962 struct _Evas_Cserve_Image_Cache 2963 { 2964 struct 2965 { 2966 int mem_total; 2967 int count; 2968 } active, cached; 2969 Eina_List *images; 2970 }; 2971 2972 /** 2973 * A handle to an image shared by a server. 2974 * @ingroup Evas_Cserve 2975 */ 2976 struct _Evas_Cserve_Image 2977 { 2978 const char *file, *key; 2979 int w, h; 2980 time_t file_mod_time; 2981 time_t file_checked_time; 2982 time_t cached_time; 2983 int refcount; 2984 int data_refcount; 2985 int memory_footprint; 2986 double head_load_time; 2987 double data_load_time; 2988 Eina_Bool alpha : 1; 2989 Eina_Bool data_loaded : 1; 2990 Eina_Bool active : 1; 2991 Eina_Bool dead : 1; 2992 Eina_Bool useless : 1; 2993 }; 2994 2995 /** 2996 * Configuration that controls the server that shares cached bitmaps. 2997 * @ingroup Evas_Cserve 2998 */ 2999 struct _Evas_Cserve_Config 3000 { 3001 int cache_max_usage; 3002 int cache_item_timeout; 3003 int cache_item_timeout_check; 3004 }; 3005 3006 /** 3007 * Retrieves if the system wants to share bitmaps using the server. 3008 * @return @c EINA_TRUE if it wants, @c EINA_FALSE otherwise. 3009 * @ingroup Evas_Cserve 3010 */ 3011 EAPI Eina_Bool evas_cserve_want_get(void) EINA_WARN_UNUSED_RESULT; 3012 3013 /** 3014 * Retrieves if the system is connected to the server used to share 3015 * bitmaps. 3016 * 3017 * @return @c EINA_TRUE if it's connected, @c EINA_FALSE otherwise. 3018 * @ingroup Evas_Cserve 3019 */ 3020 EAPI Eina_Bool evas_cserve_connected_get(void) EINA_WARN_UNUSED_RESULT; 3021 3022 /** 3023 * Retrieves statistics from a running bitmap sharing server. 3024 * @param stats pointer to structure to fill with statistics about the 3025 * bitmap cache server. 3026 * 3027 * @return @c EINA_TRUE if @p stats were filled with data, 3028 * @c EINA_FALSE otherwise (when @p stats is untouched) 3029 * @ingroup Evas_Cserve 3030 */ 3031 EAPI Eina_Bool evas_cserve_stats_get(Evas_Cserve_Stats *stats) EINA_WARN_UNUSED_RESULT; 3032 3033 /** 3034 * Completely discard/clean a given images cache, thus re-setting it. 3035 * 3036 * @param cache A handle to the given images cache. 3037 */ 3038 EAPI void evas_cserve_image_cache_contents_clean(Evas_Cserve_Image_Cache *cache); 3039 3040 /** 3041 * Retrieves the current configuration of the Evas image caching 3042 * server. 3043 * 3044 * @param config where to store current image caching server's 3045 * configuration. 3046 * 3047 * @return @c EINA_TRUE if @p config was filled with data, 3048 * @c EINA_FALSE otherwise (when @p config is untouched) 3049 * 3050 * The fields of @p config will be altered to reflect the current 3051 * configuration's values. 3052 * 3053 * @see evas_cserve_config_set() 3054 * 3055 * @ingroup Evas_Cserve 3056 */ 3057 EAPI Eina_Bool evas_cserve_config_get(Evas_Cserve_Config *config) EINA_WARN_UNUSED_RESULT; 3058 3059 /** 3060 * Changes the configurations of the Evas image caching server. 3061 * 3062 * @param config A bitmap cache configuration handle with fields set 3063 * to desired configuration values. 3064 * @return @c EINA_TRUE if @p config was successfully applied, 3065 * @c EINA_FALSE otherwise. 3066 * 3067 * @see evas_cserve_config_get() 3068 * 3069 * @ingroup Evas_Cserve 3070 */ 3071 EAPI Eina_Bool evas_cserve_config_set(const Evas_Cserve_Config *config) EINA_WARN_UNUSED_RESULT; 3072 3073 /** 3074 * Force the system to disconnect from the bitmap caching server. 3075 * 3076 * @ingroup Evas_Cserve 3077 */ 3078 EAPI void evas_cserve_disconnect(void); 3079 3080 /** 3081 * @defgroup Evas_Utils General Utilities 3082 * @ingroup Evas 3083 * 3084 * Some functions that are handy but are not specific of canvas or 3085 * objects. 3086 */ 3087 3088 /** 3089 * Converts the given Evas image load error code into a string 3090 * describing it in human-readable text. 3091 * 3092 * @param error the error code, a value in ::Evas_Load_Error. 3093 * @return Always returns a valid string. If the given @p error is not 3094 * supported, <code>"Unknown error"</code> is returned. 3095 * 3096 * Mostly evas_object_image_file_set() would be the function setting 3097 * that error value afterwards, but also evas_object_image_load(), 3098 * evas_object_image_save(), evas_object_image_data_get(), 3099 * evas_object_image_data_convert(), evas_object_image_pixels_import() 3100 * and evas_object_image_is_inside(). This function is meant to be 3101 * used in conjunction with evas_object_image_load_error_get(), as in: 3102 * 3103 * Example code: 3104 * @dontinclude evas-images.c 3105 * @skip img1 = 3106 * @until ecore_main_loop_begin( 3107 * 3108 * Here, being @c valid_path the path to a valid image and @c 3109 * bogus_path a path to a file that does not exist, the two outputs 3110 * of evas_load_error_str() would be (if no other errors occur): 3111 * <code>"No error on load"</code> and <code>"File (or file path) does 3112 * not exist"</code>, respectively. See the full @ref 3113 * Example_Evas_Images "example". 3114 * 3115 * @ingroup Evas_Utils 3116 */ 3117 EAPI const char *evas_load_error_str(Evas_Load_Error error); 3118 3119 /* Evas utility routines for color space conversions */ 3120 /* hsv color space has h in the range 0.0 to 360.0, and s,v in the range 0.0 to 1.0 */ 3121 /* rgb color space has r,g,b in the range 0 to 255 */ 3122 3123 /** 3124 * Convert a given color from HSV to RGB format. 3125 * 3126 * @param h The Hue component of the color. 3127 * @param s The Saturation component of the color. 3128 * @param v The Value component of the color. 3129 * @param r The Red component of the color. 3130 * @param g The Green component of the color. 3131 * @param b The Blue component of the color. 3132 * 3133 * This function converts a given color in HSV color format to RGB 3134 * color format. 3135 * 3136 * @ingroup Evas_Utils 3137 **/ 3138 EAPI void evas_color_hsv_to_rgb(float h, float s, float v, int *r, int *g, int *b); 3139 3140 /** 3141 * Convert a given color from RGB to HSV format. 3142 * 3143 * @param r The Red component of the color. 3144 * @param g The Green component of the color. 3145 * @param b The Blue component of the color. 3146 * @param h The Hue component of the color. 3147 * @param s The Saturation component of the color. 3148 * @param v The Value component of the color. 3149 * 3150 * This function converts a given color in RGB color format to HSV 3151 * color format. 3152 * 3153 * @ingroup Evas_Utils 3154 **/ 3155 EAPI void evas_color_rgb_to_hsv(int r, int g, int b, float *h, float *s, float *v); 3156 3157 /* argb color space has a,r,g,b in the range 0 to 255 */ 3158 3159 /** 3160 * Pre-multiplies a rgb triplet by an alpha factor. 3161 * 3162 * @param a The alpha factor. 3163 * @param r The Red component of the color. 3164 * @param g The Green component of the color. 3165 * @param b The Blue component of the color. 3166 * 3167 * This function pre-multiplies a given rgb triplet by an alpha 3168 * factor. Alpha factor is used to define transparency. 3169 * 3170 * @ingroup Evas_Utils 3171 **/ 3172 EAPI void evas_color_argb_premul(int a, int *r, int *g, int *b); 3173 3174 /** 3175 * Undo pre-multiplication of a rgb triplet by an alpha factor. 3176 * 3177 * @param a The alpha factor. 3178 * @param r The Red component of the color. 3179 * @param g The Green component of the color. 3180 * @param b The Blue component of the color. 3181 * 3182 * This function undoes pre-multiplication a given rbg triplet by an 3183 * alpha factor. Alpha factor is used to define transparency. 3184 * 3185 * @see evas_color_argb_premul(). 3186 * 3187 * @ingroup Evas_Utils 3188 **/ 3189 EAPI void evas_color_argb_unpremul(int a, int *r, int *g, int *b); 3190 3191 /** 3192 * Pre-multiplies data by an alpha factor. 3193 * 3194 * @param data The data value. 3195 * @param len The length value. 3196 * 3197 * This function pre-multiplies a given data by an alpha 3198 * factor. Alpha factor is used to define transparency. 3199 * 3200 * @ingroup Evas_Utils 3201 **/ 3202 EAPI void evas_data_argb_premul(unsigned int *data, unsigned int len); 3203 3204 /** 3205 * Undo pre-multiplication data by an alpha factor. 3206 * 3207 * @param data The data value. 3208 * @param len The length value. 3209 * 3210 * This function undoes pre-multiplication of a given data by an alpha 3211 * factor. Alpha factor is used to define transparency. 3212 * 3213 * @ingroup Evas_Utils 3214 **/ 3215 EAPI void evas_data_argb_unpremul(unsigned int *data, unsigned int len); 3216 3217 /* string and font handling */ 3218 3219 /** 3220 * Gets the next character in the string 3221 * 3222 * Given the UTF-8 string in @p str, and starting byte position in @p pos, 3223 * this function will place in @p decoded the decoded code point at @p pos 3224 * and return the byte index for the next character in the string. 3225 * 3226 * The only boundary check done is that @p pos must be >= 0. Other than that, 3227 * no checks are performed, so passing an index value that's not within the 3228 * length of the string will result in undefined behavior. 3229 * 3230 * @param str The UTF-8 string 3231 * @param pos The byte index where to start 3232 * @param decoded Address where to store the decoded code point. Optional. 3233 * 3234 * @return The byte index of the next character 3235 * 3236 * @ingroup Evas_Utils 3237 */ 3238 EAPI int evas_string_char_next_get(const char *str, int pos, int *decoded) EINA_ARG_NONNULL(1); 3239 3240 /** 3241 * Gets the previous character in the string 3242 * 3243 * Given the UTF-8 string in @p str, and starting byte position in @p pos, 3244 * this function will place in @p decoded the decoded code point at @p pos 3245 * and return the byte index for the previous character in the string. 3246 * 3247 * The only boundary check done is that @p pos must be >= 1. Other than that, 3248 * no checks are performed, so passing an index value that's not within the 3249 * length of the string will result in undefined behavior. 3250 * 3251 * @param str The UTF-8 string 3252 * @param pos The byte index where to start 3253 * @param decoded Address where to store the decoded code point. Optional. 3254 * 3255 * @return The byte index of the previous character 3256 * 3257 * @ingroup Evas_Utils 3258 */ 3259 EAPI int evas_string_char_prev_get(const char *str, int pos, int *decoded) EINA_ARG_NONNULL(1); 3260 3261 /** 3262 * Get the length in characters of the string. 3263 * 3264 * @param str The string to get the length of. 3265 * @return The length in characters (not bytes) 3266 * 3267 * @ingroup Evas_Utils 3268 */ 3269 EAPI int evas_string_char_len_get(const char *str) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); 3270 3271 /** 3272 * Get language direction. 3273 * 3274 * @ingroup Evas_Utils 3275 * @since 1.20 3276 */ 3277 EAPI Evas_BiDi_Direction evas_language_direction_get(void); 3278 3279 /** 3280 * Reinitialize language from the environment. 3281 * 3282 * The locale can change while a process is running. This call tells evas to 3283 * reload the locale from the environment like it does on start. 3284 * 3285 * @ingroup Evas_Utils 3286 * @since 1.18 3287 */ 3288 EAPI void evas_language_reinit(void); 3289 3290 /** 3291 * @defgroup Evas_Keys Key Input Functions 3292 * 3293 * Functions that feed key events to the canvas. 3294 * 3295 * As explained in @ref intro_not_evas, Evas is @b not aware of input 3296 * systems at all. Then, the user, if using it crudely (evas_new()), 3297 * will have to feed it with input events, so that it can react 3298 * somehow. If, however, the user creates a canvas by means of the 3299 * Ecore_Evas wrapper, it will automatically bind the chosen display 3300 * engine's input events to the canvas, for you. 3301 * 3302 * This group presents the functions dealing with the feeding of key 3303 * events to the canvas. On most of them, one has to reference a given 3304 * key by a name (<code>keyname</code> argument). Those are 3305 * <b>platform dependent</b> symbolic names for the keys. Sometimes 3306 * you'll get the right <code>keyname</code> by simply using an ASCII 3307 * value of the key name, but it won't be like that always. 3308 * 3309 * Typical platforms are Linux frame buffer (Ecore_FB) and X server 3310 * (Ecore_X) when using Evas with Ecore and Ecore_Evas. Please refer 3311 * to your display engine's documentation when using evas through an 3312 * Ecore helper wrapper when you need the <code>keyname</code>s. 3313 * 3314 * Example: 3315 * @dontinclude evas-events.c 3316 * @skip mods = evas_key_modifier_get(evas); 3317 * @until { 3318 * 3319 * All the other @c evas_key functions behave on the same manner. See 3320 * the full @ref Example_Evas_Events "example". 3321 * 3322 * @ingroup Evas_Canvas 3323 */ 3324 3325 /** 3326 * @addtogroup Evas_Font_Group 3327 * 3328 * @{ 3329 */ 3330 3331 /** 3332 * @defgroup Evas_Font_Path_Group Font Path Functions 3333 * 3334 * Functions that edit the paths being used to load fonts. 3335 * 3336 * @{ 3337 */ 3338 3339 /** 3340 * Removes all font paths loaded into memory by evas_font_path_app_* APIs 3341 * for the application. 3342 * @since 1.9 3343 */ 3344 EAPI void evas_font_path_global_clear(void); 3345 3346 /** 3347 * Appends a font path to the list of font paths used by the application. 3348 * @param path The new font path. 3349 * @since 1.9 3350 */ 3351 EAPI void evas_font_path_global_append(const char *path) EINA_ARG_NONNULL(1); 3352 3353 /** 3354 * Prepends a font path to the list of font paths used by the application. 3355 * @param path The new font path. 3356 * @since 1.9 3357 */ 3358 EAPI void evas_font_path_global_prepend(const char *path) EINA_ARG_NONNULL(1); 3359 3360 /** 3361 * Retrieves the list of font paths used by the application. 3362 * @return The list of font paths used. 3363 * @since 1.9 3364 */ 3365 EAPI const Eina_List *evas_font_path_global_list(void) EINA_WARN_UNUSED_RESULT; 3366 3367 /** 3368 * @} 3369 */ 3370 3371 /** 3372 * Reinitialize FontConfig. If FontConfig has to be reinitialized 3373 * according to changes of system environments (e.g. Changing font config files), it will be useful. 3374 * 3375 * @since 1.14 3376 */ 3377 EAPI void evas_font_reinit(void); 3378 3379 /** 3380 * @} 3381 */ 3382 3383 /** 3384 * Set the limit in bytes for memory allocated by font glyphs in evas. 3385 * @param[in] options for caching. 3386 * @param[in] bytes cache size in bytes, pass negative value to ignore the limit. 3387 * 3388 * @since 1.24 3389 */ 3390 EAPI void evas_font_data_cache_set(Evas_Font_Data_Cache options, int byte); 3391 3392 /** 3393 * @} 3394 */ 3395 3396 /** 3397 * Get the limit in bytes for memory allocated by font glyphs in evas. 3398 * @param[in] options for caching. 3399 * @return Returns font allocated memory cache limit, if value is negative this means no limit. 3400 * @since 1.24 3401 */ 3402 EAPI int evas_font_data_cache_get(Evas_Font_Data_Cache options); 3403 3404 /** 3405 * @} 3406 */ 3407 3408 // The below type are necessary for legacy API and need to be manually kept in sync with .eo file. 3409 #ifndef _EFL_INPUT_DEVICE_EO_CLASS_TYPE 3410 #define _EFL_INPUT_DEVICE_EO_CLASS_TYPE 3411 typedef Eo Efl_Input_Device; 3412 #endif 3413 3414 #ifndef _EFL_INPUT_DEVICE_EO_TYPES 3415 #define _EFL_INPUT_DEVICE_EO_TYPES 3416 typedef enum 3417 { 3418 EFL_INPUT_DEVICE_TYPE_NONE = 0, 3419 EFL_INPUT_DEVICE_TYPE_SEAT, 3420 EFL_INPUT_DEVICE_TYPE_KEYBOARD, 3421 EFL_INPUT_DEVICE_TYPE_MOUSE, 3422 EFL_INPUT_DEVICE_TYPE_TOUCH, 3423 EFL_INPUT_DEVICE_TYPE_PEN, 3424 EFL_INPUT_DEVICE_TYPE_WAND, 3425 EFL_INPUT_DEVICE_TYPE_GAMEPAD 3426 } Efl_Input_Device_Type; 3427 3428 #endif 3429 3430 #ifndef _EFL_GFX_ENTITY_EO_H_ 3431 #define _EFL_GFX_ENTITY_EO_H_ 3432 3433 #ifndef _EFL_GFX_ENTITY_EO_CLASS_TYPE 3434 #define _EFL_GFX_ENTITY_EO_CLASS_TYPE 3435 3436 typedef Eo Efl_Gfx_Entity; 3437 3438 #endif 3439 #endif 3440