summaryrefslogtreecommitdiff
path: root/src/lib/elementary/elm_widget_list.h
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-03-23 12:56:14 -0700
committerCedric BAIL <cedric@osg.samsung.com>2016-03-23 13:24:41 -0700
commitc2a1c49ab2042f559b28e840e54feb8494888e0e (patch)
treec6eb110b7c479499854eede9d0c3ab0a80c9a11a /src/lib/elementary/elm_widget_list.h
parent9340855597e7e465435c69b6278650346688da14 (diff)
elementary: move all legacy files to their expected new location.
Diffstat (limited to 'src/lib/elementary/elm_widget_list.h')
-rw-r--r--src/lib/elementary/elm_widget_list.h143
1 files changed, 143 insertions, 0 deletions
diff --git a/src/lib/elementary/elm_widget_list.h b/src/lib/elementary/elm_widget_list.h
new file mode 100644
index 0000000..5feaa4e
--- /dev/null
+++ b/src/lib/elementary/elm_widget_list.h
@@ -0,0 +1,143 @@
1#ifndef ELM_WIDGET_LIST_H
2#define ELM_WIDGET_LIST_H
3
4#include "elm_interface_scrollable.h"
5#include "elm_widget_layout.h"
6
7/* DO NOT USE THIS HEADER UNLESS YOU ARE PREPARED FOR BREAKING OF YOUR
8 * CODE. THIS IS ELEMENTARY'S INTERNAL WIDGET API (for now) AND IS NOT
9 * FINAL. CALL elm_widget_api_check(ELM_INTERNAL_API_VERSION) TO CHECK
10 * IT AT RUNTIME.
11 */
12
13/**
14 * @addtogroup Widget
15 * @{
16 *
17 * @section elm-list-class The Elementary List Class
18 *
19 * Elementary, besides having the @ref List widget, exposes its
20 * foundation -- the Elementary List Class -- in order to create
21 * other widgets which are a list with some more logic on top.
22 */
23
24#define ELM_LIST_SWIPE_MOVES 12
25
26typedef struct _Elm_List_Item_Data Elm_List_Item_Data;
27/**
28 * Base widget smart data extended with list instance data.
29 */
30typedef struct _Elm_List_Data Elm_List_Data;
31struct _Elm_List_Data
32{
33 Evas_Object *box, *hit_rect;
34
35 Eina_List *items, *selected, *to_delete;
36 Elm_Object_Item *last_selected_item;
37 Elm_Object_Item *focused_item; /**< a focused item by keypad arrow or mouse. This is set to NULL if widget looses focus. */
38 Elm_Object_Item *last_focused_item; /**< This records the last focused item when widget looses focus. This is required to set the focus on last focused item when widgets gets focus. */
39 Evas_Coord minw[2], minh[2], dx, dy;
40 Elm_Object_Select_Mode select_mode;
41 Elm_Object_Multi_Select_Mode multi_select_mode; /**< select mode for multiple selection */
42 int movements;
43 int walking;
44 Elm_List_Mode h_mode;
45 Elm_List_Mode mode;
46
47 struct
48 {
49 Evas_Coord x, y;
50 } history[ELM_LIST_SWIPE_MOVES];
51
52 Eina_Bool focus_on_selection_enabled : 1;
53 Eina_Bool was_selected : 1;
54 Eina_Bool fix_pending : 1;
55 Eina_Bool longpressed : 1;
56 Eina_Bool scr_minw : 1;
57 Eina_Bool scr_minh : 1;
58 Eina_Bool on_hold : 1;
59 Eina_Bool multi : 1;
60 Eina_Bool swipe : 1;
61 Eina_Bool delete_me : 1;
62 Eina_Bool mouse_down : 1; /**< a flag that mouse is down on the list at the moment. this flag is set to true on mouse and reset to false on mouse up */
63 Eina_Bool item_loop_enable : 1; /**< value whether item loop feature is enabled or not. */
64 Eina_Bool item_looping_on : 1;
65};
66
67struct _Elm_List_Item_Data
68{
69 Elm_Widget_Item_Data *base;
70
71 Ecore_Timer *swipe_timer;
72 Ecore_Timer *long_timer;
73 Evas_Object *icon, *end;
74 Evas_Smart_Cb func;
75
76 const char *label;
77 Eina_List *node;
78
79 Eina_Bool is_separator : 1;
80 Eina_Bool highlighted : 1;
81 Eina_Bool dummy_icon : 1;
82 Eina_Bool dummy_end : 1;
83 Eina_Bool selected : 1;
84 Eina_Bool deleted : 1;
85 Eina_Bool is_even : 1;
86 Eina_Bool fixed : 1;
87 Eina_Bool even : 1;
88};
89
90/**
91 * @}
92 */
93
94#define ELM_LIST_DATA_GET(o, sd) \
95 Elm_List_Data * sd = eo_data_scope_get(o, ELM_LIST_CLASS)
96
97#define ELM_LIST_DATA_GET_FROM_ITEM(it, sd) \
98 ELM_LIST_DATA_GET(WIDGET(it), sd)
99
100#define ELM_LIST_DATA_GET_OR_RETURN(o, ptr) \
101 ELM_LIST_DATA_GET(o, ptr); \
102 if (EINA_UNLIKELY(!ptr)) \
103 { \
104 CRI("No widget data for object %p (%s)", \
105 o, evas_object_type_get(o)); \
106 return; \
107 }
108
109#define ELM_LIST_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
110 ELM_LIST_DATA_GET(o, ptr); \
111 if (EINA_UNLIKELY(!ptr)) \
112 { \
113 CRI("No widget data for object %p (%s)", \
114 o, evas_object_type_get(o)); \
115 return val; \
116 }
117
118#define ELM_LIST_CHECK(obj) \
119 if (EINA_UNLIKELY(!eo_isa((obj), ELM_LIST_CLASS))) \
120 return
121
122#define ELM_LIST_ITEM_CHECK(it) \
123 ELM_WIDGET_ITEM_CHECK_OR_RETURN(it->base, ); \
124 ELM_LIST_CHECK(it->base->widget); \
125 if (it->deleted) \
126 { \
127 ERR("ERROR: " #it " has been DELETED.\n"); \
128 return; \
129 }
130
131#define ELM_LIST_ITEM_CHECK_OR_RETURN(it, ...) \
132 ELM_WIDGET_ITEM_CHECK_OR_RETURN(it->base, __VA_ARGS__); \
133 ELM_LIST_CHECK(it->base->widget) __VA_ARGS__; \
134 if (it->deleted) \
135 { \
136 ERR("ERROR: " #it " has been DELETED.\n"); \
137 return __VA_ARGS__; \
138 }
139
140#define ELM_LIST_ITEM_DATA_GET(o, sd) \
141 Elm_List_Item_Data* sd = eo_data_scope_get(o, ELM_LIST_ITEM_CLASS)
142
143#endif