handle events better on other property chnages

SVN revision: 3198
This commit is contained in:
Carsten Haitzler 2000-08-20 22:25:08 +00:00
parent 69125b70ea
commit a677bd8076
5 changed files with 60 additions and 25 deletions

View File

@ -115,8 +115,9 @@ evas_set_image_file(Evas e, Evas_Object o, char *file)
imlib_context_set_image(im);
oo->current.image.w = imlib_image_get_width();
oo->current.image.h = imlib_image_get_height();
o->current.w = (double)oo->current.image.w;
o->current.h = (double)oo->current.image.h;
evas_resize(e, o,
(double)oo->current.image.w,
(double)oo->current.image.h);
oo->current.fill.x = 0;
oo->current.fill.y = 0;
oo->current.fill.w = (double)oo->current.image.w;
@ -127,8 +128,9 @@ evas_set_image_file(Evas e, Evas_Object o, char *file)
{
oo->current.image.w = 0;
oo->current.image.h = 0;
o->current.w = (double)oo->current.image.w;
o->current.h = (double)oo->current.image.h;
evas_resize(e, o,
(double)oo->current.image.w,
(double)oo->current.image.h);
oo->current.fill.x = 0;
oo->current.fill.y = 0;
oo->current.fill.w = (double)oo->current.image.w;

View File

@ -78,8 +78,12 @@ void
evas_set_line_xy(Evas e, Evas_Object o, double x1, double y1, double x2, double y2)
{
Evas_Object_Line oo;
int event_update = 0;
oo = (Evas_Object_Line)o;
if ((o->current.visible) &&
(_evas_point_in_object(e, o, e->mouse.x, e->mouse.y)))
event_update = 1;
oo->current.x1 = x1;
oo->current.y1 = y1;
oo->current.x2 = x2;
@ -104,6 +108,10 @@ evas_set_line_xy(Evas e, Evas_Object o, double x1, double y1, double x2, double
o->current.y = y2;
o->current.h = (y1 - y2) + 1;
}
if ((o->current.visible) &&
((_evas_point_in_object(e, o, e->mouse.x, e->mouse.y)) ||
(event_update)))
evas_event_move(e, e->mouse.x, e->mouse.y);
o->changed = 1;
e->changed = 1;
}

View File

@ -261,13 +261,16 @@ evas_move(Evas e, Evas_Object o, double x, double y)
int event_update = 0;
if ((o->type == OBJECT_LINE)) return;
if (_evas_point_in_object(e, o, e->mouse.x, e->mouse.y))
if ((o->current.visible) &&
(_evas_point_in_object(e, o, e->mouse.x, e->mouse.y)))
event_update = 1;
o->current.x = x;
o->current.y = y;
o->changed = 1;
e->changed = 1;
if ((_evas_point_in_object(e, o, e->mouse.x, e->mouse.y)) || event_update)
if ((o->current.visible) &&
((_evas_point_in_object(e, o, e->mouse.x, e->mouse.y)) ||
(event_update)))
evas_event_move(e, e->mouse.x, e->mouse.y);
}
@ -276,14 +279,16 @@ evas_resize(Evas e, Evas_Object o, double w, double h)
{
int event_update = 0;
if ((o->type == OBJECT_TEXT) || (o->type == OBJECT_LINE)) return;
if (_evas_point_in_object(e, o, e->mouse.x, e->mouse.y))
if ((o->current.visible) &&
(_evas_point_in_object(e, o, e->mouse.x, e->mouse.y)))
event_update = 1;
o->current.w = w;
o->current.h = h;
o->changed = 1;
e->changed = 1;
if ((_evas_point_in_object(e, o, e->mouse.x, e->mouse.y)) || event_update)
if ((o->current.visible) &&
((_evas_point_in_object(e, o, e->mouse.x, e->mouse.y)) ||
(event_update)))
evas_event_move(e, e->mouse.x, e->mouse.y);
}

View File

@ -279,8 +279,9 @@ evas_set_text(Evas e, Evas_Object o, char *text)
__evas_imlib_text_get_size(fn, oo->current.text,
&oo->current.string.w,
&oo->current.string.h);
o->current.w = (double)oo->current.string.w;
o->current.h = (double)oo->current.string.h;
evas_resize(e, o,
(double)oo->current.string.w,
(double)oo->current.string.h);
__evas_imlib_text_font_free(fn);
}
}
@ -299,8 +300,9 @@ evas_set_text(Evas e, Evas_Object o, char *text)
__evas_gl_text_get_size(fn, oo->current.text,
&oo->current.string.w,
&oo->current.string.h);
o->current.w = (double)oo->current.string.w;
o->current.h = (double)oo->current.string.h;
evas_resize(e, o,
(double)oo->current.string.w,
(double)oo->current.string.h);
__evas_gl_text_font_free(fn);
}
}
@ -351,8 +353,9 @@ evas_set_font(Evas e, Evas_Object o, char *font, int size)
__evas_imlib_text_get_size(fn, oo->current.text,
&oo->current.string.w,
&oo->current.string.h);
o->current.w = (double)oo->current.string.w;
o->current.h = (double)oo->current.string.h;
evas_resize(e, o,
(double)oo->current.string.w,
(double)oo->current.string.h);
__evas_imlib_text_font_free(fn);
}
}
@ -371,8 +374,9 @@ evas_set_font(Evas e, Evas_Object o, char *font, int size)
__evas_gl_text_get_size(fn, oo->current.text,
&oo->current.string.w,
&oo->current.string.h);
o->current.w = (double)oo->current.string.w;
o->current.h = (double)oo->current.string.h;
evas_resize(e, o,
(double)oo->current.string.w,
(double)oo->current.string.h);
__evas_gl_text_font_free(fn);
}
}

View File

@ -132,6 +132,9 @@ main(int argc, char **argv)
evas_set_output(e, d, win, vis, cmap);
evas_set_output_size(e, win_w, win_h);
evas_set_output_viewport(e, 0, 0, win_w, win_h);
evas_set_font_cache(e, 1 * 1024 * 1024);
evas_set_image_cache(e, 8 * 1024 * 1024);
o[0] = evas_add_image_from_file(e, "img/sky001.png");
evas_show(e, o[0]);
@ -151,6 +154,11 @@ main(int argc, char **argv)
o[i] = evas_add_image_from_file(e, "img/mush.png");
evas_show(e, o[i]);
evas_set_layer(e, o[i], 100);
evas_callback_add(e, o[i], CALLBACK_MOUSE_DOWN, mouse_down, NULL);
evas_callback_add(e, o[i], CALLBACK_MOUSE_UP, mouse_up, NULL);
evas_callback_add(e, o[i], CALLBACK_MOUSE_MOVE, mouse_move, NULL);
evas_callback_add(e, o[i], CALLBACK_MOUSE_IN, mouse_in, NULL);
evas_callback_add(e, o[i], CALLBACK_MOUSE_OUT, mouse_out, NULL);
}
for (i = 120; i < 128; i++)
{
@ -158,6 +166,11 @@ main(int argc, char **argv)
evas_set_color(e, o[i], rand()&0xff, rand()&0xff, rand()&0xff, 255);
evas_show(e, o[i]);
evas_set_layer(e, o[i], 100);
evas_callback_add(e, o[i], CALLBACK_MOUSE_DOWN, mouse_down, NULL);
evas_callback_add(e, o[i], CALLBACK_MOUSE_UP, mouse_up, NULL);
evas_callback_add(e, o[i], CALLBACK_MOUSE_MOVE, mouse_move, NULL);
evas_callback_add(e, o[i], CALLBACK_MOUSE_IN, mouse_in, NULL);
evas_callback_add(e, o[i], CALLBACK_MOUSE_OUT, mouse_out, NULL);
}
o_rect = evas_add_rectangle(e);
evas_show(e, o_rect);
@ -199,7 +212,7 @@ main(int argc, char **argv)
evas_callback_add(e, o_grad, CALLBACK_MOUSE_IN, mouse_in, NULL);
evas_callback_add(e, o_grad, CALLBACK_MOUSE_OUT, mouse_out, NULL);
o_text = evas_add_text(e, "grunge", 24, "Click and Drag Objects...");
o_text = evas_add_text(e, "grunge", 14, "Click and Drag Objects...");
evas_set_color(e, o_text, 0, 0, 0, 160);
evas_move(e, o_text, 30, 60);
evas_show(e, o_text);
@ -279,13 +292,16 @@ main(int argc, char **argv)
{
int j, k;
j = (i * 50) + i;
k = (i * -60) - (i * 2);
x = (win_w + (cos((double)(a + j) * 2 * 3.141592654 / 1000) * (win_h - 100))) / 2;
y = (win_h + (sin((double)(a + k) * 2 * 3.141592654 / 1000) * (win_h - 100))) / 2;
if (i < 100)
evas_set_image_file(e, o[i], imgs[(i) & 0x7]);
evas_move(e, o[i], x, y);
if (!evas_get_data(e, o[i], "clicked"))
{
j = (i * 50) + i;
k = (i * -60) - (i * 2);
x = (win_w + (cos((double)(a + j) * 2 * 3.141592654 / 1000) * (win_h - 100))) / 2;
y = (win_h + (sin((double)(a + k) * 2 * 3.141592654 / 1000) * (win_h - 100))) / 2;
if (i < 100)
evas_set_image_file(e, o[i], imgs[(i) & 0x7]);
evas_move(e, o[i], x, y);
}
}
evas_set_angle(e, o_grad, (double)a * 360 / 1000);
evas_render(e);