summaryrefslogtreecommitdiff
path: root/legacy/elementary/src/lib/elm_widget_entry.h
diff options
context:
space:
mode:
authorGustavo Lima Chaves <glima@profusion.mobi>2012-08-30 16:45:15 +0000
committerGustavo Lima Chaves <glima@profusion.mobi>2012-08-30 16:45:15 +0000
commita9b1707fcdb08470c1effef00f4b8c307c17a82c (patch)
treec5d687a6bda053bbd234bf6ac53d5b6e57123253 /legacy/elementary/src/lib/elm_widget_entry.h
parentc0d48e6035d93bc04b1143f1ab647811888b5a2b (diff)
[elm] Entry now a scrollable layout.
SVN revision: 75890
Diffstat (limited to '')
-rw-r--r--legacy/elementary/src/lib/elm_widget_entry.h268
1 files changed, 268 insertions, 0 deletions
diff --git a/legacy/elementary/src/lib/elm_widget_entry.h b/legacy/elementary/src/lib/elm_widget_entry.h
new file mode 100644
index 0000000..1c49121
--- /dev/null
+++ b/legacy/elementary/src/lib/elm_widget_entry.h
@@ -0,0 +1,268 @@
1#ifndef ELM_WIDGET_ENTRY_H
2#define ELM_WIDGET_ENTRY_H
3
4#include "elm_interface_scrollable.h"
5#include "elm_widget_layout.h"
6
7/**
8 * @addtogroup Widget
9 * @{
10 *
11 * @section elm-entry-class The Elementary Entry Class
12 *
13 * Elementary, besides having the @ref Entry widget, exposes its
14 * foundation -- the Elementary Entry Class -- in order to create
15 * other widgets which are a entry with some more logic on top.
16 */
17
18/**
19 * @def ELM_ENTRY_CLASS
20 *
21 * Use this macro to cast whichever subclass of
22 * #Elm_Entry_Smart_Class into it, so to access its fields.
23 *
24 * @ingroup Widget
25 */
26#define ELM_ENTRY_CLASS(x) ((Elm_Entry_Smart_Class *)x)
27
28/**
29 * @def ELM_ENTRY_DATA
30 *
31 * Use this macro to cast whichever subdata of
32 * #Elm_Entry_Smart_Data into it, so to access its fields.
33 *
34 * @ingroup Widget
35 */
36#define ELM_ENTRY_DATA(x) ((Elm_Entry_Smart_Data *)x)
37
38/**
39 * @def ELM_ENTRY_SMART_CLASS_VERSION
40 *
41 * Current version for Elementary entry @b base smart class, a value
42 * which goes to _Elm_Entry_Smart_Class::version.
43 *
44 * @ingroup Widget
45 */
46#define ELM_ENTRY_SMART_CLASS_VERSION 1
47
48/**
49 * @def ELM_ENTRY_SMART_CLASS_INIT
50 *
51 * Initializer for a whole #Elm_Entry_Smart_Class structure, with
52 * @c NULL values on its specific fields.
53 *
54 * @param smart_class_init initializer to use for the "base" field
55 * (#Evas_Smart_Class).
56 *
57 * @see EVAS_SMART_CLASS_INIT_NULL
58 * @see EVAS_SMART_CLASS_INIT_NAME_VERSION
59 * @see ELM_ENTRY_SMART_CLASS_INIT_NULL
60 * @see ELM_ENTRY_SMART_CLASS_INIT_NAME_VERSION
61 *
62 * @ingroup Widget
63 */
64#define ELM_ENTRY_SMART_CLASS_INIT(smart_class_init) \
65 {smart_class_init, ELM_ENTRY_SMART_CLASS_VERSION}
66
67/**
68 * @def ELM_ENTRY_SMART_CLASS_INIT_NULL
69 *
70 * Initializer to zero out a whole #Elm_Entry_Smart_Class structure.
71 *
72 * @see ELM_ENTRY_SMART_CLASS_INIT_NAME_VERSION
73 * @see ELM_ENTRY_SMART_CLASS_INIT
74 *
75 * @ingroup Widget
76 */
77#define ELM_ENTRY_SMART_CLASS_INIT_NULL \
78 ELM_ENTRY_SMART_CLASS_INIT(EVAS_SMART_CLASS_INIT_NULL)
79
80/**
81 * @def ELM_ENTRY_SMART_CLASS_INIT_NAME_VERSION
82 *
83 * Initializer to zero out a whole #Elm_Entry_Smart_Class structure and
84 * set its name and version.
85 *
86 * This is similar to #ELM_ENTRY_SMART_CLASS_INIT_NULL, but it will
87 * also set the version field of #Elm_Entry_Smart_Class (base field)
88 * to the latest #ELM_ENTRY_SMART_CLASS_VERSION and name it to the
89 * specific value.
90 *
91 * It will keep a reference to the name field as a <c>"const char *"</c>,
92 * i.e., the name must be available while the structure is
93 * used (hint: static or global variable!) and must not be modified.
94 *
95 * @see ELM_ENTRY_SMART_CLASS_INIT_NULL
96 * @see ELM_ENTRY_SMART_CLASS_INIT
97 *
98 * @ingroup Widget
99 */
100#define ELM_ENTRY_SMART_CLASS_INIT_NAME_VERSION(name) \
101 ELM_ENTRY_SMART_CLASS_INIT \
102 (ELM_LAYOUT_SMART_CLASS_INIT_NAME_VERSION(name))
103
104/**
105 * Elementary entry base smart class. This inherits directly from
106 * #Elm_Layout_Smart_Class and is meant to build widgets extending the
107 * behavior of a entry.
108 *
109 * All of the functions listed on @ref Entry namespace will work for
110 * objects deriving from #Elm_Entry_Smart_Class.
111 */
112typedef struct _Elm_Entry_Smart_Class
113{
114 Elm_Layout_Smart_Class base;
115
116 int version; /**< Version of this smart class definition */
117} Elm_Entry_Smart_Class;
118
119typedef struct _Mod_Api Mod_Api;
120
121/**
122 * Base widget smart data extended with entry instance data.
123 */
124typedef struct _Elm_Entry_Smart_Data Elm_Entry_Smart_Data;
125struct _Elm_Entry_Smart_Data
126{
127 Elm_Layout_Smart_Data base; /* base widget smart data as
128 * first member obligatory, as
129 * we're inheriting from it */
130
131 Evas_Object *hit_rect, *entry_edje, *scr_edje;
132 const Elm_Scrollable_Smart_Interface *s_iface;
133
134 Evas_Object *hoversel;
135 Ecore_Job *deferred_recalc_job;
136 Ecore_Event_Handler *sel_notify_handler;
137 Ecore_Event_Handler *sel_clear_handler;
138 Ecore_Timer *longpress_timer;
139 Ecore_Timer *delay_write;
140 /* for deferred appending */
141 Ecore_Idler *append_text_idler;
142 char *append_text_left;
143 int append_text_position;
144 int append_text_len;
145 /* Only for clipboard */
146 const char *cut_sel;
147 const char *text;
148 const char *file;
149 Elm_Text_Format format;
150 Evas_Coord last_w, ent_mw, ent_mh;
151 Evas_Coord downx, downy;
152 Eina_List *items;
153 Eina_List *item_providers;
154 Eina_List *text_filters;
155 Eina_List *markup_filters;
156 Ecore_Job *hov_deljob;
157 Mod_Api *api; // module api if supplied
158 int cursor_pos;
159 Elm_Scroller_Policy policy_h, policy_v;
160 Elm_Wrap_Type line_wrap;
161 Elm_Input_Panel_Layout input_panel_layout;
162 Elm_Autocapital_Type autocapital_type;
163 Elm_Input_Panel_Lang input_panel_lang;
164 Elm_Input_Panel_Return_Key_Type input_panel_return_key_type;
165 void *input_panel_imdata;
166 int input_panel_imdata_len;
167 struct
168 {
169 Evas_Object *hover_parent;
170 Evas_Object *pop, *hover;
171 const char *hover_style;
172 } anchor_hover;
173
174 Elm_Cnp_Mode cnp_mode;
175
176 Eina_Bool input_panel_return_key_disabled : 1;
177 Eina_Bool drag_selection_asked : 1;
178 Eina_Bool input_panel_enable : 1;
179 Eina_Bool prediction_allow : 1;
180 Eina_Bool selection_asked : 1;
181 Eina_Bool auto_return_key : 1;
182 Eina_Bool have_selection : 1;
183 Eina_Bool deferred_cur : 1;
184 Eina_Bool context_menu : 1;
185 Eina_Bool cur_changed : 1;
186 Eina_Bool single_line : 1;
187 Eina_Bool can_write : 1;
188 Eina_Bool auto_save : 1;
189 Eina_Bool password : 1;
190 Eina_Bool editable : 1;
191 Eina_Bool disabled : 1;
192 Eina_Bool h_bounce : 1;
193 Eina_Bool v_bounce : 1;
194 Eina_Bool has_text : 1;
195 Eina_Bool use_down : 1;
196 Eina_Bool sel_mode : 1;
197 Eina_Bool changed : 1;
198 Eina_Bool scroll : 1;
199};
200
201typedef struct _Elm_Entry_Context_Menu_Item Elm_Entry_Context_Menu_Item;
202typedef struct _Elm_Entry_Item_Provider Elm_Entry_Item_Provider;
203typedef struct _Elm_Entry_Markup_Filter Elm_Entry_Markup_Filter;
204
205struct _Elm_Entry_Context_Menu_Item
206{
207 Evas_Object *obj;
208 const char *label;
209 const char *icon_file;
210 const char *icon_group;
211 Elm_Icon_Type icon_type;
212 Evas_Smart_Cb func;
213 void *data;
214};
215
216struct _Elm_Entry_Item_Provider
217{
218 Evas_Object *(*func)(void *data, Evas_Object * entry, const char *item);
219 void *data;
220};
221
222struct _Elm_Entry_Markup_Filter
223{
224 Elm_Entry_Filter_Cb func;
225 void *data;
226};
227
228typedef enum _Length_Unit
229{
230 LENGTH_UNIT_CHAR,
231 LENGTH_UNIT_BYTE,
232 LENGTH_UNIT_LAST
233} Length_Unit;
234
235/**
236 * @}
237 */
238
239EAPI extern const char ELM_ENTRY_SMART_NAME[];
240EAPI const Elm_Entry_Smart_Class *elm_entry_smart_class_get(void);
241
242#define ELM_ENTRY_DATA_GET(o, sd) \
243 Elm_Entry_Smart_Data * sd = evas_object_smart_data_get(o)
244
245#define ELM_ENTRY_DATA_GET_OR_RETURN(o, ptr) \
246 ELM_ENTRY_DATA_GET(o, ptr); \
247 if (!ptr) \
248 { \
249 CRITICAL("No widget data for object %p (%s)", \
250 o, evas_object_type_get(o)); \
251 return; \
252 }
253
254#define ELM_ENTRY_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
255 ELM_ENTRY_DATA_GET(o, ptr); \
256 if (!ptr) \
257 { \
258 CRITICAL("No widget data for object %p (%s)", \
259 o, evas_object_type_get(o)); \
260 return val; \
261 }
262
263#define ELM_ENTRY_CHECK(obj) \
264 if (!obj || !elm_widget_type_check \
265 ((obj), ELM_ENTRY_SMART_NAME, __func__)) \
266 return
267
268#endif