mm.... new widget options/modes for win... u can put a window..

INLINED in another window. :) it's an image object. have fun!



SVN revision: 58657
This commit is contained in:
Carsten Haitzler 2011-04-14 10:48:43 +00:00
parent b4968b3572
commit 315dc93196
10 changed files with 621 additions and 145 deletions

View File

@ -42,6 +42,7 @@ icon_23.png \
bubble.png \
bubble_sh.png \
mystrale.jpg \
mystrale_2.jpg
mystrale_2.jpg \
pt.png
EXTRA_DIST = $(files_DATA)

Binary file not shown.

After

Width:  |  Height:  |  Size: 875 B

View File

@ -95,7 +95,8 @@ test_colorselector.c \
test_ctxpopup.c \
test_bubble.c \
test_segment_control.c \
test_store.c
test_store.c \
test_win_inline.c
elementary_test_LDADD = $(top_builddir)/src/lib/libelementary.la \
@ELEMENTARY_EWEATHER_LIBS@ \

View File

@ -122,6 +122,7 @@ void test_ctxpopup(void *data, Evas_Object *obj, void *event_info);
void test_bubble(void *data, Evas_Object *obj, void *event_info);
void test_segment_control(void *data, Evas_Object *obj, void *event_info);
void test_store(void *data, Evas_Object *obj, void *event_info);
void test_win_inline(void *data, Evas_Object *obj, void *event_info);
struct elm_test
{
@ -376,6 +377,7 @@ my_win_main(char *autorun)
ADD_TEST("Bubble", test_bubble);
ADD_TEST("Segment Control", test_segment_control);
ADD_TEST("Store", test_store);
ADD_TEST("Window Inline", test_win_inline);
#undef ADD_TEST
if (autorun)

View File

@ -0,0 +1,226 @@
#include <Elementary.h>
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif
#ifndef ELM_LIB_QUICKLAUNCH
static void
fill(Evas_Object *win, Eina_Bool do_bg)
{
Evas_Object *bg, *sc, *bx, *ic, *bb, *av;
char buf[PATH_MAX];
if (do_bg)
{
bg = elm_bg_add(win);
elm_win_resize_object_add(win, bg);
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(bg);
}
sc = elm_scroller_add(win);
evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, sc);
bx = elm_box_add(win);
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
ic = elm_icon_add(win);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
elm_icon_file_set(ic, buf, NULL);
elm_icon_scale_set(ic, 0, 0);
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
bb = elm_bubble_add(win);
elm_bubble_label_set(bb, "Message 3");
elm_bubble_info_set(bb, "10:32 4/11/2008");
elm_bubble_icon_set(bb, ic);
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);
elm_anchorblock_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.");
elm_bubble_content_set(bb, av);
evas_object_show(av);
elm_box_pack_end(bx, bb);
evas_object_show(bb);
ic = elm_icon_add(win);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
elm_icon_file_set(ic, buf, NULL);
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
bb = elm_bubble_add(win);
elm_bubble_label_set(bb, "Message 2");
elm_bubble_info_set(bb, "7:16 27/10/2008");
elm_bubble_icon_set(bb, ic);
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);
elm_anchorblock_text_set(av,
"Hey what are you doing? This is the second last message "
"Hi there. This is the most recent message in the "
"list. It's a longer one so it can wrap more and "
"contains a <a href=contact:john>John</a> contact "
"link in it to test popups on links. The idea is that "
"all SMS's are scanned for things that look like phone "
"numbers or names that are in your contacts list, and "
"if they are, they become clickable links that pop up "
"a menus of obvious actions to perform on this piece "
"of information. This of course can be later explicitly "
"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>");
elm_bubble_content_set(bb, av);
evas_object_show(av);
elm_box_pack_end(bx, bb);
evas_object_show(bb);
ic = elm_icon_add(win);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
elm_icon_file_set(ic, buf, NULL);
elm_icon_scale_set(ic, 0, 0);
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
bb = elm_bubble_add(win);
elm_bubble_label_set(bb, "Message 1");
elm_bubble_info_set(bb, "20:47 18/6/2008");
elm_bubble_icon_set(bb, ic);
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);
elm_anchorblock_text_set(av, "This is a short message. <item relsize=16x16 vsize=full href=emoticon/haha></item>");
elm_bubble_content_set(bb, av);
evas_object_show(av);
elm_box_pack_end(bx, bb);
evas_object_show(bb);
elm_scroller_content_set(sc, bx);
evas_object_show(bx);
evas_object_show(sc);
}
static void
cb_mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Move *ev = event_info;
Evas_Object *orig = data;
Evas_Coord x, y;
Evas_Map *p;
int i, w, h;
if (!ev->buttons) return;
evas_object_geometry_get(obj, &x, &y, NULL, NULL);
evas_object_move(obj,
x + (ev->cur.output.x - ev->prev.output.x),
y + (ev->cur.output.y - ev->prev.output.y));
evas_object_image_size_get(orig, &w, &h);
p = evas_map_new(4);
evas_object_map_enable_set(orig, EINA_TRUE);
evas_object_raise(orig);
for (i = 0; i < 4; i++)
{
Evas_Object *hand;
char key[32];
snprintf(key, sizeof(key), "h-%i\n", i);
hand = evas_object_data_get(orig, key);
evas_object_raise(hand);
evas_object_geometry_get(hand, &x, &y, NULL, NULL);
x += 15;
y += 15;
evas_map_point_coord_set(p, i, x, y, 0);
if (i == 0) evas_map_point_image_uv_set(p, i, 0, 0);
else if (i == 1) evas_map_point_image_uv_set(p, i, w, 0);
else if (i == 2) evas_map_point_image_uv_set(p, i, w, h);
else if (i == 3) evas_map_point_image_uv_set(p, i, 0, h);
}
evas_object_map_set(orig, p);
evas_map_free(p);
}
static void
create_handles(Evas_Object *obj)
{
int i;
Evas_Coord x, y, w, h;
evas_object_geometry_get(obj, &x, &y, &w, &h);
for (i = 0; i < 4; i++)
{
Evas_Object *hand;
char buf[PATH_MAX];
char key[32];
hand = evas_object_image_filled_add(evas_object_evas_get(obj));
evas_object_resize(hand, 31, 31);
snprintf(buf, sizeof(buf), "%s/images/pt.png", PACKAGE_DATA_DIR);
evas_object_image_file_set(hand, buf, NULL);
if (i == 0) evas_object_move(hand, x - 15, y - 15);
else if (i == 1) evas_object_move(hand, x + w - 15, y - 15);
else if (i == 2) evas_object_move(hand, x + w - 15, y + h - 15);
else if (i == 3) evas_object_move(hand, x - 15, y + h - 15);
evas_object_event_callback_add(hand, EVAS_CALLBACK_MOUSE_MOVE, cb_mouse_move, obj);
evas_object_show(hand);
snprintf(key, sizeof(key), "h-%i\n", i);
evas_object_data_set(obj, key, hand);
}
}
void
test_win_inline(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Evas_Object *win, *bg, *win2, *win3;
char buf[PATH_MAX];
win = elm_win_add(NULL, "window-inline", ELM_WIN_BASIC);
elm_win_title_set(win, "Window Inline");
elm_win_autodel_set(win, 1);
bg = elm_bg_add(win);
snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", PACKAGE_DATA_DIR);
elm_bg_file_set(bg, buf, NULL);
elm_win_resize_object_add(win, bg);
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(bg);
win2 = elm_win_add(win, "inlined", ELM_WIN_INLINED_IMAGE);
fill(win2, EINA_TRUE);
evas_object_move(win2, 20, 60);
evas_object_resize(win2, 300, 200);
// image object for win2 is unlinked to its pos/size - so manual control
// this allows also for using map and other things with it.
evas_object_move(elm_win_inlined_image_object_get(win2), 20, 40);
evas_object_resize(elm_win_inlined_image_object_get(win2), 200, 320);
evas_object_show(win2);
win3 = elm_win_add(win, "inlined", ELM_WIN_INLINED_IMAGE);
elm_win_alpha_set(win3, EINA_TRUE);
fill(win3, EINA_FALSE);
evas_object_resize(win3, 300, 200);
evas_object_move(elm_win_inlined_image_object_get(win3), 80, 180);
evas_object_resize(elm_win_inlined_image_object_get(win3), 300, 200);
evas_object_show(win3);
create_handles(elm_win_inlined_image_object_get(win3));
evas_object_resize(win, 400, 600);
evas_object_show(win);
}
#endif

View File

@ -468,7 +468,11 @@ extern "C" {
ELM_WIN_TOOLTIP,
ELM_WIN_NOTIFICATION,
ELM_WIN_COMBO,
ELM_WIN_DND
ELM_WIN_DND,
ELM_WIN_INLINED, // YYY: not implemented yet
ELM_WIN_INLINED_IMAGE,
ELM_WIN_MEMORY // YYY: not implemented yet
} Elm_Win_Type;
typedef enum _Elm_Win_Keyboard_Mode
@ -544,6 +548,7 @@ extern "C" {
EAPI int elm_win_quickpanel_zone_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
EAPI void elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip); EINA_ARG_NONNULL(1);
EAPI void elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params); EINA_ARG_NONNULL(1);
EAPI Evas_Object *elm_win_inlined_image_object_get(Evas_Object *obj);
EAPI void elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled) EINA_ARG_NONNULL(1);
EAPI Eina_Bool elm_win_focus_highlight_enabled_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
EAPI void elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style) EINA_ARG_NONNULL(1);

View File

@ -410,8 +410,11 @@ Eina_Bool
elm_selection_set(Elm_Sel_Type selection, Evas_Object *widget, Elm_Sel_Format format, const char *selbuf)
{
#ifdef HAVE_ELEMENTARY_X
Evas_Object *top = elm_widget_top_get(widget);
Ecore_X_Window xwin = elm_win_xwindow_get(top);
Cnp_Selection *sel;
if (!xwin) return EINA_FALSE;
if ((unsigned int)selection >= (unsigned int)ELM_SEL_MAX) return EINA_FALSE;
if (!_elm_cnp_init_count) _elm_cnp_init();
if ((!selbuf) && (format != ELM_SEL_FORMAT_IMAGE))
@ -422,7 +425,7 @@ elm_selection_set(Elm_Sel_Type selection, Evas_Object *widget, Elm_Sel_Format fo
sel->active = 1;
sel->widget = widget;
sel->set(elm_win_xwindow_get(widget),&selection,sizeof(Elm_Sel_Type));
sel->set(xwin, &selection, sizeof(Elm_Sel_Type));
sel->format = format;
sel->selbuf = selbuf ? strdup(selbuf) : NULL;

View File

@ -241,31 +241,35 @@ elm_conformant_add(Evas_Object *parent)
elm_widget_resize_object_set(obj, wd->base);
#ifdef HAVE_ELEMENTARY_X
Ecore_X_Window zone, xwin;
int sh = -1;
xwin = elm_win_xwindow_get(parent);
zone = ecore_x_e_illume_zone_get(xwin);
ecore_x_e_illume_indicator_geometry_get(zone, NULL, NULL, NULL, &sh);
if (sh < 0) sh = 0;
wd->shelf = evas_object_rectangle_add(e);
evas_object_color_set(wd->shelf, 0, 0, 0, 0);
evas_object_size_hint_min_set(wd->shelf, -1, sh);
evas_object_size_hint_max_set(wd->shelf, -1, sh);
edje_object_part_swallow(wd->base, "elm.swallow.shelf", wd->shelf);
sh = -1;
ecore_x_e_illume_softkey_geometry_get(zone, NULL, NULL, NULL, &sh);
if (sh < 0) sh = 0;
wd->panel = evas_object_rectangle_add(e);
evas_object_color_set(wd->panel, 0, 0, 0, 0);
evas_object_size_hint_min_set(wd->panel, -1, sh);
evas_object_size_hint_max_set(wd->panel, -1, sh);
edje_object_part_swallow(wd->base, "elm.swallow.panel", wd->panel);
wd->prop_hdl = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY,
_prop_change, obj);
Evas_Object *top = elm_widget_top_get(obj);
Ecore_X_Window zone, xwin = elm_win_xwindow_get(top);
if ((xwin) && (!elm_win_inlined_image_object_get(top)))
{
int sh = -1;
zone = ecore_x_e_illume_zone_get(xwin);
ecore_x_e_illume_indicator_geometry_get(zone, NULL, NULL, NULL, &sh);
if (sh < 0) sh = 0;
wd->shelf = evas_object_rectangle_add(e);
evas_object_color_set(wd->shelf, 0, 0, 0, 0);
evas_object_size_hint_min_set(wd->shelf, -1, sh);
evas_object_size_hint_max_set(wd->shelf, -1, sh);
edje_object_part_swallow(wd->base, "elm.swallow.shelf", wd->shelf);
sh = -1;
ecore_x_e_illume_softkey_geometry_get(zone, NULL, NULL, NULL, &sh);
if (sh < 0) sh = 0;
wd->panel = evas_object_rectangle_add(e);
evas_object_color_set(wd->panel, 0, 0, 0, 0);
evas_object_size_hint_min_set(wd->panel, -1, sh);
evas_object_size_hint_max_set(wd->panel, -1, sh);
edje_object_part_swallow(wd->base, "elm.swallow.panel", wd->panel);
wd->prop_hdl = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY,
_prop_change, obj);
}
// FIXME: get kbd region prop
#endif

View File

@ -503,8 +503,10 @@ _del_hook(Evas_Object *obj)
entries = eina_list_remove(entries, obj);
#ifdef HAVE_ELEMENTARY_X
ecore_event_handler_del(wd->sel_notify_handler);
ecore_event_handler_del(wd->sel_clear_handler);
if (wd->sel_notify_handler)
ecore_event_handler_del(wd->sel_notify_handler);
if (wd->sel_clear_handler)
ecore_event_handler_del(wd->sel_clear_handler);
#endif
if (wd->cut_sel) eina_stringshare_del(wd->cut_sel);
if (wd->text) eina_stringshare_del(wd->text);

View File

@ -21,7 +21,7 @@ struct _Elm_Win
{
Ecore_Evas *ee;
Evas *evas;
Evas_Object *parent, *win_obj;
Evas_Object *parent, *win_obj, *img_obj, *frame_obj;
Eina_List *subobjs;
#ifdef HAVE_ELEMENTARY_X
Ecore_X_Window xwin;
@ -59,7 +59,9 @@ struct _Elm_Win
static const char *widtype = NULL;
static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _elm_win_obj_callback_img_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _elm_win_obj_callback_parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y);
static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj);
static void _elm_win_move(Ecore_Evas *ee);
static void _elm_win_resize(Ecore_Evas *ee);
@ -125,6 +127,13 @@ _elm_win_focus_in(Ecore_Evas *ee)
evas_object_smart_callback_call(win->win_obj, "focus,in", NULL);
win->focus_highlight.cur.visible = EINA_TRUE;
_elm_win_focus_highlight_reconfigure_job_start(win);
if (win->frame_obj)
{
}
else if (win->img_obj)
{
/* do nothing */
}
}
static void
@ -140,6 +149,13 @@ _elm_win_focus_out(Ecore_Evas *ee)
evas_object_smart_callback_call(win->win_obj, "focus,out", NULL);
win->focus_highlight.cur.visible = EINA_FALSE;
_elm_win_focus_highlight_reconfigure_job_start(win);
if (win->frame_obj)
{
}
else if (win->img_obj)
{
/* do nothing */
}
}
static Eina_Bool
@ -216,7 +232,21 @@ _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Objec
}
static void
_elm_win_obj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
_elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Elm_Win *win = data;
if (win->frame_obj)
{
}
else if (win->img_obj)
{
evas_object_hide(win->img_obj);
}
}
static void
_elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
{
Elm_Win *win = data;
Evas_Object *child;
@ -230,8 +260,11 @@ _elm_win_obj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void
if (win->autodel_clear) *(win->autodel_clear) = -1;
_elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
ecore_evas_callback_delete_request_set(win->ee, NULL);
ecore_evas_callback_resize_set(win->ee, NULL);
if (win->ee)
{
ecore_evas_callback_delete_request_set(win->ee, NULL);
ecore_evas_callback_resize_set(win->ee, NULL);
}
if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
while (((child = evas_object_bottom_get(win->evas))) &&
@ -256,9 +289,18 @@ _elm_win_obj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void
// FIXME: we are in the del handler for the object and delete the canvas
// that lives under it from the handler... nasty. deferring doesn't help either
ecore_job_add(_deferred_ecore_evas_free, win->ee);
_elm_win_deferred_free++;
// ecore_evas_free(win->ee);
if (win->img_obj)
{
win->img_obj = NULL;
}
else
{
if (win->ee)
{
ecore_job_add(_deferred_ecore_evas_free, win->ee);
_elm_win_deferred_free++;
}
}
_elm_win_focus_highlight_shutdown(win);
eina_stringshare_del(win->focus_highlight.style);
@ -276,6 +318,16 @@ _elm_win_obj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void
}
}
static void
_elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Elm_Win *win = data;
if (!win->img_obj) return;
evas_object_event_callback_del_full
(win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
evas_object_del(win->img_obj);
}
static void
_elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
@ -284,13 +336,37 @@ _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *ob
}
static void
_elm_win_obj_intercept_show(void *data __UNUSED__, Evas_Object *obj)
_elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
{
Elm_Win *win = data;
if (win->img_obj)
{
win->screen.x = x;
win->screen.y = y;
}
else
{
evas_object_move(obj, x, y);
}
}
static void
_elm_win_obj_intercept_show(void *data, Evas_Object *obj)
{
Elm_Win *win = data;
// this is called to make sure all smart containers have calculated their
// sizes BEFORE we show the window to make sure it initially appears at
// our desired size (ie min size is known first)
evas_smart_objects_calculate(evas_object_evas_get(obj));
evas_object_show(obj);
if (win->frame_obj)
{
}
else if (win->img_obj)
{
evas_object_show(win->img_obj);
}
}
static void
@ -307,6 +383,37 @@ _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, voi
win->screen.y = y;
evas_object_smart_callback_call(win->win_obj, "moved", NULL);
}
if (win->frame_obj)
{
}
else if (win->img_obj)
{
Evas_Coord x, y;
evas_object_geometry_get(obj, &x, &y, NULL, NULL);
win->screen.x = x;
win->screen.y = y;
// evas_object_move(win->img_obj, x, y);
}
}
static void
_elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
Elm_Win *win = data;
if (win->frame_obj)
{
}
else if (win->img_obj)
{
Evas_Coord w = 1, h = 1;
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
if (w < 1) w = 1;
if (h < 1) h = 1;
evas_object_image_size_set(win->img_obj, w, h);
}
}
static void
@ -338,6 +445,12 @@ _elm_win_resize_job(void *data)
win->deferred_resize_job = NULL;
ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
evas_object_resize(win->win_obj, w, h);
if (win->frame_obj)
{
}
else if (win->img_obj)
{
}
EINA_LIST_FOREACH(win->subobjs, l, obj)
{
evas_object_move(obj, 0, 0);
@ -971,89 +1084,137 @@ elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
CRITICAL(engine " engine creation failed. Trying software X11."); \
win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1); \
} while (0)
#define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
{
win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
#ifdef HAVE_ELEMENTARY_X
win->client_message_handler = ecore_event_handler_add
(ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
#endif
}
else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
{
win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
FALLBACK_TRY("Sofware FB");
}
else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
{
win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
FALLBACK_TRY("Sofware DirectFB");
}
else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
{
win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
FALLBACK_TRY("Sofware-16");
#ifdef HAVE_ELEMENTARY_X
win->client_message_handler = ecore_event_handler_add
(ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
#endif
}
else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
{
win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
FALLBACK_TRY("Sofware-8");
#ifdef HAVE_ELEMENTARY_X
win->client_message_handler = ecore_event_handler_add
(ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
#endif
}
else if (ENGINE_COMPARE(ELM_XRENDER_X11))
{
win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
FALLBACK_TRY("XRender");
#ifdef HAVE_ELEMENTARY_X
win->client_message_handler = ecore_event_handler_add
(ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
#endif
}
else if (ENGINE_COMPARE(ELM_OPENGL_X11))
{
win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
FALLBACK_TRY("OpenGL");
#ifdef HAVE_ELEMENTARY_X
win->client_message_handler = ecore_event_handler_add
(ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
#endif
}
else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
{
win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
FALLBACK_TRY("Sofware Win32");
}
else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
{
win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
FALLBACK_TRY("Sofware-16-WinCE");
}
else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
{
win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
FALLBACK_TRY("Sofware SDL");
}
else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
{
win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
FALLBACK_TRY("Sofware-16-SDL");
}
else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
{
win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
FALLBACK_TRY("OpenGL SDL");
}
#undef FALLBACK_TRY
switch (type)
{
case ELM_WIN_INLINED:
// FIXME: implement. same as ELM_WIN_INLINED_IMAGE but with border
// frame
break;
case ELM_WIN_INLINED_IMAGE:
{
if (parent)
{
Evas *e = evas_object_evas_get(parent);
if (e)
{
Ecore_Evas *ee = ecore_evas_ecore_evas_get(e);
if (ee)
{
win->img_obj = ecore_evas_object_image_new(ee);
if (win->img_obj)
{
win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
if (win->ee)
{
evas_object_image_alpha_set
(win->img_obj, EINA_FALSE);
evas_object_image_filled_set
(win->img_obj, EINA_TRUE);
evas_object_event_callback_add
(win->img_obj, EVAS_CALLBACK_DEL,
_elm_win_obj_callback_img_obj_del,
win);
}
else
{
evas_object_del(win->img_obj);
win->img_obj = NULL;
}
}
}
}
}
}
break;
case ELM_WIN_MEMORY:
// FIXME: implement
break;
default:
if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
{
win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
#ifdef HAVE_ELEMENTARY_X
win->client_message_handler = ecore_event_handler_add
(ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
#endif
}
else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
{
win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
FALLBACK_TRY("Sofware FB");
}
else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
{
win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
FALLBACK_TRY("Sofware DirectFB");
}
else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
{
win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
FALLBACK_TRY("Sofware-16");
#ifdef HAVE_ELEMENTARY_X
win->client_message_handler = ecore_event_handler_add
(ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
#endif
}
else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
{
win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
FALLBACK_TRY("Sofware-8");
#ifdef HAVE_ELEMENTARY_X
win->client_message_handler = ecore_event_handler_add
(ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
#endif
}
else if (ENGINE_COMPARE(ELM_XRENDER_X11))
{
win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
FALLBACK_TRY("XRender");
#ifdef HAVE_ELEMENTARY_X
win->client_message_handler = ecore_event_handler_add
(ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
#endif
}
else if (ENGINE_COMPARE(ELM_OPENGL_X11))
{
win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
FALLBACK_TRY("OpenGL");
#ifdef HAVE_ELEMENTARY_X
win->client_message_handler = ecore_event_handler_add
(ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
#endif
}
else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
{
win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
FALLBACK_TRY("Sofware Win32");
}
else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
{
win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
FALLBACK_TRY("Sofware-16-WinCE");
}
else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
{
win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
FALLBACK_TRY("Sofware SDL");
}
else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
{
win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
FALLBACK_TRY("Sofware-16-SDL");
}
else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
{
win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
FALLBACK_TRY("OpenGL SDL");
}
#undef FALLBACK_TRY
break;
}
if (!win->ee)
{
ERR("Cannot create window.");
@ -1091,6 +1252,8 @@ elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
evas_object_layer_set(win->win_obj, 50);
evas_object_pass_events_set(win->win_obj, EINA_TRUE);
evas_object_intercept_move_callback_add(win->win_obj,
_elm_win_obj_intercept_move, win);
evas_object_intercept_show_callback_add(win->win_obj,
_elm_win_obj_intercept_show, win);
ecore_evas_object_associate(win->ee, win->win_obj,
@ -1099,10 +1262,14 @@ elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
_elm_win_obj_callback_show, win);
evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
_elm_win_obj_callback_hide, win);
evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
_elm_win_obj_callback_del, win);
evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
_elm_win_obj_callback_move, win);
evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
_elm_win_obj_callback_resize, win);
ecore_evas_name_class_set(win->ee, name, _elm_appname);
ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
@ -1140,7 +1307,9 @@ elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
_debug_key_down, win);
Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0, EINA_TRUE);
Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
EINA_TRUE);
printf("Key F12 exclusive for dot tree generation. (%d)\n", ret);
#endif
return win->win_obj;
@ -1417,23 +1586,33 @@ elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
ELM_CHECK_WIDTYPE(obj, widtype);
win = elm_widget_data_get(obj);
if (!win) return;
#ifdef HAVE_ELEMENTARY_X
if (win->xwin)
if (win->frame_obj)
{
if (alpha)
{
if (!_elm_config->compositing)
elm_win_shaped_set(obj, alpha);
else
ecore_evas_alpha_set(win->ee, alpha);
}
else
ecore_evas_alpha_set(win->ee, alpha);
_elm_win_xwin_update(win);
}
else if (win->img_obj)
{
evas_object_image_alpha_set(win->img_obj, alpha);
}
else
{
#ifdef HAVE_ELEMENTARY_X
if (win->xwin)
{
if (alpha)
{
if (!_elm_config->compositing)
elm_win_shaped_set(obj, alpha);
else
ecore_evas_alpha_set(win->ee, alpha);
}
else
ecore_evas_alpha_set(win->ee, alpha);
_elm_win_xwin_update(win);
}
else
#endif
ecore_evas_alpha_set(win->ee, alpha);
ecore_evas_alpha_set(win->ee, alpha);
}
}
/**
@ -1470,15 +1649,25 @@ elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
win = elm_widget_data_get(obj);
if (!win) return;
#ifdef HAVE_ELEMENTARY_X
if (win->xwin)
if (win->frame_obj)
{
ecore_evas_transparent_set(win->ee, transparent);
_elm_win_xwin_update(win);
}
else if (win->img_obj)
{
evas_object_image_alpha_set(win->img_obj, transparent);
}
else
{
#ifdef HAVE_ELEMENTARY_X
if (win->xwin)
{
ecore_evas_transparent_set(win->ee, transparent);
_elm_win_xwin_update(win);
}
else
#endif
ecore_evas_transparent_set(win->ee, transparent);
ecore_evas_transparent_set(win->ee, transparent);
}
}
/**
@ -1555,6 +1744,7 @@ elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
win = elm_widget_data_get(obj);
if (!win) return;
// YYY: handle if win->img_obj
#define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
@ -1617,6 +1807,7 @@ elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
ELM_CHECK_WIDTYPE(obj, widtype);
win = elm_widget_data_get(obj);
if (!win) return;
// YYY: handle if win->img_obj
ecore_evas_maximized_set(win->ee, maximized);
#ifdef HAVE_ELEMENTARY_X
_elm_win_xwin_update(win);
@ -2300,6 +2491,30 @@ elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *
#endif
}
/**
* Get the inlined image object handle
*
* When you create a window with elm_win_add() of type ELM_WIN_INLINED_IMAGE,
* then the window is in fact an evas image object inlined in the parent
* canvas. You can get this object (be careful to not manipulate it as it
* is under control of elementary), and use it to do things like get pixel
* data, save the image to a file, etc.
*
* @param obj The window object to get the inlined image from
* @return The inlined image object, or NULL if none exists
*
* @ingroup Win
*/
EAPI Evas_Object *
elm_win_inlined_image_object_get(Evas_Object *obj)
{
Elm_Win *win;
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
win = elm_widget_data_get(obj);
if (!win) return NULL;
return win->img_obj;
}
/**
* Set the enabled status for the focus highlight in a window
*
@ -2619,6 +2834,18 @@ elm_win_inwin_content_unset(Evas_Object *obj)
}
/* windowing spcific calls - shall we do this differently? */
static Ecore_X_Window
_elm_ee_win_get(const Evas_Object *obj)
{
if (!obj) return 0;
#ifdef HAVE_ELEMENTARY_X
Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
#endif
return 0;
}
/**
* Get the Ecore_X_Window of an Evas_Object
*
@ -2632,13 +2859,18 @@ EAPI Ecore_X_Window
elm_win_xwindow_get(const Evas_Object *obj)
{
Ecore_X_Window xwin = 0;
Ecore_Evas *ee = NULL;
Elm_Win *win;
const char *type;
if (!obj) return 0;
type = evas_object_type_get(obj);
if (!type) return 0;
if (type != widtype) return _elm_ee_win_get(obj);
#ifdef HAVE_ELEMENTARY_X
ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
if (ee) xwin = (Ecore_X_Window)ecore_evas_window_get(ee);
return xwin;
#else
return 0;
win = elm_widget_data_get(obj);
if (!win) return xwin;
if (win->parent) return elm_win_xwindow_get(win->parent);
#endif
return xwin;
win = NULL;
}