-
-/**
- * @defgroup Scrolled_Entry Scrolled_Entry
- * @ingroup Elementary
- *
- * A scrolled entry is a convenience widget which shows
- * a box that the user can enter text into. Unlike an
- * @ref Entry widget, scrolled entries scroll with user
- * input so that the window will not expand if the length
- * of text inside the entry exceeds the initial size of the
- * widget.
- *
- * Signals that you can add callbacks for are:
- * - "changed" - The text within the entry was changed
- * - "activated" - The entry has received focus and the cursor
- * - "press" - The entry has been clicked
- * - "longpressed" - The entry has been clicked for a couple seconds
- * - "clicked" - The entry has been clicked
- * - "clicked,double" - The entry has been double clicked
- * - "focused" - The entry has received focus
- * - "unfocused" - The entry has lost focus
- * - "selection,paste" - A paste action has occurred
- * - "selection,copy" - A copy action has occurred
- * - "selection,cut" - A cut action has occurred
- * - "selection,start" - A selection has begun
- * - "selection,changed" - The selection has changed
- * - "selection,cleared" - The selection has been cleared
- * - "cursor,changed" - The cursor has changed
- * - "anchor,clicked" - The anchor has been clicked
- */
-
-typedef struct _Widget_Data Widget_Data;
-
-struct _Widget_Data
-{
- Evas_Object *scroller;
- Evas_Object *entry;
- Elm_Scroller_Policy policy_h, policy_v;
- Eina_Bool single_line : 1;
-};
-
-static const char *widtype = NULL;
-
-static const char SIG_CHANGED[] = "changed";
-static const char SIG_ACTIVATED[] = "activated";
-static const char SIG_PRESS[] = "press";
-static const char SIG_LONGPRESSED[] = "longpressed";
-static const char SIG_CLICKED[] = "clicked";
-static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
-static const char SIG_FOCUSED[] = "focused";
-static const char SIG_UNFOCUSED[] = "unfocused";
-static const char SIG_SELECTION_PASTE[] = "selection,paste";
-static const char SIG_SELECTION_COPY[] = "selection,copy";
-static const char SIG_SELECTION_CUT[] = "selection,cut";
-static const char SIG_SELECTION_START[] = "selection,start";
-static const char SIG_SELECTION_CHANGED[] = "selection,changed";
-static const char SIG_SELECTION_CLEARED[] = "selection,cleared";
-static const char SIG_CURSOR_CHANGED[] = "cursor,changed";
-static const char SIG_ANCHOR_CLICKED[] = "anchor,clicked";
-static const Evas_Smart_Cb_Description _signals[] = {
- {SIG_CHANGED, ""},
- {SIG_ACTIVATED, ""},
- {SIG_PRESS, ""},
- {SIG_LONGPRESSED, ""},
- {SIG_CLICKED, ""},
- {SIG_CLICKED_DOUBLE, ""},
- {SIG_FOCUSED, ""},
- {SIG_UNFOCUSED, ""},
- {SIG_SELECTION_PASTE, ""},
- {SIG_SELECTION_COPY, ""},
- {SIG_SELECTION_CUT, ""},
- {SIG_SELECTION_START, ""},
- {SIG_SELECTION_CHANGED, ""},
- {SIG_SELECTION_CLEARED, ""},
- {SIG_CURSOR_CHANGED, ""},
- {SIG_ANCHOR_CLICKED, ""},
- {NULL, NULL}
-};
-
-static void
-_del_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- free(wd);
-}
-
-static void
-_theme_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_object_style_set(wd->entry, elm_widget_style_get(obj));
- elm_object_style_set(wd->scroller, elm_widget_style_get(obj));
-}
-
-static void
-_sizing_eval(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Coord minw, minh, minw_scr, minh_scr;
- if (!wd) return;
-
- evas_object_size_hint_min_get(obj, &minw, &minh);
- evas_object_size_hint_min_get(wd->scroller, &minw_scr, &minh_scr);
- if (minw < minw_scr) minw = minw_scr;
- if (minh < minh_scr) minh = minh_scr;
-
- evas_object_size_hint_min_set(obj, minw, minh);
-
- if (wd->single_line)
- evas_object_size_hint_max_set(obj, -1, minh);
- else
- evas_object_size_hint_max_set(obj, -1, -1);
-}
-
-static void
-_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (elm_widget_focus_get(obj))
- elm_widget_focus_steal(wd->entry);
-}
-
-static void
-_disable_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_object_disabled_set(wd->entry, elm_widget_disabled_get(obj));
-}
-
-static void
-_signal_emit_hook(Evas_Object *obj, const char *emission, const char *source)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_object_signal_emit(wd->entry, emission, source);
- elm_object_signal_emit(wd->scroller, emission, source);
-}
-
-static void
-_entry_changed(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- _sizing_eval(data);
- evas_object_smart_callback_call(data, SIG_CHANGED, NULL);
-}
-
-static void
-_entry_activated(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- evas_object_smart_callback_call(data, SIG_ACTIVATED, NULL);
-}
-
-static void
-_entry_press(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- evas_object_smart_callback_call(data, SIG_PRESS, NULL);
-}
-
-static void
-_entry_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- evas_object_smart_callback_call(data, SIG_CLICKED, NULL);
-}
-
-static void
-_entry_clicked_double(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- evas_object_smart_callback_call(data, SIG_CLICKED_DOUBLE, NULL);
-}
-
-static void
-_entry_cursor_changed(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- evas_object_smart_callback_call(data, SIG_CURSOR_CHANGED, NULL);
-}
-
-static void
-_entry_anchor_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- evas_object_smart_callback_call(data, SIG_ANCHOR_CLICKED, NULL);
-}
-
-static void
-_entry_selection_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- evas_object_smart_callback_call(data, SIG_SELECTION_START, NULL);
-}
-
-static void
-_entry_selection_changed(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- evas_object_smart_callback_call(data, SIG_SELECTION_CHANGED, NULL);
-}
-
-static void
-_entry_selection_cleared(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- evas_object_smart_callback_call(data, SIG_SELECTION_CLEARED, NULL);
-}
-
-static void
-_entry_selection_paste(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- evas_object_smart_callback_call(data, SIG_SELECTION_PASTE, NULL);
-}
-
-static void
-_entry_selection_copy(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- evas_object_smart_callback_call(data, SIG_SELECTION_COPY, NULL);
-}
-
-static void
-_entry_selection_cut(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- evas_object_smart_callback_call(data, SIG_SELECTION_CUT, NULL);
-}
-
-static void
-_entry_longpressed(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- evas_object_smart_callback_call(data, SIG_LONGPRESSED, NULL);
-}
-
-static void
-_entry_focused(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- evas_object_smart_callback_call(data, SIG_FOCUSED, NULL);
-}
-
-static void
-_entry_unfocused(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- evas_object_smart_callback_call(data, SIG_UNFOCUSED, NULL);
-}
-
-static void
-_entry_maxlength_reached(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- evas_object_smart_callback_call(data, "maxlength,reached", NULL);
-}
-
-
-/**
- * This adds a scrolled entry to @p parent object.
- *
- * @param parent The parent object
- * @return The new object or NULL if it cannot be created
- *
- * @ingroup Scrolled_Entry
- */
-EAPI Evas_Object *