forked from enlightenment/efl
api filled out much better now........ infact... i'm almost done :)
SVN revision: 3186
This commit is contained in:
parent
da571e5aac
commit
056e350668
|
@ -65,10 +65,9 @@ AC_MSG_ERROR([Fatal Error: no Imlib2 detected.]); exit], -L/usr/X11R6/lib -L/usr
|
|||
|
||||
AC_CHECK_LIB(ttf, TT_Init_FreeType, TTF_LIBS=-lttf, [
|
||||
echo ""
|
||||
echo "ERROR: Imlib 2 needs a system with libttf.so (TrueType Font Library)"
|
||||
echo "ERROR: Evas needs a system with libttf.so (TrueType Font Library)"
|
||||
echo "You can obtain it from:"
|
||||
echo "ftp://ftp.enlightenment.org/pub/enlightenment/"
|
||||
echo "ftp://www.rasterman.com/pub/enlightenment/"
|
||||
echo "You can also obtain it from:"
|
||||
echo "http://www.freetype.org/"
|
||||
echo "You can obtain some truetype fonts from:"
|
||||
|
@ -86,14 +85,13 @@ if test x$ftype_ftype = xno; then
|
|||
echo ""
|
||||
echo "ERROR: freetype.h not found in freetype.h or freetype/freetype.h include"
|
||||
echo "paths. (ie /usr/include, /usr/local/include etc.). You need the freetype"
|
||||
echo "header files to build Imlib 2. This may mean you have to install the"
|
||||
echo "header files to build Evas. This may mean you have to install the"
|
||||
echo "freetype-devel packages for your distribution or if all else fails"
|
||||
echo "find the source for freetype and install that somewhere where Imlib 2"
|
||||
echo "find the source for freetype and install that somewhere where Evas"
|
||||
echo "can find the header files."
|
||||
echo ""
|
||||
echo "You can obtain it from:"
|
||||
echo "ftp://ftp.enlightenment.org/pub/enlightenment/"
|
||||
echo "ftp://www.rasterman.com/pub/enlightenment/"
|
||||
echo "You can also obtain it from:"
|
||||
echo "http://www.freetype.org/"
|
||||
echo "You can obtain some truetype fonts from:"
|
||||
|
|
|
@ -13,6 +13,7 @@ typedef int Evas_Image_Format;
|
|||
typedef int Evas_Render_Method;
|
||||
typedef struct _Evas_Render_Data Evas_Render_Data;
|
||||
typedef struct _Evas_List * Evas_List;
|
||||
typedef struct _Evas_Data * Evas_Data;
|
||||
typedef struct _Evas_Layer * Evas_Layer;
|
||||
typedef struct _Evas_Color_Point * Evas_Color_Point;
|
||||
typedef struct _Evas_Callback * Evas_Callback;
|
||||
|
@ -33,6 +34,7 @@ typedef struct _Evas_Object_Gradient_Box * Evas_Object_Gradient_Box;
|
|||
#define CALLBACK_MOUSE_OUT 1
|
||||
#define CALLBACK_MOUSE_DOWN 2
|
||||
#define CALLBACK_MOUSE_UP 3
|
||||
#define CALLBACK_FREE 4
|
||||
|
||||
#define IMAGE_FORMAT_BGRA 0
|
||||
#define IMAGE_FORMAT_ARGB 1
|
||||
|
@ -75,8 +77,10 @@ struct _Evas
|
|||
int in;
|
||||
int x, y;
|
||||
int buttons;
|
||||
Evas_Object object, button_object;
|
||||
} mouse;
|
||||
|
||||
|
||||
void (*evas_renderer_data_free) (Evas _e);
|
||||
|
||||
int changed;
|
||||
|
@ -107,6 +111,12 @@ struct _Evas_Rectangle
|
|||
int x, y, w, h;
|
||||
};
|
||||
|
||||
struct _Evas_Data
|
||||
{
|
||||
char *key;
|
||||
void *data;
|
||||
};
|
||||
|
||||
struct _Evas_Layer
|
||||
{
|
||||
int layer;
|
||||
|
@ -123,7 +133,7 @@ struct _Evas_Callback
|
|||
{
|
||||
Evas_Callback_Type type;
|
||||
void *data;
|
||||
void (*callback) (void *_data, Evas _e, char *_class, Evas_Object _o, int _b, int _x, int _y);
|
||||
void (*callback) (void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
|
||||
};
|
||||
|
||||
struct _Evas_Object_Any
|
||||
|
@ -145,6 +155,7 @@ struct _Evas_Object_Any
|
|||
void (*object_renderer_data_free) (Evas _e, Evas_Object _o);
|
||||
|
||||
Evas_List callbacks;
|
||||
Evas_List data;
|
||||
|
||||
Evas_Render_Data renderer_data;
|
||||
|
||||
|
@ -163,6 +174,9 @@ struct _Evas_Object_Image
|
|||
struct {
|
||||
double x, y, w, h;
|
||||
} fill;
|
||||
struct {
|
||||
int l, r, t, b
|
||||
} border;
|
||||
} current, previous;
|
||||
};
|
||||
|
||||
|
@ -247,6 +261,7 @@ Evas_Object evas_add_gradient_box(Evas e);
|
|||
void evas_set_image_file(Evas e, Evas_Object o, char *file);
|
||||
void evas_set_image_data(Evas e, Evas_Object o, void *data, Evas_Image_Format format, int w, int h);
|
||||
void evas_set_image_fill(Evas e, Evas_Object o, double x, double y, double w, double h);
|
||||
void evas_set_image_border(Evas e, Evas_Object o, int l, int r, int t, int b);
|
||||
void evas_set_color(Evas e, Evas_Object o, int r, int g, int b, int a);
|
||||
void evas_set_text(Evas e, Evas_Object o, char *text);
|
||||
void evas_set_font(Evas e, Evas_Object o, char *font, int size);
|
||||
|
@ -293,10 +308,29 @@ void evas_hide(Evas e, Evas_Object o);
|
|||
|
||||
/* image query ops */
|
||||
void evas_get_image_size(Evas e, Evas_Object o, int *w, int *h);
|
||||
void evas_get_image_border(Evas e, Evas_Object o, int *l, int *r, int *t, int *b);
|
||||
|
||||
/* coordinate space transforms */
|
||||
int evas_world_x_to_screen(Evas e, double x);
|
||||
int evas_world_y_to_screen(Evas e, double y);
|
||||
double evas_screen_x_to_world(Evas e, int x);
|
||||
double evas_screen_y_to_world(Evas e, int y);
|
||||
|
||||
/* text query ops */
|
||||
char *evas_get_text_string(Evas e, Evas_Object o);
|
||||
char *evas_get_text_font(Evas e, Evas_Object o);
|
||||
int evas_get_text_size(Evas e, Evas_Object o);
|
||||
int evas_text_at_position(Evas e, Evas_Object o, double x, double y, int *char_x, int *char_y, int *char_w, int *char_h);
|
||||
void evas_text_at(Evas e, Evas_Object o, int index, int *char_x, int *char_y, int *char_w, int *char_h);
|
||||
|
||||
/* object query ops */
|
||||
void evas_get_color(Evas e, Evas_Object o, int *r, int *g, int *b, int *a);
|
||||
Evas_Object evas_get_object_under_mouse(Evas e);
|
||||
Evas_Object evas_get_object_at_pos(Evas e, double x, double y);
|
||||
|
||||
/* data attachment ops */
|
||||
void evas_stick_data(Evas e, Evas_Object o, char *key, void *data);
|
||||
void *evas_fetch_data(Evas e, Evas_Object o, char *key);
|
||||
void evas_put_data(Evas e, Evas_Object o, char *key, void *data);
|
||||
void *evas_get_data(Evas e, Evas_Object o, char *key);
|
||||
|
||||
/* events */
|
||||
void evas_event_button_down(Evas e, int x, int y, int b);
|
||||
|
|
|
@ -4,14 +4,61 @@
|
|||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
void
|
||||
_evas_callback_call(Evas e, Evas_Object o, Evas_Callback_Type callback,
|
||||
int b, int x, int y)
|
||||
{
|
||||
Evas_List l;
|
||||
|
||||
if (o->callbacks)
|
||||
{
|
||||
for (l = o->callbacks; l; l = l->next)
|
||||
{
|
||||
Evas_Callback cb;
|
||||
|
||||
cb = l->data;
|
||||
if (cb->type == callback)
|
||||
cb->callback(cb->data, e, o, b, x, y);
|
||||
}
|
||||
evas_list_free(o->callbacks);
|
||||
}
|
||||
}
|
||||
|
||||
/* callbacks */
|
||||
void
|
||||
evas_callback_add(Evas e, Evas_Object o, Evas_Callback_Type callback, void (*func) (void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y), void *data)
|
||||
|
||||
{
|
||||
Evas_Callback cb;
|
||||
|
||||
cb = malloc(sizeof(struct _Evas_Callback));
|
||||
cb->type = callback;
|
||||
cb->data = data;
|
||||
cb->callback = func;
|
||||
o->callbacks = evas_list_append(o->callbacks, cb);
|
||||
}
|
||||
|
||||
void
|
||||
evas_callback_del(Evas e, Evas_Object o, Evas_Callback_Type callback)
|
||||
{
|
||||
Evas_List l;
|
||||
int have_cb;
|
||||
|
||||
have_cb = 1;
|
||||
while (have_cb)
|
||||
{
|
||||
for (l = o->callbacks; l; l = l->next)
|
||||
{
|
||||
Evas_Callback cb;
|
||||
|
||||
cb = l->data;
|
||||
if (cb->type == callback)
|
||||
{
|
||||
o->callbacks = evas_list_remove(o->callbacks, cb);
|
||||
free(cb);
|
||||
have_cb = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,13 @@ _evas_highest_object_at_point(Evas e, int x, int y)
|
|||
|
||||
for (ll = layer->objects; ll; ll = ll->next)
|
||||
{
|
||||
if (_evas_point_in_object(e, ll->data, x, y)) o = ll->data;
|
||||
Evas_Object ob;
|
||||
|
||||
ob = ll->data;
|
||||
if (ob->current.visible)
|
||||
{
|
||||
if (_evas_point_in_object(e, ll->data, x, y)) o = ll->data;
|
||||
}
|
||||
}
|
||||
}
|
||||
return o;
|
||||
|
@ -48,8 +54,14 @@ _evas_objects_at_point(Evas e, int x, int y)
|
|||
|
||||
for (ll = layer->objects; ll; ll = ll->next)
|
||||
{
|
||||
if (_evas_point_in_object(e, ll->data, x, y))
|
||||
objs = evas_list_prepend(objs, ll->data);
|
||||
Evas_Object ob;
|
||||
|
||||
ob = ll->data;
|
||||
if (ob->current.visible)
|
||||
{
|
||||
if (_evas_point_in_object(e, ll->data, x, y))
|
||||
objs = evas_list_prepend(objs, ll->data);
|
||||
}
|
||||
}
|
||||
}
|
||||
return objs;
|
||||
|
@ -59,22 +71,43 @@ _evas_objects_at_point(Evas e, int x, int y)
|
|||
void
|
||||
evas_event_button_down(Evas e, int x, int y, int b)
|
||||
{
|
||||
Evas_Object o;
|
||||
|
||||
if ((b > 1) || (b < 32)) return;
|
||||
if (!e->mouse.buttons) e->mouse.button_object = o;
|
||||
e->mouse.buttons |= (1 << (b - 1));
|
||||
e->mouse.x = x;
|
||||
e->mouse.y = y;
|
||||
_evas_callback_call(e, e->mouse.object, CALLBACK_MOUSE_DOWN, b, x, y);
|
||||
}
|
||||
|
||||
void
|
||||
evas_event_button_up(Evas e, int x, int y, int b)
|
||||
{
|
||||
Evas_Object o;
|
||||
|
||||
if ((b > 1) || (b < 32)) return;
|
||||
e->mouse.buttons &= ~(1 << (b - 1));
|
||||
if (!e->mouse.buttons) e->mouse.button_object = NULL;
|
||||
e->mouse.x = x;
|
||||
e->mouse.y = y;
|
||||
_evas_callback_call(e, e->mouse.object, CALLBACK_MOUSE_UP, b, x, y);
|
||||
}
|
||||
|
||||
void
|
||||
evas_event_move(Evas e, int x, int y)
|
||||
{
|
||||
Evas_Object o;
|
||||
|
||||
e->mouse.x = x;
|
||||
e->mouse.y = y;
|
||||
o = _evas_highest_object_at_point(e, e->mouse.x, e->mouse.y);
|
||||
if (o != e->mouse.object)
|
||||
{
|
||||
_evas_callback_call(e, e->mouse.object, CALLBACK_MOUSE_OUT, e->mouse.buttons, x, y);
|
||||
e->mouse.object = o;
|
||||
_evas_callback_call(e, e->mouse.object, CALLBACK_MOUSE_IN, e->mouse.buttons, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -88,3 +121,15 @@ evas_event_leave(Evas e)
|
|||
{
|
||||
e->mouse.in = 0;
|
||||
}
|
||||
|
||||
Evas_Object
|
||||
evas_get_object_under_mouse(Evas e)
|
||||
{
|
||||
return _evas_highest_object_at_point(e, e->mouse.x, e->mouse.y);
|
||||
}
|
||||
|
||||
Evas_Object
|
||||
evas_get_object_at_pos(Evas e, double x, double y)
|
||||
{
|
||||
return _evas_highest_object_at_point(e, x, y);
|
||||
}
|
||||
|
|
|
@ -169,3 +169,29 @@ evas_get_image_size(Evas e, Evas_Object o, int *w, int *h)
|
|||
if (w) *w = oo->current.image.w;
|
||||
if (h) *h = oo->current.image.h;
|
||||
}
|
||||
|
||||
void
|
||||
evas_set_image_border(Evas e, Evas_Object o, int l, int r, int t, int b)
|
||||
{
|
||||
Evas_Object_Image oo;
|
||||
|
||||
oo = o;
|
||||
oo->current.border.l = l;
|
||||
oo->current.border.r = r;
|
||||
oo->current.border.t = t;
|
||||
oo->current.border.b = b;
|
||||
o->changed = 1;
|
||||
e->changed = 1;
|
||||
}
|
||||
|
||||
void
|
||||
evas_get_image_border(Evas e, Evas_Object o, int *l, int *r, int *t, int *b)
|
||||
{
|
||||
Evas_Object_Image oo;
|
||||
|
||||
oo = o;
|
||||
if (l) *l = oo->current.border.l;
|
||||
if (r) *r = oo->current.border.r;
|
||||
if (t) *t = oo->current.border.t;
|
||||
if (b) *b = oo->current.border.b;
|
||||
}
|
||||
|
|
|
@ -87,6 +87,49 @@ evas_set_color(Evas e, Evas_Object o, int r, int g, int b, int a)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
evas_get_color(Evas e, Evas_Object o, int *r, int *g, int *b, int *a)
|
||||
{
|
||||
switch (o->type)
|
||||
{
|
||||
case OBJECT_TEXT:
|
||||
{
|
||||
Evas_Object_Text oo;
|
||||
|
||||
oo = (Evas_Object_Text)o;
|
||||
*r = oo->current.r;
|
||||
*g = oo->current.g;
|
||||
*b = oo->current.b;
|
||||
*a = oo->current.a;
|
||||
}
|
||||
break;
|
||||
case OBJECT_RECTANGLE:
|
||||
{
|
||||
Evas_Object_Rectangle oo;
|
||||
|
||||
oo = (Evas_Object_Rectangle)o;
|
||||
*r = oo->current.r;
|
||||
*g = oo->current.g;
|
||||
*b = oo->current.b;
|
||||
*a = oo->current.a;
|
||||
}
|
||||
break;
|
||||
case OBJECT_LINE:
|
||||
{
|
||||
Evas_Object_Line oo;
|
||||
|
||||
oo = (Evas_Object_Line)o;
|
||||
*r = oo->current.r;
|
||||
*g = oo->current.g;
|
||||
*b = oo->current.b;
|
||||
*a = oo->current.a;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
evas_set_text(Evas e, Evas_Object o, char *text)
|
||||
{
|
||||
|
@ -421,14 +464,56 @@ evas_font_del_path(Evas e, char *path)
|
|||
}
|
||||
|
||||
void
|
||||
evas_stick_data(Evas e, Evas_Object o, char *key, void *data)
|
||||
evas_put_data(Evas e, Evas_Object o, char *key, void *data)
|
||||
{
|
||||
/* FIXME: impliment */
|
||||
Evas_Data d;
|
||||
|
||||
if (!key) return;
|
||||
d = malloc(sizeof(struct _Evas_Data));
|
||||
d->key = strdup(key);
|
||||
d->data = data;
|
||||
o->data = evas_list_append(o->data, d);
|
||||
}
|
||||
|
||||
void *
|
||||
evas_fetch_data(Evas e, Evas_Object o, char *key)
|
||||
evas_get_data(Evas e, Evas_Object o, char *key)
|
||||
{
|
||||
/* FIXME: impliment */
|
||||
Evas_List l;
|
||||
|
||||
for (l = o->data; l; l = l->next)
|
||||
{
|
||||
Evas_Data d;
|
||||
|
||||
d = l->data;
|
||||
if (!strcmp(d->key, key)) return d->data;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
evas_world_x_to_screen(Evas e, double x)
|
||||
{
|
||||
return (int)((x - e->current.viewport.x) *
|
||||
((double)e->current.drawable_width / e->current.viewport.w));
|
||||
}
|
||||
|
||||
int
|
||||
evas_world_y_to_screen(Evas e, double y)
|
||||
{
|
||||
return (int)((y - e->current.viewport.y) *
|
||||
((double)e->current.drawable_height / e->current.viewport.h));
|
||||
}
|
||||
|
||||
double
|
||||
evas_screen_x_to_world(Evas e, int x)
|
||||
{
|
||||
return (double)((double)x * (e->current.viewport.w / (double)e->current.drawable_width));
|
||||
+ e->current.viewport.x;
|
||||
}
|
||||
|
||||
double
|
||||
evas_screen_y_to_world(Evas e, int y)
|
||||
{
|
||||
return (double)((double)y * (e->current.viewport.h / (double)e->current.drawable_height));
|
||||
+ e->current.viewport.y;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,43 @@ _evas_get_object_layer(Evas e, Evas_Object o)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
_evas_remove_data(Evas e, Evas_Object o)
|
||||
{
|
||||
Evas_List l;
|
||||
|
||||
if (o->data)
|
||||
{
|
||||
for (l = o->data; l; l = l->next)
|
||||
{
|
||||
Evas_Data d;
|
||||
|
||||
d = l->data;
|
||||
free(d->key);
|
||||
free(d);
|
||||
}
|
||||
evas_list_free(o->data);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_evas_remove_callbacks(Evas e, Evas_Object o)
|
||||
{
|
||||
Evas_List l;
|
||||
|
||||
if (o->callbacks)
|
||||
{
|
||||
for (l = o->callbacks; l; l = l->next)
|
||||
{
|
||||
Evas_Callback cb;
|
||||
|
||||
cb = l->data;
|
||||
free(cb);
|
||||
}
|
||||
evas_list_free(o->callbacks);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_evas_real_del_object(Evas e, Evas_Object o)
|
||||
{
|
||||
|
@ -32,6 +69,9 @@ _evas_real_del_object(Evas e, Evas_Object o)
|
|||
if (layer->layer == o->current.layer)
|
||||
{
|
||||
layer->objects = evas_list_remove(layer->objects, o);
|
||||
_evas_callback_call(e, o, CALLBACK_FREE, 0, 0, 0);
|
||||
_evas_remove_callbacks(e, o);
|
||||
_evas_remove_data(e, o);
|
||||
o->object_renderer_data_free(e, o);
|
||||
o->object_free(o);
|
||||
return;
|
||||
|
|
|
@ -194,6 +194,10 @@ evas_render(Evas e)
|
|||
((!oo->current.file) && (oo->previous.file)) ||
|
||||
(oo->current.new_data) ||
|
||||
(oo->current.scale != oo->previous.scale) ||
|
||||
(oo->current.border.l != oo->previous.border.l) ||
|
||||
(oo->current.border.r != oo->previous.border.r) ||
|
||||
(oo->current.border.t != oo->previous.border.t) ||
|
||||
(oo->current.border.b != oo->previous.border.b) ||
|
||||
(oo->current.fill.x != oo->previous.fill.x) ||
|
||||
(oo->current.fill.y != oo->previous.fill.y) ||
|
||||
(oo->current.fill.w != oo->previous.fill.w) ||
|
||||
|
|
Loading…
Reference in New Issue