struct _Widget_Data
{
- Evas_Object *ent, *scroller, *end, *icon;
+ Evas_Object *ent, *scroller;
Evas_Object *hoversel;
Ecore_Job *deferred_recalc_job;
Ecore_Event_Handler *sel_notify_handler;
Elm_Scroller_Policy policy_h, policy_v;
Elm_Wrap_Type linewrap;
Elm_Input_Panel_Layout input_panel_layout;
+ Elm_Autocapital_Type autocapital_type;
Eina_Bool changed : 1;
Eina_Bool single_line : 1;
Eina_Bool password : 1;
Eina_Bool textonly : 1;
Eina_Bool usedown : 1;
Eina_Bool scroll : 1;
+ Eina_Bool input_panel_enable : 1;
};
struct _Elm_Entry_Context_Menu_Item
static const char SIG_ANCHOR_IN[] = "anchor,in";
static const char SIG_ANCHOR_OUT[] = "anchor,out";
static const char SIG_PREEDIT_CHANGED[] = "preedit,changed";
+static const char SIG_UNDO_REQUEST[] = "undo,request";
+static const char SIG_REDO_REQUEST[] = "redo,request";
static const Evas_Smart_Cb_Description _signals[] = {
{SIG_CHANGED, ""},
{SIG_ACTIVATED, ""},
{SIG_ANCHOR_OUT, ""},
{SIG_PREEDIT_CHANGED, ""},
{SIG_CHANGED_USER, ""},
+ {SIG_UNDO_REQUEST, ""},
+ {SIG_REDO_REQUEST, ""},
{NULL, NULL}
};
if (elm_widget_disabled_get(obj))
edje_object_signal_emit(wd->ent, "elm,state,disabled", "elm");
edje_object_part_text_input_panel_layout_set(wd->ent, "elm.text", wd->input_panel_layout);
+ edje_object_part_text_autocapital_type_set(wd->ent, "elm.text", wd->autocapital_type);
+ edje_object_part_text_input_panel_enabled_set(wd->ent, "elm.text", wd->input_panel_enable);
elm_entry_cursor_pos_set(obj, wd->cursor_pos);
if (elm_widget_focus_get(obj))
edje_object_signal_emit(wd->ent, "elm,action,focus", "elm");
evas_object_geometry_get(wd->ent, NULL, NULL, &resw, NULL);
edje_object_size_min_restricted_calc(wd->ent, &minw, &minh, resw, 0);
- elm_coords_finger_size_adjust(1, &minw, 1, &minh);
- wd->entmw = minw;
+ edje_object_size_min_restricted_calc(wd->ent, &fw, &fh, 0, 0);
+ elm_coords_finger_size_adjust(1, &fw, 1, &minh);
+ wd->entmw = fw;
wd->entmh = minh;
/* This is a hack to workaround the way min size hints are treated.
* If the minimum width is smaller than the restricted width, it means
{
evas_object_focus_set(wd->ent, EINA_TRUE);
edje_object_signal_emit(wd->ent, "elm,action,focus", "elm");
- if (top) elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_ON);
+ if (top && wd->input_panel_enable)
+ elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_ON);
evas_object_smart_callback_call(obj, SIG_FOCUSED, NULL);
}
else
{
edje_object_signal_emit(wd->ent, "elm,action,unfocus", "elm");
evas_object_focus_set(wd->ent, EINA_FALSE);
- if (top) elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_OFF);
+ if (top && wd->input_panel_enable)
+ elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_OFF);
evas_object_smart_callback_call(obj, SIG_UNFOCUSED, NULL);
}
}
Evas_Object *edje;
if ((!wd) || (!content)) return;
- edje = elm_smart_scroller_edje_object_get(wd->scroller);
+ if (wd->scroll)
+ edje = elm_smart_scroller_edje_object_get(wd->scroller);
+ else
+ edje = wd->ent;
+
+ /* Delete the currently swallowed object */
+ {
+ Evas_Object *cswallow = edje_object_part_swallow_get(edje, part);
+ if (cswallow)
+ evas_object_del(cswallow);
+ }
+
if (!strcmp(part, "elm.swallow.icon"))
{
- if (wd->icon)
- evas_object_del(wd->icon);
- wd->icon = content;
edje_object_signal_emit(edje, "elm,action,show,icon", "elm");
}
else if (!strcmp(part, "elm.swallow.end"))
{
- if (wd->end)
- evas_object_del(wd->end);
- wd->end = content;
edje_object_signal_emit(edje, "elm,action,show,end", "elm");
}
evas_event_freeze(evas_object_evas_get(obj));
Evas_Object *content, *edje;
if (!wd) return NULL;
- edje = elm_smart_scroller_edje_object_get(wd->scroller);
+ if (wd->scroll)
+ edje = elm_smart_scroller_edje_object_get(wd->scroller);
+ else
+ edje = wd->ent;
+
if (!strcmp(part, "elm.swallow.icon"))
{
- wd->icon = NULL;
edje_object_signal_emit(edje, "elm,action,hide,icon", "elm");
}
else if (!strcmp(part, "elm.swallow.end"))
{
- wd->end = NULL;
edje_object_signal_emit(edje, "elm,action,hide,end", "elm");
}
Evas_Object *content = NULL, *edje;
if (!wd) return NULL;
- if (!strcmp(part, "elm.swallow.icon"))
- return wd->icon;
- if (!strcmp(part, "elm.swallow.end"))
- return wd->end;
+ if (wd->scroll)
+ edje = elm_smart_scroller_edje_object_get(wd->scroller);
+ else
+ edje = wd->ent;
- edje = elm_smart_scroller_edje_object_get(wd->scroller);
if (edje)
content = edje_object_part_swallow_get(edje, part);
return content;
}
static void
+_translate_hook(Evas_Object *obj)
+{
+ evas_object_smart_callback_call(obj, "language,changed", NULL);
+}
+
+static void
_signal_emit_hook(Evas_Object *obj, const char *emission, const char *source)
{
Widget_Data *wd = elm_widget_data_get(obj);
Evas_Object *sub = event_info;
Evas_Object *edje;
- edje = elm_smart_scroller_edje_object_get(wd->scroller);
- if (sub == wd->icon)
+ if (wd->scroll)
+ edje = elm_smart_scroller_edje_object_get(wd->scroller);
+ else
+ edje = wd->ent;
+
+ if (sub == edje_object_part_swallow_get(edje, "elm.swallow.icon"))
{
- wd->icon = NULL;
+ edje_object_part_unswallow(edje, sub);
if (edje)
edje_object_signal_emit(edje, "elm,action,hide,icon", "elm");
}
- else if (sub == wd->end)
+ else if (sub == edje_object_part_swallow_get(edje, "elm.swallow.end"))
{
- wd->end = NULL;
+ edje_object_part_unswallow(edje, sub);
if (edje)
edje_object_signal_emit(edje, "elm,action,hide,end", "elm");
}
_sizing_eval(data);
if (wd->text) eina_stringshare_del(wd->text);
wd->text = NULL;
- evas_object_smart_callback_call(data, event, NULL);
if (wd->delay_write)
{
ecore_timer_del(wd->delay_write);
}
evas_event_thaw(evas_object_evas_get(data));
evas_event_thaw_eval(evas_object_evas_get(data));
- if ((!wd->autosave) || (!wd->file)) return;
- wd->delay_write = ecore_timer_add(2.0, _delay_write, data);
+ if ((wd->autosave) && (wd->file))
+ wd->delay_write = ecore_timer_add(2.0, _delay_write, data);
+ /* callback - this could call callbacks that delete the entry... thus...
+ * any access to wd after this could be invalid */
+ evas_object_smart_callback_call(data, event, NULL);
}
static void
}
static void
+_signal_undo_request(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
+{
+ evas_object_smart_callback_call(data, SIG_UNDO_REQUEST, NULL);
+}
+
+static void
+_signal_redo_request(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
+{
+ evas_object_smart_callback_call(data, SIG_REDO_REQUEST, NULL);
+}
+
+static void
_signal_selection_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
{
Widget_Data *wd = elm_widget_data_get(data);
{
int len = 0;
ELM_CHECK_WIDTYPE(obj, widtype);
- if (item && strcmp(item, "default")) return;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
evas_event_freeze(evas_object_evas_get(obj));
if (!entry) entry = "";
+ if (item && strcmp(item, "default"))
+ {
+ edje_object_part_text_set(wd->ent, item, entry);
+ return;
+ }
+
if (wd->text) eina_stringshare_del(wd->text);
wd->text = NULL;
wd->changed = EINA_TRUE;
elm_widget_content_set_hook_set(obj, _content_set_hook);
elm_widget_content_unset_hook_set(obj, _content_unset_hook);
elm_widget_content_get_hook_set(obj, _content_get_hook);
+ elm_widget_translate_hook_set(obj, _translate_hook);
evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, wd);
_signal_mouse_double, obj);
edje_object_signal_callback_add(wd->ent, "mouse,down,1,triple", "elm.text",
_signal_mouse_triple, obj);
+ edje_object_signal_callback_add(wd->ent, "entry,undo,request", "elm.text",
+ _signal_undo_request, obj);
+ edje_object_signal_callback_add(wd->ent, "entry,redo,request", "elm.text",
+ _signal_redo_request, obj);
edje_object_part_text_set(wd->ent, "elm.text", "");
if (_elm_config->desktop_entry)
edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_TRUE);
elm_entry_input_panel_layout_set(obj, ELM_INPUT_PANEL_LAYOUT_NORMAL);
+ wd->input_panel_enable = edje_object_part_text_input_panel_enabled_get(wd->ent, "elm.text");
+ wd->autocapital_type = edje_object_part_text_autocapital_type_get(wd->ent, "elm.text");
+
#ifdef HAVE_ELEMENTARY_X
top = elm_widget_top_get(obj);
if ((top) && (elm_win_xwindow_get(top)))
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
Evas_Object *edje;
- if ((!wd) || (!wd->icon)) return;
- edje = elm_smart_scroller_edje_object_get(wd->scroller);
- if (!edje) return;
+ if (!wd) return;
+ if (wd->scroll)
+ edje = elm_smart_scroller_edje_object_get(wd->scroller);
+ else
+ edje = wd->ent;
+
+ if ((!edje) || (!edje_object_part_swallow_get(edje, "elm.swallow.icon"))) return;
if (setting)
edje_object_signal_emit(edje, "elm,action,show,icon", "elm");
else
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
Evas_Object *edje;
- if ((!wd) || (!wd->end)) return;
- edje = elm_smart_scroller_edje_object_get(wd->scroller);
- if (!edje) return;
+ if (!wd) return;
+ if (wd->scroll)
+ edje = elm_smart_scroller_edje_object_get(wd->scroller);
+ else
+ edje = wd->ent;
+
+ if ((!edje) || (!edje_object_part_swallow_get(edje, "elm.swallow.icon"))) return;
if (setting)
edje_object_signal_emit(edje, "elm,action,show,end", "elm");
else
return wd->input_panel_layout;
}
+
+EAPI void
+elm_entry_autocapital_type_set(Evas_Object *obj, Elm_Autocapital_Type autocapital_type)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ wd->autocapital_type = autocapital_type;
+ edje_object_part_text_autocapital_type_set(wd->ent, "elm.text", autocapital_type);
+}
+
+EAPI Elm_Autocapital_Type
+elm_entry_autocapital_type_get(Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) ELM_AUTOCAPITAL_TYPE_NONE;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return ELM_AUTOCAPITAL_TYPE_NONE;
+
+ return wd->autocapital_type;
+}
+
+EAPI void
+elm_entry_input_panel_enabled_set(Evas_Object *obj, Eina_Bool enabled)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ wd->input_panel_enable = enabled;
+ edje_object_part_text_input_panel_enabled_set(wd->ent, "elm.text", enabled);
+}
+