1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
#ifndef ELM_WIDGET_MULTIBUTTONENTRY_H
#define ELM_WIDGET_MULTIBUTTONENTRY_H
#include "elm_widget_layout.h"
/* DO NOT USE THIS HEADER UNLESS YOU ARE PREPARED FOR BREAKING OF YOUR
* CODE. THIS IS ELEMENTARY'S INTERNAL WIDGET API (for now) AND IS NOT
* FINAL. CALL elm_widget_api_check(ELM_INTERNAL_API_VERSION) TO CHECK
* IT AT RUNTIME.
*/
/**
* @addtogroup Widget
* @{
*
* @section elm-multibuttonentry-class The Elementary Multi Button Entry Class
*
* Elementary, besides having the @ref Multibuttonentry widget,
* exposes its foundation -- the Elementary Multi Button Entry Class --
* in order to create other widgets which are a multi button entry with
* some more logic on top.
*/
/**
* Base widget smart data extended with multibuttonentry instance data.
*/
typedef enum _Multibuttonentry_Pos
{
MULTIBUTTONENTRY_POS_START,
MULTIBUTTONENTRY_POS_END,
MULTIBUTTONENTRY_POS_BEFORE,
MULTIBUTTONENTRY_POS_AFTER,
} Multibuttonentry_Pos;
typedef enum _Multibuttonentry_Button_State
{
MULTIBUTTONENTRY_BUTTON_STATE_DEFAULT,
MULTIBUTTONENTRY_BUTTON_STATE_SELECTED,
} Multibuttonentry_Button_State;
typedef enum _MultiButtonEntry_Closed_Button_Type
{
MULTIBUTTONENTRY_CLOSED_IMAGE,
MULTIBUTTONENTRY_CLOSED_LABEL
} MultiButtonEntry_Closed_Button_Type;
typedef enum _Multibuttonentry_View_State
{
MULTIBUTTONENTRY_VIEW_NONE,
MULTIBUTTONENTRY_VIEW_GUIDETEXT,
MULTIBUTTONENTRY_VIEW_ENTRY,
MULTIBUTTONENTRY_VIEW_SHRINK
} Multibuttonentry_View_State;
typedef struct _Multibuttonentry_Item Elm_Multibuttonentry_Item_Data;
struct _Multibuttonentry_Item
{
Elm_Widget_Item_Data *base;
Evas_Coord vw, rw; // vw: visual width, real width
Eina_Bool visible : 1;
Evas_Smart_Cb func;
};
typedef struct _Elm_Multibuttonentry_Item_Filter
{
Elm_Multibuttonentry_Item_Filter_Cb callback_func;
void *data;
} Elm_Multibuttonentry_Item_Filter;
typedef struct _Efl_Ui_Multibuttonentry_Data
Efl_Ui_Multibuttonentry_Data;
struct _Efl_Ui_Multibuttonentry_Data
{
Evas_Object *parent;
Evas_Object *box;
Evas_Object *entry;
Evas_Object *label;
Evas_Object *guide_text;
Evas_Object *end; /* used to represent the
* total number of
* invisible buttons */
Eina_List *items;
Eina_List *filter_list;
Elm_Multibuttonentry_Item_Data *selected_it; /* selected item */
Elm_Multibuttonentry_Item_Data *focused_it;
Efl_Ui_Multibuttonentry_Format_Cb format_func;
const void *format_func_data;
const char *label_str, *guide_text_str;
int n_str;
Multibuttonentry_View_State view_state;
Evas_Coord w_box, h_box;
int shrink;
Elm_Multibuttonentry_Item_Filter_Cb add_callback;
void *add_callback_data;
Eina_Bool last_it_select : 1;
Eina_Bool editable : 1;
Eina_Bool focused : 1;
Eina_Bool label_packed : 1;
Ecore_Timer *longpress_timer;
};
/**
* @}
*/
#define EFL_UI_MULTIBUTTONENTRY_DATA_GET(o, sd) \
Efl_Ui_Multibuttonentry_Data *sd = efl_data_scope_get(o, EFL_UI_MULTIBUTTONENTRY_CLASS);
#define EFL_UI_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(o, ptr) \
EFL_UI_MULTIBUTTONENTRY_DATA_GET(o, ptr); \
if (EINA_UNLIKELY(!ptr)) \
{ \
CRI("No widget data for object %p (%s)", \
o, evas_object_type_get(o)); \
return; \
}
#define EFL_UI_MULTIBUTTONENTRY_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
Efl_Ui_Multibuttonentry_Data * ptr = efl_data_scope_get(o, EFL_UI_MULTIBUTTONENTRY_CLASS); \
if (EINA_UNLIKELY(!ptr)) \
{ \
CRI("No widget data for object %p (%s)", \
o, evas_object_type_get(o)); \
return val; \
}
#define ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(o, sd) \
Elm_Multibuttonentry_Item_Data *sd = efl_data_scope_get(o, ELM_MULTIBUTTONENTRY_ITEM_CLASS)
#define ELM_MULTIBUTTONENTRY_CHECK(obj) \
if (EINA_UNLIKELY(!efl_isa((obj), ELM_MULTIBUTTONENTRY_CLASS))) \
return
#define ELM_MULTIBUTTONENTRY_ITEM_CHECK(it) \
if (EINA_UNLIKELY(!efl_isa((it->base->eo_obj), ELM_MULTIBUTTONENTRY_ITEM_CLASS))) \
return
#define ELM_MULTIBUTTONENTRY_ITEM_CHECK_OR_RETURN(it, ...) \
if (EINA_UNLIKELY(!efl_isa((it->base->eo_obj), ELM_MULTIBUTTONENTRY_ITEM_CLASS))) \
return __VA_ARGS__;
#endif
|