1 #ifndef ELM_WIDGET_ROUTE_H
2 #define ELM_WIDGET_ROUTE_H
3 
4 #include "elm_route_eo.h"
5 
6 /* DO NOT USE THIS HEADER UNLESS YOU ARE PREPARED FOR BREAKING OF YOUR
7  * CODE. THIS IS ELEMENTARY'S INTERNAL WIDGET API (for now) AND IS NOT
8  * FINAL. CALL elm_widget_api_check(ELM_INTERNAL_API_VERSION) TO CHECK
9  * IT AT RUNTIME.
10  */
11 
12 /**
13  * @addtogroup Widget
14  * @{
15  *
16  * @section elm-route-class The Elementary Route Class
17  *
18  * Elementary, besides having the @ref Route widget, exposes its
19  * foundation -- the Elementary Route Class -- in order to create other
20  * widgets which are a route with some more logic on top.
21  */
22 
23 /**
24  * Base widget smart data extended with route instance data.
25  */
26 typedef struct _Elm_Route_Data       Elm_Route_Data;
27 typedef struct Segment               Segment;
28 
29 struct _Elm_Route_Data
30 {
31 #ifdef ELM_EMAP
32    EMap_Route           *emap;
33 #endif
34 
35    double                lon_min, lon_max;
36    double                lat_min, lat_max;
37 
38    Eina_List            *segments; //list of *Segment
39 
40    Eina_Bool             must_calc_segments : 1;
41 };
42 
43 struct Segment
44 {
45    Evas_Object     *obj;
46 
47 #ifdef ELM_EMAP
48    EMap_Route_Node *node_start;
49    EMap_Route_Node *node_end;
50 #endif
51 
52    double           start_x, start_y;
53    double           end_x, end_y;
54 
55    Eina_Bool        must_calc : 1;
56 };
57 /**
58  * @}
59  */
60 
61 #define ELM_ROUTE_DATA_GET(o, sd) \
62   Elm_Route_Data * sd = efl_data_scope_get(o, ELM_ROUTE_CLASS)
63 
64 #define ELM_ROUTE_DATA_GET_OR_RETURN(o, ptr)         \
65   ELM_ROUTE_DATA_GET(o, ptr);                        \
66   if (EINA_UNLIKELY(!ptr))                           \
67     {                                                \
68        ERR("No widget data for object %p (%s)",      \
69            o, evas_object_type_get(o));              \
70        return;                                       \
71     }
72 
73 #define ELM_ROUTE_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
74   ELM_ROUTE_DATA_GET(o, ptr);                         \
75   if (EINA_UNLIKELY(!ptr))                            \
76     {                                                 \
77        ERR("No widget data for object %p (%s)",       \
78            o, evas_object_type_get(o));               \
79        return val;                                    \
80     }
81 
82 #define ELM_ROUTE_CHECK(obj)                              \
83   if (EINA_UNLIKELY(!efl_isa((obj), ELM_ROUTE_CLASS))) \
84     return
85 
86 #endif
87