2010-09-10 17:52:33 -07:00
|
|
|
#include <Elementary.h>
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
#ifndef ELM_LIB_QUICKLAUNCH
|
|
|
|
|
2010-09-27 11:18:37 -07:00
|
|
|
typedef struct _Testitem
|
|
|
|
{
|
|
|
|
Elm_Gengrid_Item *item;
|
2010-12-06 04:46:02 -08:00
|
|
|
const char *path;
|
|
|
|
int mode;
|
|
|
|
int onoff;
|
2010-09-27 11:18:37 -07:00
|
|
|
} Testitem;
|
|
|
|
|
|
|
|
static Elm_Gengrid_Item_Class gic;
|
|
|
|
|
|
|
|
char *
|
2010-12-06 04:46:02 -08:00
|
|
|
grdt_lbl_get(void *data,
|
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
const char *part __UNUSED__)
|
2010-09-27 11:18:37 -07:00
|
|
|
{
|
|
|
|
const Testitem *ti = data;
|
|
|
|
char buf[256];
|
|
|
|
snprintf(buf, sizeof(buf), "Photo %s", ti->path);
|
|
|
|
return strdup(buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
Evas_Object *
|
2011-10-23 19:10:35 -07:00
|
|
|
grdt_content_get(void *data,
|
2010-12-06 04:46:02 -08:00
|
|
|
Evas_Object *obj,
|
|
|
|
const char *part)
|
2010-09-27 11:18:37 -07:00
|
|
|
{
|
|
|
|
const Testitem *ti = data;
|
|
|
|
if (!strcmp(part, "elm.swallow.icon"))
|
|
|
|
{
|
2010-12-06 04:46:02 -08:00
|
|
|
Evas_Object *icon = elm_bg_add(obj);
|
|
|
|
elm_bg_file_set(icon, ti->path, NULL);
|
|
|
|
evas_object_size_hint_aspect_set(icon,
|
|
|
|
EVAS_ASPECT_CONTROL_VERTICAL,
|
|
|
|
1, 1);
|
|
|
|
evas_object_show(icon);
|
|
|
|
return icon;
|
2010-09-27 11:18:37 -07:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Elm_Genlist_Item_Class itct;
|
|
|
|
|
|
|
|
static void
|
2010-12-06 04:46:02 -08:00
|
|
|
gltt_exp(void *data __UNUSED__,
|
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
void *event_info)
|
2010-09-27 11:18:37 -07:00
|
|
|
{
|
2012-01-19 21:18:31 -08:00
|
|
|
Elm_Object_Item *glit = event_info;
|
2012-01-29 20:37:41 -08:00
|
|
|
Evas_Object *gl = elm_object_item_widget_get(glit);
|
2012-01-29 17:08:54 -08:00
|
|
|
int val = (int)(long) elm_object_item_data_get(glit);
|
2012-01-19 21:18:31 -08:00
|
|
|
Elm_Object_Item *glit1, *glit2, *glit3;
|
2010-09-27 11:18:37 -07:00
|
|
|
|
|
|
|
val *= 10;
|
2012-01-29 17:08:54 -08:00
|
|
|
glit1 = elm_genlist_item_append(gl, &itct, (void *)(long) (val + 1), glit,
|
2012-01-19 21:18:31 -08:00
|
|
|
ELM_GENLIST_ITEM_NONE, NULL, NULL);
|
2012-01-29 17:08:54 -08:00
|
|
|
glit2 = elm_genlist_item_append(gl, &itct, (void *)(long) (val + 2), glit,
|
2012-01-19 21:18:31 -08:00
|
|
|
ELM_GENLIST_ITEM_NONE, NULL, NULL);
|
2012-01-29 17:08:54 -08:00
|
|
|
glit3 = elm_genlist_item_append(gl, &itct, (void *)(long) (val + 3), glit,
|
2012-01-19 21:18:31 -08:00
|
|
|
ELM_GENLIST_ITEM_SUBITEMS, NULL, NULL);
|
|
|
|
|
|
|
|
elm_genlist_item_tooltip_text_set(glit1, "Testing A");
|
|
|
|
elm_genlist_item_tooltip_text_set(glit2, "Testing B");
|
|
|
|
elm_genlist_item_tooltip_text_set(glit3, "Testing C");
|
2010-09-27 11:18:37 -07:00
|
|
|
}
|
2010-10-20 10:41:31 -07:00
|
|
|
|
2010-09-27 11:18:37 -07:00
|
|
|
static void
|
2010-12-06 04:46:02 -08:00
|
|
|
gltt_con(void *data __UNUSED__,
|
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
void *event_info)
|
2010-09-27 11:18:37 -07:00
|
|
|
{
|
2012-01-19 21:18:31 -08:00
|
|
|
Elm_Object_Item *glit = event_info;
|
|
|
|
elm_genlist_item_subitems_clear(glit);
|
2010-09-27 11:18:37 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-12-06 04:46:02 -08:00
|
|
|
gltt_exp_req(void *data __UNUSED__,
|
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
void *event_info)
|
2010-09-27 11:18:37 -07:00
|
|
|
{
|
2012-01-19 21:18:31 -08:00
|
|
|
Elm_Object_Item *glit = event_info;
|
|
|
|
elm_genlist_item_expanded_set(glit, EINA_TRUE);
|
2010-09-27 11:18:37 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-12-06 04:46:02 -08:00
|
|
|
gltt_con_req(void *data __UNUSED__,
|
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
void *event_info)
|
2010-09-27 11:18:37 -07:00
|
|
|
{
|
2012-01-19 21:18:31 -08:00
|
|
|
Elm_Object_Item *glit = event_info;
|
|
|
|
elm_genlist_item_expanded_set(glit, EINA_FALSE);
|
2010-09-27 11:18:37 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
char *
|
2011-11-30 22:15:08 -08:00
|
|
|
gltt_text_get(void *data,
|
2010-12-06 04:46:02 -08:00
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
const char *part __UNUSED__)
|
2010-09-27 11:18:37 -07:00
|
|
|
{
|
|
|
|
char buf[256];
|
2010-09-29 05:22:22 -07:00
|
|
|
snprintf(buf, sizeof(buf), "Item mode %i", (int)(long)data);
|
2010-09-27 11:18:37 -07:00
|
|
|
return strdup(buf);
|
|
|
|
}
|
|
|
|
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
static Evas_Object *
|
2010-12-06 04:46:02 -08:00
|
|
|
_tt_item_icon(void *data __UNUSED__,
|
2011-07-26 02:38:23 -07:00
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
Evas_Object *tt,
|
2010-12-06 04:46:02 -08:00
|
|
|
void *item __UNUSED__)
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
{
|
2011-07-26 02:38:23 -07:00
|
|
|
Evas_Object *ic = elm_icon_add(tt);
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
char buf[PATH_MAX];
|
2010-12-06 04:46:02 -08:00
|
|
|
snprintf(buf, sizeof(buf), "%s/images/logo_small.png",
|
2011-08-25 03:01:59 -07:00
|
|
|
elm_app_data_dir_get());
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
elm_icon_file_set(ic, buf, NULL);
|
|
|
|
elm_icon_scale_set(ic, 0, 0);
|
|
|
|
evas_object_resize(ic, 64, 64);
|
|
|
|
return ic;
|
|
|
|
}
|
|
|
|
|
2011-07-23 11:24:12 -07:00
|
|
|
static Evas_Object *
|
|
|
|
_tt_item_icon2(void *data __UNUSED__,
|
2011-07-26 02:38:23 -07:00
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
Evas_Object *tt,
|
2011-07-23 11:24:12 -07:00
|
|
|
void *item __UNUSED__)
|
|
|
|
{
|
2011-07-26 02:38:23 -07:00
|
|
|
Evas_Object *ic = elm_icon_add(tt);
|
2011-07-23 11:24:12 -07:00
|
|
|
char buf[PATH_MAX];
|
2011-08-25 03:01:59 -07:00
|
|
|
snprintf(buf, sizeof(buf), "%s/images/logo.png", elm_app_data_dir_get());
|
2011-07-23 11:24:12 -07:00
|
|
|
elm_icon_file_set(ic, buf, NULL);
|
|
|
|
elm_icon_scale_set(ic, 0, 0);
|
|
|
|
return ic;
|
|
|
|
}
|
|
|
|
|
2011-07-26 03:28:01 -07:00
|
|
|
static Evas_Object *
|
|
|
|
_tt_item_icon3(void *data __UNUSED__,
|
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
Evas_Object *tt,
|
|
|
|
void *item __UNUSED__)
|
|
|
|
{
|
2011-11-23 21:07:23 -08:00
|
|
|
int w, h, sw, sh;
|
2011-07-26 03:28:01 -07:00
|
|
|
Evas_Object *ic = elm_icon_add(tt);
|
2011-11-30 09:44:00 -08:00
|
|
|
|
2011-07-26 03:28:01 -07:00
|
|
|
char buf[PATH_MAX];
|
2011-08-25 03:01:59 -07:00
|
|
|
snprintf(buf, sizeof(buf), "%s/images/insanely_huge_test_image.jpg", elm_app_data_dir_get());
|
2011-07-26 03:28:01 -07:00
|
|
|
elm_icon_file_set(ic, buf, NULL);
|
2011-11-23 21:07:23 -08:00
|
|
|
elm_icon_size_get(ic, &w, &h);
|
|
|
|
elm_win_screen_size_get(tt, NULL, NULL, &sw, &sh);
|
|
|
|
if ((w > sw) || (h > sh))
|
|
|
|
{
|
|
|
|
float sc = 0;
|
|
|
|
if ((float)w / (float)sw >= 0.8)
|
|
|
|
sc = ((float)sw * 0.8) / (float)w;
|
|
|
|
else if ((float)h / (float)sh >= 0.8)
|
|
|
|
sc = ((float)sh * 0.8) / (float)h;
|
|
|
|
if (sc) elm_object_scale_set(ic, sc);
|
|
|
|
}
|
2011-07-26 03:28:01 -07:00
|
|
|
return ic;
|
|
|
|
}
|
|
|
|
|
2011-07-31 17:49:46 -07:00
|
|
|
static Evas_Object *
|
|
|
|
_tt_item_label(void *data __UNUSED__,
|
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
Evas_Object *tt,
|
|
|
|
void *item __UNUSED__)
|
|
|
|
{
|
|
|
|
Evas_Object *l = elm_label_add(tt);
|
2011-12-08 04:39:18 -08:00
|
|
|
elm_object_text_set(l, "Something useful here?<ps/>"
|
|
|
|
"No probably not, but this is a super long label<ps/>"
|
|
|
|
"which probably breaks on your system, now doesn't it?<ps/>"
|
2011-07-31 17:49:46 -07:00
|
|
|
"Yeah, I thought so.");
|
|
|
|
elm_label_line_wrap_set(l, ELM_WRAP_MIXED);
|
|
|
|
return l;
|
|
|
|
}
|
|
|
|
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
static void
|
2010-12-06 04:46:02 -08:00
|
|
|
_tt_item_icon_del(void *data,
|
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
void *event_info)
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
{
|
|
|
|
// test to check for del_cb behavior!
|
|
|
|
printf("_tt_icon_del: data=%ld (== 456?), event_info=%p\n",
|
|
|
|
(long)data, event_info);
|
|
|
|
}
|
|
|
|
|
2010-09-10 17:52:33 -07:00
|
|
|
static void
|
2010-12-06 04:46:02 -08:00
|
|
|
_tt_text_replace(void *data __UNUSED__,
|
|
|
|
Evas_Object *obj,
|
|
|
|
void *event_info __UNUSED__)
|
2010-09-10 17:52:33 -07:00
|
|
|
{
|
|
|
|
static int count = 0;
|
|
|
|
char buf[64];
|
|
|
|
snprintf(buf, sizeof(buf), "count=%d", count);
|
|
|
|
count++;
|
|
|
|
elm_object_tooltip_text_set(obj, buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-12-06 04:46:02 -08:00
|
|
|
_tt_timer_del(void *data __UNUSED__,
|
|
|
|
Evas *e __UNUSED__,
|
|
|
|
Evas_Object *obj,
|
|
|
|
void *event_info __UNUSED__)
|
2010-09-10 17:52:33 -07:00
|
|
|
{
|
|
|
|
Ecore_Timer *timer = evas_object_data_del(obj, "test-timer");
|
|
|
|
if (!timer) return;
|
|
|
|
ecore_timer_del(timer);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_tt_text_replace_timer_cb(void *data)
|
|
|
|
{
|
|
|
|
_tt_text_replace(NULL, data, NULL);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-12-06 04:46:02 -08:00
|
|
|
_tt_text_replace_timed(void *data __UNUSED__,
|
|
|
|
Evas_Object *obj,
|
|
|
|
void *event_info __UNUSED__)
|
2010-09-10 17:52:33 -07:00
|
|
|
{
|
|
|
|
Ecore_Timer *timer = evas_object_data_get(obj, "test-timer");
|
|
|
|
if (timer)
|
|
|
|
{
|
|
|
|
ecore_timer_del(timer);
|
|
|
|
evas_object_data_del(obj, "test-timer");
|
2011-06-29 00:11:54 -07:00
|
|
|
elm_object_text_set(obj, "Simple text tooltip, click to start"
|
2010-12-06 04:46:02 -08:00
|
|
|
" changed timed");
|
2010-09-10 17:52:33 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
timer = ecore_timer_add(1.5, _tt_text_replace_timer_cb, obj);
|
|
|
|
evas_object_data_set(obj, "test-timer", timer);
|
2011-06-29 00:11:54 -07:00
|
|
|
elm_object_text_set(obj, "Simple text tooltip, click to stop changed"
|
2010-12-06 04:46:02 -08:00
|
|
|
" timed");
|
2010-09-10 17:52:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static Evas_Object *
|
2010-12-06 04:46:02 -08:00
|
|
|
_tt_icon(void *data __UNUSED__,
|
2011-07-26 02:38:23 -07:00
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
Evas_Object *tt)
|
2010-09-10 17:52:33 -07:00
|
|
|
{
|
2011-07-26 02:38:23 -07:00
|
|
|
Evas_Object *ic = elm_icon_add(tt);
|
2010-09-10 17:52:33 -07:00
|
|
|
char buf[PATH_MAX];
|
2010-12-06 04:46:02 -08:00
|
|
|
snprintf(buf, sizeof(buf), "%s/images/logo_small.png",
|
2011-08-25 03:01:59 -07:00
|
|
|
elm_app_data_dir_get());
|
2010-09-10 17:52:33 -07:00
|
|
|
elm_icon_file_set(ic, buf, NULL);
|
|
|
|
elm_icon_scale_set(ic, 0, 0);
|
|
|
|
evas_object_resize(ic, 64, 64);
|
|
|
|
return ic;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Evas_Object *
|
2010-12-06 04:46:02 -08:00
|
|
|
_tt_icon2(void *data __UNUSED__,
|
2011-07-26 02:38:23 -07:00
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
Evas_Object *tt)
|
2010-09-10 17:52:33 -07:00
|
|
|
{
|
2011-07-26 02:38:23 -07:00
|
|
|
Evas_Object *ic = elm_icon_add(tt);
|
2010-09-10 17:52:33 -07:00
|
|
|
char buf[PATH_MAX];
|
2011-08-25 03:01:59 -07:00
|
|
|
snprintf(buf, sizeof(buf), "%s/images/icon_00.png", elm_app_data_dir_get());
|
2010-09-10 17:52:33 -07:00
|
|
|
elm_icon_file_set(ic, buf, NULL);
|
|
|
|
elm_icon_scale_set(ic, 0, 0);
|
|
|
|
evas_object_resize(ic, 64, 64);
|
|
|
|
return ic;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-12-06 04:46:02 -08:00
|
|
|
_tt_icon_del(void *data,
|
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
void *event_info)
|
2010-09-10 17:52:33 -07:00
|
|
|
{
|
|
|
|
// test to check for del_cb behavior!
|
|
|
|
printf("_tt_icon_del: data=%ld (== 123?), event_info=%p\n",
|
|
|
|
(long)data, event_info);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_tt_icon_replace_timer_cb(void *data)
|
|
|
|
{
|
|
|
|
static int current = 0;
|
|
|
|
|
|
|
|
elm_object_tooltip_content_cb_set
|
|
|
|
(data, current ? _tt_icon2 : _tt_icon, NULL, NULL);
|
|
|
|
|
|
|
|
current = !current;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-12-06 04:46:02 -08:00
|
|
|
_tt_icon_replace_timed(void *data __UNUSED__,
|
|
|
|
Evas_Object *obj,
|
|
|
|
void *event_info __UNUSED__)
|
2010-09-10 17:52:33 -07:00
|
|
|
{
|
|
|
|
Ecore_Timer *timer = evas_object_data_get(obj, "test-timer");
|
|
|
|
if (timer)
|
|
|
|
{
|
|
|
|
ecore_timer_del(timer);
|
|
|
|
evas_object_data_del(obj, "test-timer");
|
2011-06-29 00:11:54 -07:00
|
|
|
elm_object_text_set(obj, "Icon tooltip, click to start changed"
|
2010-12-06 04:46:02 -08:00
|
|
|
" timed");
|
2010-09-10 17:52:33 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
timer = ecore_timer_add(1.5, _tt_icon_replace_timer_cb, obj);
|
|
|
|
evas_object_data_set(obj, "test-timer", timer);
|
2011-06-29 00:11:54 -07:00
|
|
|
elm_object_text_set(obj, "Icon tooltip, click to stop changed timed");
|
2010-09-10 17:52:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_tt_style_replace_timer_cb(void *data)
|
|
|
|
{
|
|
|
|
static int current = 0;
|
|
|
|
elm_object_tooltip_style_set(data, current ? NULL : "transparent");
|
|
|
|
current = !current;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-12-06 04:46:02 -08:00
|
|
|
_tt_style_replace_timed(void *data __UNUSED__,
|
|
|
|
Evas_Object *obj,
|
|
|
|
void *event_info __UNUSED__)
|
2010-09-10 17:52:33 -07:00
|
|
|
{
|
|
|
|
Ecore_Timer *timer = evas_object_data_get(obj, "test-timer");
|
|
|
|
if (timer)
|
|
|
|
{
|
|
|
|
ecore_timer_del(timer);
|
|
|
|
evas_object_data_del(obj, "test-timer");
|
2011-06-29 00:11:54 -07:00
|
|
|
elm_object_text_set(obj, "Icon tooltip style, click to start"
|
2010-12-06 04:46:02 -08:00
|
|
|
" changed timed");
|
2010-09-10 17:52:33 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
timer = ecore_timer_add(1.5, _tt_style_replace_timer_cb, obj);
|
|
|
|
evas_object_data_set(obj, "test-timer", timer);
|
2011-06-29 00:11:54 -07:00
|
|
|
elm_object_text_set(obj, "Icon tooltip style, click to stop changed"
|
2010-12-06 04:46:02 -08:00
|
|
|
" timed");
|
2010-09-10 17:52:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-12-06 04:46:02 -08:00
|
|
|
_tt_visible_lock_toggle(void *data __UNUSED__,
|
|
|
|
Evas_Object *obj,
|
|
|
|
void *event_info __UNUSED__)
|
2010-09-10 17:52:33 -07:00
|
|
|
{
|
|
|
|
static int locked = 0;
|
|
|
|
|
|
|
|
locked = !locked;
|
|
|
|
if (locked)
|
|
|
|
{
|
2011-06-29 00:11:54 -07:00
|
|
|
elm_object_text_set(obj, "Locked tooltip visibility");
|
2010-12-06 04:46:02 -08:00
|
|
|
elm_object_tooltip_text_set(obj, "This tooltip is locked"
|
2011-12-08 04:39:18 -08:00
|
|
|
" visible,<br/> click the button"
|
2010-12-06 04:46:02 -08:00
|
|
|
" to unlock!");
|
2010-09-10 17:52:33 -07:00
|
|
|
elm_object_tooltip_show(obj);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-06-29 00:11:54 -07:00
|
|
|
elm_object_text_set(obj, "Unlocked tooltip visibility");
|
2010-12-06 04:46:02 -08:00
|
|
|
elm_object_tooltip_text_set(obj, "This tooltip is unlocked"
|
2011-12-08 04:39:18 -08:00
|
|
|
" visible,<br/> click the button"
|
2010-12-06 04:46:02 -08:00
|
|
|
" to lock!");
|
2010-09-10 17:52:33 -07:00
|
|
|
elm_object_tooltip_hide(obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-12-06 04:46:02 -08:00
|
|
|
test_tooltip(void *data __UNUSED__,
|
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
void *event_info __UNUSED__)
|
2010-09-10 17:52:33 -07:00
|
|
|
{
|
2010-10-20 10:41:31 -07:00
|
|
|
Evas_Object *win, *bg, *bx, *tb, *bt, *se, *lst;
|
2011-11-29 21:10:23 -08:00
|
|
|
Elm_Object_Item *tb_it;
|
2012-01-11 19:03:56 -08:00
|
|
|
Elm_Object_Item *lit;
|
2010-09-10 17:52:33 -07:00
|
|
|
|
|
|
|
win = elm_win_add(NULL, "tooltip", ELM_WIN_BASIC);
|
|
|
|
elm_win_title_set(win, "Tooltip");
|
2011-07-25 07:22:19 -07:00
|
|
|
elm_win_autodel_set(win, EINA_TRUE);
|
2010-09-10 17:52:33 -07:00
|
|
|
|
|
|
|
bg = elm_bg_add(win);
|
|
|
|
elm_win_resize_object_add(win, bg);
|
2010-12-06 04:46:02 -08:00
|
|
|
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND,
|
|
|
|
EVAS_HINT_EXPAND);
|
2010-09-10 17:52:33 -07:00
|
|
|
evas_object_show(bg);
|
|
|
|
|
|
|
|
bx = elm_box_add(win);
|
2010-12-06 04:46:02 -08:00
|
|
|
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND,
|
|
|
|
EVAS_HINT_EXPAND);
|
2010-09-10 17:52:33 -07:00
|
|
|
elm_win_resize_object_add(win, bx);
|
|
|
|
evas_object_show(bx);
|
|
|
|
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
tb = elm_toolbar_add(win);
|
2011-05-03 21:53:39 -07:00
|
|
|
elm_toolbar_homogeneous_set(tb, 0);
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, 0.0);
|
|
|
|
evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0);
|
|
|
|
elm_box_pack_end(bx, tb);
|
|
|
|
evas_object_show(tb);
|
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
tb_it = elm_toolbar_item_append(tb, NULL, "Open", NULL, NULL);
|
2012-01-12 00:25:12 -08:00
|
|
|
elm_object_item_tooltip_text_set(tb_it, "Opens a file");
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
|
2011-11-29 21:10:23 -08:00
|
|
|
tb_it = elm_toolbar_item_append(tb, NULL, "Icon", NULL, NULL);
|
2012-01-12 00:25:12 -08:00
|
|
|
elm_object_item_tooltip_content_cb_set
|
2011-11-29 21:10:23 -08:00
|
|
|
(tb_it, _tt_item_icon, (void *)456L, _tt_item_icon_del);
|
2012-01-12 00:25:12 -08:00
|
|
|
elm_object_item_tooltip_style_set(tb_it, "transparent");
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
|
2010-09-10 17:52:33 -07:00
|
|
|
bt = elm_button_add(win);
|
2011-06-29 00:11:54 -07:00
|
|
|
elm_object_text_set(bt, "Simple text tooltip");
|
2010-09-10 17:52:33 -07:00
|
|
|
elm_object_tooltip_text_set(bt, "Simple text tooltip");
|
|
|
|
elm_box_pack_end(bx, bt);
|
|
|
|
evas_object_show(bt);
|
|
|
|
|
|
|
|
bt = elm_button_add(win);
|
2011-06-29 00:11:54 -07:00
|
|
|
elm_object_text_set(bt, "Simple text tooltip, click to change");
|
2010-09-10 17:52:33 -07:00
|
|
|
elm_object_tooltip_text_set(bt, "Initial");
|
|
|
|
evas_object_smart_callback_add(bt, "clicked", _tt_text_replace, NULL);
|
|
|
|
elm_box_pack_end(bx, bt);
|
|
|
|
evas_object_show(bt);
|
|
|
|
|
|
|
|
bt = elm_button_add(win);
|
2011-06-29 00:11:54 -07:00
|
|
|
elm_object_text_set(bt, "Simple text tooltip, click to start"
|
2010-12-06 04:46:02 -08:00
|
|
|
" changed timed");
|
2010-09-10 17:52:33 -07:00
|
|
|
elm_object_tooltip_text_set(bt, "Initial");
|
2010-12-06 04:46:02 -08:00
|
|
|
evas_object_smart_callback_add(bt, "clicked", _tt_text_replace_timed,
|
|
|
|
NULL);
|
2010-09-10 17:52:33 -07:00
|
|
|
elm_box_pack_end(bx, bt);
|
|
|
|
evas_object_show(bt);
|
2010-12-06 04:46:02 -08:00
|
|
|
evas_object_event_callback_add(bt, EVAS_CALLBACK_DEL, _tt_timer_del,
|
|
|
|
NULL);
|
2010-09-10 17:52:33 -07:00
|
|
|
|
|
|
|
bt = elm_button_add(win);
|
2011-06-29 00:11:54 -07:00
|
|
|
elm_object_text_set(bt, "Icon tooltip");
|
2010-12-06 04:46:02 -08:00
|
|
|
elm_object_tooltip_content_cb_set(bt, _tt_icon, (void *)123L,
|
|
|
|
_tt_icon_del);
|
2010-09-10 17:52:33 -07:00
|
|
|
elm_box_pack_end(bx, bt);
|
|
|
|
evas_object_show(bt);
|
|
|
|
|
|
|
|
bt = elm_button_add(win);
|
2011-06-29 00:11:54 -07:00
|
|
|
elm_object_text_set(bt, "Icon tooltip, click to start changed timed");
|
2010-09-10 17:52:33 -07:00
|
|
|
elm_object_tooltip_content_cb_set(bt, _tt_icon, NULL, NULL);
|
2010-12-06 04:46:02 -08:00
|
|
|
evas_object_smart_callback_add(bt, "clicked", _tt_icon_replace_timed,
|
|
|
|
NULL);
|
2010-09-10 17:52:33 -07:00
|
|
|
elm_box_pack_end(bx, bt);
|
|
|
|
evas_object_show(bt);
|
2010-12-06 04:46:02 -08:00
|
|
|
evas_object_event_callback_add(bt, EVAS_CALLBACK_DEL, _tt_timer_del,
|
|
|
|
NULL);
|
2010-09-10 17:52:33 -07:00
|
|
|
|
|
|
|
bt = elm_button_add(win);
|
2011-06-29 00:11:54 -07:00
|
|
|
elm_object_text_set(bt, "Transparent Icon tooltip");
|
2010-09-10 17:52:33 -07:00
|
|
|
elm_object_tooltip_content_cb_set(bt, _tt_icon, NULL, NULL);
|
|
|
|
elm_object_tooltip_style_set(bt, "transparent");
|
|
|
|
elm_box_pack_end(bx, bt);
|
|
|
|
evas_object_show(bt);
|
|
|
|
|
|
|
|
bt = elm_button_add(win);
|
2011-06-29 00:11:54 -07:00
|
|
|
elm_object_text_set(bt, "Icon tooltip style, click to start changed"
|
2010-12-06 04:46:02 -08:00
|
|
|
" timed");
|
2010-09-10 17:52:33 -07:00
|
|
|
elm_object_tooltip_content_cb_set(bt, _tt_icon, NULL, NULL);
|
2010-12-06 04:46:02 -08:00
|
|
|
evas_object_smart_callback_add(bt, "clicked", _tt_style_replace_timed,
|
|
|
|
NULL);
|
2010-09-10 17:52:33 -07:00
|
|
|
elm_box_pack_end(bx, bt);
|
|
|
|
evas_object_show(bt);
|
2010-12-06 04:46:02 -08:00
|
|
|
evas_object_event_callback_add(bt, EVAS_CALLBACK_DEL, _tt_timer_del,
|
|
|
|
NULL);
|
2010-09-10 17:52:33 -07:00
|
|
|
|
|
|
|
bt = elm_button_add(win);
|
2011-06-29 00:11:54 -07:00
|
|
|
elm_object_text_set(bt, "Unlocked tooltip visibility");
|
2011-12-08 04:39:18 -08:00
|
|
|
elm_object_tooltip_text_set(bt, "This tooltip is unlocked visible,<br/>"
|
2010-12-06 04:46:02 -08:00
|
|
|
" click the button to lock!");
|
|
|
|
evas_object_smart_callback_add(bt, "clicked", _tt_visible_lock_toggle,
|
|
|
|
NULL);
|
2010-09-10 17:52:33 -07:00
|
|
|
elm_box_pack_end(bx, bt);
|
|
|
|
evas_object_show(bt);
|
|
|
|
|
2011-06-17 02:44:31 -07:00
|
|
|
se = elm_entry_add(win);
|
|
|
|
elm_entry_scrollable_set(se, EINA_TRUE);
|
elm_smart_scroller now propagates the events, fixes tooltips in scrolled stuff.
The els_scroller.c:_smart_add() as disabling event propagation on
itself, that way an owner object (ie: elm_scroller,
elm_scrolled_entry, elm_list, ...) was not getting the mouse events it
gets, thus any evas_object_event_callback_add(..., EVAS_CALLBACK_MOUSE_*...)
were not working (effectively breaking tooltips).
Seems that the reason to do so was double-event reporting. It could
happen as the elm_smart_scroller has an event_obj that repeats event,
thus the object behind it, the edje_object, could get and possibly
repeat them as well.
As we are sure event_obj always get the events, but not sure of the
edje, as it depend on user contents, the logic is now changed to stop
propagation of the edje instead (it still processes the events! just
not propagates to elm_smart_scroller).
I hope this patch does not break anything, but please check your software!
SVN revision: 52350
2010-09-16 14:33:10 -07:00
|
|
|
evas_object_size_hint_weight_set(se, EVAS_HINT_EXPAND, 0.0);
|
|
|
|
evas_object_size_hint_align_set(se, EVAS_HINT_FILL, 0.5);
|
2011-06-17 02:44:31 -07:00
|
|
|
elm_entry_scrollbar_policy_set(se, ELM_SCROLLER_POLICY_OFF,
|
2010-12-06 04:46:02 -08:00
|
|
|
ELM_SCROLLER_POLICY_OFF);
|
2011-12-30 02:02:19 -08:00
|
|
|
elm_object_text_set(se, "Hello, some scrolled entry here!");
|
elm_smart_scroller now propagates the events, fixes tooltips in scrolled stuff.
The els_scroller.c:_smart_add() as disabling event propagation on
itself, that way an owner object (ie: elm_scroller,
elm_scrolled_entry, elm_list, ...) was not getting the mouse events it
gets, thus any evas_object_event_callback_add(..., EVAS_CALLBACK_MOUSE_*...)
were not working (effectively breaking tooltips).
Seems that the reason to do so was double-event reporting. It could
happen as the elm_smart_scroller has an event_obj that repeats event,
thus the object behind it, the edje_object, could get and possibly
repeat them as well.
As we are sure event_obj always get the events, but not sure of the
edje, as it depend on user contents, the logic is now changed to stop
propagation of the edje instead (it still processes the events! just
not propagates to elm_smart_scroller).
I hope this patch does not break anything, but please check your software!
SVN revision: 52350
2010-09-16 14:33:10 -07:00
|
|
|
elm_object_tooltip_text_set(se, "Type something here!");
|
2011-06-17 02:44:31 -07:00
|
|
|
elm_entry_single_line_set(se, 1);
|
elm_smart_scroller now propagates the events, fixes tooltips in scrolled stuff.
The els_scroller.c:_smart_add() as disabling event propagation on
itself, that way an owner object (ie: elm_scroller,
elm_scrolled_entry, elm_list, ...) was not getting the mouse events it
gets, thus any evas_object_event_callback_add(..., EVAS_CALLBACK_MOUSE_*...)
were not working (effectively breaking tooltips).
Seems that the reason to do so was double-event reporting. It could
happen as the elm_smart_scroller has an event_obj that repeats event,
thus the object behind it, the edje_object, could get and possibly
repeat them as well.
As we are sure event_obj always get the events, but not sure of the
edje, as it depend on user contents, the logic is now changed to stop
propagation of the edje instead (it still processes the events! just
not propagates to elm_smart_scroller).
I hope this patch does not break anything, but please check your software!
SVN revision: 52350
2010-09-16 14:33:10 -07:00
|
|
|
elm_box_pack_end(bx, se);
|
|
|
|
evas_object_show(se);
|
|
|
|
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
lst = elm_list_add(win);
|
2012-01-11 19:03:56 -08:00
|
|
|
lit = elm_list_item_append(lst, "Hello", NULL, NULL, NULL, NULL);
|
2012-01-11 23:51:15 -08:00
|
|
|
elm_object_item_tooltip_content_cb_set(lit, _tt_item_label, NULL, NULL);
|
|
|
|
elm_object_item_tooltip_window_mode_set(lit, EINA_TRUE);
|
2012-01-11 19:03:56 -08:00
|
|
|
lit = elm_list_item_append(lst, "Icon Tooltip", NULL, NULL, NULL, NULL);
|
2012-01-11 23:51:15 -08:00
|
|
|
elm_object_item_tooltip_content_cb_set(lit, _tt_item_icon, NULL, NULL);
|
2012-01-11 19:03:56 -08:00
|
|
|
lit = elm_list_item_append(lst, "Big Icon Tooltip", NULL, NULL, NULL, NULL);
|
2012-01-11 23:51:15 -08:00
|
|
|
elm_object_item_tooltip_content_cb_set(lit, _tt_item_icon2, NULL, NULL);
|
|
|
|
elm_object_item_tooltip_style_set(lit, "transparent");
|
|
|
|
elm_object_item_tooltip_window_mode_set(lit, EINA_TRUE);
|
2012-01-11 19:03:56 -08:00
|
|
|
lit = elm_list_item_append(lst, "Insanely Big Icon Tooltip", NULL, NULL, NULL, NULL);
|
2012-01-11 23:51:15 -08:00
|
|
|
elm_object_item_tooltip_content_cb_set(lit, _tt_item_icon3, NULL, NULL);
|
|
|
|
elm_object_item_tooltip_style_set(lit, "transparent");
|
|
|
|
elm_object_item_tooltip_window_mode_set(lit, EINA_TRUE);
|
2010-12-06 04:46:02 -08:00
|
|
|
evas_object_size_hint_weight_set(lst, EVAS_HINT_EXPAND,
|
|
|
|
EVAS_HINT_EXPAND);
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
evas_object_size_hint_align_set(lst, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
evas_object_size_hint_min_set(lst, 100, 100);
|
|
|
|
elm_list_go(lst);
|
|
|
|
elm_box_pack_end(bx, lst);
|
|
|
|
evas_object_show(lst);
|
2010-09-10 17:52:33 -07:00
|
|
|
|
2010-10-20 10:41:31 -07:00
|
|
|
evas_object_resize(win, 320, 580);
|
|
|
|
evas_object_show(win);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-12-06 04:46:02 -08:00
|
|
|
test_tooltip2(void *data __UNUSED__,
|
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
void *event_info __UNUSED__)
|
2010-10-20 10:41:31 -07:00
|
|
|
{
|
|
|
|
Evas_Object *win, *bg, *bx, *grid, *gl;
|
2012-01-19 21:18:31 -08:00
|
|
|
Elm_Object_Item *glit1, *glit2, *glit3;
|
2010-10-20 10:41:31 -07:00
|
|
|
static Testitem ti[144];
|
|
|
|
int i, n;
|
|
|
|
char buf[PATH_MAX];
|
|
|
|
const char *img[9] =
|
2010-12-06 04:46:02 -08:00
|
|
|
{
|
|
|
|
"panel_01.jpg",
|
|
|
|
"plant_01.jpg",
|
|
|
|
"rock_01.jpg",
|
|
|
|
"rock_02.jpg",
|
|
|
|
"sky_01.jpg",
|
|
|
|
"sky_02.jpg",
|
|
|
|
"sky_03.jpg",
|
|
|
|
"sky_04.jpg",
|
|
|
|
"wood_01.jpg",
|
|
|
|
};
|
2010-10-20 10:41:31 -07:00
|
|
|
|
|
|
|
win = elm_win_add(NULL, "tooltip2", ELM_WIN_BASIC);
|
|
|
|
elm_win_title_set(win, "Tooltip 2");
|
2011-07-25 07:22:19 -07:00
|
|
|
elm_win_autodel_set(win, EINA_TRUE);
|
2010-10-20 10:41:31 -07:00
|
|
|
|
|
|
|
bg = elm_bg_add(win);
|
2010-12-06 04:46:02 -08:00
|
|
|
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND,
|
|
|
|
EVAS_HINT_EXPAND);
|
2010-10-20 10:41:31 -07:00
|
|
|
elm_win_resize_object_add(win, bg);
|
|
|
|
evas_object_show(bg);
|
|
|
|
|
|
|
|
bx = elm_box_add(win);
|
2010-12-06 04:46:02 -08:00
|
|
|
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND,
|
|
|
|
EVAS_HINT_EXPAND);
|
2010-10-20 10:41:31 -07:00
|
|
|
elm_win_resize_object_add(win, bx);
|
|
|
|
evas_object_show(bx);
|
|
|
|
|
|
|
|
grid = elm_gengrid_add(win);
|
|
|
|
elm_gengrid_item_size_set(grid, 100, 100);
|
|
|
|
elm_gengrid_horizontal_set(grid, EINA_FALSE);
|
|
|
|
elm_gengrid_multi_select_set(grid, EINA_TRUE);
|
|
|
|
evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2010-12-06 04:46:02 -08:00
|
|
|
evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND,
|
|
|
|
EVAS_HINT_EXPAND);
|
2010-10-20 10:41:31 -07:00
|
|
|
|
|
|
|
gic.item_style = "default";
|
2011-11-30 22:15:08 -08:00
|
|
|
gic.func.text_get = grdt_lbl_get;
|
2011-10-23 19:10:35 -07:00
|
|
|
gic.func.content_get = grdt_content_get;
|
2010-10-20 10:41:31 -07:00
|
|
|
|
|
|
|
n = 0;
|
|
|
|
for (i = 0; i < 9; i++)
|
|
|
|
{
|
2011-08-25 03:01:59 -07:00
|
|
|
snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(),
|
2010-12-06 04:46:02 -08:00
|
|
|
img[n]);
|
|
|
|
n++;
|
|
|
|
ti[i].mode = i;
|
|
|
|
ti[i].path = eina_stringshare_add(buf);
|
|
|
|
ti[i].item = elm_gengrid_item_append(grid, &gic, &(ti[i]), NULL,
|
|
|
|
NULL);
|
|
|
|
if (n % 2)
|
|
|
|
elm_gengrid_item_tooltip_text_set(ti[i].item, "Testing X");
|
|
|
|
else
|
|
|
|
elm_gengrid_item_tooltip_text_set(ti[i].item, "Testing Y");
|
|
|
|
if (!(i % 5))
|
2011-11-30 06:19:29 -08:00
|
|
|
elm_gengrid_item_selected_set(ti[i].item, EINA_TRUE);
|
2010-10-20 10:41:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
elm_box_pack_end(bx, grid);
|
|
|
|
evas_object_show(grid);
|
|
|
|
|
2010-09-27 11:18:37 -07:00
|
|
|
gl = elm_genlist_add(win);
|
|
|
|
evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2010-12-06 04:46:02 -08:00
|
|
|
evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND,
|
|
|
|
EVAS_HINT_EXPAND);
|
2010-09-27 11:18:37 -07:00
|
|
|
|
2010-12-06 04:46:02 -08:00
|
|
|
itct.item_style = "default";
|
2011-11-30 22:15:08 -08:00
|
|
|
itct.func.text_get = gltt_text_get;
|
2010-09-27 11:18:37 -07:00
|
|
|
|
2012-01-19 21:18:31 -08:00
|
|
|
glit1 = elm_genlist_item_append(gl, &itct, (void *)1, NULL,
|
|
|
|
ELM_GENLIST_ITEM_SUBITEMS, NULL, NULL);
|
|
|
|
glit2 = elm_genlist_item_append(gl, &itct, (void *)2, NULL,
|
|
|
|
ELM_GENLIST_ITEM_SUBITEMS, NULL, NULL);
|
|
|
|
glit3 = elm_genlist_item_append(gl, &itct, (void *)3, NULL,
|
|
|
|
ELM_GENLIST_ITEM_NONE, NULL, NULL);
|
2010-09-27 11:18:37 -07:00
|
|
|
|
2012-01-19 21:18:31 -08:00
|
|
|
elm_genlist_item_tooltip_text_set(glit1, "Testing 1");
|
|
|
|
elm_genlist_item_tooltip_text_set(glit2, "Testing 2");
|
|
|
|
elm_genlist_item_tooltip_text_set(glit3, "Testing 3");
|
2010-09-27 11:18:37 -07:00
|
|
|
|
|
|
|
evas_object_smart_callback_add(gl, "expand,request", gltt_exp_req, gl);
|
2010-12-06 04:46:02 -08:00
|
|
|
evas_object_smart_callback_add(gl, "contract,request", gltt_con_req,
|
|
|
|
gl);
|
2010-09-27 11:18:37 -07:00
|
|
|
evas_object_smart_callback_add(gl, "expanded", gltt_exp, gl);
|
|
|
|
evas_object_smart_callback_add(gl, "contracted", gltt_con, gl);
|
|
|
|
|
|
|
|
elm_box_pack_end(bx, gl);
|
|
|
|
evas_object_show(gl);
|
|
|
|
|
2010-10-20 10:41:31 -07:00
|
|
|
evas_object_resize(win, 320, 480);
|
2010-09-10 17:52:33 -07:00
|
|
|
evas_object_show(win);
|
|
|
|
}
|
2010-12-06 04:46:02 -08:00
|
|
|
|
2010-09-10 17:52:33 -07:00
|
|
|
#endif
|