aboutsummaryrefslogtreecommitdiffstats
path: root/src/iconbar.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/iconbar.c')
-rw-r--r--src/iconbar.c806
1 files changed, 301 insertions, 505 deletions
diff --git a/src/iconbar.c b/src/iconbar.c
index 94174aada..eeb5442f5 100644
--- a/src/iconbar.c
+++ b/src/iconbar.c
@@ -1,567 +1,363 @@
#include "iconbar.h"
-static Evas_List iconbars;
+static Evas_List iconbars = NULL;
-E_Iconbar *
-e_iconbar_new(E_View *v)
-{
- /* vertical lines (left, center, right) and title */
- /* Evas_Object ovl, ovc, ovr, ot; */
-
- E_Iconbar *ib;
-
- ib = NEW(E_Iconbar, 1);
- ZERO(ib, E_Iconbar, 1);
- OBJ_INIT(ib, e_iconbar_free);
-
- printf("in ib_new()\n");
-
- ib->v = v;
- ib->e = v->evas;
- /* ib->name = strdup(v->dir); */
-
- /* e_iconbar_draw(ib); */
- iconbars = evas_list_append(iconbars, ib);
-
- if(e_iconbar_config(ib) == 0)
- return NULL;
+static E_Config_Base_Type *cf_iconbar = NULL;
+static E_Config_Base_Type *cf_iconbar_icon = NULL;
- return ib;
-}
+static void ib_bits_show(void *data);
+static void ib_bits_hide(void *data);
+static void ib_bits_move(void *data, double x, double y);
+static void ib_bits_resize(void *data, double w, double h);
+static void ib_bits_raise(void *data);
+static void ib_bits_lower(void *data);
+static void ib_bits_set_layer(void *data, int l);
+static void ib_bits_set_clip(void *data, Evas_Object clip);
+static void ib_bits_set_color_class(void *data, char *cc, int r, int g, int b, int a);
+static void ib_bits_get_min_size(void *data, double *w, double *h);
+static void ib_bits_get_max_size(void *data, double *w, double *h);
+
+static void ib_mouse_in(void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
+static void ib_mouse_out(void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
+static void ib_mouse_down(void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
+static void ib_mouse_up(void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
void
-e_iconbar_realize(E_Iconbar *ib)
+e_iconbar_init()
{
- printf("in e_iconbar_realize()\n");
-
- if(ib->geom.conf.left < 0)
- ib->geom.left = ib->geom.conf.left + ib->v->size.w;
- if(ib->geom.conf.top < 0)
- ib->geom.top = ib->geom.conf.top + ib->v->size.h;
- if(ib->geom.conf.w == 0)
- ib->geom.w = ib->v->size.w;
- if(ib->geom.conf.h == 0)
- ib->geom.h = ib->v->size.h;
-
- printf("w: %i, h: %i\nt: %i, l: %i\n", ib->geom.w, ib->geom.h, ib->geom.top, ib->geom.left);
-
-
- /* horizontal */
- if (ib->geom.horizontal)
- {
- ib->obj.scroll = evas_add_rectangle(ib->e);
- ib->obj.line_l = evas_add_image_from_file(ib->e, ib->image.hline);
- ib->obj.line_c = evas_add_image_from_file(ib->e, ib->image.hline);
- ib->obj.line_r = evas_add_image_from_file(ib->e, ib->image.hline);
- ib->obj.title = evas_add_image_from_file(ib->e, ib->image.title);
- ib->obj.clip = evas_add_rectangle(ib->e);
-
- evas_get_image_size(ib->e, ib->obj.title, &ib->geom.title_w, &ib->geom.title_h);
- evas_get_image_size(ib->e, ib->obj.line_l, &ib->geom.line_w, &ib->geom.line_h);
-
- evas_set_layer(ib->e, ib->obj.scroll, 400);
-
- evas_resize(ib->e, ib->obj.scroll, ib->geom.w, ib->geom.scroll_w);
- evas_resize(ib->e, ib->obj.line_l, ib->geom.w, ib->geom.line_h);
- evas_resize(ib->e, ib->obj.line_c, ib->geom.w, ib->geom.line_h);
- evas_resize(ib->e, ib->obj.line_r, ib->geom.w, ib->geom.line_h);
- evas_resize(ib->e, ib->obj.clip, ib->geom.w, ib->geom.h);
-
- evas_set_image_fill(ib->e, ib->obj.line_l, 0, 0, ib->geom.line_w, ib->geom.line_h);
- evas_set_image_fill(ib->e, ib->obj.line_c, 0, 0, ib->geom.line_w, ib->geom.line_h);
- evas_set_image_fill(ib->e, ib->obj.line_r, 0, 0, ib->geom.line_w, ib->geom.line_h);
-
- evas_move(ib->e, ib->obj.scroll, ib->geom.left, ib->geom.top + ib->geom.h - ib->geom.scroll_w);
- evas_move(ib->e, ib->obj.line_l, ib->geom.left, ib->geom.top);
- evas_move(ib->e, ib->obj.line_c, ib->geom.left, ib->geom.top + ib->geom.h - ib->geom.scroll_w);
- evas_move(ib->e, ib->obj.line_r, ib->geom.left, ib->geom.top + ib->geom.h);
- evas_move(ib->e, ib->obj.title, ib->geom.left - ib->geom.title_w - 5, ib->geom.top + (ib->geom.h - ib->geom.title_h) / 2);
- evas_move(ib->e, ib->obj.clip, ib->geom.left, ib->geom.top);
-
- evas_set_color(ib->e, ib->obj.scroll, 129, 129, 129, 0);
- evas_set_color(ib->e, ib->obj.clip, 255, 255, 255, 255);
- }
-
- /* vertical */
- if (!ib->geom.horizontal)
- {
- ib->obj.scroll = evas_add_rectangle(ib->e);
- ib->obj.line_l = evas_add_image_from_file(ib->e, ib->image.vline);
- ib->obj.line_c = evas_add_image_from_file(ib->e, ib->image.vline);
- ib->obj.line_r = evas_add_image_from_file(ib->e, ib->image.vline);
- ib->obj.title = evas_add_image_from_file(ib->e, ib->image.title);
- ib->obj.clip = evas_add_rectangle(ib->e);
-
- evas_get_image_size(ib->e, ib->obj.title, &ib->geom.title_w, &ib->geom.title_h);
- evas_get_image_size(ib->e, ib->obj.line_l, &ib->geom.line_w, &ib->geom.line_h);
-
- evas_set_layer(ib->e, ib->obj.scroll, 400);
-
- evas_resize(ib->e, ib->obj.scroll, ib->geom.scroll_w, ib->geom.h);
- evas_resize(ib->e, ib->obj.line_l, ib->geom.line_w, ib->geom.h);
- evas_resize(ib->e, ib->obj.line_c, ib->geom.line_w, ib->geom.h);
- evas_resize(ib->e, ib->obj.line_r, ib->geom.line_w, ib->geom.h);
- evas_resize(ib->e, ib->obj.clip, ib->geom.w, ib->geom.h);
-
- evas_set_image_fill(ib->e, ib->obj.line_l, 0, 0, ib->geom.line_w, ib->geom.line_h);
- evas_set_image_fill(ib->e, ib->obj.line_c, 0, 0, ib->geom.line_w, ib->geom.line_h);
- evas_set_image_fill(ib->e, ib->obj.line_r, 0, 0, ib->geom.line_w, ib->geom.line_h);
-
- evas_move(ib->e, ib->obj.scroll, ib->geom.left + ib->geom.w - ib->geom.scroll_w, ib->geom.top);
- evas_move(ib->e, ib->obj.line_l, ib->geom.left, ib->geom.top);
- evas_move(ib->e, ib->obj.line_c, ib->geom.left + ib->geom.w - ib->geom.scroll_w, ib->geom.top);
- evas_move(ib->e, ib->obj.line_r, ib->geom.left + ib->geom.w, ib->geom.top);
- evas_move(ib->e, ib->obj.title, ib->geom.left + ((ib->geom.w - ib->geom.title_w - ib->geom.scroll_w) / 2 ), ib->geom.top - ib->geom.title_h - 5);
- evas_move(ib->e, ib->obj.clip, ib->geom.left, ib->geom.top);
-
- evas_set_color(ib->e, ib->obj.scroll, 129, 129, 129, 0);
- evas_set_color(ib->e, ib->obj.clip, 255, 255, 255, 255);
- }
-
-
- /* Clip icons */
- {
- Evas_List l;
- for (l = ib->icons; l; l = l->next)
- {
- E_Iconbar_Icon *i;
- i = l->data;
- evas_set_clip(ib->e, i->image, ib->obj.clip);
- }
- }
-
- /* show the iconbar */
- evas_show(ib->e, ib->obj.scroll);
- evas_show(ib->e, ib->obj.line_l);
- evas_show(ib->e, ib->obj.line_c);
- evas_show(ib->e, ib->obj.line_r);
- evas_show(ib->e, ib->obj.title);
- evas_show(ib->e, ib->obj.clip);
-
- evas_callback_add(ib->e, ib->obj.scroll, CALLBACK_MOUSE_MOVE, s_mouse_move, ib);
- evas_callback_add(ib->e, ib->obj.scroll, CALLBACK_MOUSE_IN, s_mouse_in, ib);
- evas_callback_add(ib->e, ib->obj.scroll, CALLBACK_MOUSE_OUT, s_mouse_out, ib);
-
- e_iconbar_fix_icons(ib);
-
- printf("realized!\n");
+ cf_iconbar_icon = e_config_type_new();
+ E_CONFIG_NODE(cf_iconbar_icon, "exec", E_CFG_TYPE_STR, NULL, E_Iconbar_Icon, exec, 0, 0, "");
+ E_CONFIG_NODE(cf_iconbar_icon, "image", E_CFG_TYPE_KEY, NULL, E_Iconbar_Icon, image_path, 0, 0, "");
+
+ cf_iconbar = e_config_type_new();
+ E_CONFIG_NODE(cf_iconbar, "icons", E_CFG_TYPE_LIST, cf_iconbar_icon, E_Iconbar, icons, 0, 0, NULL);
}
-
-E_Iconbar_Icon *
-e_iconbar_new_icon(E_Iconbar *ib, char *image, char *exec)
+E_Iconbar *
+e_iconbar_new(E_View *v)
{
- E_Iconbar_Icon *i;
-
- i = NEW(E_Iconbar_Icon, 1);
- i->image = evas_add_image_from_file(ib->e, image);
- i->exec = strdup(exec);
- evas_get_image_size(ib->e, i->image, &(i->w), &(i->h));
-
- if (ib->geom.horizontal)
- {
- i->x = 0;
- i->y = (ib->geom.h - i->h - ib->geom.scroll_w) / 2 + ib->geom.top;
- }
- else
- {
- i->x = (ib->geom.w - i->w - ib->geom.scroll_w) / 2 + ib->geom.left;
- i->y = 0;
- }
-
- printf("x: %f, y: %f\n", i->x, i->y);
- evas_callback_add(ib->e, i->image, CALLBACK_MOUSE_IN, i_mouse_in, NULL);
- evas_callback_add(ib->e, i->image, CALLBACK_MOUSE_OUT, i_mouse_out, NULL);
- evas_callback_add(ib->e, i->image, CALLBACK_MOUSE_DOWN, i_mouse_down, i->exec);
-
- evas_set_color(ib->e, i->image, 255, 255, 255, 128);
- evas_set_layer(ib->e, i->image, 400);
- /* evas_set_clip(ib->e, i->image, ib->obj.clip); */
- /* printf("before ib->icons set\n"); */
- ib->icons = evas_list_append(ib->icons, i);
- /* printf("after set\n"); */
-
- return i;
-}
-
+ Evas_List l;
+ char buf[PATH_MAX];
+ E_Iconbar *ib;
+
+ sprintf(buf, "%s/.e_iconbar.db", v->dir);
+
+ ib = e_config_load(buf, "", cf_iconbar);
+ if (!ib) return NULL;
+
+ OBJ_INIT(ib, e_iconbar_free);
+ ib->view = v;
+
+ for (l = ib->icons; l; l = l->next)
+ {
+ E_Iconbar_Icon *ic;
+
+ ic = l->data;
+ OBJ_INIT(ic, e_iconbar_icon_free);
+ ic->iconbar = ib;
+ }
+ sprintf(buf, "%s/.e_iconbar.bits.db", v->dir);
+
+ ib->bit = ebits_load(buf);
+ if (!ib->bit)
+ {
+ OBJ_UNREF(ib);
+ return NULL;
+ }
+
+ return ib;
+}
-int
-e_iconbar_config(E_Iconbar *ib)
+void
+e_iconbar_free(E_Iconbar *ib)
{
- E_DB_File *db;
- char buf[PATH_MAX], *userdir;
-
- /* userdir = e_config_user_dir(); */
- /* sprintf(buf, "%sbehavior/iconbar.db", userdir); */
- sprintf(buf, "%s/.e_iconbar.db", ib->v->dir);
- ib->db = strdup(buf);
- db = e_db_open_read(ib->db);
-
- if (!db)
- {
- /* ib->no_show = 1;
-
- db = e_db_open(ib->db);
- e_db_int_set(db, "/ib/num", 0);
- e_db_int_set(db, "/ib/geom/w", 75);
- e_db_int_set(db, "/ib/geom/h", 620);
- e_db_int_set(db, "/ib/geom/top", 165);
- e_db_int_set(db, "/ib/geom/left", -150);
- e_db_int_set(db, "/ib/geom/scroll_w", 16);
- e_db_int_set(db, "/ib/geom/horizontal", 0);
- e_db_int_set(db, "/ib/scroll_when_less", 0);
- e_db_str_set(db, "/ib/image/title", "/usr/local/share/enlightenment/data/ib_title.png");
- e_db_str_set(db, "/ib/image/vline", "/usr/local/share/enlightenment/data/vline.png");
- e_db_str_set(db, "/ib/image/hline", "/usr/local/share/enlightenment/data/hline.png");
- */
- return 0;
- }
-
- e_db_int_get(db, "/ib/geom/w", &(ib->geom.conf.w) );
- e_db_int_get(db, "/ib/geom/h", &(ib->geom.conf.h));
- e_db_int_get(db, "/ib/geom/top", &(ib->geom.conf.top));
- e_db_int_get(db, "/ib/geom/left", &(ib->geom.conf.left));
- e_db_int_get(db, "/ib/geom/scroll_w", &(ib->geom.scroll_w));
- e_db_int_get(db, "/ib/geom/horizontal", &(ib->geom.horizontal));
- e_db_int_get(db, "/ib/scroll_when_less", &(ib->scroll_when_less));
- ib->image.title = e_db_str_get(db, "/ib/image/title");
- ib->image.vline = e_db_str_get(db, "/ib/image/vline");
- ib->image.hline = e_db_str_get(db, "/ib/image/hline");
-
- ib->start = 0.0;
- ib->icons = NULL;
-
- ib->geom.left = ib->geom.conf.left;
- ib->geom.top = ib->geom.conf.top;
- ib->geom.w = ib->geom.conf.w;
- ib->geom.h = ib->geom.conf.h;
-
- /*
- {
- double w, h;
- evas_get_viewport(ib->e, NULL, NULL, &w, &h);
-
- if(ib->geom.conf.left < 0)
- ib->geom.left = ib->geom.conf.left + w;
- else
- ib->geom.left = ib->geom.conf.left;
- if(ib->geom.conf.top < 0)
- ib->geom.top = ib->geom.conf.top + h;
- else
- ib->geom.top = ib->geom.conf.top;
- }
+ iconbars = evas_list_remove(iconbars, ib);
- */
- printf("w: %i, h: %i\nt: %i, l: %i\n", ib->geom.w, ib->geom.h, ib->geom.top, ib->geom.left);
-
+ ib->view->changed = 1;
+ if (ib->bit) ebits_free(ib->bit);
+ if (ib->icons)
+ {
+ Evas_List l;
- {
- int i, num;
-
- if (e_db_int_get(db, "/ib/num", &num))
- {
- printf("making %i icons...\n", num);
-
- for ( i = 0; i < num; i++)
+ for (l = ib->icons; l; l = l->next)
{
- char *icon, *exec, buf[PATH_MAX];
-
- sprintf(buf, "/ib/%i/icon", i);
- /* printf("reading #%i's icon...\n", i); */
- icon = e_db_str_get(db, buf);
- /* printf("icon: %s, reading #%i's exec...\n", icon, i); */
- sprintf(buf, "/ib/%i/exec", i);
- exec = e_db_str_get(db, buf);
- printf("exec: %s... creating icon\n", exec);
-
- /* printf("creating icon, %s, %s\n", icon, exec); */
- e_iconbar_new_icon(ib, icon, exec);
- printf("created...\n");
+ E_Iconbar_Icon *ic;
+
+ ic = l->data;
+ OBJ_UNREF(ic);
}
- }
- }
- /* printf("created icon.\n"); */
-
- e_db_close(db);
-
- return 1;
+ evas_list_free(ib->icons);
+ }
+ FREE(ib);
}
-
void
-e_iconbar_fix_icons(E_Iconbar *ib)
+e_iconbar_icon_free(E_Iconbar_Icon *ic)
{
- Evas_List l;
- double cur, spacer;
-
- spacer = 8.0;
-
- if (!ib->geom.horizontal)
- {
- cur = ib->geom.top + ib->start + spacer;
- for (l = ib->icons; l; l = l->next)
- {
- E_Iconbar_Icon *i;
-
- i = l->data;
- i->y = cur;
- i->x = (ib->geom.w - i->w - ib->geom.scroll_w) / 2 + ib->geom.left;
- cur = cur + i->h + spacer;
-
- evas_move(ib->e, i->image, i->x, i->y);
- evas_show(ib->e, i->image);
- }
-
- ib->length = cur - ib->start - ib->geom.top;
- }
- else
- {
- cur = ib->geom.left + ib->start + spacer;
- for (l = ib->icons; l; l = l->next)
- {
- E_Iconbar_Icon *i;
-
- i = l->data;
- i->x = cur;
- i->y = (ib->geom.h - i->h - ib->geom.scroll_w) / 2 + ib->geom.top;
- cur = cur + i->w + spacer;
-
- evas_move(ib->e, i->image, i->x, i->y);
- evas_show(ib->e, i->image);
- }
-
- ib->length = cur - ib->start - ib->geom.left;
- }
+ if (ic->image) evas_del_object(ic->iconbar->view->evas, ic->image);
+ IF_FREE(ic->image_path);
+ IF_FREE(ic->exec);
+ FREE(ic);
}
-
+
void
-e_iconbar_scroll(int val, void *data)
+e_iconbar_realize(E_Iconbar *ib)
{
- E_Iconbar *ib;
- double vis_length;
-
- /* printf("before scroll data to ib set\n"); */
- ib = data;
- /* printf("after data set\n"); */
- /* printf("start: %f, speed: %f\n", ib->start, ib->speed); */
- ib->start = ib->start - ib->speed;
- if (ib->geom.horizontal) vis_length = ib->geom.w;
- else vis_length = ib->geom.h;
-
- if (ib->length > vis_length)
- {
- if (ib->start > 0)
- ib->start = 0;
- else if (ib->start < vis_length - ib->length)
- ib->start = vis_length - ib->length;
- }
- else if (ib->scroll_when_less)
- {
- /* icons scroll even if they don't fill the bar */
- if (ib->start < 0)
- ib->start = 0;
- else if (ib->start > vis_length - ib->length)
- ib->start = vis_length - ib->length;
-
- }
- else
- {
- ib->start = 0;
- }
- /* printf("before fix\n"); */
- e_iconbar_fix_icons(ib);
- /* printf("after fix\n"); */
-
- if (ib->scrolling)
- {
- /* printf("before timer\n"); */
- ecore_add_event_timer("e_iconbar_scroll()", 0.01, e_iconbar_scroll, 1, ib);
- /* printf("after timer\n"); */
- }
+ Evas_List l;
+
+ for (l = ib->icons; l; l = l->next)
+ {
+ E_Iconbar_Icon *ic;
+ char buf[PATH_MAX];
+
+ ic = l->data;
+ sprintf(buf, "%s/.e_iconbar.db:%s", ib->view->dir, ic->image_path);
+ ic->image = evas_add_image_from_file(ib->view->evas, buf);
+ evas_set_color(ib->view->evas, ic->image, 255, 255, 255, 128);
+ evas_callback_add(ib->view->evas, ic->image, CALLBACK_MOUSE_IN, ib_mouse_in, ic);
+ evas_callback_add(ib->view->evas, ic->image, CALLBACK_MOUSE_OUT, ib_mouse_out, ic);
+ evas_callback_add(ib->view->evas, ic->image, CALLBACK_MOUSE_DOWN, ib_mouse_down, ic);
+ evas_callback_add(ib->view->evas, ic->image, CALLBACK_MOUSE_UP, ib_mouse_up, ic);
+ }
+ ebits_add_to_evas(ib->bit, ib->view->evas);
+ ebits_set_named_bit_replace(ib->bit, "Icons",
+ ib_bits_show,
+ ib_bits_hide,
+ ib_bits_move,
+ ib_bits_resize,
+ ib_bits_raise,
+ ib_bits_lower,
+ ib_bits_set_layer,
+ ib_bits_set_clip,
+ ib_bits_set_color_class,
+ ib_bits_get_min_size,
+ ib_bits_get_max_size,
+ ib);
+ ebits_set_layer(ib->bit, 10000);
+ e_iconbar_fix(ib);
}
void
-i_mouse_in(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
+e_iconbar_fix(E_Iconbar *ib)
{
- evas_set_color(_e, _o, 255, 255, 255, 255);
+ Evas_List l;
+ double ix, iy, aw, ah;
+
+ ebits_move(ib->bit, 0, 0);
+ ebits_resize(ib->bit, ib->view->size.w, ib->view->size.h);
+ ebits_show(ib->bit);
+ ib->view->changed = 1;
+
+ ix = ib->icon_area.x;
+ iy = ib->icon_area.y;
+ aw = ib->icon_area.w;
+ ah = ib->icon_area.h;
+
+ if (aw > ah) /* horizontal */
+ {
+ }
+ else /* vertical */
+ {
+ }
+
+ for (l = ib->icons; l; l = l->next)
+ {
+ E_Iconbar_Icon *ic;
+ int iw, ih;
+ double w, h;
+ double ox, oy;
+
+ ic = l->data;
+ evas_get_image_size(ic->iconbar->view->evas, ic->image, &iw, &ih);
+ w = iw;
+ h = ih;
+ ox = 0;
+ oy = 0;
+ if (aw > ah) /* horizontal */
+ {
+ if (h > ah)
+ {
+ w = (ah * w) / h;
+ h = ah;
+ }
+ ox = 0;
+ oy = (ah - h) / 2;
+ evas_move(ic->iconbar->view->evas, ic->image, ix + ox, iy + oy);
+ evas_resize(ic->iconbar->view->evas, ic->image, w, h);
+ ix += w;
+ }
+ else /* vertical */
+ {
+ if (w > aw)
+ {
+ h = (aw * h) / w;
+ w = aw;
+ }
+ ox = (aw - w) / 2;
+ oy = 0;
+ evas_move(ic->iconbar->view->evas, ic->image, ix + ox, iy + oy);
+ evas_resize(ic->iconbar->view->evas, ic->image, w, h);
+ iy += h;
+ }
+ }
}
-void
-i_mouse_out(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
+static void
+ib_bits_show(void *data)
{
- evas_set_color(_e, _o, 255, 255, 255, 128);
+ E_Iconbar *ib;
+ Evas_List l;
+
+ ib = (E_Iconbar *)data;
+ for (l = ib->icons; l; l = l->next)
+ {
+ E_Iconbar_Icon *ic;
+
+ ic = l->data;
+ evas_show(ic->iconbar->view->evas, ic->image);
+ }
}
-void
-i_mouse_down(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
+static void
+ib_bits_hide(void *data)
{
- char *file = _data;
- e_exec_run(file);
+ E_Iconbar *ib;
+ Evas_List l;
+
+ ib = (E_Iconbar *)data;
+ for (l = ib->icons; l; l = l->next)
+ {
+ E_Iconbar_Icon *ic;
+
+ ic = l->data;
+ evas_hide(ic->iconbar->view->evas, ic->image);
+ }
}
+static void
+ib_bits_move(void *data, double x, double y)
+{
+ E_Iconbar *ib;
+ Evas_List l;
+
+ ib = (E_Iconbar *)data;
+ ib->icon_area.x = x;
+ ib->icon_area.y = y;
+}
-void
-s_mouse_move(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
-{
- E_Iconbar *ib;
-
- double center;
- int top_speed;
- double r;
-
- /* printf("set ib in s_mouse_move\n"); */
+static void
+ib_bits_resize(void *data, double w, double h)
+{
+ E_Iconbar *ib;
+ Evas_List l;
+
+ ib = (E_Iconbar *)data;
+ ib->icon_area.w = w;
+ ib->icon_area.h = h;
+}
- ib = _data;
-
- top_speed = 5;
-
- if (ib->geom.horizontal)
- {
- center = ib->geom.left + (.5 * ib->geom.w);
- r = (_x - center) / (.5 * ib->geom.w);
- }
- else
- {
- center = ib->geom.top + (.5 * ib->geom.h);
- r = (_y - center) / (.5 * ib->geom.h);
- }
-
- ib->speed = r * (double)top_speed;
-
- e_iconbar_scroll(1, ib);
+static void
+ib_bits_raise(void *data)
+{
+ E_Iconbar *ib;
+ Evas_List l;
+
+ ib = (E_Iconbar *)data;
+ for (l = ib->icons; l; l = l->next)
+ {
+ E_Iconbar_Icon *ic;
+
+ ic = l->data;
+ evas_raise(ic->iconbar->view->evas, ic->image);
+ }
}
-void
-s_mouse_in(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
+static void
+ib_bits_lower(void *data)
{
- E_Iconbar *ib;
- ib = _data;
- /* printf("setting scrolling\n"); */
- ib->scrolling = 1;
- /* printf("set scrolling\n"); */
+ E_Iconbar *ib;
+ Evas_List l;
+
+ ib = (E_Iconbar *)data;
+ for (l = ib->icons; l; l = l->next)
+ {
+ E_Iconbar_Icon *ic;
+
+ ic = l->data;
+ evas_lower(ic->iconbar->view->evas, ic->image);
+ }
}
-void
-s_mouse_out(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
+static void
+ib_bits_set_layer(void *data, int lay)
{
- E_Iconbar *ib;
- ib = _data;
- ib->scrolling = 0;
+ E_Iconbar *ib;
+ Evas_List l;
+
+ ib = (E_Iconbar *)data;
+ for (l = ib->icons; l; l = l->next)
+ {
+ E_Iconbar_Icon *ic;
+
+ ic = l->data;
+ evas_set_layer(ic->iconbar->view->evas, ic->image, lay);
+ }
}
-void
-e_iconbar_free(E_Iconbar *ib)
+static void
+ib_bits_set_clip(void *data, Evas_Object clip)
{
-
- Evas_List l;
-
- printf("in e_iconbar_clean_up()\n");
-
- iconbars = evas_list_remove(iconbars, ib);
-
- for (l = ib->icons; l; l = l->next)
- {
- E_Iconbar_Icon *i;
- i = l->data;
- FREE(i);
- }
- FREE(ib->icons);
- FREE(ib);
- e_db_runtime_flush();
-
- printf("e_iconbar_clean_up() run successfully\n");
}
+static void
+ib_bits_set_color_class(void *data, char *cc, int r, int g, int b, int a)
+{
+}
static void
-e_iconbar_idle(void *data)
+ib_bits_get_min_size(void *data, double *w, double *h)
{
- Evas_List l;
-
- for (l = iconbars; l; l = l->next)
- {
- E_Iconbar *ib;
-
- ib = l->data;
- e_iconbar_update(ib);
- /* e_iconbar_redraw(ib); */
- }
+ *w = 0;
+ *h = 0;
}
-void
-e_iconbar_update(E_Iconbar *ib)
+static void
+ib_bits_get_max_size(void *data, double *w, double *h)
{
- if (ib->v->changed)
- {
- e_iconbar_redraw(ib);
- }
+ *w = 999999;
+ *h = 999999;
}
+static void
+ib_mouse_in(void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
+{
+ E_Iconbar_Icon *ic;
+
+ ic = (E_Iconbar_Icon *)data;
+ evas_set_color(ic->iconbar->view->evas, ic->image, 255, 255, 255, 255);
+ ic->iconbar->view->changed = 1;
+}
-void
-e_iconbar_redraw(E_Iconbar *ib)
+static void
+ib_mouse_out(void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
{
- if(ib->geom.conf.left < 0)
- ib->geom.left = ib->geom.conf.left + ib->v->size.w;
- if(ib->geom.conf.top < 0)
- ib->geom.top = ib->geom.conf.top + ib->v->size.h;
- if(ib->geom.conf.w == 0)
- ib->geom.w = ib->v->size.w;
- if(ib->geom.conf.h == 0)
- ib->geom.h = ib->v->size.h;
-
-
- /* horizontal */
- if (ib->geom.horizontal)
- {
- evas_move(ib->e, ib->obj.scroll, ib->geom.left, ib->geom.top + ib->geom.h - ib->geom.scroll_w);
- evas_move(ib->e, ib->obj.line_l, ib->geom.left, ib->geom.top);
- evas_move(ib->e, ib->obj.line_c, ib->geom.left, ib->geom.top + ib->geom.h - ib->geom.scroll_w);
- evas_move(ib->e, ib->obj.line_r, ib->geom.left, ib->geom.top + ib->geom.h);
- evas_move(ib->e, ib->obj.title, ib->geom.left - ib->geom.title_w - 5, ib->geom.top + (ib->geom.h - ib->geom.title_h) / 2);
- evas_move(ib->e, ib->obj.clip, ib->geom.left, ib->geom.top);
- }
-
- /* vertical */
- if (!ib->geom.horizontal)
- {
- evas_move(ib->e, ib->obj.scroll, ib->geom.left + ib->geom.w - ib->geom.scroll_w, ib->geom.top);
- evas_move(ib->e, ib->obj.line_l, ib->geom.left, ib->geom.top);
- evas_move(ib->e, ib->obj.line_c, ib->geom.left + ib->geom.w - ib->geom.scroll_w, ib->geom.top);
- evas_move(ib->e, ib->obj.line_r, ib->geom.left + ib->geom.w, ib->geom.top);
- evas_move(ib->e, ib->obj.title, ib->geom.left + ((ib->geom.w - ib->geom.title_w - ib->geom.scroll_w) / 2 ), ib->geom.top - ib->geom.title_h - 5);
- evas_move(ib->e, ib->obj.clip, ib->geom.left, ib->geom.top);
- }
-
-
- /* Clip icons */
- {
- Evas_List l;
- for (l = ib->icons; l; l = l->next)
- {
- E_Iconbar_Icon *i;
- i = l->data;
- evas_set_clip(ib->e, i->image, ib->obj.clip);
- }
- }
-
- /* show the iconbar */
- evas_show(ib->e, ib->obj.scroll);
- evas_show(ib->e, ib->obj.line_l);
- evas_show(ib->e, ib->obj.line_c);
- evas_show(ib->e, ib->obj.line_r);
- evas_show(ib->e, ib->obj.title);
- evas_show(ib->e, ib->obj.clip);
-
- evas_callback_add(ib->e, ib->obj.scroll, CALLBACK_MOUSE_MOVE, s_mouse_move, ib);
- evas_callback_add(ib->e, ib->obj.scroll, CALLBACK_MOUSE_IN, s_mouse_in, ib);
- evas_callback_add(ib->e, ib->obj.scroll, CALLBACK_MOUSE_OUT, s_mouse_out, ib);
-
- e_iconbar_fix_icons(ib);
+ E_Iconbar_Icon *ic;
+
+ ic = (E_Iconbar_Icon *)data;
+ evas_set_color(ic->iconbar->view->evas, ic->image, 255, 255, 255, 128);
+ ic->iconbar->view->changed = 1;
}
-void
-e_iconbar_init()
+static void
+ib_mouse_down(void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
+{
+ E_Iconbar_Icon *ic;
+
+ ic = (E_Iconbar_Icon *)data;
+ e_exec_run(ic->exec);
+}
+
+static void
+ib_mouse_up(void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
{
- ecore_event_filter_idle_handler_add(e_iconbar_idle, NULL);
}