+/*
+ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+ */
#include <Elementary.h>
#include "elm_priv.h"
struct _Widget_Data
{
- Evas_Object *base;
- Evas_Object *entry;
- Evas_Object *ricon;
- Evas_Object *licon;
- Evas_Object *eraser;
- const char *label;
- const char *guide_text;
- Eina_Bool needs_size_calc:1;
- Eina_Bool show_guide_text:1;
- Eina_Bool editing:1;
- Eina_Bool single_line : 1;
- Eina_Bool eraser_visible : 1;
- Evas_Event_Mouse_Down down_ev;
+ Evas_Object *base;
+ Evas_Object *entry;
+ Evas_Object *ricon;
+ Evas_Object *licon;
+ Evas_Object *eraser;
+ const char *label;
+ const char *guide_text;
+ Eina_Bool needs_size_calc:1;
+ Eina_Bool show_guide_text:1;
+ Eina_Bool editing:1;
+ Eina_Bool single_line : 1;
+ Eina_Bool eraser_visible : 1;
+ Evas_Event_Mouse_Down down_ev;
};
static const char *widtype = NULL;
static void
_del_hook(Evas_Object *obj)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (wd->label) eina_stringshare_del(wd->label);
- free(wd);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ if (wd->label) eina_stringshare_del(wd->label);
+ free(wd);
}
static void
_on_focus_hook(void *data, Evas_Object *obj)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- const char* text;
- if (!wd || !wd->base)
- return ;
- if (!elm_widget_focus_get(obj) && !(elm_widget_disabled_get(obj)) ) {
- wd->editing = EINA_FALSE;
- edje_object_signal_emit(wd->base, "elm,action,unfocus", "elm");
- edje_object_signal_emit(wd->base, "elm,state,over,show", "elm");
- text = elm_entry_entry_get(wd->entry);
- edje_object_part_text_set(wd->base, "elm.content.no.edit", text);
- edje_object_signal_emit(wd->base, "elm,action,no,edit", "elm");
- if(_empty_entry(wd->entry)) {
- if(wd->guide_text) {
- edje_object_part_text_set(wd->base, "elm.guidetext", wd->guide_text);
- edje_object_signal_emit(wd->base, "elm,state,guidetext,visible", "elm");
- wd->show_guide_text = EINA_TRUE;
- }
- }
- }
+ Widget_Data *wd = elm_widget_data_get(obj);
+ const char* text;
+ if (!wd || !wd->base)
+ return ;
+ if (!elm_widget_focus_get(obj) && !(elm_widget_disabled_get(obj)) )
+ {
+ wd->editing = EINA_FALSE;
+ edje_object_signal_emit(wd->base, "elm,action,unfocus", "elm");
+ edje_object_signal_emit(wd->base, "elm,state,over,show", "elm");
+ text = elm_entry_entry_get(wd->entry);
+ edje_object_part_text_set(wd->base, "elm.content.no.edit", text);
+ edje_object_signal_emit(wd->base, "elm,action,no,edit", "elm");
+ if(_empty_entry(wd->entry))
+ {
+ if(wd->guide_text)
+ {
+ edje_object_part_text_set(wd->base, "elm.guidetext", wd->guide_text);
+ edje_object_signal_emit(wd->base, "elm,state,guidetext,visible", "elm");
+ wd->show_guide_text = EINA_TRUE;
+ }
+ }
+ }
}
static void
_theme_hook(Evas_Object *obj)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd || !wd->base)
- return;
- _elm_theme_object_set(obj, wd->base, "editfield", "base", elm_widget_style_get(obj));
- edje_object_part_swallow(wd->base, "elm.swallow.content", wd->entry);
- if(wd->ricon)
- edje_object_part_swallow(wd->base, "right_icon", wd->ricon);
- if(wd->licon)
- edje_object_part_swallow(wd->base, "left_icon", wd->licon);
- if(wd->eraser)
- edje_object_part_swallow(wd->base, "eraser", wd->eraser);
- _sizing_eval(obj);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd || !wd->base)
+ return;
+ _elm_theme_object_set(obj, wd->base, "editfield", "base", elm_widget_style_get(obj));
+ edje_object_part_swallow(wd->base, "elm.swallow.content", wd->entry);
+ if(wd->ricon)
+ edje_object_part_swallow(wd->base, "right_icon", wd->ricon);
+ if(wd->licon)
+ edje_object_part_swallow(wd->base, "left_icon", wd->licon);
+ if(wd->eraser)
+ edje_object_part_swallow(wd->base, "eraser", wd->eraser);
+ _sizing_eval(obj);
}
static void
_changed_hook(Evas_Object *obj)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (wd->needs_size_calc)
- {
- _sizing_eval(obj);
- wd->needs_size_calc = EINA_FALSE;
- }
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (wd->needs_size_calc)
+ {
+ _sizing_eval(obj);
+ wd->needs_size_calc = EINA_FALSE;
+ }
}
static void
static void
_request_sizing_eval(Evas_Object *obj)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- if(!wd || !wd->base)
- return;
- if (wd->needs_size_calc)
- return;
- wd->needs_size_calc = EINA_TRUE;
- evas_object_smart_changed(obj);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if(!wd || !wd->base)
+ return;
+ if (wd->needs_size_calc)
+ return;
+ wd->needs_size_calc = EINA_TRUE;
+ evas_object_smart_changed(obj);
}
static void
_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
- double weight_x;
- evas_object_size_hint_weight_get(data, &weight_x, NULL);
- if (weight_x == EVAS_HINT_EXPAND)
- _request_sizing_eval(data);
+ double weight_x;
+ evas_object_size_hint_weight_get(data, &weight_x, NULL);
+ if (weight_x == EVAS_HINT_EXPAND)
+ _request_sizing_eval(data);
}
static Eina_Bool
_empty_entry(Evas_Object *entry)
{
- const char* text;
- char *strip_text;
- int len = 0;
-
- text = elm_entry_entry_get(entry);
- if(!text) return EINA_FALSE;
- strip_text = elm_entry_markup_to_utf8(text);
- if (strip_text) {
- len = strlen(strip_text);
- free(strip_text);
- }
- if(len == 0)
- return EINA_TRUE;
- else
- return EINA_FALSE;
+ const char* text;
+ char *strip_text;
+ int len = 0;
+
+ text = elm_entry_entry_get(entry);
+ if(!text) return EINA_FALSE;
+ strip_text = elm_entry_markup_to_utf8(text);
+ if (strip_text) {
+ len = strlen(strip_text);
+ free(strip_text);
+ }
+ if(len == 0)
+ return EINA_TRUE;
+ else
+ return EINA_FALSE;
}
static void
_entry_changed_cb(void *data, Evas_Object *obj, void* event_info)
{
- const char *text;
- Evas_Object *ef_obj = (Evas_Object *)data;
- Widget_Data *wd = elm_widget_data_get(ef_obj);
-
- if(!wd || !wd->base) return;
-
- if(!_empty_entry(wd->entry)) {
- text = elm_entry_entry_get(wd->entry);
- edje_object_part_text_set(wd->base, "elm.content.no.edit", text);
- if(wd->guide_text) {
- edje_object_signal_emit(wd->base, "elm,state,guidetext,hidden", "elm");
- wd->show_guide_text = EINA_FALSE;
- }
- }
+ const char *text;
+ Evas_Object *ef_obj = (Evas_Object *)data;
+ Widget_Data *wd = elm_widget_data_get(ef_obj);
+
+ if(!wd || !wd->base) return;
+
+ if(!_empty_entry(wd->entry))
+ {
+ text = elm_entry_entry_get(wd->entry);
+ edje_object_part_text_set(wd->base, "elm.content.no.edit", text);
+ if(wd->guide_text)
+ {
+ edje_object_signal_emit(wd->base, "elm,state,guidetext,hidden", "elm");
+ wd->show_guide_text = EINA_FALSE;
+ }
+ }
}
static void
_signal_mouse_clicked(void *data, Evas_Object *obj, const char *emission, const char *source)
{
- Widget_Data *wd = elm_widget_data_get(data);
- if(!wd || !wd->base) return;
-
- if(strcmp(source, "left_icon") && strcmp(source, "right_icon") && strcmp(source, "over_change_bg"))
- {
- edje_object_signal_emit(wd->base, "elm,action,focus", "elm");
- edje_object_signal_emit(wd->base, "elm,state,over,hide", "elm");
- edje_object_signal_emit(wd->base, "elm,action,edit", "elm");
- elm_widget_focus_set(wd->entry, EINA_TRUE);
- if(wd->editing == EINA_FALSE)
- elm_entry_cursor_end_set(wd->entry);
- if(!_empty_entry(wd->entry)) {
- if(wd->guide_text) {
- edje_object_signal_emit(wd->base, "elm,state,guidetext,hidden", "elm");
- wd->show_guide_text = EINA_FALSE;
- }
- }
- evas_object_smart_callback_call(data, "clicked", NULL);
- wd->editing = EINA_TRUE;
- }
+ Widget_Data *wd = elm_widget_data_get(data);
+ if(!wd || !wd->base) return;
+
+ if(strcmp(source, "left_icon") && strcmp(source, "right_icon") && strcmp(source, "over_change_bg"))
+ {
+ edje_object_signal_emit(wd->base, "elm,action,focus", "elm");
+ edje_object_signal_emit(wd->base, "elm,state,over,hide", "elm");
+ edje_object_signal_emit(wd->base, "elm,action,edit", "elm");
+ elm_widget_focus_set(wd->entry, EINA_TRUE);
+
+ if(wd->editing == EINA_FALSE)
+ elm_entry_cursor_end_set(wd->entry);
+
+ if(!_empty_entry(wd->entry))
+ {
+ if(wd->guide_text)
+ {
+ edje_object_signal_emit(wd->base, "elm,state,guidetext,hidden", "elm");
+ wd->show_guide_text = EINA_FALSE;
+ }
+ }
+ evas_object_smart_callback_call(data, "clicked", NULL);
+ wd->editing = EINA_TRUE;
+ }
}
static void
_resize_cb(void *data, Evas *evas, Evas_Object *obj, void *event)
{
- Widget_Data *wd = elm_widget_data_get(data);
- Evas_Coord w, h;
- if (!wd || !wd->base) return;
- evas_object_geometry_get(obj, NULL, NULL, NULL, &h);
- evas_object_geometry_get(wd->eraser, NULL, NULL, &w, NULL);
- evas_object_size_hint_min_set(wd->eraser, w, h - ERASER_PADDING);
- evas_object_resize(wd->eraser, w, h - ERASER_PADDING);
+ Widget_Data *wd = elm_widget_data_get(data);
+ Evas_Coord w, h;
+ if (!wd || !wd->base) return;
+ evas_object_geometry_get(obj, NULL, NULL, NULL, &h);
+ evas_object_geometry_get(wd->eraser, NULL, NULL, &w, NULL);
+ evas_object_size_hint_min_set(wd->eraser, w, h - ERASER_PADDING);
+ evas_object_resize(wd->eraser, w, h - ERASER_PADDING);
}
static void
_eraser_drag_end(void *data, Evas_Object *obj, const char *emission, const char *source)
{
- Widget_Data *wd = elm_widget_data_get(data);
- if (!wd || !wd->base || !wd->entry)
- return;
- elm_entry_entry_set(wd->entry, "");
- edje_object_part_text_set(wd->base, "elm.content.no.edit", "");
+ Widget_Data *wd = elm_widget_data_get(data);
+ if (!wd || !wd->base || !wd->entry)
+ return;
+ elm_entry_entry_set(wd->entry, "");
+ edje_object_part_text_set(wd->base, "elm.content.no.edit", "");
}
static void
static void
_eraser_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
- Widget_Data *wd = elm_widget_data_get(data);
- Evas_Event_Mouse_Up *ev = event_info;
- Evas_Coord distance;
- unsigned int dur;
- double pos = 0.0;
- if (!wd || !wd->base)
- return;
- edje_object_part_drag_value_get(wd->base, "eraser", &pos, NULL);
- if (pos == 1.0) {
- edje_object_signal_emit(wd->base, "elm,state,eraser,flick", "elm");
- return;
- }
- dur = ev->timestamp - wd->down_ev.timestamp;
- distance = wd->down_ev.canvas.x - ev->canvas.x;
- if ((dur && dur > 1000) || (distance < 10 && distance > -10)) {
- edje_object_signal_emit(wd->base, "elm,state,eraser,drag", "elm");
- return;
- }
- if(((float)distance / dur) > 0.5)
- edje_object_signal_emit(wd->base, "elm,state,eraser,flick", "elm");
- else
- edje_object_signal_emit(wd->base, "elm,state,eraser,drag", "elm");
+ Widget_Data *wd = elm_widget_data_get(data);
+ Evas_Event_Mouse_Up *ev = event_info;
+ Evas_Coord distance;
+ unsigned int dur;
+ double pos = 0.0;
+ if (!wd || !wd->base)
+ return;
+ edje_object_part_drag_value_get(wd->base, "eraser", &pos, NULL);
+ if (pos == 1.0)
+ {
+ edje_object_signal_emit(wd->base, "elm,state,eraser,flick", "elm");
+ return;
+ }
+ dur = ev->timestamp - wd->down_ev.timestamp;
+ distance = wd->down_ev.canvas.x - ev->canvas.x;
+ if ((dur && dur > 1000) || (distance < 10 && distance > -10))
+ {
+ edje_object_signal_emit(wd->base, "elm,state,eraser,drag", "elm");
+ return;
+ }
+ if(((float)distance / dur) > 0.5)
+ edje_object_signal_emit(wd->base, "elm,state,eraser,flick", "elm");
+ else
+ edje_object_signal_emit(wd->base, "elm,state,eraser,drag", "elm");
}
static void
_eraser_init(Evas_Object *obj)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd || !wd->base)
- return;
- wd->eraser = edje_object_add(evas_object_evas_get(obj));
- elm_widget_sub_object_add(obj, wd->eraser);
- _elm_theme_object_set(obj, wd->eraser, "editfield/eraser", "base", "default");
- edje_object_part_swallow(wd->base, "eraser", wd->eraser);
- evas_object_event_callback_add(wd->eraser, EVAS_CALLBACK_MOUSE_DOWN, _eraser_mouse_down, obj);
- evas_object_event_callback_add(wd->eraser, EVAS_CALLBACK_MOUSE_UP, _eraser_mouse_up, obj);
- edje_object_signal_callback_add(wd->base, "drag", "end", _eraser_drag_end, obj);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd || !wd->base)
+ return;
+ wd->eraser = edje_object_add(evas_object_evas_get(obj));
+ elm_widget_sub_object_add(obj, wd->eraser);
+ _elm_theme_object_set(obj, wd->eraser, "editfield/eraser", "base", "default");
+ edje_object_part_swallow(wd->base, "eraser", wd->eraser);
+ evas_object_event_callback_add(wd->eraser, EVAS_CALLBACK_MOUSE_DOWN, _eraser_mouse_down, obj);
+ evas_object_event_callback_add(wd->eraser, EVAS_CALLBACK_MOUSE_UP, _eraser_mouse_up, obj);
+ edje_object_signal_callback_add(wd->base, "drag", "end", _eraser_drag_end, obj);
}
/**
EAPI Evas_Object *
elm_editfield_add(Evas_Object *parent)
{
- Evas_Object *obj;
- Evas *e;
- Widget_Data *wd;
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (e == NULL)
- return NULL;
- obj = elm_widget_add(e);
- ELM_SET_WIDTYPE(widtype, "editfield");
- elm_widget_type_set(obj, "editfield");
- elm_widget_sub_object_add(parent, obj);
- elm_widget_data_set(obj, wd);
- elm_widget_del_hook_set(obj, _del_hook);
- elm_widget_theme_hook_set(obj, _theme_hook);
- elm_widget_changed_hook_set(obj, _changed_hook);
- elm_widget_on_focus_hook_set( obj, _on_focus_hook, NULL );
- elm_widget_can_focus_set(obj, EINA_TRUE);
-
- wd->base = edje_object_add(e);
- _elm_theme_object_set(obj, wd->base, "editfield", "base", "default");
- elm_widget_resize_object_set(obj, wd->base);
- edje_object_signal_callback_add(wd->base, "mouse,clicked,1", "*",
- _signal_mouse_clicked, obj);
- evas_object_event_callback_add(wd->base, EVAS_CALLBACK_RESIZE, _resize_cb, obj);
-
- wd->editing = EINA_FALSE;
- wd->single_line = EINA_FALSE;
- wd->eraser_visible = EINA_FALSE;
-
- wd->entry = elm_entry_add(obj);
- elm_object_style_set(wd->entry, "editfield");
- evas_object_size_hint_weight_set(wd->entry, 0, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(wd->entry, 0, EVAS_HINT_FILL);
- evas_object_event_callback_add(wd->entry,
- EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints, obj);
- edje_object_part_swallow(wd->base, "elm.swallow.content", wd->entry);
- evas_object_smart_callback_add(wd->entry, "changed", _entry_changed_cb, obj);
- elm_widget_sub_object_add(obj, wd->entry);
-
- _sizing_eval(obj);
-
- return obj;
+ Evas_Object *obj;
+ Evas *e;
+ Widget_Data *wd;
+
+ wd = ELM_NEW(Widget_Data);
+ e = evas_object_evas_get(parent);
+ if (e == NULL)
+ return NULL;
+ obj = elm_widget_add(e);
+ ELM_SET_WIDTYPE(widtype, "editfield");
+ elm_widget_type_set(obj, "editfield");
+ elm_widget_sub_object_add(parent, obj);
+ elm_widget_data_set(obj, wd);
+ elm_widget_del_hook_set(obj, _del_hook);
+ elm_widget_theme_hook_set(obj, _theme_hook);
+ elm_widget_changed_hook_set(obj, _changed_hook);
+ elm_widget_on_focus_hook_set( obj, _on_focus_hook, NULL );
+ elm_widget_can_focus_set(obj, EINA_TRUE);
+
+ wd->base = edje_object_add(e);
+ _elm_theme_object_set(obj, wd->base, "editfield", "base", "default");
+ elm_widget_resize_object_set(obj, wd->base);
+ edje_object_signal_callback_add(wd->base, "mouse,clicked,1", "*",
+ _signal_mouse_clicked, obj);
+ evas_object_event_callback_add(wd->base, EVAS_CALLBACK_RESIZE, _resize_cb, obj);
+
+ wd->editing = EINA_FALSE;
+ wd->single_line = EINA_FALSE;
+ wd->eraser_visible = EINA_FALSE;
+
+ wd->entry = elm_entry_add(obj);
+ elm_object_style_set(wd->entry, "editfield");
+ evas_object_size_hint_weight_set(wd->entry, 0, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(wd->entry, 0, EVAS_HINT_FILL);
+ evas_object_event_callback_add(wd->entry,
+ EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+ _changed_size_hints, obj);
+ edje_object_part_swallow(wd->base, "elm.swallow.content", wd->entry);
+ evas_object_smart_callback_add(wd->entry, "changed", _entry_changed_cb, obj);
+ elm_widget_sub_object_add(obj, wd->entry);
+
+ _sizing_eval(obj);
+
+ return obj;
}
/**
EAPI void
elm_editfield_label_set(Evas_Object *obj, const char *label)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- ELM_CHECK_WIDTYPE(obj, widtype);
- if (!wd || !wd->base)
- return;
- if (wd->label)
- eina_stringshare_del(wd->label);
- if (label) {
- wd->label = eina_stringshare_add(label);
- edje_object_signal_emit(wd->base, "elm,state,text,visible", "elm");
- edje_object_signal_emit(wd->base, "elm,state,left,icon,hide", "elm");
- }
- else {
- wd->label = NULL;
- edje_object_signal_emit(wd->base, "elm,state,text,hidden", "elm");
- edje_object_signal_emit(wd->base, "elm,state,left,icon,show", "elm");
- }
- edje_object_message_signal_process(wd->base);
- edje_object_part_text_set(wd->base, "elm.text", label);
- _sizing_eval(obj);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ if (!wd || !wd->base)
+ return;
+ if (wd->label)
+ eina_stringshare_del(wd->label);
+ if (label)
+ {
+ wd->label = eina_stringshare_add(label);
+ edje_object_signal_emit(wd->base, "elm,state,text,visible", "elm");
+ edje_object_signal_emit(wd->base, "elm,state,left,icon,hide", "elm");
+ }
+ else
+ {
+ wd->label = NULL;
+ edje_object_signal_emit(wd->base, "elm,state,text,hidden", "elm");
+ edje_object_signal_emit(wd->base, "elm,state,left,icon,show", "elm");
+ }
+ edje_object_message_signal_process(wd->base);
+ edje_object_part_text_set(wd->base, "elm.text", label);
+ _sizing_eval(obj);
}
/**
EAPI const char*
elm_editfield_label_get(Evas_Object *obj)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- if (!wd || !wd->base)
- return NULL;
- return wd->label;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ if (!wd || !wd->base)
+ return NULL;
+ return wd->label;
}
/**
EAPI void
elm_editfield_guide_text_set(Evas_Object *obj, const char *text)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- ELM_CHECK_WIDTYPE(obj, widtype);
- if (!wd || !wd->base)
- return;
- if (wd->guide_text)
- eina_stringshare_del(wd->guide_text);
- if (text) {
- wd->guide_text = eina_stringshare_add(text);
- edje_object_part_text_set(wd->base, "elm.guidetext", wd->guide_text);
- wd->show_guide_text = EINA_TRUE;
- }
- else
- wd->guide_text = NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ if (!wd || !wd->base)
+ return;
+ if (wd->guide_text)
+ eina_stringshare_del(wd->guide_text);
+ if (text)
+ {
+ wd->guide_text = eina_stringshare_add(text);
+ edje_object_part_text_set(wd->base, "elm.guidetext", wd->guide_text);
+ wd->show_guide_text = EINA_TRUE;
+ }
+ else
+ wd->guide_text = NULL;
}
/**
EAPI const char*
elm_editfield_guide_text_get(Evas_Object *obj)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- if (!wd || !wd->base)
- return NULL;
- return wd->guide_text;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ if (!wd || !wd->base)
+ return NULL;
+ return wd->guide_text;
}
/**
EAPI Evas_Object *
elm_editfield_entry_get(Evas_Object *obj)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- if (!wd)
- return NULL;
- return wd->entry;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ if (!wd)
+ return NULL;
+ return wd->entry;
}
/**
EAPI Eina_Bool
elm_editfield_left_icon_set(Evas_Object *obj, Evas_Object *icon)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
- if (!wd || !wd->base)
- return EINA_FALSE;
- if ((wd->licon != icon) && (wd->licon))
- elm_widget_sub_object_del(obj, wd->licon);
- if (icon)
- {
- if (!(edje_object_part_swallow(wd->base, "left_icon", icon)))
- return EINA_FALSE;
- wd->licon = icon;
- elm_widget_sub_object_add(obj, icon);
- evas_object_event_callback_add(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints, obj);
- edje_object_signal_emit(wd->base, "elm,state,left,icon,show", "elm");
- edje_object_signal_emit(wd->base, "elm,state,text,hidden", "elm");
- _sizing_eval(obj);
- }
- return EINA_TRUE;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
+ if (!wd || !wd->base)
+ return EINA_FALSE;
+ if ((wd->licon != icon) && (wd->licon))
+ elm_widget_sub_object_del(obj, wd->licon);
+ if (icon)
+ {
+ if (!(edje_object_part_swallow(wd->base, "left_icon", icon)))
+ return EINA_FALSE;
+ wd->licon = icon;
+ elm_widget_sub_object_add(obj, icon);
+ evas_object_event_callback_add(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+ _changed_size_hints, obj);
+ edje_object_signal_emit(wd->base, "elm,state,left,icon,show", "elm");
+ edje_object_signal_emit(wd->base, "elm,state,text,hidden", "elm");
+ _sizing_eval(obj);
+ }
+ return EINA_TRUE;
}
/**
EAPI Evas_Object *
elm_editfield_left_icon_get(Evas_Object *obj)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- if (!wd || !wd->base || !wd->licon)
- return NULL;
- return wd->licon;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ if (!wd || !wd->base || !wd->licon)
+ return NULL;
+ return wd->licon;
}
/**
EAPI Eina_Bool
elm_editfield_right_icon_set(Evas_Object *obj, Evas_Object *icon)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
- if (!wd || !wd->base)
- return EINA_FALSE;
- if ((wd->ricon != icon) && (wd->ricon))
- elm_widget_sub_object_del(obj, wd->ricon);
- if (icon)
- {
- if ( !(edje_object_part_swallow(wd->base, "right_icon", icon)) )
- return EINA_FALSE;
- wd->ricon = icon;
- elm_widget_sub_object_add(obj, icon);
- evas_object_event_callback_add(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints, obj);
- edje_object_signal_emit(wd->base, "elm,state,right,icon,show", "elm");
- _sizing_eval(obj);
- }
- return EINA_TRUE;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
+ if (!wd || !wd->base)
+ return EINA_FALSE;
+ if ((wd->ricon != icon) && (wd->ricon))
+ elm_widget_sub_object_del(obj, wd->ricon);
+ if (icon)
+ {
+ if ( !(edje_object_part_swallow(wd->base, "right_icon", icon)) )
+ return EINA_FALSE;
+ wd->ricon = icon;
+ elm_widget_sub_object_add(obj, icon);
+ evas_object_event_callback_add(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+ _changed_size_hints, obj);
+ edje_object_signal_emit(wd->base, "elm,state,right,icon,show", "elm");
+ _sizing_eval(obj);
+ }
+ return EINA_TRUE;
}
/**
EAPI Evas_Object *
elm_editfield_right_icon_get(Evas_Object *obj)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- if (!wd || !wd->base || !wd->ricon)
- return NULL;
- return wd->ricon;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ if (!wd || !wd->base || !wd->ricon)
+ return NULL;
+ return wd->ricon;
}
/**
EAPI void
elm_editfield_entry_single_line_set(Evas_Object *obj, Eina_Bool single_line)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- ELM_CHECK_WIDTYPE(obj, widtype);
- if (!wd || !wd->base)
- return;
- wd->single_line = single_line;
- elm_entry_single_line_set(wd->entry, single_line);
- if(wd->single_line && wd->eraser_visible)
- edje_object_signal_emit(wd->base, "elm,state,eraser,show", "elm");
- else
- edje_object_signal_emit(wd->base, "elm,state,eraser,hide", "elm");
+ Widget_Data *wd = elm_widget_data_get(obj);
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ if (!wd || !wd->base)
+ return;
+ wd->single_line = single_line;
+ elm_entry_single_line_set(wd->entry, single_line);
+ if(wd->single_line && wd->eraser_visible)
+ edje_object_signal_emit(wd->base, "elm,state,eraser,show", "elm");
+ else
+ edje_object_signal_emit(wd->base, "elm,state,eraser,hide", "elm");
}
/**
EAPI void
elm_editfield_eraser_set(Evas_Object *obj, Eina_Bool visible)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- ELM_CHECK_WIDTYPE(obj, widtype);
- if (!wd || !wd->base)
- return;
- wd->eraser_visible = visible;
- _eraser_init(obj);
- if(wd->single_line && wd->eraser_visible)
- edje_object_signal_emit(wd->base, "elm,state,eraser,show", "elm");
- else
- edje_object_signal_emit(wd->base, "elm,state,eraser,hide", "elm");
+ Widget_Data *wd = elm_widget_data_get(obj);
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ if (!wd || !wd->base)
+ return;
+ wd->eraser_visible = visible;
+ _eraser_init(obj);
+ if(wd->single_line && wd->eraser_visible)
+ edje_object_signal_emit(wd->base, "elm,state,eraser,show", "elm");
+ else
+ edje_object_signal_emit(wd->base, "elm,state,eraser,hide", "elm");
}