widget_preview_flipselector \
widget_preview_hoversel \
widget_preview_hover \
-widget_preview_anchorview \
-widget_preview_anchorblock \
widget_preview_flip \
widget_preview_separator \
widget_preview_radio \
+++ /dev/null
-#include "widget_preview_tmpl_head.c"
-
-Evas_Object *o = elm_anchorblock_add(win);
-evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-elm_win_resize_object_add(win, o);
-evas_object_show(o);
-
-elm_object_text_set(o, "Anchorblock <b>bold</> and lots and lots and lots and "
- "lots and lots and lots and lots and lots of text");
-
-#include "widget_preview_tmpl_foot.c"
+++ /dev/null
-#include "widget_preview_tmpl_head.c"
-
-Evas_Object *o = elm_anchorview_add(win);
-evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-elm_win_resize_object_add(win, o);
-evas_object_show(o);
-
-elm_object_text_set(o, "Anchorview <b>bold</> and lots and lots and lots and "
- "lots and lots and lots and lots and lots of text");
-
-#include "widget_preview_tmpl_foot.c"
test.c \
test_3d.c \
test_actionslider.c \
-test_anchorblock.c \
-test_anchorview.c \
test_anim.c \
test_bg.c \
test_box.c \
test_datetime.c \
test_diskselector.c \
test_entry.c \
+test_entry_anchor.c \
+test_entry_anchor2.c \
test_fileselector_button.c \
test_fileselector.c \
test_fileselector_entry.c \
void test_entry8(void *data, Evas_Object *obj, void *event_info);
void test_entry_notepad(void *data, Evas_Object *obj, void *event_info);
void test_multibuttonentry(void *data, Evas_Object *obj, void *event_info);
-void test_anchorview(void *data, Evas_Object *obj, void *event_info);
-void test_anchorblock(void *data, Evas_Object *obj, void *event_info);
+void test_entry_anchor2(void *data, Evas_Object *obj, void *event_info);
+void test_entry_anchor(void *data, Evas_Object *obj, void *event_info);
void test_toolbar(void *data, Evas_Object *obj, void *event_info);
void test_toolbar2(void *data, Evas_Object *obj, void *event_info);
void test_toolbar3(void *data, Evas_Object *obj, void *event_info);
ADD_TEST(NULL, "Entries", "Entry 8", test_entry8);
ADD_TEST(NULL, "Entries", "Entry Notepad", test_entry_notepad);
ADD_TEST(NULL, "Entries", "Multibuttonentry", test_multibuttonentry);
+ ADD_TEST(NULL, "Entries", "Entry Anchor", test_entry_anchor);
+ ADD_TEST(NULL, "Entries", "Entry Anchor2", test_entry_anchor2);
//------------------------------//
ADD_TEST(NULL, "Buttons", "Buttons", test_button);
ADD_TEST(NULL, "Times & Dates", "Datetime", test_datetime);
//------------------------------//
- ADD_TEST(NULL, "Text", "Anchorview", test_anchorview);
- ADD_TEST(NULL, "Text", "Anchorblock", test_anchorblock);
ADD_TEST(NULL, "Text", "Label", test_label);
//------------------------------//
}
static void
-my_anchorblock_bt(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+my_entry_anchor_bt(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Evas_Object *av = data;
- elm_anchorblock_hover_end(av);
+ elm_entry_anchor_hover_end(av);
}
static void
-my_anchorblock_anchor(void *data, Evas_Object *obj, void *event_info)
+my_entry_anchor(void *data, Evas_Object *obj, void *event_info)
{
Evas_Object *av = data;
- Elm_Entry_Anchorblock_Info *ei = event_info;
+ Elm_Entry_Anchor_Hover_Info *ei = event_info;
Evas_Object *bt, *bx;
bt = elm_button_add(obj);
- elm_object_text_set(bt, ei->name);
+ elm_object_text_set(bt, ei->anchor_info->name);
elm_object_part_content_set(ei->hover, "middle", bt);
evas_object_show(bt);
bt = elm_button_add(obj);
elm_object_text_set(bt, "Top 1");
elm_box_pack_end(bx, bt);
- evas_object_smart_callback_add(bt, "clicked", my_anchorblock_bt, av);
+ evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av);
evas_object_show(bt);
bt = elm_button_add(obj);
elm_object_text_set(bt, "Top 2");
elm_box_pack_end(bx, bt);
- evas_object_smart_callback_add(bt, "clicked", my_anchorblock_bt, av);
+ evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av);
evas_object_show(bt);
bt = elm_button_add(obj);
elm_object_text_set(bt, "Top 3");
elm_box_pack_end(bx, bt);
- evas_object_smart_callback_add(bt, "clicked", my_anchorblock_bt, av);
+ evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av);
evas_object_show(bt);
elm_object_part_content_set(ei->hover, "top", bx);
evas_object_show(bx);
bt = elm_button_add(obj);
elm_object_text_set(bt, "Bot");
elm_object_part_content_set(ei->hover, "bottom", bt);
- evas_object_smart_callback_add(bt, "clicked", my_anchorblock_bt, av);
+ evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av);
evas_object_show(bt);
}
if (ei->hover_left)
bt = elm_button_add(obj);
elm_object_text_set(bt, "Left");
elm_object_part_content_set(ei->hover, "left", bt);
- evas_object_smart_callback_add(bt, "clicked", my_anchorblock_bt, av);
+ evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av);
evas_object_show(bt);
}
if (ei->hover_right)
bt = elm_button_add(obj);
elm_object_text_set(bt, "Right");
elm_object_part_content_set(ei->hover, "right", bt);
- evas_object_smart_callback_add(bt, "clicked", my_anchorblock_bt, av);
+ evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av);
evas_object_show(bt);
}
}
static void
-my_anchorblock_edge_left(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+my_entry_anchor_edge_left(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
printf("left\n");
}
static void
-my_anchorblock_edge_right(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+my_entry_anchor_edge_right(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
printf("right\n");
}
static void
-my_anchorblock_edge_top(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+my_entry_anchor_edge_top(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
printf("top\n");
}
static void
-my_anchorblock_edge_bottom(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+my_entry_anchor_edge_bottom(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
printf("bottom\n");
}
static void
-my_anchorblock_scroll(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
+my_entry_anchor_scroll(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
Evas_Coord x, y, w, h, vw, vh;
}
void
-test_anchorblock(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+test_entry_anchor(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Evas_Object *win, *bg, *av, *sc, *bx, *bb, *ic;
char buf[PATH_MAX];
- win = elm_win_add(NULL, "anchorblock", ELM_WIN_BASIC);
+ win = elm_win_add(NULL, "entry_anchor", ELM_WIN_BASIC);
elm_win_title_set(win, "Anchorblock");
elm_win_autodel_set(win, EINA_TRUE);
evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, sc);
- evas_object_smart_callback_add(sc, "edge_left", my_anchorblock_edge_left, NULL);
- evas_object_smart_callback_add(sc, "edge_right", my_anchorblock_edge_right, NULL);
- evas_object_smart_callback_add(sc, "edge_top", my_anchorblock_edge_top, NULL);
- evas_object_smart_callback_add(sc, "edge_bottom", my_anchorblock_edge_bottom, NULL);
- evas_object_smart_callback_add(sc, "scroll", my_anchorblock_scroll, NULL);
+ evas_object_smart_callback_add(sc, "edge_left", my_entry_anchor_edge_left, NULL);
+ evas_object_smart_callback_add(sc, "edge_right", my_entry_anchor_edge_right, NULL);
+ evas_object_smart_callback_add(sc, "edge_top", my_entry_anchor_edge_top, NULL);
+ evas_object_smart_callback_add(sc, "edge_bottom", my_entry_anchor_edge_bottom, NULL);
+ evas_object_smart_callback_add(sc, "scroll", my_entry_anchor_scroll, NULL);
bx = elm_box_add(win);
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
evas_object_show(ic);
evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
- av = elm_anchorblock_add(win);
- elm_anchorblock_hover_style_set(av, "popout");
- elm_anchorblock_hover_parent_set(av, win);
+ av = elm_entry_add(win);
+ elm_entry_anchor_hover_style_set(av, "popout");
+ elm_entry_anchor_hover_parent_set(av, win);
elm_object_text_set(av,
"Hi there. This is the most recent message in the "
"list of messages. It has one <a href=tel:+614321234>+61 432 1234</a> "
"(phone number) to click on.");
- evas_object_smart_callback_add(av, "anchor,clicked",
- my_anchorblock_anchor, av);
+ evas_object_smart_callback_add(av, "anchor,hover,opened",
+ my_entry_anchor, av);
elm_object_content_set(bb, av);
evas_object_show(av);
elm_box_pack_end(bx, bb);
evas_object_show(ic);
evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
- av = elm_anchorblock_add(win);
- elm_anchorblock_hover_style_set(av, "popout");
- elm_anchorblock_hover_parent_set(av, win);
+ av = elm_entry_add(win);
+ elm_entry_anchor_hover_style_set(av, "popout");
+ elm_entry_anchor_hover_parent_set(av, win);
elm_object_text_set(av,
"Hey what are you doing? This is the second last message "
"Hi there. This is the most recent message in the "
"done by links maybe running local apps or even being "
"web URL's too that launch the web browser and point it "
"to that URL. <item relsize=16x16 vsize=full href=emoticon/omg></item>");
- evas_object_smart_callback_add(av, "anchor,clicked", my_anchorblock_anchor, av);
+ evas_object_smart_callback_add(av, "anchor,hover,opened", my_entry_anchor, av);
elm_object_content_set(bb, av);
evas_object_show(av);
elm_box_pack_end(bx, bb);
evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
- av = elm_anchorblock_add(win);
- elm_anchorblock_hover_style_set(av, "popout");
- elm_anchorblock_hover_parent_set(av, win);
+ av = elm_entry_add(win);
+ elm_entry_anchor_hover_style_set(av, "popout");
+ elm_entry_anchor_hover_parent_set(av, win);
elm_object_text_set(av, "This is a short message. <item relsize=16x16 vsize=full href=emoticon/haha></item>");
- evas_object_smart_callback_add(av, "anchor,clicked",
- my_anchorblock_anchor, av);
+ evas_object_smart_callback_add(av, "anchor,hover,opened",
+ my_entry_anchor, av);
elm_object_content_set(bb, av);
evas_object_show(av);
elm_box_pack_end(bx, bb);
#endif
#ifndef ELM_LIB_QUICKLAUNCH
static void
-my_anchorview_bt(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+my_entry_anchor_bt(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Evas_Object *av = data;
- elm_anchorview_hover_end(av);
+ elm_entry_anchor_hover_end(av);
}
static void
my_anchorview_anchor(void *data, Evas_Object *obj, void *event_info)
{
Evas_Object *av = data;
- Elm_Entry_Anchorview_Info *ei = event_info;
+ Elm_Entry_Anchor_Hover_Info *ei = event_info;
Evas_Object *bt, *bx;
bt = elm_button_add(obj);
- elm_object_text_set(bt, ei->name);
+ elm_object_text_set(bt, ei->anchor_info->name);
elm_object_part_content_set(ei->hover, "middle", bt);
evas_object_show(bt);
bt = elm_button_add(obj);
elm_object_text_set(bt, "Top 1");
elm_box_pack_end(bx, bt);
- evas_object_smart_callback_add(bt, "clicked", my_anchorview_bt, av);
+ evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av);
evas_object_show(bt);
bt = elm_button_add(obj);
elm_object_text_set(bt, "Top 2");
elm_box_pack_end(bx, bt);
- evas_object_smart_callback_add(bt, "clicked", my_anchorview_bt, av);
+ evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av);
evas_object_show(bt);
bt = elm_button_add(obj);
elm_object_text_set(bt, "Top 3");
elm_box_pack_end(bx, bt);
- evas_object_smart_callback_add(bt, "clicked", my_anchorview_bt, av);
+ evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av);
evas_object_show(bt);
elm_object_part_content_set(ei->hover, "top", bx);
evas_object_show(bx);
bt = elm_button_add(obj);
elm_object_text_set(bt, "Bot");
elm_object_part_content_set(ei->hover, "bottom", bt);
- evas_object_smart_callback_add(bt, "clicked", my_anchorview_bt, av);
+ evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av);
evas_object_show(bt);
}
if (ei->hover_left)
bt = elm_button_add(obj);
elm_object_text_set(bt, "Left");
elm_object_part_content_set(ei->hover, "left", bt);
- evas_object_smart_callback_add(bt, "clicked", my_anchorview_bt, av);
+ evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av);
evas_object_show(bt);
}
if (ei->hover_right)
bt = elm_button_add(obj);
elm_object_text_set(bt, "Right");
elm_object_part_content_set(ei->hover, "right", bt);
- evas_object_smart_callback_add(bt, "clicked", my_anchorview_bt, av);
+ evas_object_smart_callback_add(bt, "clicked", my_entry_anchor_bt, av);
evas_object_show(bt);
}
}
void
-test_anchorview(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+test_entry_anchor2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Evas_Object *win, *bg, *av;
- win = elm_win_add(NULL, "anchorview", ELM_WIN_BASIC);
+ win = elm_win_add(NULL, "entry_anchor", ELM_WIN_BASIC);
elm_win_title_set(win, "Anchorview");
elm_win_autodel_set(win, EINA_TRUE);
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(bg);
- av = elm_anchorview_add(win);
- elm_anchorview_hover_style_set(av, "popout");
- elm_anchorview_hover_parent_set(av, win);
+ av = elm_entry_add(win);
+ elm_entry_anchor_hover_style_set(av, "popout");
+ elm_entry_anchor_hover_parent_set(av, win);
elm_object_text_set(av,
"This is an entry widget in this window that<br/>"
"uses markup <b>like this</> for styling and<br/>"
"called <a href=anc-02>Anchors</a> so you will need<br/>"
"to refer to them this way. <item relsize=16x16 vsize=full href=emoticon/guilty-smile></item>");
evas_object_size_hint_weight_set(av, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_smart_callback_add(av, "anchor,clicked", my_anchorview_anchor, av);
+ evas_object_smart_callback_add(av, "anchor,hover,opened", my_anchorview_anchor, av);
elm_win_resize_object_add(win, av);
evas_object_show(av);
evas_object_show(ic);
evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
- av = elm_anchorblock_add(win);
- elm_anchorblock_hover_style_set(av, "popout");
- elm_anchorblock_hover_parent_set(av, win);
+ av = elm_entry_add(win);
+ elm_entry_anchor_hover_style_set(av, "popout");
+ elm_entry_anchor_hover_parent_set(av, win);
elm_object_text_set(av,
"Hi there. This is the most recent message in the "
"list of messages. It has one <a href=tel:+614321234>+61 432 1234</a> "
evas_object_show(ic);
evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
- av = elm_anchorblock_add(win);
- elm_anchorblock_hover_style_set(av, "popout");
- elm_anchorblock_hover_parent_set(av, win);
+ av = elm_entry_add(win);
+ elm_entry_anchor_hover_style_set(av, "popout");
+ elm_entry_anchor_hover_parent_set(av, win);
elm_object_text_set(av,
"Hey what are you doing? This is the second last message "
"Hi there. This is the most recent message in the "
evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
- av = elm_anchorblock_add(win);
- elm_anchorblock_hover_style_set(av, "popout");
- elm_anchorblock_hover_parent_set(av, win);
+ av = elm_entry_add(win);
+ elm_entry_anchor_hover_style_set(av, "popout");
+ elm_entry_anchor_hover_parent_set(av, win);
elm_object_text_set(av, "This is a short message. <item relsize=16x16 vsize=full href=emoticon/haha></item>");
elm_object_content_set(bb, av);
evas_object_show(av);
evas_object_show(ic);
evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
- av = elm_anchorblock_add(win);
- elm_anchorblock_hover_style_set(av, "popout");
- elm_anchorblock_hover_parent_set(av, win);
+ av = elm_entry_add(win);
+ elm_entry_anchor_hover_style_set(av, "popout");
+ elm_entry_anchor_hover_parent_set(av, win);
elm_object_text_set(av,
"Hi there. This is the most recent message in the "
"list of messages. It has one <a href=tel:+614321234>+61 432 1234</a> "
evas_object_show(ic);
evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
- av = elm_anchorblock_add(win);
- elm_anchorblock_hover_style_set(av, "popout");
- elm_anchorblock_hover_parent_set(av, win);
+ av = elm_entry_add(win);
+ elm_entry_anchor_hover_style_set(av, "popout");
+ elm_entry_anchor_hover_parent_set(av, win);
elm_object_text_set(av,
"Hey what are you doing? This is the second last message "
"Hi there. This is the most recent message in the "
evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
- av = elm_anchorblock_add(win);
- elm_anchorblock_hover_style_set(av, "popout");
- elm_anchorblock_hover_parent_set(av, win);
+ av = elm_entry_add(win);
+ elm_entry_anchor_hover_style_set(av, "popout");
+ elm_entry_anchor_hover_parent_set(av, win);
elm_object_text_set(av, "This is a short message. <item relsize=16x16 vsize=full href=emoticon/haha></item>");
elm_object_content_set(bb, av);
evas_object_show(av);
modules.inc \
elm.c \
elm_actionslider.c \
-elm_anchorblock.c \
-elm_anchorview.c \
elm_bubble.c \
elm_button.c \
elm_calendar.c \
+++ /dev/null
-#include "private.h"
-
-typedef struct _Elm_Params_Anchorblock
-{
- Elm_Params base;
- const char *text;
-} Elm_Params_Anchorblock;
-
-static void
-external_anchorblock_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
-{
- const Elm_Params_Anchorblock *p;
-
- if (to_params) p = to_params;
- else if (from_params) p = from_params;
- else return;
-
- if (p->text)
- {
- elm_object_text_set(obj, p->text);
- }
-}
-
-static Eina_Bool
-external_anchorblock_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
-{
- if (!strcmp(param->name, "text"))
- {
- if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
- {
- elm_object_text_set(obj, param->s);
- return EINA_TRUE;
- }
- }
-
- ERR("unknown parameter '%s' of type '%s'",
- param->name, edje_external_param_type_str(param->type));
-
- return EINA_FALSE;
-}
-
-static Eina_Bool
-external_anchorblock_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
-{
- if (!strcmp(param->name, "text"))
- {
- if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
- {
- param->s = elm_object_text_get(obj);
- return EINA_TRUE;
- }
- }
-
- ERR("unknown parameter '%s' of type '%s'",
- param->name, edje_external_param_type_str(param->type));
-
- return EINA_FALSE;
-}
-
-static void *
-external_anchorblock_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params)
-{
- Elm_Params_Anchorblock *mem;
- Edje_External_Param *param;
- const Eina_List *l;
-
- mem = ELM_NEW(Elm_Params_Anchorblock);
- if (!mem)
- return NULL;
-
- EINA_LIST_FOREACH(params, l, param)
- {
- if (!strcmp(param->name, "text"))
- mem->text = eina_stringshare_add(param->s);
- }
-
- return mem;
-}
-
-static Evas_Object *external_anchorblock_content_get(void *data __UNUSED__,
- const Evas_Object *obj __UNUSED__, const char *content __UNUSED__)
-{
- ERR("No content.");
- return NULL;
-}
-
-static void
-external_anchorblock_params_free(void *params)
-{
- Elm_Params_Anchorblock *mem = params;
-
- if (mem->text)
- eina_stringshare_del(mem->text);
- free(mem);
-}
-
-static Edje_External_Param_Info external_anchorblock_params[] = {
- DEFINE_EXTERNAL_COMMON_PARAMS,
- EDJE_EXTERNAL_PARAM_INFO_STRING_DEFAULT("text", "some text"),
- EDJE_EXTERNAL_PARAM_INFO_SENTINEL
-};
-
-DEFINE_EXTERNAL_ICON_ADD(anchorblock, "anchorblock")
-DEFINE_EXTERNAL_TYPE_SIMPLE(anchorblock, "Anchorblock");
+++ /dev/null
-#include "private.h"
-
-typedef struct _Elm_Params_Anchorview
-{
- Elm_Params base;
- const char *text;
-} Elm_Params_Anchorview;
-
-static void
-external_anchorview_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
-{
- const Elm_Params_Anchorview *p;
-
- if (to_params) p = to_params;
- else if (from_params) p = from_params;
- else return;
-
- if (p->text)
- {
- elm_object_text_set(obj, p->text);
- }
-}
-
-static Eina_Bool
-external_anchorview_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
-{
- if (!strcmp(param->name, "text"))
- {
- if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
- {
- elm_object_text_set(obj, param->s);
- return EINA_TRUE;
- }
- }
-
- ERR("unknown parameter '%s' of type '%s'",
- param->name, edje_external_param_type_str(param->type));
-
- return EINA_FALSE;
-}
-
-static Eina_Bool
-external_anchorview_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
-{
- if (!strcmp(param->name, "text"))
- {
- if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
- {
- param->s = elm_object_text_get(obj);
- return EINA_TRUE;
- }
- }
-
- ERR("unknown parameter '%s' of type '%s'",
- param->name, edje_external_param_type_str(param->type));
-
- return EINA_FALSE;
-}
-
-static void *
-external_anchorview_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params)
-{
- Elm_Params_Anchorview *mem;
- Edje_External_Param *param;
- const Eina_List *l;
-
- mem = ELM_NEW(Elm_Params_Anchorview);
- if (!mem)
- return NULL;
-
- EINA_LIST_FOREACH(params, l, param)
- {
- if (!strcmp(param->name, "text"))
- mem->text = eina_stringshare_add(param->s);
- }
-
- return mem;
-}
-
-static Evas_Object *external_anchorview_content_get(void *data __UNUSED__,
- const Evas_Object *obj __UNUSED__, const char *content __UNUSED__)
-{
- ERR("No content.");
- return NULL;
-}
-
-static void
-external_anchorview_params_free(void *params)
-{
- Elm_Params_Anchorview *mem = params;
-
- if (mem->text)
- eina_stringshare_del(mem->text);
- free(mem);
-}
-
-static Edje_External_Param_Info external_anchorview_params[] = {
- DEFINE_EXTERNAL_COMMON_PARAMS,
- EDJE_EXTERNAL_PARAM_INFO_STRING_DEFAULT("text", "some text"),
- EDJE_EXTERNAL_PARAM_INFO_SENTINEL
-};
-
-DEFINE_EXTERNAL_ICON_ADD(anchorview, "anchorview")
-DEFINE_EXTERNAL_TYPE_SIMPLE(anchorview, "Anchorview");
/* other includes */
// Tom Hacohen
-#include <elc_anchorblock.h>
-#include <elc_anchorview.h>
#include <elc_ctxpopup.h>
#include <elc_fileselector_button.h>
#include <elc_fileselector_entry.h>
includesunstabledir = $(includedir)/elementary-@VMAJ@
includesub_HEADERS = \
-elc_anchorblock.h \
-elc_anchorview.h \
elc_ctxpopup.h \
elc_fileselector_button.h \
elc_fileselector_entry.h \
libelementary_la_SOURCES = \
elm_priv.h \
-elc_anchorblock.c \
-elc_anchorview.c \
elc_ctxpopup.c \
elc_popup.c \
elc_fileselector_button.c \
+++ /dev/null
-#include <Elementary.h>
-#include "elm_priv.h"
-
-typedef struct _Widget_Data Widget_Data;
-typedef struct _Elm_Anchorblock_Item_Provider Elm_Anchorblock_Item_Provider;
-
-struct _Widget_Data
-{
- Evas_Object *entry;
- Evas_Object *hover_parent;
- Evas_Object *pop, *hover;
- Eina_List *item_providers;
- const char *hover_style;
-};
-
-struct _Elm_Anchorblock_Item_Provider
-{
- Evas_Object *(*func) (void *data, Evas_Object *anchorblock, const char *item);
- void *data;
-};
-
-static const char *widtype = NULL;
-
-static const char SIG_ANCHOR_CLICKED[] = "anchor,clicked";
-static const Evas_Smart_Cb_Description _signals[] = {
- {SIG_ANCHOR_CLICKED, ""}, /* TODO: declare the type properly, as data is
- * being passed
- */
- {NULL, NULL}
-};
-
-static void _del_pre_hook(Evas_Object *obj);
-static void _del_hook(Evas_Object *obj);
-static void _sizing_eval(Evas_Object *obj);
-static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void _parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
-
-static void
-_del_pre_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- evas_object_event_callback_del_full(wd->entry, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints, obj);
- elm_anchorblock_hover_end(obj);
- elm_anchorblock_hover_parent_set(obj, NULL);
-}
-
-static void
-_del_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Elm_Anchorblock_Item_Provider *ip;
- if (!wd) return;
- if (wd->hover_style) eina_stringshare_del(wd->hover_style);
- EINA_LIST_FREE(wd->item_providers, ip)
- {
- free(ip);
- }
- free(wd);
-}
-
-static void
-_mirrored_set(Evas_Object *obj, Eina_Bool rtl)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_widget_mirrored_set(wd->hover, rtl);
-}
-
-static void
-_theme_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- _elm_widget_mirrored_reload(obj);
- _mirrored_set(obj, elm_widget_mirrored_get(obj));
-}
-
-static void
-_sizing_eval(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
- if (!wd) return;
- evas_object_size_hint_min_get(wd->entry, &minw, &minh);
- evas_object_size_hint_min_set(obj, minw, minh);
- evas_object_size_hint_max_set(obj, maxw, maxh);
-}
-
-static void
-_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- _sizing_eval(data);
-}
-
-static void
-_hover_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- elm_anchorblock_hover_end(data);
-}
-
-static void
-_anchor_clicked(void *data, Evas_Object *obj, void *event_info)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- Elm_Entry_Anchor_Info *info = event_info;
- Evas_Object *hover_parent;
- Elm_Entry_Anchorblock_Info ei;
- Evas_Coord x, w, y, h, px, py;
- if (!wd) return;
- wd->pop = elm_icon_add(obj);
- evas_object_move(wd->pop, info->x, info->y);
- evas_object_resize(wd->pop, info->w, info->h);
- wd->hover = elm_hover_add(obj);
- elm_widget_mirrored_set(wd->hover, elm_widget_mirrored_get((Evas_Object *) data));
- if (wd->hover_style)
- elm_object_style_set(wd->hover, wd->hover_style);
- hover_parent = wd->hover_parent;
- if (!hover_parent) hover_parent = obj;
- elm_hover_parent_set(wd->hover, hover_parent);
- elm_hover_target_set(wd->hover, wd->pop);
- ei.name = info->name;
- ei.button = info->button;
- ei.hover = wd->hover;
- ei.anchor.x = info->x;
- ei.anchor.y = info->y;
- ei.anchor.w = info->w;
- ei.anchor.h = info->h;
- evas_object_geometry_get(hover_parent, &x, &y, &w, &h);
- ei.hover_parent.x = x;
- ei.hover_parent.y = y;
- ei.hover_parent.w = w;
- ei.hover_parent.h = h;
- px = info->x + (info->w / 2);
- py = info->y + (info->h / 2);
- ei.hover_left = 1;
- if (px < (x + (w / 3))) ei.hover_left = 0;
- ei.hover_right = 1;
- if (px > (x + ((w * 2) / 3))) ei.hover_right = 0;
- ei.hover_top = 1;
- if (py < (y + (h / 3))) ei.hover_top = 0;
- ei.hover_bottom = 1;
- if (py > (y + ((h * 2) / 3))) ei.hover_bottom = 0;
-
- if (elm_widget_mirrored_get(wd->hover))
- { /* Swap right and left because they switch sides in RTL */
- Eina_Bool tmp = ei.hover_left;
- ei.hover_left = ei.hover_right;
- ei.hover_right = tmp;
- }
-
- evas_object_smart_callback_call(data, SIG_ANCHOR_CLICKED, &ei);
- evas_object_smart_callback_add(wd->hover, "clicked", _hover_clicked, data);
- evas_object_show(wd->hover);
-}
-
-static void
-_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- if (!wd) return;
- wd->hover_parent = NULL;
-}
-
-static Evas_Object *
-_item_provider(void *data, Evas_Object *entry __UNUSED__, const char *item)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- Eina_List *l;
- Elm_Anchorblock_Item_Provider *ip;
-
- EINA_LIST_FOREACH(wd->item_providers, l, ip)
- {
- Evas_Object *o;
-
- o = ip->func(ip->data, data, item);
- if (o) return o;
- }
- return NULL;
-}
-
-static void
-_elm_anchorblock_text_set(Evas_Object *obj, const char *item, const char *text)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (item && strcmp(item, "default")) return;
- if (!wd) return;
- elm_object_text_set(wd->entry, text);
- if (wd->hover) evas_object_del(wd->hover);
- if (wd->pop) evas_object_del(wd->pop);
- wd->hover = NULL;
- wd->pop = NULL;
- _sizing_eval(obj);
-}
-
-static const char*
-_elm_anchorblock_text_get(const Evas_Object *obj, const char *item)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (item && strcmp(item, "default")) return NULL;
- if (!wd) return NULL;
- return elm_object_text_get(wd->entry);
-}
-
-EAPI Evas_Object *
-elm_anchorblock_add(Evas_Object *parent)
-{
- Evas_Object *obj;
- Evas *e;
- Widget_Data *wd;
-
- ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
-
- ELM_SET_WIDTYPE(widtype, "anchorblock");
- elm_widget_type_set(obj, "anchorblock");
- elm_widget_sub_object_add(parent, obj);
- elm_widget_data_set(obj, wd);
- elm_widget_del_pre_hook_set(obj, _del_pre_hook);
- elm_widget_del_hook_set(obj, _del_hook);
- elm_widget_theme_hook_set(obj, _theme_hook);
- elm_widget_can_focus_set(obj, EINA_TRUE);
- elm_widget_text_set_hook_set(obj, _elm_anchorblock_text_set);
- elm_widget_text_get_hook_set(obj, _elm_anchorblock_text_get);
-
- wd->entry = elm_entry_add(parent);
- elm_entry_item_provider_prepend(wd->entry, _item_provider, obj);
- elm_widget_resize_object_set(obj, wd->entry);
- elm_entry_editable_set(wd->entry, 0);
- evas_object_size_hint_weight_set(wd->entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(wd->entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
-
- evas_object_event_callback_add(wd->entry, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints, obj);
-
- elm_object_text_set(wd->entry, "");
-
- evas_object_smart_callback_add(wd->entry, "anchor,clicked",
- _anchor_clicked, obj);
-
- _mirrored_set(obj, elm_widget_mirrored_get(obj));
- _sizing_eval(obj);
-
- // TODO: convert Elementary to subclassing of Evas_Smart_Class
- // TODO: and save some bytes, making descriptions per-class and not instance!
- evas_object_smart_callbacks_descriptions_set(obj, _signals);
- return obj;
-}
-
-EAPI void
-elm_anchorblock_hover_parent_set(Evas_Object *obj, Evas_Object *parent)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (wd->hover_parent)
- evas_object_event_callback_del_full(wd->hover_parent, EVAS_CALLBACK_DEL, _parent_del, obj);
- wd->hover_parent = parent;
- if (wd->hover_parent)
- evas_object_event_callback_add(wd->hover_parent, EVAS_CALLBACK_DEL, _parent_del, obj);
-}
-
-EAPI Evas_Object *
-elm_anchorblock_hover_parent_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return wd->hover_parent;
-}
-
-EAPI void
-elm_anchorblock_hover_style_set(Evas_Object *obj, const char *style)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- eina_stringshare_replace(&wd->hover_style, style);
-}
-
-EAPI const char *
-elm_anchorblock_hover_style_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return wd->hover_style;
-}
-
-EAPI void
-elm_anchorblock_hover_end(Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (wd->hover) evas_object_del(wd->hover);
- if (wd->pop) evas_object_del(wd->pop);
- wd->hover = NULL;
- wd->pop = NULL;
-}
-
-EAPI void
-elm_anchorblock_item_provider_append(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *anchorblock, const char *item), void *data)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- EINA_SAFETY_ON_NULL_RETURN(func);
- Elm_Anchorblock_Item_Provider *ip = calloc(1, sizeof(Elm_Anchorblock_Item_Provider));
- if (!ip) return;
- ip->func = func;
- ip->data = data;
- wd->item_providers = eina_list_append(wd->item_providers, ip);
-}
-
-EAPI void
-elm_anchorblock_item_provider_prepend(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *anchorblock, const char *item), void *data)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- EINA_SAFETY_ON_NULL_RETURN(func);
- Elm_Anchorblock_Item_Provider *ip = calloc(1, sizeof(Elm_Anchorblock_Item_Provider));
- if (!ip) return;
- ip->func = func;
- ip->data = data;
- wd->item_providers = eina_list_prepend(wd->item_providers, ip);
-}
-
-EAPI void
-elm_anchorblock_item_provider_remove(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *anchorblock, const char *item), void *data)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- Eina_List *l;
- Elm_Anchorblock_Item_Provider *ip;
- if (!wd) return;
- EINA_SAFETY_ON_NULL_RETURN(func);
- EINA_LIST_FOREACH(wd->item_providers, l, ip)
- {
- if ((ip->func == func) && (ip->data == data))
- {
- wd->item_providers = eina_list_remove_list(wd->item_providers, l);
- free(ip);
- return;
- }
- }
-}
+++ /dev/null
-/**
- * @defgroup Anchorblock Anchorblock
- *
- * @image html img/widget/anchorblock/preview-00.png
- * @image latex img/widget/anchorblock/preview-00.eps
- *
- * Anchorblock is for displaying text that contains markup with anchors
- * like <c>\<a href=1234\>something\</\></c> in it.
- *
- * Besides being styled differently, the anchorblock widget provides the
- * necessary functionality so that clicking on these anchors brings up a
- * popup with user defined content such as "call", "add to contacts" or
- * "open web page". This popup is provided using the @ref Hover widget.
- *
- * This widget emits the following signals:
- * @li "anchor,clicked": will be called when an anchor is clicked. The
- * @p event_info parameter on the callback will be a pointer of type
- * ::Elm_Entry_Anchorblock_Info.
- *
- * @see Anchorview
- * @see Entry
- * @see Hover
- *
- * Default text parts of the anchorblock widget that you can use for are:
- * @li "default" - A label of the anchorblock
- *
- * Supported elm_object common APIs.
- * @li elm_object_part_text_set
- * @li elm_object_part_text_get
- *
- * Since examples are usually better than plain words, we might as well
- * try @ref tutorial_anchorblock_example "one".
- */
-
-/**
- * @addtogroup Anchorblock
- * @{
- */
-
-/* XXX: Remove this awful widget. */
-
-/**
- * @typedef Elm_Entry_Anchorblock_Info
- *
- * The info sent in the callback for "anchor,clicked" signals emitted by
- * the Anchorblock widget.
- */
-typedef struct _Elm_Entry_Anchorblock_Info Elm_Entry_Anchorblock_Info;
-
-/**
- * @struct _Elm_Entry_Anchorblock_Info
- *
- * The info sent in the callback for "anchor,clicked" signals emitted by
- * the Anchorblock widget.
- */
-struct _Elm_Entry_Anchorblock_Info
-{
- const char *name; /**< Name of the anchor, as indicated in its href
- attribute */
- int button; /**< The mouse button used to click on it */
- Evas_Object *hover; /**< The hover object to use for the popup */
- struct
- {
- Evas_Coord x, y, w, h;
- } anchor, /**< Geometry selection of text used as anchor */
- hover_parent; /**< Geometry of the object used as parent by the
- hover */
- Eina_Bool hover_left : 1; /**< Hint indicating if there's space
- for content on the left side of
- the hover. Before calling the
- callback, the widget will make the
- necessary calculations to check
- which sides are fit to be set with
- content, based on the position the
- hover is activated and its distance
- to the edges of its parent object
- */
- Eina_Bool hover_right : 1; /**< Hint indicating content fits on
- the right side of the hover.
- See @ref hover_left */
- Eina_Bool hover_top : 1; /**< Hint indicating content fits on top
- of the hover. See @ref hover_left */
- Eina_Bool hover_bottom : 1; /**< Hint indicating content fits
- below the hover. See @ref
- hover_left */
-};
-
-/**
- * Add a new Anchorblock object
- *
- * @param parent The parent object
- * @return The new object or NULL if it cannot be created
- */
-EAPI Evas_Object *elm_anchorblock_add(Evas_Object *parent);
-
-/**
- * Set the parent of the hover popup
- *
- * Sets the parent object to use by the hover created by the anchorblock
- * when an anchor is clicked. See @ref Hover for more details on this.
- *
- * @param obj The anchorblock object
- * @param parent The object to use as parent for the hover
- */
-EAPI void elm_anchorblock_hover_parent_set(Evas_Object *obj, Evas_Object *parent);
-
-/**
- * Get the parent of the hover popup
- *
- * Get the object used as parent for the hover created by the anchorblock
- * widget. See @ref Hover for more details on this.
- * If no parent is set, the same anchorblock object will be used.
- *
- * @param obj The anchorblock object
- * @return The object used as parent for the hover, NULL if none is set.
- */
-EAPI Evas_Object *elm_anchorblock_hover_parent_get(const Evas_Object *obj);
-
-/**
- * Set the style that the hover should use
- *
- * When creating the popup hover, anchorblock will request that it's
- * themed according to @p style.
- *
- * @param obj The anchorblock object
- * @param style The style to use for the underlying hover
- *
- * @see elm_object_style_set()
- */
-EAPI void elm_anchorblock_hover_style_set(Evas_Object *obj, const char *style);
-
-/**
- * Get the style that the hover should use
- *
- * Get the style, the hover created by anchorblock will use.
- *
- * @param obj The anchorblock object
- * @return The style to use by the hover. NULL means the default is used.
- *
- * @see elm_object_style_set()
- */
-EAPI const char *elm_anchorblock_hover_style_get(const Evas_Object *obj);
-
-/**
- * Ends the hover popup in the anchorblock
- *
- * When an anchor is clicked, the anchorblock widget will create a hover
- * object to use as a popup with user provided content. This function
- * terminates this popup, returning the anchorblock to its normal state.
- *
- * @param obj The anchorblock object
- */
-EAPI void elm_anchorblock_hover_end(Evas_Object *obj);
-
-/**
- * Appends a custom item provider to the given anchorblock
- *
- * Appends the given function to the list of items providers. This list is
- * called, one function at a time, with the given @p data pointer, the
- * anchorblock object and, in the @p item parameter, the item name as
- * referenced in its href string. Following functions in the list will be
- * called in order until one of them returns something different to NULL,
- * which should be an Evas_Object which will be used in place of the item
- * element.
- *
- * Items in the markup text take the form \<item relsize=16x16 vsize=full
- * href=item/name\>\</item\>
- *
- * @param obj The anchorblock object
- * @param func The function to add to the list of providers
- * @param data User data that will be passed to the callback function
- *
- * @see elm_entry_item_provider_append()
- */
-EAPI void elm_anchorblock_item_provider_append(Evas_Object *obj, Evas_Object * (*func)(void *data, Evas_Object * anchorblock, const char *item), void *data);
-
-/**
- * Prepend a custom item provider to the given anchorblock
- *
- * Like elm_anchorblock_item_provider_append(), but it adds the function
- * @p func to the beginning of the list, instead of the end.
- *
- * @param obj The anchorblock object
- * @param func The function to add to the list of providers
- * @param data User data that will be passed to the callback function
- */
-EAPI void elm_anchorblock_item_provider_prepend(Evas_Object *obj, Evas_Object * (*func)(void *data, Evas_Object * anchorblock, const char *item), void *data);
-
-/**
- * Remove a custom item provider from the list of the given anchorblock
- *
- * Removes the function and data pairing that matches @p func and @p data.
- * That is, unless the same function and same user data are given, the
- * function will not be removed from the list. This allows us to add the
- * same callback several times, with different @p data pointers and be
- * able to remove them later without conflicts.
- *
- * @param obj The anchorblock object
- * @param func The function to remove from the list
- * @param data The data matching the function to remove from the list
- */
-EAPI void elm_anchorblock_item_provider_remove(Evas_Object *obj, Evas_Object * (*func)(void *data, Evas_Object * anchorblock, const char *item), void *data);
-
-/**
- * @}
- */
+++ /dev/null
-#include <Elementary.h>
-#include "elm_priv.h"
-
-typedef struct _Widget_Data Widget_Data;
-typedef struct _Elm_Anchorview_Item_Provider Elm_Anchorview_Item_Provider;
-
-struct _Widget_Data
-{
- Evas_Object *scroller, *entry;
- Evas_Object *hover_parent;
- Evas_Object *pop, *hover;
- Eina_List *item_providers;
- const char *hover_style;
-};
-
-struct _Elm_Anchorview_Item_Provider
-{
- Evas_Object *(*func) (void *data, Evas_Object *anchorview, const char *item);
- void *data;
-};
-
-static const char *widtype = NULL;
-
-static const char SIG_ANCHOR_CLICKED[] = "anchor,clicked";
-static const Evas_Smart_Cb_Description _signals[] = {
- {SIG_ANCHOR_CLICKED, ""}, /* TODO: declare the type properly, as data is
- * being passed
- */
- {NULL, NULL}
-};
-
-static void _del_pre_hook(Evas_Object *obj);
-static void _del_hook(Evas_Object *obj);
-static void _sizing_eval(Evas_Object *obj);
-static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void _parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
-
-static void
-_del_pre_hook(Evas_Object *obj)
-{
- elm_anchorview_hover_end(obj);
- elm_anchorview_hover_parent_set(obj, NULL);
-}
-
-static void
-_del_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Elm_Anchorview_Item_Provider *ip;
- if (!wd) return;
- if (wd->hover_style) eina_stringshare_del(wd->hover_style);
- EINA_LIST_FREE(wd->item_providers, ip)
- {
- free(ip);
- }
- free(wd);
-}
-
-static void
-_mirrored_set(Evas_Object *obj, Eina_Bool rtl)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_widget_mirrored_set(wd->hover, rtl);
-}
-
-static void
-_theme_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- _elm_widget_mirrored_reload(obj);
- _mirrored_set(obj, elm_widget_mirrored_get(obj));
-}
-
-static void
-_sizing_eval(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
- if (!wd) return;
- evas_object_size_hint_min_set(obj, minw, minh);
- evas_object_size_hint_max_set(obj, maxw, maxh);
-}
-
-static void
-_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- _sizing_eval(data);
-}
-
-static void
-_hover_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- elm_anchorview_hover_end(data);
-}
-
-static void
-_anchor_clicked(void *data, Evas_Object *obj, void *event_info)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- Elm_Entry_Anchor_Info *info = event_info;
- Evas_Object *hover_parent;
- Elm_Entry_Anchorview_Info ei;
- Evas_Coord x, w, y, h, px, py;
- if (!wd) return;
- wd->pop = elm_icon_add(obj);
- evas_object_move(wd->pop, info->x, info->y);
- evas_object_resize(wd->pop, info->w, info->h);
- wd->hover = elm_hover_add(obj);
- elm_widget_mirrored_set(wd->hover, elm_widget_mirrored_get((Evas_Object *) data));
- if (wd->hover_style) elm_object_style_set(wd->hover, wd->hover_style);
- hover_parent = wd->hover_parent;
- if (!hover_parent) hover_parent = obj;
- elm_hover_parent_set(wd->hover, hover_parent);
- elm_hover_target_set(wd->hover, wd->pop);
- ei.name = info->name;
- ei.button = info->button;
- ei.hover = wd->hover;
- ei.anchor.x = info->x;
- ei.anchor.y = info->y;
- ei.anchor.w = info->w;
- ei.anchor.h = info->h;
- evas_object_geometry_get(hover_parent, &x, &y, &w, &h);
- ei.hover_parent.x = x;
- ei.hover_parent.y = y;
- ei.hover_parent.w = w;
- ei.hover_parent.h = h;
- px = info->x + (info->w / 2);
- py = info->y + (info->h / 2);
- ei.hover_left = 1;
- if (px < (x + (w / 3))) ei.hover_left = 0;
- ei.hover_right = 1;
- if (px > (x + ((w * 2) / 3))) ei.hover_right = 0;
- ei.hover_top = 1;
- if (py < (y + (h / 3))) ei.hover_top = 0;
- ei.hover_bottom = 1;
- if (py > (y + ((h * 2) / 3))) ei.hover_bottom = 0;
-
- if (elm_widget_mirrored_get(wd->hover))
- { /* Swap right and left because they switch sides in RTL */
- Eina_Bool tmp = ei.hover_left;
- ei.hover_left = ei.hover_right;
- ei.hover_right = tmp;
- }
-
- evas_object_smart_callback_call(data, SIG_ANCHOR_CLICKED, &ei);
- evas_object_smart_callback_add(wd->hover, "clicked", _hover_clicked, data);
- evas_object_show(wd->hover);
-}
-
-static void
-_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- if (!wd) return;
- wd->hover_parent = NULL;
-}
-
-static Evas_Object *
-_item_provider(void *data, Evas_Object *entry __UNUSED__, const char *item)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- Eina_List *l;
- Elm_Anchorview_Item_Provider *ip;
-
- EINA_LIST_FOREACH(wd->item_providers, l, ip)
- {
- Evas_Object *o;
-
- o = ip->func(ip->data, data, item);
- if (o) return o;
- }
- return NULL;
-}
-
-static void
-_elm_anchorview_text_set(Evas_Object *obj, const char *item, const char *text)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (item && strcmp(item, "default")) return;
- if (!wd) return;
- elm_object_text_set(wd->entry, text);
- if (wd->hover) evas_object_del(wd->hover);
- if (wd->pop) evas_object_del(wd->pop);
- wd->hover = NULL;
- wd->pop = NULL;
- _sizing_eval(obj);
-}
-
-static const char*
-_elm_anchorview_text_get(const Evas_Object *obj, const char *item)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (item && strcmp(item, "default")) return NULL;
- if (!wd) return NULL;
- return elm_object_text_get(wd->entry);
-}
-
-EAPI Evas_Object *
-elm_anchorview_add(Evas_Object *parent)
-{
- Evas_Object *obj;
- Evas *e;
- Widget_Data *wd;
-
- ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
-
- ELM_SET_WIDTYPE(widtype, "anchorview");
- elm_widget_type_set(obj, "anchorview");
- elm_widget_sub_object_add(parent, obj);
- elm_widget_data_set(obj, wd);
- elm_widget_del_pre_hook_set(obj, _del_pre_hook);
- elm_widget_del_hook_set(obj, _del_hook);
- elm_widget_theme_hook_set(obj, _theme_hook);
- elm_widget_can_focus_set(obj, EINA_TRUE);
- elm_widget_text_set_hook_set(obj, _elm_anchorview_text_set);
- elm_widget_text_get_hook_set(obj, _elm_anchorview_text_get);
-
- wd->scroller = elm_scroller_add(parent);
- elm_widget_resize_object_set(obj, wd->scroller);
- wd->entry = elm_entry_add(parent);
- elm_entry_item_provider_prepend(wd->entry, _item_provider, obj);
- elm_entry_editable_set(wd->entry, 0);
- evas_object_size_hint_weight_set(wd->entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(wd->entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_object_content_set(wd->scroller, wd->entry);
- evas_object_show(wd->entry);
-
- evas_object_event_callback_add(wd->entry, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints, obj);
-
- elm_object_text_set(wd->entry, "");
-
- evas_object_smart_callback_add(wd->entry, "anchor,clicked",
- _anchor_clicked, obj);
-
- _mirrored_set(obj, elm_widget_mirrored_get(obj));
- _sizing_eval(obj);
-
- // TODO: convert Elementary to subclassing of Evas_Smart_Class
- // TODO: and save some bytes, making descriptions per-class and not instance!
- evas_object_smart_callbacks_descriptions_set(obj, _signals);
- return obj;
-}
-
-EAPI void
-elm_anchorview_hover_parent_set(Evas_Object *obj, Evas_Object *parent)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (wd->hover_parent)
- evas_object_event_callback_del_full(wd->hover_parent, EVAS_CALLBACK_DEL, _parent_del, obj);
- wd->hover_parent = parent;
- if (wd->hover_parent)
- evas_object_event_callback_add(wd->hover_parent, EVAS_CALLBACK_DEL, _parent_del, obj);
-}
-
-EAPI Evas_Object *
-elm_anchorview_hover_parent_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return wd->hover_parent;
-}
-
-EAPI void
-elm_anchorview_hover_style_set(Evas_Object *obj, const char *style)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- eina_stringshare_replace(&wd->hover_style, style);
-}
-
-EAPI const char *
-elm_anchorview_hover_style_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return wd->hover_style;
-}
-
-EAPI void
-elm_anchorview_hover_end(Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (wd->hover) evas_object_del(wd->hover);
- if (wd->pop) evas_object_del(wd->pop);
- wd->hover = NULL;
- wd->pop = NULL;
-}
-
-EAPI void
-elm_anchorview_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_scroller_bounce_set(wd->scroller, h_bounce, v_bounce);
-}
-
-EAPI void
-elm_anchorview_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_scroller_bounce_get(wd->scroller, h_bounce, v_bounce);
-}
-
-EAPI void
-elm_anchorview_item_provider_append(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *anchorview, const char *item), void *data)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- EINA_SAFETY_ON_NULL_RETURN(func);
- Elm_Anchorview_Item_Provider *ip = calloc(1, sizeof(Elm_Anchorview_Item_Provider));
- if (!ip) return;
- ip->func = func;
- ip->data = data;
- wd->item_providers = eina_list_append(wd->item_providers, ip);
-}
-
-EAPI void
-elm_anchorview_item_provider_prepend(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *anchorview, const char *item), void *data)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- EINA_SAFETY_ON_NULL_RETURN(func);
- Elm_Anchorview_Item_Provider *ip = calloc(1, sizeof(Elm_Anchorview_Item_Provider));
- if (!ip) return;
- ip->func = func;
- ip->data = data;
- wd->item_providers = eina_list_prepend(wd->item_providers, ip);
-}
-
-EAPI void
-elm_anchorview_item_provider_remove(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *anchorview, const char *item), void *data)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- Eina_List *l;
- Elm_Anchorview_Item_Provider *ip;
- if (!wd) return;
- EINA_SAFETY_ON_NULL_RETURN(func);
- EINA_LIST_FOREACH(wd->item_providers, l, ip)
- {
- if ((ip->func == func) && (ip->data == data))
- {
- wd->item_providers = eina_list_remove_list(wd->item_providers, l);
- free(ip);
- return;
- }
- }
-}
+++ /dev/null
-/**
- * @defgroup Anchorview Anchorview
- *
- * @image html img/widget/anchorview/preview-00.png
- * @image latex img/widget/anchorview/preview-00.eps
- *
- * Anchorview is for displaying text that contains markup with anchors
- * like <c>\<a href=1234\>something\</\></c> in it.
- *
- * Besides being styled differently, the anchorview widget provides the
- * necessary functionality so that clicking on these anchors brings up a
- * popup with user defined content such as "call", "add to contacts" or
- * "open web page". This popup is provided using the @ref Hover widget.
- *
- * This widget is very similar to @ref Anchorblock, so refer to that
- * widget for an example. The only difference Anchorview has is that the
- * widget is already provided with scrolling functionality, so if the
- * text set to it is too large to fit in the given space, it will scroll,
- * whereas the @ref Anchorblock widget will keep growing to ensure all the
- * text can be displayed.
- *
- * This widget emits the following signals:
- * @li "anchor,clicked": will be called when an anchor is clicked. The
- * @p event_info parameter on the callback will be a pointer of type
- * ::Elm_Entry_Anchorview_Info.
- *
- * See @ref Anchorblock for an example on how to use both of them.
- *
- * @see Anchorblock
- * @see Entry
- * @see Hover
- *
- * @{
- */
-
-/**
- * @typedef Elm_Entry_Anchorview_Info
- *
- * The info sent in the callback for "anchor,clicked" signals emitted by
- * the Anchorview widget.
- */
-typedef struct _Elm_Entry_Anchorview_Info Elm_Entry_Anchorview_Info;
-
-/* XXX: Merge into entry. */
-
-/**
- * @struct _Elm_Entry_Anchorview_Info
- *
- * The info sent in the callback for "anchor,clicked" signals emitted by
- * the Anchorview widget.
- */
-struct _Elm_Entry_Anchorview_Info
-{
- const char *name; /**< Name of the anchor, as indicated in its href
- attribute */
- int button; /**< The mouse button used to click on it */
- Evas_Object *hover; /**< The hover object to use for the popup */
- struct
- {
- Evas_Coord x, y, w, h;
- } anchor, /**< Geometry selection of text used as anchor */
- hover_parent; /**< Geometry of the object used as parent by the
- hover */
- Eina_Bool hover_left : 1; /**< Hint indicating if there's space
- for content on the left side of
- the hover. Before calling the
- callback, the widget will make the
- necessary calculations to check
- which sides are fit to be set with
- content, based on the position the
- hover is activated and its distance
- to the edges of its parent object
- */
- Eina_Bool hover_right : 1; /**< Hint indicating content fits on
- the right side of the hover.
- See @ref hover_left */
- Eina_Bool hover_top : 1; /**< Hint indicating content fits on top
- of the hover. See @ref hover_left */
- Eina_Bool hover_bottom : 1; /**< Hint indicating content fits
- below the hover. See @ref
- hover_left */
-};
-
-/**
- * Add a new Anchorview object to the parent.
- *
- * @param parent The parent object
- * @return The new object or NULL if it cannot be created
- */
-EAPI Evas_Object *elm_anchorview_add(Evas_Object *parent);
-
-/**
- * Set the parent of the hover popup
- *
- * Sets the parent object to use by the hover created by the anchorview
- * when an anchor is clicked. See @ref Hover for more details on this.
- * If no parent is set, the same anchorview object will be used.
- *
- * @param obj The anchorview object
- * @param parent The object to use as parent for the hover
- */
-EAPI void elm_anchorview_hover_parent_set(Evas_Object *obj, Evas_Object *parent);
-
-/**
- * Get the parent of the hover popup
- *
- * Get the object used as parent for the hover created by the anchorview
- * widget. See @ref Hover for more details on this.
- *
- * @param obj The anchorview object
- * @return The object used as parent for the hover, NULL if none is set.
- */
-EAPI Evas_Object *elm_anchorview_hover_parent_get(const Evas_Object *obj);
-
-/**
- * Set the style that the hover should use
- *
- * When creating the popup hover, anchorview will request that it is
- * themed according to @p style.
- *
- * @param obj The anchorview object
- * @param style The style to use for the underlying hover
- *
- * @see elm_object_style_set()
- */
-EAPI void elm_anchorview_hover_style_set(Evas_Object *obj, const char *style);
-
-/**
- * Get the style that the hover uses.
- *
- * Get the style the hover created by anchorview will use.
- *
- * @param obj The anchorview object
- * @return The style to use by the hover. NULL means the default is used.
- *
- * @see elm_object_style_set()
- */
-EAPI const char *elm_anchorview_hover_style_get(const Evas_Object *obj);
-
-/**
- * Ends the hover popup in the anchorview
- *
- * When an anchor is clicked, the anchorview widget will create a hover
- * object to use as a popup with user provided content. This function
- * terminates this popup, returning the anchorview to its normal state.
- *
- * @param obj The anchorview object
- */
-EAPI void elm_anchorview_hover_end(Evas_Object *obj);
-
-/**
- * Set bouncing behaviour when the scrolled content reaches an edge
- *
- * Tell the internal scroller object whether it should bounce or not
- * when it reaches the respective edges for each axis.
- *
- * @param obj The anchorview object
- * @param h_bounce Whether to bounce or not in the horizontal axis
- * @param v_bounce Whether to bounce or not in the vertical axis
- *
- * @see elm_scroller_bounce_set()
- */
-EAPI void elm_anchorview_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce);
-
-/**
- * Get the bouncing behaviour of the internal scroller
- *
- * Get whether the internal scroller will bounce when the edge of each
- * axis is reached scrolling.
- *
- * @param obj The anchorview object
- * @param h_bounce Pointer to store the bounce state of the horizontal
- * axis
- * @param v_bounce Pointer to store the bounce state of the vertical
- * axis
- *
- * @see elm_scroller_bounce_get()
- */
-EAPI void elm_anchorview_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce);
-
-/**
- * Appends a custom item provider to the given anchorview
- *
- * Appends the given function to the list of items providers. This list is
- * called, one function at a time, with the given @p data pointer, the
- * anchorview object and, in the @p item parameter, the item name as
- * referenced in its href string. Following functions in the list will be
- * called in order until one of them returns something different to NULL,
- * which should be an Evas_Object which will be used in place of the item
- * element.
- *
- * Items in the markup text take the form \<item relsize=16x16 vsize=full
- * href=item/name\>\</item\>
- *
- * @param obj The anchorview object
- * @param func The function to add to the list of providers
- * @param data User data that will be passed to the callback function
- *
- * @see elm_entry_item_provider_append()
- */
-EAPI void elm_anchorview_item_provider_append(Evas_Object *obj, Evas_Object * (*func)(void *data, Evas_Object * anchorview, const char *item), void *data);
-
-/**
- * Prepend a custom item provider to the given anchorview
- *
- * Like elm_anchorview_item_provider_append(), but it adds the function
- * @p func to the beginning of the list, instead of the end.
- *
- * @param obj The anchorview object
- * @param func The function to add to the list of providers
- * @param data User data that will be passed to the callback function
- */
-EAPI void elm_anchorview_item_provider_prepend(Evas_Object *obj, Evas_Object * (*func)(void *data, Evas_Object * anchorview, const char *item), void *data);
-
-/**
- * Remove a custom item provider from the list of the given anchorview
- *
- * Removes the function and data pairing that matches @p func and @p data.
- * That is, unless the same function and same user data are given, the
- * function will not be removed from the list. This allows us to add the
- * same callback several times, with different @p data pointers and be
- * able to remove them later without conflicts.
- *
- * @param obj The anchorview object
- * @param func The function to remove from the list
- * @param data The data matching the function to remove from the list
- */
-EAPI void elm_anchorview_item_provider_remove(Evas_Object *obj, Evas_Object * (*func)(void *data, Evas_Object * anchorview, const char *item), void *data);
-
-/**
- * @}
- */
Elm_Input_Panel_Return_Key_Type input_panel_return_key_type;
void *input_panel_imdata;
int input_panel_imdata_len;
+ struct {
+ Evas_Object *hover_parent;
+ Evas_Object *pop, *hover;
+ const char *hover_style;
+ } anchor_hover;
Eina_Bool changed : 1;
Eina_Bool single_line : 1;
Eina_Bool password : 1;
static void _signal_entry_cut_notify(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _signal_cursor_changed(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _add_chars_till_limit(Evas_Object *obj, char **text, int can_add, Length_Unit unit);
+static void _entry_hover_anchor_clicked(void *data, Evas_Object *obj, void *event_info);
static const char SIG_CHANGED[] = "changed";
static const char SIG_CHANGED_USER[] = "changed,user";
static const char SIG_CURSOR_CHANGED[] = "cursor,changed";
static const char SIG_CURSOR_CHANGED_MANUAL[] = "cursor,changed,manual";
static const char SIG_ANCHOR_CLICKED[] = "anchor,clicked";
+static const char SIG_ANCHOR_HOVER_OPENED[] = "anchor,hover,opened";
static const char SIG_ANCHOR_DOWN[] = "anchor,down";
static const char SIG_ANCHOR_UP[] = "anchor,up";
static const char SIG_ANCHOR_IN[] = "anchor,in";
{SIG_CURSOR_CHANGED, ""},
{SIG_CURSOR_CHANGED_MANUAL, ""},
{SIG_ANCHOR_CLICKED, ""},
+ {SIG_ANCHOR_HOVER_OPENED, ""},
{SIG_ANCHOR_DOWN, ""},
{SIG_ANCHOR_UP, ""},
{SIG_ANCHOR_IN, ""},
wd->delay_write = NULL;
if (wd->autosave) _save(obj);
}
+ elm_entry_anchor_hover_end(obj);
+ elm_entry_anchor_hover_parent_set(obj, NULL);
}
static void
if (wd->input_panel_imdata) free(wd->input_panel_imdata);
free(wd);
+ if (wd->anchor_hover.hover_style) eina_stringshare_del(wd->anchor_hover.hover_style);
evas_event_thaw(evas_object_evas_get(obj));
evas_event_thaw_eval(evas_object_evas_get(obj));
}
{
Widget_Data *wd = elm_widget_data_get(obj);
edje_object_mirrored_set(wd->ent, rtl);
+ if (wd->anchor_hover.hover)
+ elm_widget_mirrored_set(wd->anchor_hover.hover, rtl);
}
static void
_signal_anchor_geoms_do_things_with(wd, &ei);
if (!wd->disabled)
- evas_object_smart_callback_call(data, SIG_ANCHOR_CLICKED, &ei);
+ {
+ evas_object_smart_callback_call(data, SIG_ANCHOR_CLICKED, &ei);
+
+ _entry_hover_anchor_clicked(data, data, &ei);
+ }
}
static void
return edje_object_part_text_imf_context_get(wd->ent, "elm.text");
}
+
+/* START - ANCHOR HOVER */
+static void
+_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ Widget_Data *wd = elm_widget_data_get(data);
+ if (!wd) return;
+ wd->anchor_hover.hover_parent = NULL;
+}
+
+EAPI void
+elm_entry_anchor_hover_parent_set(Evas_Object *obj, Evas_Object *parent)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ if (wd->anchor_hover.hover_parent)
+ evas_object_event_callback_del_full(wd->anchor_hover.hover_parent, EVAS_CALLBACK_DEL, _parent_del, obj);
+ wd->anchor_hover.hover_parent = parent;
+ if (wd->anchor_hover.hover_parent)
+ evas_object_event_callback_add(wd->anchor_hover.hover_parent, EVAS_CALLBACK_DEL, _parent_del, obj);
+}
+
+EAPI Evas_Object *
+elm_entry_anchor_hover_parent_get(const Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+ return wd->anchor_hover.hover_parent;
+}
+
+EAPI void
+elm_entry_anchor_hover_style_set(Evas_Object *obj, const char *style)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ eina_stringshare_replace(&wd->anchor_hover.hover_style, style);
+}
+
+EAPI const char *
+elm_entry_anchor_hover_style_get(const Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+ return wd->anchor_hover.hover_style;
+}
+
+EAPI void
+elm_entry_anchor_hover_end(Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ if (wd->anchor_hover.hover) evas_object_del(wd->anchor_hover.hover);
+ if (wd->anchor_hover.pop) evas_object_del(wd->anchor_hover.pop);
+ wd->anchor_hover.hover = NULL;
+ wd->anchor_hover.pop = NULL;
+}
+
+
+static void
+_anchor_hover_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ elm_entry_anchor_hover_end(data);
+}
+
+static void
+_entry_hover_anchor_clicked(void *data, Evas_Object *obj, void *event_info)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ Elm_Entry_Anchor_Info *info = event_info;
+ Evas_Object *hover_parent;
+ Elm_Entry_Anchor_Hover_Info ei;
+ Evas_Coord x, w, y, h, px, py;
+ if (!wd) return;
+ ei.anchor_info = event_info;
+ wd->anchor_hover.pop = elm_icon_add(obj);
+ evas_object_move(wd->anchor_hover.pop, info->x, info->y);
+ evas_object_resize(wd->anchor_hover.pop, info->w, info->h);
+ wd->anchor_hover.hover = elm_hover_add(obj);
+ elm_widget_mirrored_set(wd->anchor_hover.hover, elm_widget_mirrored_get(obj));
+ if (wd->anchor_hover.hover_style)
+ elm_object_style_set(wd->anchor_hover.hover, wd->anchor_hover.hover_style);
+ hover_parent = wd->anchor_hover.hover_parent;
+ if (!hover_parent) hover_parent = obj;
+ elm_hover_parent_set(wd->anchor_hover.hover, hover_parent);
+ elm_hover_target_set(wd->anchor_hover.hover, wd->anchor_hover.pop);
+ ei.hover = wd->anchor_hover.hover;
+ evas_object_geometry_get(hover_parent, &x, &y, &w, &h);
+ ei.hover_parent.x = x;
+ ei.hover_parent.y = y;
+ ei.hover_parent.w = w;
+ ei.hover_parent.h = h;
+ px = info->x + (info->w / 2);
+ py = info->y + (info->h / 2);
+ ei.hover_left = 1;
+ if (px < (x + (w / 3))) ei.hover_left = 0;
+ ei.hover_right = 1;
+ if (px > (x + ((w * 2) / 3))) ei.hover_right = 0;
+ ei.hover_top = 1;
+ if (py < (y + (h / 3))) ei.hover_top = 0;
+ ei.hover_bottom = 1;
+ if (py > (y + ((h * 2) / 3))) ei.hover_bottom = 0;
+
+ if (elm_widget_mirrored_get(wd->anchor_hover.hover))
+ { /* Swap right and left because they switch sides in RTL */
+ Eina_Bool tmp = ei.hover_left;
+ ei.hover_left = ei.hover_right;
+ ei.hover_right = tmp;
+ }
+
+ evas_object_smart_callback_call(data, SIG_ANCHOR_HOVER_OPENED, &ei);
+ evas_object_smart_callback_add(wd->anchor_hover.hover, "clicked", _anchor_hover_clicked, data);
+ evas_object_show(wd->anchor_hover.hover);
+}
+/* END - ANCHOR HOVER */
+
};
/**
+ * @typedef Elm_Entry_Anchor_Hover_Info
+ *
+ * The info sent in the callback for "anchor,clicked" signals emitted by
+ * the Anchor_Hover widget.
+ */
+typedef struct _Elm_Entry_Anchor_Hover_Info Elm_Entry_Anchor_Hover_Info;
+
+/**
+ * @struct _Elm_Entry_Anchor_Hover_Info
+ *
+ * The info sent in the callback for "anchor,clicked" signals emitted by
+ * the Anchor_Hover widget.
+ */
+struct _Elm_Entry_Anchor_Hover_Info
+{
+ const Elm_Entry_Anchor_Info *anchor_info; /**< The actual anchor info. */
+ Evas_Object *hover; /**< The hover object to use for the popup */
+ struct
+ {
+ Evas_Coord x, y, w, h;
+ } hover_parent; /**< Geometry of the object used as parent by the
+ hover */
+ Eina_Bool hover_left : 1; /**< Hint indicating if there's space
+ for content on the left side of
+ the hover. Before calling the
+ callback, the widget will make the
+ necessary calculations to check
+ which sides are fit to be set with
+ content, based on the position the
+ hover is activated and its distance
+ to the edges of its parent object
+ */
+ Eina_Bool hover_right : 1; /**< Hint indicating content fits on
+ the right side of the hover.
+ See @ref hover_left */
+ Eina_Bool hover_top : 1; /**< Hint indicating content fits on top
+ of the hover. See @ref hover_left */
+ Eina_Bool hover_bottom : 1; /**< Hint indicating content fits
+ below the hover. See @ref
+ hover_left */
+};
+
+/**
* @typedef Elm_Entry_Filter_Cb
* This callback type is used by entry filters to modify text.
* @param data The data specified as the last param when adding the filter
*/
EAPI Elm_Cnp_Mode elm_entry_cnp_mode_get(const Evas_Object *obj);
+/**
+ * Set the parent of the hover popup
+ *
+ * Sets the parent object to use by the hover created by the entry
+ * when an anchor is clicked. See @ref Hover for more details on this.
+ *
+ * @param obj The entry object
+ * @param parent The object to use as parent for the hover
+ */
+EAPI void elm_entry_anchor_hover_parent_set(Evas_Object *obj, Evas_Object *parent);
+
+/**
+ * Get the parent of the hover popup
+ *
+ * Get the object used as parent for the hover created by the entry
+ * widget. See @ref Hover for more details on this.
+ * If no parent is set, the same entry object will be used.
+ *
+ * @param obj The entry object
+ * @return The object used as parent for the hover, NULL if none is set.
+ */
+EAPI Evas_Object *elm_entry_anchor_hover_parent_get(const Evas_Object *obj);
+
+/**
+ * Set the style that the hover should use
+ *
+ * When creating the popup hover, entry will request that it's
+ * themed according to @p style.
+ *
+ * Setting style no NULL means disabling automatic hover.
+ *
+ * @param obj The entry object
+ * @param style The style to use for the underlying hover
+ *
+ * @see elm_object_style_set()
+ */
+EAPI void elm_entry_anchor_hover_style_set(Evas_Object *obj, const char *style);
+
+/**
+ * Get the style that the hover should use
+ *
+ * Get the style, the hover created by entry will use.
+ *
+ * @param obj The entry object
+ * @return The style to use by the hover. NULL means the default is used.
+ *
+ * @see elm_object_style_set()
+ */
+EAPI const char *elm_entry_anchor_hover_style_get(const Evas_Object *obj);
+
+/**
+ * Ends the hover popup in the entry
+ *
+ * When an anchor is clicked, the entry widget will create a hover
+ * object to use as a popup with user provided content. This function
+ * terminates this popup, returning the entry to its normal state.
+ *
+ * @param obj The entry object
+ */
+EAPI void elm_entry_anchor_hover_end(Evas_Object *obj);
/**
* @}