forked from enlightenment/enlightenment
and make that text abstraction do..... outlines! :)
SVN revision: 5028
This commit is contained in:
parent
e8e462159f
commit
82c3eaeda2
101
src/text.c
101
src/text.c
|
@ -13,14 +13,27 @@ e_text_new(Evas evas, char *text, char *class)
|
|||
if (text) t->text = strdup(text);
|
||||
else t->text = strdup("");
|
||||
t->evas = evas;
|
||||
t->obj = evas_add_text(t->evas, "borzoib", 8, t->text);
|
||||
evas_set_color(t->evas, t->obj, 0, 0, 0, 255);
|
||||
t->color.r = 0;
|
||||
t->color.g = 0;
|
||||
t->color.b = 0;
|
||||
t->obj.o1 = evas_add_text(t->evas, "borzoib", 8, t->text);
|
||||
t->obj.o2 = evas_add_text(t->evas, "borzoib", 8, t->text);
|
||||
t->obj.o3 = evas_add_text(t->evas, "borzoib", 8, t->text);
|
||||
t->obj.o4 = evas_add_text(t->evas, "borzoib", 8, t->text);
|
||||
t->obj.text = evas_add_text(t->evas, "borzoib", 8, t->text);
|
||||
evas_set_color(t->evas, t->obj.o1, 0, 0, 0, 255);
|
||||
evas_set_color(t->evas, t->obj.o2, 0, 0, 0, 255);
|
||||
evas_set_color(t->evas, t->obj.o3, 0, 0, 0, 255);
|
||||
evas_set_color(t->evas, t->obj.o4, 0, 0, 0, 255);
|
||||
evas_set_color(t->evas, t->obj.text, 255, 255, 255, 255);
|
||||
evas_move(t->evas, t->obj.o1, t->x + 1, t->y);
|
||||
evas_move(t->evas, t->obj.o2, t->x, t->y + 1);
|
||||
evas_move(t->evas, t->obj.o3, t->x + 2, t->y + 1);
|
||||
evas_move(t->evas, t->obj.o4, t->x + 1, t->y + 2);
|
||||
evas_move(t->evas, t->obj.text, t->x + 1, t->y + 1);
|
||||
t->color.r = 255;
|
||||
t->color.g = 255;
|
||||
t->color.b = 255;
|
||||
t->color.a = 255;
|
||||
t->w = evas_get_text_width(t->evas, t->obj);
|
||||
t->h = evas_get_text_height(t->evas, t->obj);
|
||||
t->w = evas_get_text_width(t->evas, t->obj.text) + 2;
|
||||
t->h = evas_get_text_height(t->evas, t->obj.text) + 2;
|
||||
t->min.w = t->w;
|
||||
t->min.h = t->h;
|
||||
t->max.w = t->w;
|
||||
|
@ -35,9 +48,13 @@ e_text_free(E_Text *t)
|
|||
IF_FREE(t->class);
|
||||
IF_FREE(t->text);
|
||||
|
||||
if ((t->evas) && (t->obj))
|
||||
if ((t->evas) && (t->obj.text))
|
||||
{
|
||||
evas_del_object(t->evas, t->obj);
|
||||
evas_del_object(t->evas, t->obj.o1);
|
||||
evas_del_object(t->evas, t->obj.o2);
|
||||
evas_del_object(t->evas, t->obj.o3);
|
||||
evas_del_object(t->evas, t->obj.o4);
|
||||
evas_del_object(t->evas, t->obj.text);
|
||||
}
|
||||
FREE(t);
|
||||
}
|
||||
|
@ -49,7 +66,13 @@ e_text_set_text(E_Text *t, char *text)
|
|||
if (!strcmp(t->text, text)) return;
|
||||
IF_FREE(t->text);
|
||||
t->text = strdup(text);
|
||||
evas_set_text(t->evas, t->obj, t->text);
|
||||
evas_set_text(t->evas, t->obj.text, t->text);
|
||||
t->w = evas_get_text_width(t->evas, t->obj.text) + 2;
|
||||
t->h = evas_get_text_height(t->evas, t->obj.text) + 2;
|
||||
t->min.w = t->w;
|
||||
t->min.h = t->h;
|
||||
t->max.w = t->w;
|
||||
t->max.h = t->h;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -57,31 +80,51 @@ e_text_set_layer(E_Text *t, int l)
|
|||
{
|
||||
if (t->layer == l) return;
|
||||
t->layer = l;
|
||||
evas_set_layer(t->evas, t->obj, t->layer);
|
||||
evas_set_layer(t->evas, t->obj.o1, t->layer);
|
||||
evas_set_layer(t->evas, t->obj.o2, t->layer);
|
||||
evas_set_layer(t->evas, t->obj.o3, t->layer);
|
||||
evas_set_layer(t->evas, t->obj.o4, t->layer);
|
||||
evas_set_layer(t->evas, t->obj.text, t->layer);
|
||||
}
|
||||
|
||||
void
|
||||
e_text_set_clip(E_Text *t, Evas_Object clip)
|
||||
{
|
||||
evas_set_clip(t->evas, t->obj, clip);
|
||||
evas_set_clip(t->evas, t->obj.o1, clip);
|
||||
evas_set_clip(t->evas, t->obj.o2, clip);
|
||||
evas_set_clip(t->evas, t->obj.o3, clip);
|
||||
evas_set_clip(t->evas, t->obj.o4, clip);
|
||||
evas_set_clip(t->evas, t->obj.text, clip);
|
||||
}
|
||||
|
||||
void
|
||||
e_text_unset_clip(E_Text *t)
|
||||
{
|
||||
evas_unset_clip(t->evas, t->obj);
|
||||
evas_unset_clip(t->evas, t->obj.o1);
|
||||
evas_unset_clip(t->evas, t->obj.o2);
|
||||
evas_unset_clip(t->evas, t->obj.o3);
|
||||
evas_unset_clip(t->evas, t->obj.o4);
|
||||
evas_unset_clip(t->evas, t->obj.text);
|
||||
}
|
||||
|
||||
void
|
||||
e_text_raise(E_Text *t)
|
||||
{
|
||||
evas_raise(t->evas, t->obj);
|
||||
evas_raise(t->evas, t->obj.o1);
|
||||
evas_raise(t->evas, t->obj.o2);
|
||||
evas_raise(t->evas, t->obj.o3);
|
||||
evas_raise(t->evas, t->obj.o4);
|
||||
evas_raise(t->evas, t->obj.text);
|
||||
}
|
||||
|
||||
void
|
||||
e_text_lower(E_Text *t)
|
||||
{
|
||||
evas_lower(t->evas, t->obj);
|
||||
evas_lower(t->evas, t->obj.text);
|
||||
evas_lower(t->evas, t->obj.o4);
|
||||
evas_lower(t->evas, t->obj.o3);
|
||||
evas_lower(t->evas, t->obj.o2);
|
||||
evas_lower(t->evas, t->obj.o1);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -89,7 +132,11 @@ e_text_show(E_Text *t)
|
|||
{
|
||||
if (t->visible) return;
|
||||
t->visible = 1;
|
||||
evas_show(t->evas, t->obj);
|
||||
evas_show(t->evas, t->obj.o1);
|
||||
evas_show(t->evas, t->obj.o2);
|
||||
evas_show(t->evas, t->obj.o3);
|
||||
evas_show(t->evas, t->obj.o4);
|
||||
evas_show(t->evas, t->obj.text);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -97,7 +144,11 @@ e_text_hide(E_Text *t)
|
|||
{
|
||||
if (!t->visible) return;
|
||||
t->visible = 0;
|
||||
evas_hide(t->evas, t->obj);
|
||||
evas_hide(t->evas, t->obj.o1);
|
||||
evas_hide(t->evas, t->obj.o2);
|
||||
evas_hide(t->evas, t->obj.o3);
|
||||
evas_hide(t->evas, t->obj.o4);
|
||||
evas_hide(t->evas, t->obj.text);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -111,7 +162,7 @@ e_text_set_color(E_Text *t, int r, int g, int b, int a)
|
|||
t->color.g = g;
|
||||
t->color.b = b;
|
||||
t->color.a = a;
|
||||
evas_set_color(t->evas, t->obj, t->color.r, t->color.g, t->color.b, t->color.a);
|
||||
evas_set_color(t->evas, t->obj.text, t->color.r, t->color.g, t->color.b, t->color.a);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -120,12 +171,19 @@ e_text_move(E_Text *t, double x, double y)
|
|||
if ((t->x == x) && (t->y == y)) return;
|
||||
t->x = x;
|
||||
t->y = y;
|
||||
evas_move(t->evas, t->obj, t->x, t->y);
|
||||
evas_move(t->evas, t->obj.o1, t->x + 1, t->y);
|
||||
evas_move(t->evas, t->obj.o2, t->x, t->y + 1);
|
||||
evas_move(t->evas, t->obj.o3, t->x + 2, t->y + 1);
|
||||
evas_move(t->evas, t->obj.o4, t->x + 1, t->y + 2);
|
||||
evas_move(t->evas, t->obj.text, t->x + 1, t->y + 1);
|
||||
}
|
||||
|
||||
void
|
||||
e_text_resize(E_Text *t, double w, double h)
|
||||
{
|
||||
UN(t);
|
||||
UN(w);
|
||||
UN(h);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -154,14 +212,19 @@ e_text_get_max_size(E_Text *t, double *w, double *h)
|
|||
void
|
||||
e_text_set_state(E_Text *t, char *state)
|
||||
{
|
||||
UN(t);
|
||||
UN(state);
|
||||
}
|
||||
|
||||
void
|
||||
e_text_set_class(E_Text *t, char *class)
|
||||
{
|
||||
UN(t);
|
||||
UN(class);
|
||||
}
|
||||
|
||||
void
|
||||
e_text_update_class(E_Text *t)
|
||||
{
|
||||
UN(t);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,13 @@ struct _E_Text
|
|||
int layer;
|
||||
|
||||
Evas evas;
|
||||
Evas_Object obj;
|
||||
struct {
|
||||
Evas_Object text;
|
||||
Evas_Object o1;
|
||||
Evas_Object o2;
|
||||
Evas_Object o3;
|
||||
Evas_Object o4;
|
||||
} obj;
|
||||
};
|
||||
|
||||
E_Text *e_text_new(Evas evas, char *text, char *class);
|
||||
|
|
20
src/view.c
20
src/view.c
|
@ -1481,12 +1481,12 @@ e_view_icon_show(E_Icon *ic)
|
|||
evas_callback_add(ic->view->evas, ic->obj.event2, CALLBACK_MOUSE_MOVE, e_icon_move_cb, ic);
|
||||
}
|
||||
evas_set_layer(ic->view->evas, ic->obj.icon, 200);
|
||||
evas_set_layer(ic->view->evas, ic->obj.text, 200);
|
||||
e_text_set_layer(ic->obj.text, 200);
|
||||
evas_set_layer(ic->view->evas, ic->obj.event1, 210);
|
||||
evas_set_layer(ic->view->evas, ic->obj.event2, 210);
|
||||
|
||||
evas_show(ic->view->evas, ic->obj.icon);
|
||||
evas_show(ic->view->evas, ic->obj.text);
|
||||
e_text_show(ic->obj.text);
|
||||
evas_show(ic->view->evas, ic->obj.event1);
|
||||
evas_show(ic->view->evas, ic->obj.event2);
|
||||
}
|
||||
|
@ -1497,7 +1497,7 @@ e_view_icon_hide(E_Icon *ic)
|
|||
if (!ic->state.visible) return;
|
||||
ic->state.visible = 0;
|
||||
evas_hide(ic->view->evas, ic->obj.icon);
|
||||
evas_hide(ic->view->evas, ic->obj.text);
|
||||
e_text_hide(ic->obj.text);
|
||||
evas_hide(ic->view->evas, ic->obj.event1);
|
||||
evas_hide(ic->view->evas, ic->obj.event2);
|
||||
}
|
||||
|
@ -1526,7 +1526,7 @@ e_view_icon_apply_xy(E_Icon *ic)
|
|||
evas_move(ic->view->evas, ic->obj.icon,
|
||||
ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.icon.w) / 2),
|
||||
ic->view->scroll.y + ic->geom.y);
|
||||
evas_move(ic->view->evas, ic->obj.text,
|
||||
e_text_move(ic->obj.text,
|
||||
ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.text.w) / 2),
|
||||
ic->view->scroll.y + ic->geom.y + ic->geom.icon.h + ic->view->spacing.icon.g);
|
||||
if (ic->obj.sel.under.icon)
|
||||
|
@ -1676,8 +1676,13 @@ e_view_icon_initial_show(E_Icon *ic)
|
|||
/* first. lets figure out the size of the icon */
|
||||
evas_get_image_size(ic->view->evas, ic->obj.icon,
|
||||
&(ic->geom.icon.w), &(ic->geom.icon.h));
|
||||
ic->geom.text.w = (int)evas_get_text_width(ic->view->evas, ic->obj.text);
|
||||
ic->geom.text.h = (int)evas_get_text_height(ic->view->evas, ic->obj.text);
|
||||
{
|
||||
double tw, th;
|
||||
|
||||
e_text_get_geometry(ic->obj.text, NULL, NULL, &tw, &th);
|
||||
ic->geom.text.w = (int)tw;
|
||||
ic->geom.text.h = (int)th;
|
||||
}
|
||||
|
||||
/* now lets allocate space for it if we need to */
|
||||
ic->geom.x = 999999;
|
||||
|
@ -1802,8 +1807,7 @@ e_view_file_added(int id, char *file)
|
|||
ic->file = strdup(file);
|
||||
ic->changed = 1;
|
||||
ic->obj.icon = evas_add_image_from_file(ic->view->evas, NULL);
|
||||
ic->obj.text = evas_add_text(ic->view->evas, "borzoib", 8, ic->file);
|
||||
evas_set_color(ic->view->evas, ic->obj.text, 0, 0, 0, 255);
|
||||
ic->obj.text = e_text_new(ic->view->evas, ic->file, "filename");
|
||||
v->icons = evas_list_append(v->icons, ic);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "e.h"
|
||||
#include "background.h"
|
||||
#include "fs.h"
|
||||
#include "text.h"
|
||||
|
||||
typedef struct _E_View E_View;
|
||||
typedef struct _E_Icon E_Icon;
|
||||
|
@ -137,9 +138,9 @@ struct _E_Icon
|
|||
|
||||
struct {
|
||||
Evas_Object icon;
|
||||
Evas_Object text;
|
||||
Evas_Object event1;
|
||||
Evas_Object event2;
|
||||
E_Text *text;
|
||||
struct {
|
||||
struct {
|
||||
Ebits_Object icon;
|
||||
|
|
Loading…
Reference in New Issue