1 #ifndef ELM_INTEFARCE_SCROLLER_H 2 #define ELM_INTEFARCE_SCROLLER_H 3 4 /** 5 * @addtogroup Widget 6 * @{ 7 * 8 * @section elm-scrollable-interface The Elementary Scrollable Interface 9 * 10 * This is a common interface for widgets having @b scrollable views. 11 * Widgets using/implementing this must use the 12 * @c EVAS_SMART_SUBCLASS_IFACE_NEW macro (instead of the 13 * @c EVAS_SMART_SUBCLASS_NEW one) when declaring its smart class, 14 * so an interface is also declared. 15 * 16 * The scrollable interface comes built with Elementary and is exposed 17 * as #ELM_SCROLLABLE_IFACE. 18 * 19 * The interface API is explained in details at 20 * #Elm_Scrollable_Smart_Interface. 21 * 22 * An Elementary scrollable interface will handle an internal @b 23 * panning object. It has the function of clipping and moving the 24 * actual scrollable content around, by the command of the scrollable 25 * interface calls. Though it's not the common case, one might 26 * want/have to change some aspects of the internal panning object 27 * behavior. For that, we have it also exposed here -- 28 * #Elm_Pan_Smart_Class. Use elm_pan_smart_class_get() to build your 29 * custom panning object, when creating a scrollable widget (again, 30 * only if you need a custom panning object) and set it with 31 * Elm_Scrollable_Smart_Interface::extern_pan_set. 32 */ 33 34 #include <elm_pan_eo.legacy.h> 35 #include <elm_scroller.h> 36 37 /** 38 * Elementary scroller panning base smart data. 39 */ 40 typedef struct _Elm_Pan_Smart_Data Elm_Pan_Smart_Data; 41 struct _Elm_Pan_Smart_Data 42 { 43 Evas_Object *self; 44 Evas_Object *content; 45 Evas_Object *interface_object; 46 Evas_Coord x, y, w, h; 47 Evas_Coord content_w, content_h, px, py; 48 }; 49 50 /** 51 * Elementary scrollable interface base data. 52 */ 53 typedef void (*Elm_Interface_Scrollable_Cb)(Evas_Object *, void *data); 54 typedef void (*Elm_Interface_Scrollable_Min_Limit_Cb)(Evas_Object *obj, Eina_Bool w, Eina_Bool h); 55 typedef void (*Elm_Interface_Scrollable_Resize_Cb)(Evas_Object *obj, Evas_Coord w, Evas_Coord h); 56 57 typedef struct _Elm_Scrollable_Smart_Interface_Data 58 Elm_Scrollable_Smart_Interface_Data; 59 60 #include "elm_interface_scrollable.eo.h" 61 62 struct _Elm_Scrollable_Smart_Interface_Data 63 { 64 Evas_Coord x, y, w, h; 65 Evas_Coord wx, wy, ww, wh; /**< Last "wanted" geometry */ 66 67 Evas_Object *obj; 68 Evas_Object *content; 69 Evas_Object *pan_obj; 70 Evas_Object *edje_obj; 71 Evas_Object *event_rect; 72 73 Evas_Object *parent_widget; 74 75 Elm_Scroller_Policy hbar_flags, vbar_flags; 76 Elm_Scroller_Single_Direction one_direction_at_a_time; 77 Efl_Ui_Layout_Orientation block; 78 79 struct 80 { 81 Evas_Coord x, y; 82 Evas_Coord sx, sy; 83 Evas_Coord dx, dy; 84 Evas_Coord pdx, pdy; 85 Evas_Coord bx, by; 86 Evas_Coord ax, ay; 87 Evas_Coord bx0, by0; 88 Evas_Coord b0x, b0y; 89 Evas_Coord b2x, b2y; 90 91 struct 92 { 93 Evas_Coord x, y; 94 double timestamp; 95 } history[60]; 96 97 double est_timestamp_diff; 98 99 double dragged_began_timestamp; 100 double anim_start; 101 double anim_start2; 102 double anim_start3; 103 double anim_dur; 104 105 double onhold_vx, onhold_vy, onhold_tlast, 106 onhold_vxe, onhold_vye; 107 108 double last_time_x_wheel; 109 double last_time_y_wheel; 110 111 Evas_Coord hold_x, hold_y; 112 Evas_Coord locked_x, locked_y; 113 int hdir, vdir; 114 115 Ecore_Idle_Enterer *hold_enterer; 116 117 Eina_Bool hold_animator : 1; 118 Eina_Bool onhold_animator : 1; 119 Eina_Bool momentum_animator : 1; /**< an animator which is called whenever a scroller is moving due to a flick action(mouse down, move, up) */ 120 Eina_Bool bounce_x_animator : 1; /**< an animator to express the bouncing animation on x axis. */ 121 Eina_Bool bounce_y_animator : 1; /**< an animator to express the bouncing animation on y axis. */ 122 123 Eina_Bool last_hold_x_wheel : 1; 124 Eina_Bool last_hold_y_wheel : 1; 125 Eina_Bool bounce_x_hold : 1; 126 Eina_Bool bounce_y_hold : 1; 127 Eina_Bool dragged_began : 1; 128 Eina_Bool want_dragged : 1; 129 Eina_Bool hold_parent : 1; 130 Eina_Bool want_reset : 1; 131 Eina_Bool cancelled : 1; 132 Eina_Bool dragged : 1; 133 Eina_Bool locked : 1; 134 Eina_Bool scroll : 1; 135 Eina_Bool dir_x : 1; 136 Eina_Bool dir_y : 1; 137 Eina_Bool hold : 1; 138 Eina_Bool now : 1; 139 } down; 140 141 struct 142 { 143 Evas_Coord w, h; 144 Eina_Bool resized : 1; 145 } content_info; 146 147 struct 148 { 149 Evas_Coord x, y; 150 } step, page, current_page; 151 152 struct 153 { 154 Elm_Interface_Scrollable_Cb drag_start; 155 Elm_Interface_Scrollable_Cb drag_stop; 156 Elm_Interface_Scrollable_Cb animate_start; 157 Elm_Interface_Scrollable_Cb animate_stop; 158 Elm_Interface_Scrollable_Cb scroll; 159 Elm_Interface_Scrollable_Cb scroll_left; 160 Elm_Interface_Scrollable_Cb scroll_right; 161 Elm_Interface_Scrollable_Cb scroll_up; 162 Elm_Interface_Scrollable_Cb scroll_down; 163 Elm_Interface_Scrollable_Cb edge_left; 164 Elm_Interface_Scrollable_Cb edge_right; 165 Elm_Interface_Scrollable_Cb edge_top; 166 Elm_Interface_Scrollable_Cb edge_bottom; 167 Elm_Interface_Scrollable_Cb vbar_drag; 168 Elm_Interface_Scrollable_Cb vbar_press; 169 Elm_Interface_Scrollable_Cb vbar_unpress; 170 Elm_Interface_Scrollable_Cb hbar_drag; 171 Elm_Interface_Scrollable_Cb hbar_press; 172 Elm_Interface_Scrollable_Cb hbar_unpress; 173 Elm_Interface_Scrollable_Cb page_change; 174 175 Elm_Interface_Scrollable_Min_Limit_Cb content_min_limit; 176 Elm_Interface_Scrollable_Resize_Cb content_viewport_resize; 177 } cb_func; 178 179 struct 180 { 181 struct 182 { 183 Evas_Coord start, end; 184 double t_start, t_end; 185 Eina_Bool animator; 186 } x, y; 187 } scrollto; 188 189 double pagerel_h, pagerel_v; 190 Evas_Coord pagesize_h, pagesize_v; 191 int page_limit_h, page_limit_v; 192 int current_calc; 193 194 double last_wheel_mul; 195 unsigned int last_wheel; 196 197 unsigned char size_adjust_recurse; 198 unsigned char size_count; 199 void *event_info; 200 201 double gravity_x, gravity_y; 202 Evas_Coord prev_cw, prev_ch; 203 204 Eina_Bool size_adjust_recurse_abort : 1; 205 206 Eina_Bool momentum_animator_disabled : 1; 207 Eina_Bool bounce_animator_disabled : 1; 208 Eina_Bool page_snap_horiz : 1; 209 Eina_Bool page_snap_vert : 1; 210 Eina_Bool wheel_disabled : 1; 211 Eina_Bool hbar_visible : 1; 212 Eina_Bool vbar_visible : 1; 213 Eina_Bool bounce_horiz : 1; 214 Eina_Bool bounce_vert : 1; 215 Eina_Bool is_mirrored : 1; 216 Eina_Bool extern_pan : 1; 217 Eina_Bool bouncemey : 1; 218 Eina_Bool bouncemex : 1; 219 Eina_Bool freeze : 1; 220 Eina_Bool freeze_want : 1; 221 Eina_Bool hold : 1; 222 Eina_Bool min_w : 1; 223 Eina_Bool min_h : 1; 224 Eina_Bool go_left : 1; 225 Eina_Bool go_right : 1; 226 Eina_Bool go_up : 1; 227 Eina_Bool go_down : 1; 228 Eina_Bool loop_h : 1; 229 Eina_Bool loop_v : 1; 230 231 void *manager; /* Efl_Ui_Focus_Manager */ 232 }; 233 234 #define ELM_SCROLLABLE_CHECK(obj, ...) \ 235 \ 236 if (!efl_isa(obj, ELM_INTERFACE_SCROLLABLE_MIXIN)) \ 237 { \ 238 ERR("The object (%p) doesn't implement the Elementary scrollable" \ 239 " interface", obj); \ 240 if (getenv("ELM_ERROR_ABORT")) abort(); \ 241 return __VA_ARGS__; \ 242 } 243 244 #ifdef EFL_BETA_API_SUPPORT 245 EAPI void elm_pan_gravity_set(Elm_Pan *, double x, double) EINA_DEPRECATED; 246 EAPI void elm_pan_gravity_get(const Elm_Pan *, double *, double *) EINA_DEPRECATED; 247 #endif 248 249 /** 250 * @} 251 */ 252 253 #endif 254