utc_UIFW_elm_controlbar_item_select_func \
utc_UIFW_elm_controlbar_item_visible_set_func \
utc_UIFW_elm_controlbar_item_visible_get_func \
- utc_UIFW_elm_controlbar_item_disable_set_func \
+ utc_UIFW_elm_controlbar_item_disabled_set_func \
utc_UIFW_elm_controlbar_item_icon_set_func \
utc_UIFW_elm_controlbar_item_icon_get_func \
utc_UIFW_elm_controlbar_item_label_set_func \
/elm_ts/controlbar/utc_UIFW_elm_controlbar_item_select_func
/elm_ts/controlbar/utc_UIFW_elm_controlbar_item_visible_set_func
/elm_ts/controlbar/utc_UIFW_elm_controlbar_item_visible_get_func
-/elm_ts/controlbar/utc_UIFW_elm_controlbar_item_disable_set_func
+/elm_ts/controlbar/utc_UIFW_elm_controlbar_item_disabled_set_func
/elm_ts/controlbar/utc_UIFW_elm_controlbar_item_icon_set_func
/elm_ts/controlbar/utc_UIFW_elm_controlbar_item_icon_get_func
/elm_ts/controlbar/utc_UIFW_elm_controlbar_item_label_set_func
void (*tet_startup)(void) = startup;
void (*tet_cleanup)(void) = cleanup;
-static void utc_UIFW_elm_controlbar_item_disable_set_func_01(void);
-static void utc_UIFW_elm_controlbar_item_disable_set_func_02(void);
+static void utc_UIFW_elm_controlbar_item_disabled_set_func_01(void);
+static void utc_UIFW_elm_controlbar_item_disabled_set_func_02(void);
enum {
POSITIVE_TC_IDX = 0x01,
};
struct tet_testlist tet_testlist[] = {
- { utc_UIFW_elm_controlbar_item_disable_set_func_01, POSITIVE_TC_IDX },
- { utc_UIFW_elm_controlbar_item_disable_set_func_02, NEGATIVE_TC_IDX },
+ { utc_UIFW_elm_controlbar_item_disabled_set_func_01, POSITIVE_TC_IDX },
+ { utc_UIFW_elm_controlbar_item_disabled_set_func_02, NEGATIVE_TC_IDX },
{ NULL, 0 }
};
}
/**
- * @brief Positive test case of elm_controlbar_item_disable_set()
+ * @brief Positive test case of elm_controlbar_item_disabled_set()
*/
-static void utc_UIFW_elm_controlbar_item_disable_set_func_01(void)
+static void utc_UIFW_elm_controlbar_item_disabled_set_func_01(void)
{
- elm_controlbar_item_disable_set(item1, EINA_TRUE);
+ elm_controlbar_item_disabled_set(item1, EINA_TRUE);
tet_result(TET_PASS);
}
/**
- * @brief Negative test case of ug_init elm_controlbar_item_disable_set()
+ * @brief Negative test case of ug_init elm_controlbar_item_disabled_set()
*/
-static void utc_UIFW_elm_controlbar_item_disable_set_func_02(void)
+static void utc_UIFW_elm_controlbar_item_disabled_set_func_02(void)
{
- elm_controlbar_item_disable_set(NULL, EINA_TRUE);
+ elm_controlbar_item_disabled_set(NULL, EINA_TRUE);
tet_result(TET_PASS);
}
CC ?= gcc
-TARGETS = uts_elm_ctxpopup_add_func \
- uts_elm_ctxpopup_horizontal_set \
- uts_elm_ctxpopup_horizontal_get \
- uts_elm_ctxpopup_item_append \
- uts_elm_ctxpopup_item_icon_set \
- uts_elm_ctxpopup_item_label_set \
- uts_elm_ctxpopup_item_del \
- uts_elm_ctxpopup_item_disabled_set \
- uts_elm_ctxpopup_item_disabled_get \
- uts_elm_ctxpopup_clear \
- uts_elm_ctxpopup_item_label_get \
- uts_elm_ctxpopup_item_icon_get \
- uts_elm_ctxpopup_direction_priority_set \
- uts_elm_ctxpopup_direction_priority_get \
- uts_elm_ctxpopup_content_set \
- uts_elm_ctxpopup_content_unset \
- uts_elm_ctxpopup_hover_parent_set \
- uts_elm_ctxpopup_hover_parent_get
-
-
-
-PKGS = elementary
+TARGETS = utc_UIFW_elm_ctxpopup_add_func \
+ utc_UIFW_elm_ctxpopup_horizontal_set_func \
+ utc_UIFW_elm_ctxpopup_horizontal_get_func \
+ utc_UIFW_elm_ctxpopup_item_append_func \
+ utc_UIFW_elm_ctxpopup_item_icon_set_func \
+ utc_UIFW_elm_ctxpopup_item_label_set_func \
+ utc_UIFW_elm_ctxpopup_item_del_func \
+ utc_UIFW_elm_ctxpopup_item_disabled_set_func \
+ utc_UIFW_elm_ctxpopup_item_disabled_get_func \
+ utc_UIFW_elm_ctxpopup_clear_func \
+ utc_UIFW_elm_ctxpopup_item_label_get_func \
+ utc_UIFW_elm_ctxpopup_item_icon_get_func \
+ utc_UIFW_elm_ctxpopup_direction_priority_set_func \
+ utc_UIFW_elm_ctxpopup_direction_priority_get_func \
+ utc_UIFW_elm_ctxpopup_content_set_func \
+ utc_UIFW_elm_ctxpopup_content_unset_func \
+ utc_UIFW_elm_ctxpopup_hover_parent_set_func \
+ utc_UIFW_elm_ctxpopup_hover_parent_get_func
+
+PKGS = elementary evas
LDFLAGS = `pkg-config --libs $(PKGS)`
LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o
all: $(TARGETS)
-$(TARGET): %: %.c
- $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)
+$(TARGETS): %: %.c
+ $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)
clean:
rm -f $(TARGETS)
utc_UIFW_elm_editfield_entry_eraser_set_func\
utc_UIFW_elm_editfield_entry_eraser_get_func
-PKGS = elementary
+PKGS = elementary evas
LDFLAGS = `pkg-config --libs $(PKGS)`
LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o
all: $(TARGETS)
-$(TARGET): %: %.c
- $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)
+$(TARGETS): %: %.c
+ $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)
clean:
rm -f $(TARGETS)
+elementary (1.0.0+svn.61256slp2+build38) unstable; urgency=low
+
+ * Package Upload.
+ * Git: 165.213.180.234:slp/pkgs/e/elementary
+ * Tag: elementary_1.0.0+svn.61256slp2+build38
+
+ -- ChunEon Park <chuneon.park@samsung.com> Wed, 21 Sep 2011 16:49:09 +0900
+
elementary (1.0.0+svn.61256slp2+build37) unstable; urgency=low
* Package Upload.
Eina_Bool elm_navigationbar_ex_title_object_visible_get(Elm_Navigationbar_ex_Item* item);
/* naviframe */
+ #define ELM_NAVIFRAME_ITEM_CONTENT "elm.swallow.content"
#define ELM_NAVIFRAME_ITEM_ICON "elm.swallow.icon"
#define ELM_NAVIFRAME_ITEM_OPTIONHEADER "elm.swallow.optionheader"
#define ELM_NAVIFRAME_ITEM_TITLE_LABEL "elm.text.title"
EAPI Evas_Object *elm_naviframe_add(Evas_Object *parent) EINA_ARG_NONNULL(1);
EAPI Elm_Object_Item *elm_naviframe_item_push(Evas_Object *obj, const char *title_label, Evas_Object *prev_btn, Evas_Object *next_btn, Evas_Object *content, const char *item_style) EINA_ARG_NONNULL(1, 5);
EAPI Evas_Object *elm_naviframe_item_pop(Evas_Object *obj) EINA_ARG_NONNULL(1);
+ EAPI void elm_naviframe_item_pop_to(Elm_Object_Item *it) EINA_ARG_NONNULL(1);
EAPI void elm_naviframe_content_preserve_on_pop_set(Evas_Object *obj, Eina_Bool preserve) EINA_ARG_NONNULL(1);
EAPI Eina_Bool elm_naviframe_content_preserve_on_pop_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
EAPI Elm_Object_Item *elm_naviframe_top_item_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
//In this case, all directions are invalid because of lack of space.
if (idx == 4)
{
- //TODO 1: Find the largest space direction.
Evas_Coord length[2];
- length[0] = pos.y - hover_area.y;
- length[1] = (hover_area.y + hover_area.h) - pos.y;
-
- if (length[0] > length[1])
- idx = ELM_CTXPOPUP_DIRECTION_UP;
+ if(!wd->horizontal)
+ {
+ length[0] = pos.y - hover_area.y;
+ length[1] = (hover_area.y + hover_area.h) - pos.y;
+
+ // ELM_CTXPOPUP_DIRECTION_UP
+ if (length[0] > length[1])
+ {
+ _adjust_pos_x(&pos, &base_size, &hover_area);
+ pos.y -= base_size.y;
+ arrow = ELM_CTXPOPUP_DIRECTION_UP;
+ if (pos.y < (hover_area.y + arrow_size.y))
+ {
+ base_size.y -= ((hover_area.y + arrow_size.y) - pos.y);
+ pos.y = hover_area.y + arrow_size.y;
+ }
+ }
+ //ELM_CTXPOPUP_DIRECTION_DOWN
+ else
+ {
+ _adjust_pos_x(&pos, &base_size, &hover_area);
+ arrow = ELM_CTXPOPUP_DIRECTION_DOWN;
+ if ((pos.y + arrow_size.y + base_size.y) >
+ (hover_area.y + hover_area.h))
+ base_size.y -=
+ ((pos.y + arrow_size.y + base_size.y) -
+ (hover_area.y + hover_area.h));
+ }
+ }
else
- idx = ELM_CTXPOPUP_DIRECTION_DOWN;
-
- //TODO 2: determine x , y
- switch (idx)
{
- case ELM_CTXPOPUP_DIRECTION_UP:
- _adjust_pos_x(&pos, &base_size, &hover_area);
- pos.y -= base_size.y;
- arrow = ELM_CTXPOPUP_DIRECTION_DOWN;
- if (pos.y < hover_area.y + arrow_size.y)
- {
- base_size.y -= ((hover_area.y + arrow_size.y) - pos.y);
- pos.y = hover_area.y + arrow_size.y;
- }
- break;
- case ELM_CTXPOPUP_DIRECTION_LEFT:
- _adjust_pos_y(&pos, &base_size, &hover_area);
- pos.x -= base_size.x;
- arrow = ELM_CTXPOPUP_DIRECTION_RIGHT;
- if (pos.x < hover_area.x + arrow_size.x)
- {
- base_size.x -= ((hover_area.x + arrow_size.x) - pos.x);
- pos.x = hover_area.x + arrow_size.x;
- }
- break;
- case ELM_CTXPOPUP_DIRECTION_RIGHT:
- _adjust_pos_y(&pos, &base_size, &hover_area);
- arrow = ELM_CTXPOPUP_DIRECTION_LEFT;
- if (pos.x + arrow_size.x + base_size.x >
- hover_area.x + hover_area.w)
- base_size.x -=
- ((pos.x + arrow_size.x + base_size.x) -
- (hover_area.x + hover_area.w));
- break;
- case ELM_CTXPOPUP_DIRECTION_DOWN:
- _adjust_pos_x(&pos, &base_size, &hover_area);
- arrow = ELM_CTXPOPUP_DIRECTION_UP;
- if (pos.y + arrow_size.y + base_size.y >
- hover_area.y + hover_area.h)
- base_size.y -=
- ((pos.y + arrow_size.y + base_size.y) -
- (hover_area.y + hover_area.h));
- break;
- default:
- break;
+ length[0] = pos.x - hover_area.x;
+ length[1] = (hover_area.x + hover_area.w) - pos.x;
+
+ //ELM_CTXPOPUP_DIRECTION_LEFT
+ if (length[0] > length[1])
+ {
+ _adjust_pos_y(&pos, &base_size, &hover_area);
+ pos.x -= base_size.x;
+ arrow = ELM_CTXPOPUP_DIRECTION_LEFT;
+ if (pos.x < (hover_area.x + arrow_size.x))
+ {
+ base_size.x -= ((hover_area.x + arrow_size.x) - pos.x);
+ pos.x = hover_area.x + arrow_size.x;
+ }
+ }
+ //ELM_CTXPOPUP_DIRECTION_RIGHT
+ else
+ {
+ _adjust_pos_y(&pos, &base_size, &hover_area);
+ arrow = ELM_CTXPOPUP_DIRECTION_RIGHT;
+ if (pos.x + (arrow_size.x + base_size.x) >
+ hover_area.x + hover_area.w)
+ base_size.x -=
+ ((pos.x + arrow_size.x + base_size.x) -
+ (hover_area.x + hover_area.w));
+ }
}
}
wd = elm_widget_data_get(obj);
if (!wd) return;
- EINA_LIST_FOREACH(wd->stack, list, it)
+ EINA_LIST_REVERSE_FOREACH(wd->stack, list, it)
_item_del(it);
eina_list_free(wd->stack);
free(wd);
eina_list_free(it->content_list);
eina_list_free(it->text_list);
- evas_object_del(it->base.view);
-
wd->stack = eina_list_remove(wd->stack, it);
- free(it);
+ elm_widget_item_del(it);
}
static void
"elm,action,popped,finished",
"",
_popped_finished, it);
- elm_naviframe_item_style_set(ELM_CAST(it), item_style);
-
- //title
edje_object_signal_callback_add(it->base.view,
"elm,action,title,clicked",
- "elm",
+ "",
_title_clicked, it);
+ elm_naviframe_item_style_set(ELM_CAST(it), item_style);
+
_item_text_set_hook(ELM_CAST(it), "elm.text.title", title_label);
//title buttons
}
EAPI void
+elm_naviframe_item_pop_to(Elm_Object_Item *it)
+{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Elm_Naviframe_Item *navi_it = ELM_CAST(it);
+ Widget_Data *wd = elm_widget_data_get(navi_it->base.widget);
+ Eina_List *l, *prev_l;
+
+ if (it == elm_naviframe_top_item_get(navi_it->base.widget)) return;
+
+ l = eina_list_last(wd->stack)->prev;
+
+ while(l)
+ {
+ if (l->data == it) break;
+ prev_l = l->prev;
+ _item_del(l->data);
+ wd->stack = eina_list_remove(wd->stack, l);
+ l = prev_l;
+ }
+ elm_naviframe_item_pop(navi_it->base.widget);
+}
+
+EAPI void
elm_naviframe_content_preserve_on_pop_set(Evas_Object *obj, Eina_Bool preserve)
{
ELM_CHECK_WIDTYPE(obj, widtype);
struct _Widget_Data
{
Eina_List *stack;
+ Evas_Object *rect;
Evas_Object *base;
Evas_Object *pager;
Eina_Bool title_visible : 1;
static void
_resize(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ Evas_Coord w, h;
+ evas_object_geometry_get(obj, NULL, NULL, &w, &h);
+ evas_object_resize(wd->rect, w, h);
+
_sizing_eval(obj);
}
static void
+_hide(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ evas_object_hide(wd->rect);
+}
+
+static void
+_move(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ Evas_Coord x, y;
+ evas_object_geometry_get(obj, &x, &y, NULL, NULL);
+ evas_object_move(wd->rect, x, y);
+}
+
+static void
_titleobj_switching(Evas_Object *obj, Elm_Navigationbar_Item *it)
{
Widget_Data *wd = elm_widget_data_get(obj);
else
edje_object_signal_emit(wd->base, "elm,action,push", "elm");
evas_object_pass_events_set(wd->base, EINA_TRUE);
+ evas_object_show(wd->rect);
}
if (it->title_obj)
{
wd->popping = EINA_FALSE;
evas_object_smart_callback_call(navi_bar, SIG_HIDE_FINISHED, event_info);
evas_object_pass_events_set(wd->base, EINA_FALSE);
+ evas_object_hide(wd->rect);
}
static void
edje_object_part_swallow(wd->base, "elm.swallow.content", wd->pager);
evas_object_smart_callback_add(wd->pager, "hide,finished", _hide_finished, obj);
evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, NULL);
+ evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _move, NULL);
+ evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _hide, NULL);
wd->title_visible = EINA_TRUE;
evas_object_smart_callbacks_descriptions_set(obj, _signals);
+ //Rect
+ wd->rect = evas_object_rectangle_add(e);
+ evas_object_color_set(wd->rect, 0, 0, 0, 0);
+ elm_widget_sub_object_add(obj, wd->rect);
+
//TODO: apply elm_object_disabled_set
return obj;
\r
strncpy(buf, "item/", sizeof(buf));\r
strncat(buf, item_style, sizeof(buf) - strlen(buf));\r
- if (!eina_stringshare_replace(&it->item_style, item_style)) return NULL;\r
+ eina_stringshare_replace(&it->item_style, item_style);\r
_elm_theme_object_set(obj, it->base, "navigationbar_ex", buf, elm_widget_style_get(obj));\r
\r
\r
static Paste_Image *pasteimage_alloc(const char *file, int pathlen);
static Eina_Bool pasteimage_append(Paste_Image *pi, Evas_Object *entry);
static void pasteimage_free(Paste_Image *pi);
+static void entry_insert_filter(Evas_Object* entry, char* str);
/* Optimisation: Turn this into a 256 byte table:
* then can lookup in one index, not N checks */
cnp_debug("Got %s\n", p);
if (strncmp(p, "file://", 7))
{
- /* elm_selection_set send target notify->data just "x" */
- if (*p == 'x') return EINA_TRUE;
if (*p != '/') return EINA_FALSE;
}
{
if ((atoms[j].atom == atomlist[i]) && (atoms[j].notify))
{
- if ((j == CNP_ATOM_text_uri) ||
+/* if ((j == CNP_ATOM_text_uri) ||
(j == CNP_ATOM_text_urilist))
{
if(!is_uri_type_data(sel, notify)) continue;
- }
+ }*/
cnp_debug("Atom %s matches\n",atoms[j].name);
goto done;
}
return 0;
}
+static void
+entry_insert_filter(Evas_Object* entry, char* str)
+{
+ if (!entry || !str)
+ return;
+
+ char *insertStr = str;
+ // if entry has text only set then remove item tags
+ if (elm_entry_cnp_textonly_get(entry))
+ {
+ while (EINA_TRUE)
+ {
+ char *startTag = NULL;
+ char *endTag = NULL;
+
+ startTag = strstr(insertStr, "<item");
+ if (!startTag)
+ startTag = strstr(insertStr, "</item");
+ if (startTag)
+ endTag = strstr(insertStr, ">");
+ else
+ break;
+ if (!endTag || startTag > endTag)
+ {
+ cnp_debug("Broken tag: %s\n", str);
+ break;
+ }
+
+ size_t sindex = startTag - insertStr;
+ size_t eindex = endTag - insertStr + 1;
+
+ Eina_Strbuf *buf = eina_strbuf_new();
+ if (buf)
+ {
+ eina_strbuf_append(buf, insertStr);
+ eina_strbuf_remove(buf, sindex, eindex);
+ insertStr = eina_strbuf_string_steal(buf);
+ eina_strbuf_free(buf);
+ }
+ }
+ }
+ cnp_debug("remove item tag: %s\n", insertStr);
+
+ // if entry has single line set then remove <br> & <ps> tags
+ if (elm_entry_single_line_get(entry))
+ {
+ Eina_Strbuf *buf = eina_strbuf_new();
+ if (buf)
+ {
+ eina_strbuf_append(buf, insertStr);
+ eina_strbuf_replace_all(buf, "<br>", "");
+ eina_strbuf_replace_all(buf, "<ps>", "");
+ insertStr = eina_strbuf_string_steal(buf);
+ eina_strbuf_free(buf);
+ }
+ }
+ cnp_debug("remove break tag: %s\n", insertStr);
+
+ elm_entry_entry_insert(entry, insertStr);
+
+ if (insertStr != str)
+ free(insertStr);
+}
static int
notify_handler_text(Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify)
cnp_debug("Notify handler text %d %d %p\n", data->format,data->length, data->data);
str = mark_up((char *)data->data, data->length, NULL);
cnp_debug("String is %s (from %s)\n", str, data->data);
- elm_entry_entry_insert(sel->requestwidget, str);
+ entry_insert_filter(sel->requestwidget, str);
+ //elm_entry_entry_insert(sel->requestwidget, str);
free(str);
return 0;
}
sel->datacb(sel->udata, sel->widget, &ddata);
}
else
- elm_entry_entry_insert(sel->requestwidget, stripstr);
+ entry_insert_filter(sel->requestwidget, stripstr);
+ //elm_entry_entry_insert(sel->requestwidget, stripstr);
cnp_debug("String is %s (%d bytes)\n", stripstr, data->length);
free(stripstr);
sel->datacb(sel->udata, sel->widget, &ddata);
}
else
- elm_entry_entry_insert(sel->requestwidget, stripstr);
+ entry_insert_filter(sel->requestwidget, stripstr);
+ //elm_entry_entry_insert(sel->requestwidget, stripstr);
cnp_debug("String is %s (%d bytes)\n", stripstr, data->length);
free(stripstr);
if (!pi) return EINA_FALSE;
if (!entry) return EINA_FALSE;
+ if (elm_entry_cnp_textonly_get(entry)) return EINA_FALSE;
pasteimage_provider_set(entry);
*
*/
-
#define MAX_NUM_COLORS 30
typedef struct _Colorpalette_Item Colorpalette_Item;
+typedef struct _Widget_Data Widget_Data;
+
struct _Colorpalette_Item
{
- Evas_Object *parent;
+ Evas_Object *obj;
Evas_Object *lo;
Evas_Object *cr;
unsigned int r, g, b;
};
-
-typedef struct _Widget_Data Widget_Data;
struct _Widget_Data
{
- Evas_Object *parent;
- Evas_Object *lay;
+ Evas_Object *base;
Evas_Object *tab;
-
- Evas_Coord x, y, w, h;
- Evas_Coord tab_w, tab_h;
- Evas_Coord rect_w, rect_h;
-
- unsigned int row, col;
Elm_Colorpalette_Color *color;
-
Eina_List *items;
-
+ unsigned int row, col;
unsigned int num;
};
+static const char *widtype = NULL;
static void _del_hook(Evas_Object *obj);
static void _theme_hook(Evas_Object *obj);
static void _sizing_eval(Evas_Object *obj);
-
-static void _colorpalette_object_move(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _colorpalette_object_resize(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void _colorpalette_object_show(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void _colorpalette_object_hide(void *data, Evas *e, Evas_Object *obj, void *event_info);
-
static void _color_select_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _color_release_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _color_table_delete(Evas_Object *obj);
-static void _color_table_update(Evas_Object *obj, int row, int col, int color_num, Elm_Colorpalette_Color *color);
+static void _color_table_update(Evas_Object *obj, unsigned int row, unsigned int col, unsigned int color_num, Elm_Colorpalette_Color *color);
static void
_del_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
-
if (!wd) return;
-
_color_table_delete(obj);
-
- if (wd->color){
+ if (wd->color)
+ {
free(wd->color);
- }
-
- if (wd->lay){
- evas_object_smart_member_del(wd->lay);
- evas_object_del(wd->lay);
- wd->lay = NULL;
- }
+ }
free(wd);
}
_theme_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd)
- return;
-
- _elm_theme_object_set(obj, wd->lay, "colorpalette", "bg", elm_widget_style_get(obj));
+ _elm_theme_object_set(obj, wd->base, "colorpalette", "base", elm_widget_style_get(obj));
_color_table_update(obj, wd->row, wd->col, wd->num, wd->color);
_sizing_eval(obj);
-
}
static void
_sizing_eval(Evas_Object *obj)
{
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd)
- return;
-
- _colorpalette_object_move(obj, NULL, obj, NULL);
- _colorpalette_object_resize(obj, NULL, obj, NULL);
-}
-
-
-static void _colorpalette_object_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- DBG("%s", __func__);
-
- Widget_Data *wd;
- Evas_Coord x, y;
-
- if(!data)
- return;
-
- wd = elm_widget_data_get((Evas_Object *)data);
-
- if(!wd)
- return;
-
- evas_object_geometry_get(wd->lay, &x, &y, NULL, NULL);
-
- wd->x = x;
- wd->y = y;
-
- evas_object_move(wd->lay, x, y);
-}
-
-
-static void _colorpalette_object_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- Widget_Data *wd;
+ Widget_Data *wd = NULL;
Colorpalette_Item *item = NULL;
- Evas_Coord w, h;
- Evas_Coord tab_w, tab_h;
- double pad_x, pad_y;
-
- if(!data)
- return;
-
- wd = elm_widget_data_get((Evas_Object *)data);
-
- if(!wd)
- return;
-
- evas_object_geometry_get(wd->lay, NULL, NULL, &w, &h);
- wd->w = w;
- wd->h = h;
-
- evas_object_geometry_get(wd->tab, NULL, NULL, &tab_w, &tab_h);
- if (tab_w > 0 && tab_h > 0) {
- wd->tab_w = tab_w;
- wd->tab_h = tab_h;
- }
-
+ Evas_Coord tab_w = 0, tab_h = 0;
+ Evas_Coord pad_x = 0, pad_y = 0;
+ Evas_Coord rect_w = 0, rect_h = 0;
+ Evas_Coord minw = -1, minh = -1;
+
+ wd = elm_widget_data_get((Evas_Object *)obj);
+ elm_coords_finger_size_adjust(1, &minw, 1, &minh);
+ edje_object_size_min_restricted_calc(wd->base, &minw, &minh, minw, minh);
+ evas_object_size_hint_min_set(obj, minw, minh);
+ evas_object_size_hint_max_set(obj, -1, -1);
+
+ edje_object_part_geometry_get(wd->base,"bg" ,NULL, NULL, &tab_w, &tab_h);
if (wd->items)
- item = wd->items->data;
-
- edje_object_part_geometry_get(elm_layout_edje_get(item->lo),"bg" ,NULL, NULL, &wd->rect_w, &wd->rect_h);
-
- pad_x = ((double)wd->tab_w - (double)wd->rect_w * (double)wd->col) / (double)(wd->col - 1);
- pad_y = ((double)wd->tab_h - (double)wd->rect_h * (double)wd->row) / (double)(wd->row - 1);
-
- if (pad_x < 0.0 )
- pad_x = 0;
- if (pad_y < 0.0 )
- pad_y = 0;
-
- elm_table_padding_set(wd->tab, (int)pad_x , (int)pad_y);
-
- if(!wd->lay)
- return;
-
- evas_object_resize(wd->lay, w, h);
-}
-
-
-static void _colorpalette_object_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- DBG("%s", __func__);
-
- Widget_Data *wd = NULL;
-
- if(data == NULL)
- return;
-
- wd = elm_widget_data_get((Evas_Object *)data);
-
-
- if(wd == NULL)
- return;
-
- if (wd->lay) {
- evas_object_show(wd->lay);
- }
+ item = wd->items->data;
+ edje_object_part_geometry_get(elm_layout_edje_get(item->lo),"bg" ,NULL, NULL, &rect_w, &rect_h);
+ if (wd->col - 1) /*value cannot be 0 else divide by zero error will cause floating point exception*/
+ pad_x = (tab_w - (rect_w * wd->col)) / (wd->col - 1);
+ if (wd->row - 1) /*value cannot be 0 else divide by zero error will cause floating point exception*/
+ pad_y = (tab_h - (rect_h * wd->row)) / (wd->row - 1);
+ elm_table_padding_set(wd->tab, pad_x, pad_y);
+ elm_table_homogeneous_set(wd->tab, EINA_TRUE);
}
-static void _colorpalette_object_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+static void _colorpalette_object_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
- DBG("%s", __func__);
-
- Widget_Data *wd = NULL;
-
- if(data == NULL)
- return;
-
- wd = elm_widget_data_get((Evas_Object *)data);
-
- if(wd == NULL)
- return;
-
- if (wd->lay) {
- evas_object_hide(wd->lay);
- }
+ _sizing_eval(data);
}
static void _color_select_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
- Colorpalette_Item *item = (Colorpalette_Item *) data;
Elm_Colorpalette_Color *color;
-
+ Colorpalette_Item *item = (Colorpalette_Item *) data;
color = ELM_NEW(Elm_Colorpalette_Color);
-
+ if (!color) return;
color->r = item->r;
color->g = item->g;
color->b = item->b;
-
- evas_object_smart_callback_call(item->parent, "clicked", color);
-
+ evas_object_smart_callback_call(item->obj, "clicked", color);
edje_object_signal_emit(elm_layout_edje_get(item->lo), "focus_visible", "elm");
}
-
static void _color_release_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Colorpalette_Item *item = (Colorpalette_Item *) data;
edje_object_signal_emit(elm_layout_edje_get(item->lo), "focus_invisible", "elm");
}
-
static void _color_table_delete(Evas_Object *obj)
{
Widget_Data *wd = NULL;
Colorpalette_Item *item;
wd = elm_widget_data_get(obj);
- if (!wd) return;
-
- if (wd->items) {
- EINA_LIST_FREE(wd->items, item) {
- if (item->lo){
+ if (wd->items)
+ {
+ EINA_LIST_FREE(wd->items, item)
+ {
+ if (item->lo)
+ {
evas_object_del(item->lo);
item->lo = NULL;
- }
- if (item->cr){
+ }
+ if (item->cr)
+ {
evas_object_del(item->cr);
item->cr = NULL;
- }
+ }
free(item);
- }
- }
-
- if (wd->tab) {
- edje_object_part_unswallow(wd->lay, wd->tab);
- evas_object_del(wd->tab);
- }
+ }
+ }
+ if (wd->tab) evas_object_del(wd->tab);
}
-
-static void _color_table_update(Evas_Object *obj, int row, int col, int color_num, Elm_Colorpalette_Color *color)
+static void _color_table_update(Evas_Object *obj, unsigned int row, unsigned int col, unsigned int color_num, Elm_Colorpalette_Color *color)
{
Widget_Data *wd = elm_widget_data_get(obj);
Colorpalette_Item *item;
Evas_Object *lo;
Evas_Object *cr;
- Evas *e;
- int i, j, count;
-
- if ( !wd )
- return;
-
- count = 0;
-
- e = evas_object_evas_get(wd->parent);
+ unsigned int i, j, count;
_color_table_delete(obj);
-
+ count = 0;
wd->row = row;
wd->col = col;
wd->num = color_num;
wd->tab = elm_table_add(obj);
-
evas_object_size_hint_weight_set(wd->tab, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(wd->tab, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ edje_object_part_swallow(wd->base, "palette", wd->tab);
- edje_object_part_swallow(wd->lay, "palette", wd->tab);
- evas_object_show(wd->tab);
-
- for ( i = 0 ; i < row ; i++) {
- for ( j = 0 ; j < col ; j++ ) {
+ for ( i = 0 ; i < row ; i++)
+ {
+ for ( j = 0 ; j < col ; j++ )
+ {
item = ELM_NEW(Colorpalette_Item);
- if (item){
+ if (item)
+ {
lo = elm_layout_add(obj);
elm_layout_theme_set(lo, "colorpalette", "base", "bg");
evas_object_size_hint_weight_set(lo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(lo, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(lo);
- elm_table_pack(wd->tab, lo, j, i, 1, 1);
-
- item->parent = obj;
+ elm_table_pack(wd->tab, lo, (int)j, (int)i, 1, 1);
+ item->obj = obj;
item->lo = lo;
-
- if (count < color_num){
- cr = edje_object_add(e);
+ if (count < color_num)
+ {
+ cr = edje_object_add(evas_object_evas_get(obj));
_elm_theme_object_set(obj, cr, "colorpalette", "base", "color");
evas_object_color_set(cr, color[count].r, color[count].g, color[count].b, 255);
evas_object_size_hint_weight_set(cr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(cr, EVAS_HINT_FILL, EVAS_HINT_FILL);
-
evas_object_event_callback_add(cr, EVAS_CALLBACK_MOUSE_DOWN, _color_select_cb, item);
evas_object_event_callback_add(cr, EVAS_CALLBACK_MOUSE_UP, _color_release_cb, item);
-
evas_object_show(cr);
edje_object_part_swallow(elm_layout_edje_get(lo), "color_rect", cr);
-
item->cr = cr;
item->r = color[count].r;
item->g = color[count].g;
item->b = color[count].b;
- }
+ }
wd->items = eina_list_append(wd->items, item);
count ++;
- }
- }
- }
+ }
+ }
+ }
+}
+
+static int
+_hex_string_get(char ch)
+{
+ if ((ch >= '0') && (ch <= '9')) return (ch - '0');
+ else if ((ch >= 'A') && (ch <= 'F')) return (ch - 'A' + 10);
+ else if ((ch >= 'a') && (ch <= 'f')) return (ch - 'a' + 10);
+ return 0;
}
+static void
+_color_parse(const char *str, unsigned char *r, unsigned char *g, unsigned char *b)
+{
+ int slen;
+
+ slen = strlen(str);
+ *r = *g = *b = 0;
+
+ if (slen == 7) /* #RRGGBB */
+ {
+ *r = (_hex_string_get(str[1]) << 4) | (_hex_string_get(str[2]));
+ *g = (_hex_string_get(str[3]) << 4) | (_hex_string_get(str[4]));
+ *b = (_hex_string_get(str[5]) << 4) | (_hex_string_get(str[6]));
+ }
+ *r = (*r * 0xff) / 255;
+ *g = (*g * 0xff) / 255;
+ *b = (*b * 0xff) / 255;
+}
/**
* Add a new colorpalette to the parent.
Evas_Object *obj = NULL;
Widget_Data *wd = NULL;
Evas *e;
+ Eina_List *colors;
+ const Eina_List *l;
+ const char *color_code;
+ int color_num = 0;
+ int row = 0;
+ int col = 0;
+ int index = 0;
- e = evas_object_evas_get(parent);
- if (e == NULL) return NULL;
- wd = ELM_NEW(Widget_Data);
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
+ ELM_SET_WIDTYPE(widtype, "colorpalette");
elm_widget_type_set(obj, "colorpalette");
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);
- wd->parent = parent;
- wd->lay = edje_object_add(e);
- _elm_theme_object_set(obj, wd->lay, "colorpalette", "bg", "default");
-
- evas_object_size_hint_weight_set(wd->lay, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- if(wd->lay == NULL) {
- printf("Cannot load bg edj\n");
- return NULL;
- }
-
- wd->color = (Elm_Colorpalette_Color*) calloc (10, sizeof(Elm_Colorpalette_Color));
-
- wd->color[0].r = 55; wd->color[0].g = 90; wd->color[0].b = 18;
- wd->color[1].r = 255; wd->color[1].g = 213; wd->color[1].b = 0;
- wd->color[2].r = 146; wd->color[2].g = 255; wd->color[2].b = 11;
- wd->color[3].r = 9; wd->color[3].g = 186; wd->color[3].b = 10;
- wd->color[4].r = 86; wd->color[4].g = 201; wd->color[4].b = 242;
- wd->color[5].r = 18; wd->color[5].g = 83; wd->color[5].b = 128;
- wd->color[6].r = 140; wd->color[6].g = 53; wd->color[6].b = 238;
- wd->color[7].r = 255; wd->color[7].g = 145; wd->color[7].b = 145;
- wd->color[8].r = 255; wd->color[8].g = 59; wd->color[8].b = 119;
- wd->color[9].r = 133; wd->color[9].g = 100; wd->color[9].b = 69;
-
- _color_table_update(obj, 2, 5, 10, wd->color);
-
- elm_widget_resize_object_set(obj, wd->lay);
- evas_object_event_callback_add(wd->lay, EVAS_CALLBACK_RESIZE, _colorpalette_object_resize, obj);
- evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _colorpalette_object_move, obj);
- evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _colorpalette_object_show, obj);
- evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _colorpalette_object_hide, obj);
+ wd->base = edje_object_add(e);
+ _elm_theme_object_set(obj, wd->base, "colorpalette", "base", "default");
+ elm_widget_resize_object_set(obj, wd->base);
+ color_num = atoi(edje_object_data_get(wd->base, "color_num")); /* Need to get this value
+ from edc inorder to allocate memory in advance: Think of a better way*/
+ row = atoi(edje_object_data_get(wd->base, "row"));
+ col = atoi(edje_object_data_get(wd->base, "col"));
+ wd->color = (Elm_Colorpalette_Color*) calloc (color_num, sizeof(Elm_Colorpalette_Color));
+ colors = elm_widget_stringlist_get(edje_object_data_get(wd->base, "colors"));
+ EINA_LIST_FOREACH(colors, l, color_code)
+ {
+ unsigned char r, g, b;
+ /*Optimized color parsing algorithm*/
+ _color_parse(color_code, &r, &g, &b);
+ /*TODO: Make color storing structure and item also take unsigned char*/
+ wd->color[index].r = (unsigned int)r;
+ wd->color[index].g = (unsigned int)g;
+ wd->color[index].b = (unsigned int)b;
+ index++;
+ }
+ elm_widget_stringlist_free(colors);
+ _color_table_update(obj, row, col, color_num, wd->color);
+ evas_object_event_callback_add(wd->base, EVAS_CALLBACK_RESIZE, _colorpalette_object_resize, obj);
+ _sizing_eval(obj);
return obj;
}
*/
EAPI void elm_colorpalette_color_set(Evas_Object *obj, int color_num, Elm_Colorpalette_Color *color)
{
+ ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
int i;
if (color_num > MAX_NUM_COLORS) return;
-
if (!wd) return;
- if (wd->color) {
+ if (wd->color)
+ {
free(wd->color);
wd->color = NULL;
- }
-
+ }
wd->color = (Elm_Colorpalette_Color*) calloc (color_num, sizeof(Elm_Colorpalette_Color));
-
- for ( i = 0 ; i < color_num ; i++) {
+ for (i = 0; i < color_num; i++)
+ {
wd->color[i].r = color[i].r;
wd->color[i].g = color[i].g;
wd->color[i].b = color[i].b;
- }
-
+ }
_color_table_update(obj, wd->row, wd->col, color_num, wd->color);
_sizing_eval(obj);
}
*/
EAPI void elm_colorpalette_row_column_set(Evas_Object *obj, int row, int col)
{
+ ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd) return ;
-
+ if (!wd) return;
+ /*Row can be incomplete with atleast one color*/
+ if(((row-1)*col) > MAX_NUM_COLORS) return;
_color_table_update(obj, row, col, wd->num, wd->color);
_sizing_eval(obj);
}
-/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/
Ecore_Job *deferred_recalc_job;
Ecore_Event_Handler *sel_notify_handler;
Ecore_Event_Handler *sel_clear_handler;
- Ecore_Timer *longpress_timer;
Ecore_Timer *delay_write;
/* for deferred appending */
Ecore_Idler *append_text_idler;
wd->append_text_idler = NULL;
}
if (wd->matchlist_job) ecore_job_del(wd->matchlist_job);
- if (wd->longpress_timer) ecore_timer_del(wd->longpress_timer);
if (wd->mgf_proxy) evas_object_del(wd->mgf_proxy);
if (wd->mgf_bg) evas_object_del(wd->mgf_bg);
if (wd->mgf_clip) evas_object_del(wd->mgf_clip);
Widget_Data *wd = elm_widget_data_get(obj);
Evas_Object *top = elm_widget_top_get(obj);
if (!wd) return;
- if (!wd->editable) return;
if (elm_widget_focus_get(obj))
{
printf("[Elm_entry::Focused] obj : %p\n", obj);
}
static Eina_Bool
-_long_press(void *data)
+_signal_long_pressed(void *data)
{
Widget_Data *wd = elm_widget_data_get(data);
if (!wd) return ECORE_CALLBACK_CANCEL;
wd->long_pressed = EINA_TRUE;
- if (wd->longpress_timer)
- {
- ecore_timer_del(wd->longpress_timer);
- wd->longpress_timer = NULL;
- }
-
_cancel(data, NULL, NULL);
_magnifier_create(data);
_magnifier_show(data);
elm_object_scroll_freeze_push(data);
- wd->longpress_timer = NULL;
evas_object_smart_callback_call(data, SIG_LONGPRESSED, NULL);
return ECORE_CALLBACK_CANCEL;
}
wd->downx = ev->canvas.x;
wd->downy = ev->canvas.y;
wd->long_pressed = EINA_FALSE;
- if (ev->button == 1)
- {
- if (wd->longpress_timer) ecore_timer_del(wd->longpress_timer);
- wd->longpress_timer = ecore_timer_add(_elm_config->longpress_timeout, _long_press, data);
- }
}
static void
if (!wd->double_clicked)
{
if ((wd->api) && (wd->api->obj_mouseup))
- {
- wd->api->obj_mouseup(data);
- }
+ wd->api->obj_mouseup(data);
}
-
- if (wd->longpress_timer)
- {
- ecore_timer_del(wd->longpress_timer);
- wd->longpress_timer = NULL;
- }
-
_magnifier_hide(data);
elm_object_scroll_freeze_pop(data);
if (wd->long_pressed)
- {
- _menu_press(data);
- }
-
+ _menu_press(data);
}
else if (ev->button == 3)
{
Evas_Event_Mouse_Move *ev = event_info;
if (!wd) return;
if (wd->disabled) return;
- if (!wd->selmode)
- {
- if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
- {
- if (wd->longpress_timer)
- {
- ecore_timer_del(wd->longpress_timer);
- wd->longpress_timer = NULL;
- }
- }
- else if (wd->longpress_timer)
- {
- Evas_Coord dx, dy;
-
- dx = wd->downx - ev->cur.canvas.x;
- dx *= dx;
- dy = wd->downy - ev->cur.canvas.y;
- dy *= dy;
- if ((dx + dy) >
- ((_elm_config->finger_size / 2) *
- (_elm_config->finger_size / 2)))
- {
- ecore_timer_del(wd->longpress_timer);
- wd->longpress_timer = NULL;
- }
- }
- }
- else if (wd->longpress_timer)
- {
- Evas_Coord dx, dy;
-
- dx = wd->downx - ev->cur.canvas.x;
- dx *= dx;
- dy = wd->downy - ev->cur.canvas.y;
- dy *= dy;
- if ((dx + dy) >
- ((_elm_config->finger_size / 2) *
- (_elm_config->finger_size / 2)))
- {
- ecore_timer_del(wd->longpress_timer);
- wd->longpress_timer = NULL;
- }
- }
if (ev->buttons == 1)
{
_entry_changed_common_handling(data, SIG_PREEDIT_CHANGED);
}
-
static void
_signal_handler_move_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
{
Widget_Data *wd = elm_widget_data_get(data);
+ if (!wd) return;
+
elm_object_scroll_freeze_push(data);
if ((wd->api) && (wd->api->obj_hidemenu))
_signal_handler_move_end(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
{
Widget_Data *wd = elm_widget_data_get(data);
+ if (!wd) return;
+
elm_object_scroll_freeze_pop(data);
if (wd->have_selection)
_magnifier_show(data);
}
+static Evas_Object *
+_viewport_obj_get(Evas_Object *data)
+{
+ Widget_Data *wd = elm_widget_data_get(data);
+ if (!wd) return NULL;
+
+ if(!data || !strlen(elm_widget_type_get(data)))
+ return NULL;
+
+ Evas_Coord x, y, w, h;
+ x = y = w = h = -1;
+
+ if (wd->scroll)
+ {
+ //evas_object_geometry_get(wd->scroller, &x, &y, &w, &h);
+ //printf(">>> wd->scroller (%d, %d, %d, %d) \n", x, y, w, h);
+ return wd->scroller;
+ }
+
+ Evas_Object *parent_obj = data;
+
+ while(parent_obj = elm_widget_parent_get(parent_obj))
+ {
+ //evas_object_geometry_get(parent_obj, &x, &y, &w, &h);
+ //printf(">>> %s (%d, %d, %d, %d) \n", elm_widget_type_get(parent_obj), x, y, w, h);
+ if (!strcmp(elm_widget_type_get(parent_obj), "scroller") ||
+ !strcmp(elm_widget_type_get(parent_obj), "genlist"))
+ return parent_obj;
+ }
+
+ return NULL;
+}
+
static void
_signal_selection_end(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
{
elm_selection_set(ELM_SEL_PRIMARY, data, ELM_SEL_FORMAT_MARKUP, txt);
}
#endif
+
+ if (!_elm_config->desktop_entry)
+ edje_object_part_text_viewport_object_set(wd->ent, "elm.text", _viewport_obj_get(data));
}
static void
evas_object_smart_callback_call(data, SIG_PRESS, NULL);
if ((wd->api) && (wd->api->obj_hidemenu))
- {
- wd->api->obj_hidemenu(data);
- }
+ wd->api->obj_hidemenu(data);
}
static void
Widget_Data *wd = elm_widget_data_get(data);
if (!wd) return;
evas_object_smart_callback_call(data, SIG_CLICKED, NULL);
+
+ if (!_elm_config->desktop_entry && !wd->double_clicked)
+ _cancel(data, NULL, NULL);
}
static void
_signal_selection_start, obj);
edje_object_signal_callback_add(wd->ent, "selection,end", "elm.text",
_signal_selection_end, obj);
+ edje_object_signal_callback_add(wd->ent, "long,pressed", "elm.text",
+ _signal_long_pressed, obj);
edje_object_signal_callback_add(wd->ent, "magnifier,changed", "elm.text",
_signal_magnifier_changed, obj);
edje_object_signal_callback_add(wd->ent, "selection,changed", "elm.text",
ext_mod->selectall = _selectall;
ext_mod->ent = wd->ent;
ext_mod->items = wd->items;
- ext_mod->longpress_timer = wd->longpress_timer;
ext_mod->editable = wd->editable;
ext_mod->have_selection = wd->have_selection;
ext_mod->password = wd->password;
const char *photo_file;
void (*func) (void *data, Evas_Object *obj, void *event_info);
void *data;
- //Evas_Coord x, y, w, h;
- //Evas_Coord ox, oy, ow, oh;
- //int moving:1;
};
// Image Slider Widget Data.
int move_cnt;
int ani_lock:1;
int moving:1;
-
- Eina_Bool on_zoom:1;
- int dx, dy, mx, my;
- int mdx, mdy, mmx, mmy;
- int dratio;
- int ratio;
};
// Global value declaration.
static void _imageslider_update(Widget_Data * wd);
static void _imageslider_update_pos(Widget_Data * wd, Evas_Coord x, Evas_Coord y, Evas_Coord w);
-static void _imageslider_update_center_pos(Widget_Data * wd, Evas_Coord x, Evas_Coord my, Evas_Coord y, Evas_Coord w);
static void _imageslider_obj_shift(Widget_Data * wd, Eina_Bool left);
static int _check_drag(int state, void *data);
-static void _check_zoom(void *data);
-
static void _anim(Widget_Data * wd);
static Eina_Bool _timer_cb(void *data);
-//static void _signal_clicked(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _ev_imageslider_down_cb(void *data, Evas * e, Evas_Object *obj, void *event_info);
static void _ev_imageslider_up_cb(void *data, Evas * e, Evas_Object *obj, void *event_info);
static void _ev_imageslider_move_cb(void *data, Evas * e, Evas_Object *obj, void *event_info);
static void
_del_hook(Evas_Object *obj)
{
- int i;
-
Widget_Data *wd;
wd = elm_widget_data_get(obj);
- if (!wd)
- return;
-
- for (i = 0; i < BLOCK_MAX; i++)
- {
- elm_widget_sub_object_del(wd->obj, wd->ly[i]);
- evas_object_del(wd->ly[i]);
- }
+ if (!wd) return;
if (wd->its)
{
wd->anim_timer = NULL;
}
- if (wd)
- free(wd);
+ if (wd) free(wd);
}
return;
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
- fprintf(stderr, "%d %d -resize\n", w, h);
+ DBG("%d %d -resize\n", w, h);
wd->w = w;
wd->h = h;
static void
_imageslider_update_pos(Widget_Data * wd, Evas_Coord x, Evas_Coord y, Evas_Coord w)
{
- int i = 0;
evas_object_move(wd->ly[BLOCK_LEFT], x - (w + INTERVAL_WIDTH), y);
evas_object_move(wd->ly[BLOCK_CENTER], x, y);
evas_object_move(wd->ly[BLOCK_RIGHT], x + (w + INTERVAL_WIDTH), y);
- //making sure that the clipping happens for all three layouts based on clipper's geometry
- for (i = 0; i < BLOCK_MAX; i++)
- evas_object_clip_set(wd->ly[i], wd->clip);
- evas_render_idle_flush(evas_object_evas_get(wd->obj));
-}
-
-// Update the center position of Image Slider item.
-static void
-_imageslider_update_center_pos(Widget_Data * wd, Evas_Coord x, Evas_Coord my __UNUSED__, Evas_Coord y, Evas_Coord w)
-{
- Evas_Coord ix = 0, iy = 0, iw = 0, ih = 0;
- const Evas_Object *eo = elm_layout_content_get((const Evas_Object*)(wd->ly[BLOCK_CENTER]), "swl.photo");
- if (eo)
- evas_object_geometry_get(eo, &ix, &iy, &iw, &ih);
- if ((ix > 0) || (ix + iw < wd->w))
- {
- edje_object_signal_emit(elm_layout_edje_get(wd->ly[BLOCK_CENTER]), "block.on", "block");
- _imageslider_update_pos(wd, x, y, w);
- wd->on_zoom = EINA_FALSE;
- }
}
// Shift next/previous Image Slider item in layouts.
// Whenever MOUSE DOWN event occurs, Call this function.
static void
-_ev_imageslider_down_cb(void *data, Evas * e __UNUSED__, Evas_Object *obj, void *event_info)
+_ev_imageslider_down_cb(void *data, Evas * e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
{
Widget_Data *wd = data;
- Evas_Coord ix = 0, iy = 0, iw = 0, ih = 0;
Evas_Event_Mouse_Down *ev = event_info;
- Evas_Object *eo = NULL;
if (wd->ani_lock)
return;
wd->down_pos = ev->canvas;
wd->timestamp = ev->timestamp;
wd->move_cnt = MOVE_STEP;
-
- /*wd->dx = ev->canvas.x;
- wd->dy = ev->canvas.y;
- wd->mx = ev->canvas.x;
- wd->my = ev->canvas.y;
-
- wd->dratio = 1;
- wd->ratio = 1;
-
- eo = (Evas_Object*)elm_layout_content_get((const Evas_Object*)obj, "swl.photo");
- if (eo)
- evas_object_geometry_get(eo, &ix, &iy, &iw, &ih);
-
- if (iw != wd->w)
- {
- printf("Zooming\n");
- wd->on_zoom = EINA_TRUE;
- edje_object_signal_emit(elm_layout_edje_get(obj), "block.off", "block");
- }*/
}
// Whenever MOUSE UP event occurs, Call this function.
int interval;
- if (wd->ani_lock)
- return;
+ if (wd->ani_lock) return;
- if (wd->on_zoom)
+ step = wd->down_pos.x - ev->canvas.x;
+ interval = ev->timestamp - wd->timestamp;
+ if (step == 0 || interval == 0)
{
+ DBG("case1: emit CLICK event\n");
+ evas_object_smart_callback_call(wd->obj, SIG_CLICKED, NULL);
+ return;
}
- else
+ if (interval < CLICK_TIME_MAX)
{
- step = wd->down_pos.x - ev->canvas.x;
- interval = ev->timestamp - wd->timestamp;
- if (step == 0 || interval == 0)
+ if (step < CLICK_WIDTH_MIN && step > CLICK_WIDTH_MIN)
{
- fprintf(stderr, "[[[ DEBUG ]]]: case1: emit CLICK event\n");
+ DBG("case2: emit CLICK event\n");
evas_object_smart_callback_call(wd->obj, SIG_CLICKED, NULL);
return;
}
- if (interval < CLICK_TIME_MAX)
+ }
+
+ if (interval < FLICK_TIME_MAX)
+ {
+ if (step < FLICK_WIDTH_MIN && step > FLICK_WIDTH_MIN)
{
- if (step < CLICK_WIDTH_MIN && step > CLICK_WIDTH_MIN)
- {
- fprintf(stderr, "[[[ DEBUG ]]]: case2: emit CLICK event\n");
- evas_object_smart_callback_call(wd->obj, SIG_CLICKED, NULL);
- return;
- }
- }
+ DBG("ev_imageslider_up_cb-black zone (1)\n");
- if (interval < FLICK_TIME_MAX)
+ _imageslider_obj_move(wd, 0);
+ }
+ else
{
- if (step < FLICK_WIDTH_MIN && step > FLICK_WIDTH_MIN)
- {
- fprintf(stderr, "[[[ DEBUG ]]]:_ev_imageslider_up_cb-black zone (1)\n");
+ DBG("ev_imageslider_up_cb-black zone (2)\n");
- _imageslider_obj_move(wd, 0);
- }
- else
- {
- fprintf(stderr, "[[[ DEBUG ]]]:_ev_imageslider_up_cb-black zone (2)\n");
+ _imageslider_obj_move(wd, step);
+ }
- _imageslider_obj_move(wd, step);
- }
+ }
+ else
+ {
+ step = (wd->x - wd->move_x) << 1;
+ if (step <= wd->w && step >= -(wd->w))
+ {
+ DBG("ev_imageslider_up_cb-white zone (1)\n");
+ _imageslider_obj_move(wd, 0);
}
else
{
- step = (wd->x - wd->move_x) << 1;
- if (step <= wd->w && step >= -(wd->w))
- {
- fprintf(stderr, "[[[ DEBUG ]]]:_ev_imageslider_up_cb-white zone (1)\n");
-
- _imageslider_obj_move(wd, 0);
- }
- else
- {
- fprintf(stderr, "[[[ DEBUG ]]]:_ev_imageslider_up_cb-white zone (2)\n");
+ DBG("ev_imageslider_up_cb-white zone (2)\n");
- _imageslider_obj_move(wd, step);
- }
+ _imageslider_obj_move(wd, step);
}
}
-
}
// Whenever MOUSE MOVE event occurs, Call this
static void
-_ev_imageslider_move_cb(void *data, Evas * e __UNUSED__, Evas_Object *obj, void *event_info)
+_ev_imageslider_move_cb(void *data, Evas * e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
{
- int idx;
-
- Evas_Object *eo;
-
+ int idx = 0;
Evas_Coord step;
-
Widget_Data *wd = data;
-
Evas_Event_Mouse_Move *ev = event_info;
- Elm_Imageslider_Item *it;
-
- if (wd->ani_lock)
- return;
-
+ if (wd->ani_lock) return;
if (wd->move_cnt == MOVE_STEP)
{
wd->move_cnt = 0;
idx = BLOCK_LEFT;
else
idx = BLOCK_RIGHT;
-
wd->move_x = wd->x + ((ev->cur.canvas.x - wd->down_pos.x));
wd->move_y = wd->y + ((ev->cur.canvas.y - wd->down_pos.y));
-
- /*if (wd->on_zoom)
- {
- _imageslider_update_center_pos(wd, wd->move_x, wd->move_y, wd->y, wd->w);
- }
- else
- {*/
- _imageslider_update_pos(wd, wd->move_x, wd->y, wd->w);
- //}
+ _imageslider_update_pos(wd, wd->move_x, wd->y, wd->w);
}
}
wd->move_cnt++;
-
}
-#if 0
-// Whenever CLICK event occurs, Call this API
-// But, DONOT emit CLICK event.
-// DO NOT use this callback function. Remove later.
-static void
-_signal_clicked(void *data, Evas_Object *obj, const char *emission, const char *source)
-{
- fprintf(stderr, "[[[ DEBUG ]]]: Call the callback function about Click event!, But DONOT emit CLICK event in the callback function!\n");
-}
-#endif
-
static inline double
time_get(Evas_Coord x, Evas_Coord w)
{
_imageslider_update(wd);
if (wd->queue_idler)
- {
- ecore_idler_del(wd->queue_idler);
- wd->queue_idler = NULL;
- }
+ wd->queue_idler = NULL;
return ECORE_CALLBACK_CANCEL;
}
return 0;
}
-static void
-_check_zoom(void *data)
-{
- Widget_Data *wd = data;
-
- Elm_Imageslider_Item *it;
-
- Evas_Coord ix = 0, iy = 0, iw = 0, ih = 0;
-
- double dx = 0, dy = 0;
-
- Evas_Object *eo = NULL;
-
- it = eina_list_data_get(wd->cur);
-
- eo = (Evas_Object*)elm_layout_content_get(wd->ly[BLOCK_CENTER], "swl.photo");
- if (eo)
- evas_object_geometry_get(eo, &ix, &iy, &iw, &ih);
- edje_object_part_drag_value_get(elm_layout_edje_get(wd->ly[BLOCK_CENTER]), "swl.photo", &dx, &dy);
-
- if ((iw != wd->w) || ((dx != 0) || (dy != 0)))
- {
- wd->on_zoom = EINA_TRUE;
- //edje_object_signal_emit(elm_layout_edje_get(wd->ly[BLOCK_CENTER]), "block.off", "block");
- }
- else
- {
- wd->on_zoom = EINA_FALSE;
- edje_object_signal_emit(elm_layout_edje_get(wd->ly[BLOCK_CENTER]), "block.on", "block");
- }
-}
-
static Eina_Bool
_timer_cb(void *data)
{
struct timeval tv;
- int t;
-
- int ret;
+ int t = 0;
+ int ret = 0;
wd = data;
- if (wd->ani_lock == EINA_FALSE)
- return EINA_FALSE;
-
+ if (!wd->ani_lock)
+ {
+ if (wd->anim_timer)
+ wd->anim_timer = NULL;
+ return ECORE_CALLBACK_CANCEL;
+ }
gettimeofday(&tv, NULL);
t = (tv.tv_sec - wd->tv.tv_sec) * 1000 + (tv.tv_usec - wd->tv.tv_usec) / 1000;
ret = _check_drag(BLOCK_LEFT, wd);
ret = _check_drag(BLOCK_RIGHT, wd);
- //_check_zoom(wd);
if (!wd->queue_idler)
wd->queue_idler = ecore_idler_add(_icon_to_image, wd);
if (wd->anim_timer)
- {
- ecore_timer_del(wd->anim_timer);
- wd->anim_timer = NULL;
- }
+ wd->anim_timer = NULL;
return ECORE_CALLBACK_CANCEL;
}
Evas_Object *eo;
- if (!wd)
- return;
+ if (!wd) return;
if (!wd->cur) return;
//elm_image_prescale_set(eo, wd->w);
elm_image_file_set(eo, it->photo_file, NULL);
elm_layout_content_set(wd->ly[i], "swl.photo", eo);
- //elm_image_object_size_get(eo, &it->w, &it->h);
- //evas_object_geometry_get(eo, &it->ox, &it->oy, &it->ow, &it->oh);
- //it->ow = it->w;
- //it->oh = it->h;
}
- /*if (wd->moving != it->moving)
- {
- it->moving = wd->moving;
- if (wd->moving)
- {
- //elm_image_prescale_set(eo, MOVING_IMAGE_SIZE);
- }
- else
- {
- //elm_image_prescale_set(eo, it->w > it->h ? it->w : it->h);
- }
- }*/
}
}
-
_anim(wd);
}
elm_widget_sub_object_add(obj, wd->ly[i]);
evas_object_smart_member_add(wd->ly[i], obj);
- //edje_object_signal_callback_add(elm_layout_edje_get(wd->ly[i]), "elm,photo,clicked", "", _signal_clicked, obj);
evas_object_event_callback_add(wd->ly[i], EVAS_CALLBACK_MOUSE_DOWN, _ev_imageslider_down_cb, wd);
evas_object_event_callback_add(wd->ly[i], EVAS_CALLBACK_MOUSE_UP, _ev_imageslider_up_cb, wd);
evas_object_event_callback_add(wd->ly[i], EVAS_CALLBACK_MOUSE_MOVE, _ev_imageslider_move_cb, wd);
}
wd->obj = obj;
-
evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _imageslider_resize, obj);
evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _imageslider_move, obj);
evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _imageslider_show, obj);
evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _imageslider_hide, obj);
_sizing_eval(obj);
-
return obj;
}
if (!wd->cur)
wd->cur = wd->its;
-
_imageslider_update(wd);
-
return it;
}
Elm_Imageslider_Item *it;
- fprintf(stderr, "[[[ DEBUG ]]]:: New elm_imageslider_item_append_relative()\n");
+ DBG("New elm_imageslider_item_append_relative()\n");
if (!obj || !(wd = elm_widget_data_get(obj)))
return NULL;
it->func = func;
it->data = data;
- wd->its =
- eina_list_append_relative(wd->its, it, eina_list_nth(wd->its, index - 2));
+ wd->its = eina_list_append_relative(wd->its, it, eina_list_nth(wd->its,
+ index - 2));
if (!wd->cur)
wd->cur = wd->its;
-
_imageslider_update(wd);
-
return it;
}
it->data = data;
it->obj = obj;
wd->its = eina_list_prepend(wd->its, it);
-
if (!wd->cur)
wd->cur = wd->its;
-
_imageslider_update(wd);
-
return it;
}
break;
}
}
-
_imageslider_update(wd);
-
}
/**
return EINA_TRUE;
else
return EINA_FALSE;
-
}
/**
{
eo = (Evas_Object*)elm_layout_content_get(wd->ly[i], "swl.photo");
if (eo)
- {
- elm_layout_content_set(wd->ly[i], "swl.photo", NULL);
- }
+ elm_layout_content_set(wd->ly[i], "swl.photo", NULL);
}
-
_imageslider_update(wd);
-
}
/**
return eina_list_data_get(l);
}
}
-
return NULL;
}
return eina_list_data_get(l);
}
}
-
return NULL;
}
if (!obj || (!(wd = elm_widget_data_get(obj))))
return;
-
if (wd->ani_lock)
return;
-
_imageslider_obj_move(wd, -1);
}
if (!obj || (!(wd = elm_widget_data_get(obj))))
return;
-
if (wd->ani_lock)
return;
-
_imageslider_obj_move(wd, 1);
-
}
/**
if (!it || (!(wd = elm_widget_data_get(it->obj)))) return;
ELM_CHECK_WIDTYPE(it->obj, widtype);
- if (wd->ani_lock == EINA_TRUE) return;
+ if (wd->ani_lock) return;
if (it == eina_list_data_get(eina_list_prev(wd->cur)))
elm_layout_content_set(wd->ly[BLOCK_LEFT], "swl.photo", NULL);
else if (it == eina_list_data_get(wd->cur))
ecore_imf_context_input_panel_show(imf_context);
evas_object_focus_set(obj, EINA_TRUE);
}
- else if ((imf_context) && (!wd->current) || (!eina_list_count(wd->items)))
+ else if ((imf_context) && ((!wd->current) || (!eina_list_count(wd->items))))
{
_view_update(obj);
ecore_imf_context_input_panel_show(imf_context);
Evas_Object *obj;
Evas *e;
Widget_Data *wd;
- if (!parent) return NULL;
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
ELM_SET_WIDTYPE(widtype, "multibuttonentry");
elm_widget_type_set(obj, "multibuttonentry");
elm_widget_sub_object_add(parent, obj);
ext_mod->cnpinit(data,obj,event_info);
elm_cbhm_helper_init(obj);
if (ext_mod->textonly)
- elm_cbhm_send_raw_data("show0");
+ elm_cbhm_send_raw_data("show0");
else
- elm_cbhm_send_raw_data("show1");
+ elm_cbhm_send_raw_data("show1");
evas_object_hide(obj);
// end for cbhm
}
(ext_mod->ent, "context_menu_orientation");
if ((context_menu_orientation) &&
(!strcmp(context_menu_orientation, "horizontal")))
- elm_ctxpopup_horizontal_set(ext_mod->popup, EINA_TRUE);
+ elm_ctxpopup_horizontal_set(ext_mod->popup, EINA_TRUE);
elm_widget_sub_object_add(obj, ext_mod->popup);
if (!ext_mod->selmode)
if (1) // need way to detect if someone has a selection
{
if (ext_mod->editable)
- elm_ctxpopup_item_append(ext_mod->popup, "Paste", NULL, _paste, obj );
+ elm_ctxpopup_item_append(ext_mod->popup, "Paste", NULL, _paste, obj );
}
//elm_ctxpopup_item_append(wd->ctxpopup, NULL, "Selectall",_select_all, obj );
// start for cbhm
{
elm_ctxpopup_item_append(ext_mod->popup, "Copy", NULL, _copy, obj );
if (ext_mod->editable)
- elm_ctxpopup_item_append(ext_mod->popup, "Cut", NULL, _cut, obj );
+ elm_ctxpopup_item_append(ext_mod->popup, "Cut", NULL, _cut, obj );
if (ext_mod->editable)
- elm_ctxpopup_item_append(ext_mod->popup, "Paste", NULL, _paste, obj );
+ elm_ctxpopup_item_append(ext_mod->popup, "Paste", NULL, _paste, obj );
}
else
{
if (1) // need way to detect if someone has a selection
{
if (ext_mod->editable)
- elm_ctxpopup_item_append(ext_mod->popup, "Paste", NULL, _paste, obj );
+ elm_ctxpopup_item_append(ext_mod->popup, "Paste", NULL, _paste, obj );
}
}
// start for cbhm
EAPI void
obj_mouseup(Evas_Object *obj)
{
- if (!obj || !ext_mod) {
- return;
- }
-
- /*update*/
- elm_entry_extension_module_data_get(obj,ext_mod);
- if (ext_mod->longpress_timer)
- {
- if (ext_mod->have_selection )
- {
- _cancel(obj,ext_mod->popup,NULL);
- }
- }
+ if (!obj || !ext_mod)
+ return;
}
EAPI void
obj_hidemenu(Evas_Object *obj)
{
- if (!obj || !ext_mod) {
- return;
- }
+ if (!obj || !ext_mod)
+ return;
evas_object_hide(ext_mod->popup);
// if (ext_mod->popup) evas_object_del(ext_mod->popup);