aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--data/themes/default_scrollframe.edc2
-rw-r--r--src/bin/Makefile.am4
-rw-r--r--src/bin/e_ilist.c10
-rw-r--r--src/bin/e_ilist.h1
-rw-r--r--src/bin/e_includes.h1
-rw-r--r--src/bin/e_livethumb.c218
-rw-r--r--src/bin/e_livethumb.h17
-rw-r--r--src/bin/e_scrollframe.c12
-rw-r--r--src/bin/e_test.c13
9 files changed, 270 insertions, 8 deletions
diff --git a/data/themes/default_scrollframe.edc b/data/themes/default_scrollframe.edc
index a320af290..800df1373 100644
--- a/data/themes/default_scrollframe.edc
+++ b/data/themes/default_scrollframe.edc
@@ -62,7 +62,7 @@ group {
state: "default" 0.0;
color: 0 0 0 0;
rel1 {
- offset: 3 3;
+ offset: 4 4;
}
rel2 {
relative: 0.0 0.0;
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
index c730766ba..10b193366 100644
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -109,7 +109,8 @@ e_scrollframe.h \
e_file_selector.h \
e_file_dialog.h \
e_int_border_menu.h \
-e_ilist.h
+e_ilist.h \
+e_livethumb.h
enlightenment_src = \
e_user.c \
@@ -200,6 +201,7 @@ e_file_selector.c \
e_file_dialog.c \
e_int_border_menu.c \
e_ilist.c \
+e_livethumb.c \
$(ENLIGHTENMENTHEADERS)
enlightenment_SOURCES = \
diff --git a/src/bin/e_ilist.c b/src/bin/e_ilist.c
index e7ad5d40f..f987fb3fd 100644
--- a/src/bin/e_ilist.c
+++ b/src/bin/e_ilist.c
@@ -295,6 +295,16 @@ static void
_e_smart_del(Evas_Object *obj)
{
INTERNAL_ENTRY;
+ while (sd->items)
+ {
+ E_Smart_Item *si;
+
+ si = sd->items->data;
+ sd->items = evas_list_remove_list(sd->items, sd->items);
+ if (si->icon_obj) evas_object_del(si->icon_obj);
+ evas_object_del(si->base_obj);
+ free(si);
+ }
evas_object_del(sd->box_obj);
free(sd);
}
diff --git a/src/bin/e_ilist.h b/src/bin/e_ilist.h
index 193d746fb..92759d04e 100644
--- a/src/bin/e_ilist.h
+++ b/src/bin/e_ilist.h
@@ -7,6 +7,7 @@
#define E_ILIST_H
EAPI Evas_Object *e_ilist_add (Evas *evas);
+EAPI void e_ilist_icon_size_set (Evas_Object *obj, Evas_Coord w, Evas_Coord h);
EAPI void e_ilist_append (Evas_Object *obj, Evas_Object *icon, char *label, void (*func) (void *data, void *data2), void *data, void *data2);
EAPI void e_ilist_select_set (Evas_Object *obj, int n);
EAPI int e_ilist_select_get (Evas_Object *obj);
diff --git a/src/bin/e_includes.h b/src/bin/e_includes.h
index aa41d750e..7ca613e12 100644
--- a/src/bin/e_includes.h
+++ b/src/bin/e_includes.h
@@ -90,3 +90,4 @@
#include "e_widget_fileman.h"
#include "e_int_border_menu.h"
#include "e_ilist.h"
+#include "e_livethumb.h"
diff --git a/src/bin/e_livethumb.c b/src/bin/e_livethumb.c
new file mode 100644
index 000000000..e83a0c05f
--- /dev/null
+++ b/src/bin/e_livethumb.c
@@ -0,0 +1,218 @@
+/*
+ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+ */
+#include "e.h"
+
+#define SMART_NAME "e_livethumb"
+#define API_ENTRY E_Smart_Data *sd; sd = evas_object_smart_data_get(obj); if ((!obj) || (!sd) || (evas_object_type_get(obj) && strcmp(evas_object_type_get(obj), SMART_NAME)))
+#define INTERNAL_ENTRY E_Smart_Data *sd; sd = evas_object_smart_data_get(obj); if (!sd) return;
+typedef struct _E_Smart_Data E_Smart_Data;
+typedef struct _E_Smart_Item E_Smart_Item;
+
+struct _E_Smart_Data
+{
+ Evas_Coord x, y, w, h;
+
+ Evas_Object *smart_obj;
+ Evas_Object *evas_obj;
+ Evas_Object *thumb_obj;
+ Evas *evas;
+ Evas_Coord vw, vh;
+};
+
+/* local subsystem functions */
+static void _e_smart_reconfigure(E_Smart_Data *sd);
+static void _e_smart_add(Evas_Object *obj);
+static void _e_smart_del(Evas_Object *obj);
+static void _e_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
+static void _e_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
+static void _e_smart_show(Evas_Object *obj);
+static void _e_smart_hide(Evas_Object *obj);
+static void _e_smart_color_set(Evas_Object *obj, int r, int g, int b, int a);
+static void _e_smart_clip_set(Evas_Object *obj, Evas_Object * clip);
+static void _e_smart_clip_unset(Evas_Object *obj);
+static void _e_smart_init(void);
+
+/* local subsystem globals */
+static Evas_Smart *_e_smart = NULL;
+
+/* externally accessible functions */
+Evas_Object *
+e_livethumb_add(Ecore_Evas *ee)
+{
+ Evas_Object *obj;
+ E_Smart_Data *sd;
+
+
+ _e_smart_init();
+ obj = evas_object_smart_add(ecore_evas_get(ee), _e_smart);
+ sd = evas_object_smart_data_get(obj);
+ sd->evas_obj = ecore_evas_object_image_new(ee);
+ evas_object_smart_member_add(sd->evas_obj, obj);
+ evas_object_image_size_set(sd->evas_obj, sd->vw, sd->vh);
+ sd->evas = ecore_evas_get(evas_object_data_get(sd->evas_obj, "Ecore_Evas"));
+ e_canvas_add(evas_object_data_get(sd->evas_obj, "Ecore_Evas"));
+ return obj;
+}
+
+Evas *
+e_livethumb_evas_get(Evas_Object *obj)
+{
+ API_ENTRY return NULL;
+ return sd->evas;
+}
+
+void
+e_livethumb_vsize_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
+{
+ API_ENTRY return;
+ if ((w == sd->vw) && (h == sd->vh)) return;
+ sd->vw = w;
+ sd->vh = h;
+ evas_object_image_size_set(sd->evas_obj, sd->vw, sd->vh);
+ if (sd->thumb_obj) evas_object_resize(sd->thumb_obj, sd->vw, sd->vh);
+}
+
+void
+e_livethumb_vsize_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
+{
+ API_ENTRY return;
+ if (w) *w = sd->vw;
+ if (h) *h = sd->vh;
+}
+
+void
+e_livethumb_thumb_set(Evas_Object *obj, Evas_Object *thumb)
+{
+ API_ENTRY return;
+ if (!thumb)
+ {
+ sd->thumb_obj = NULL;
+ return;
+ }
+ sd->thumb_obj = thumb;
+ evas_object_show(sd->thumb_obj);
+ evas_object_move(sd->thumb_obj, 0, 0);
+ evas_object_resize(sd->thumb_obj, sd->vw, sd->vh);
+}
+
+Evas_Object *
+e_livethumb_thumb_get(Evas_Object *obj)
+{
+ API_ENTRY return NULL;
+ return sd->thumb_obj;
+}
+
+/* local subsystem functions */
+
+static void
+_e_smart_reconfigure(E_Smart_Data *sd)
+{
+ evas_object_move(sd->evas_obj, sd->x, sd->y);
+ evas_object_resize(sd->evas_obj, sd->w, sd->h);
+ evas_object_image_fill_set(sd->evas_obj, 0, 0, sd->w, sd->h);
+}
+
+static void
+_e_smart_add(Evas_Object *obj)
+{
+ E_Smart_Data *sd;
+ Evas_Object *o;
+
+ sd = calloc(1, sizeof(E_Smart_Data));
+ if (!sd) return;
+ evas_object_smart_data_set(obj, sd);
+
+ sd->smart_obj = obj;
+ sd->x = 0;
+ sd->y = 0;
+ sd->w = 0;
+ sd->h = 0;
+ sd->vw = 1;
+ sd->vh = 1;
+}
+
+static void
+_e_smart_del(Evas_Object *obj)
+{
+ INTERNAL_ENTRY;
+ e_canvas_del(evas_object_data_get(sd->evas_obj, "Ecore_Evas"));
+ evas_object_del(sd->evas_obj);
+ free(sd);
+}
+
+static void
+_e_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
+{
+ INTERNAL_ENTRY;
+ if ((sd->x == x) && (sd->y == y)) return;
+ sd->x = x;
+ sd->y = y;
+ _e_smart_reconfigure(sd);
+}
+
+static void
+_e_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
+{
+ INTERNAL_ENTRY;
+ if ((sd->w == w) && (sd->h == h)) return;
+ sd->w = w;
+ sd->h = h;
+ _e_smart_reconfigure(sd);
+}
+
+static void
+_e_smart_show(Evas_Object *obj)
+{
+ INTERNAL_ENTRY;
+ evas_object_show(sd->evas_obj);
+}
+
+static void
+_e_smart_hide(Evas_Object *obj)
+{
+ INTERNAL_ENTRY;
+ evas_object_hide(sd->evas_obj);
+}
+
+static void
+_e_smart_color_set(Evas_Object *obj, int r, int g, int b, int a)
+{
+ INTERNAL_ENTRY;
+ evas_object_color_set(sd->evas_obj, r, g, b, a);
+}
+
+static void
+_e_smart_clip_set(Evas_Object *obj, Evas_Object * clip)
+{
+ INTERNAL_ENTRY;
+ evas_object_clip_set(sd->evas_obj, clip);
+}
+
+static void
+_e_smart_clip_unset(Evas_Object *obj)
+{
+ INTERNAL_ENTRY;
+ evas_object_clip_unset(sd->evas_obj);
+}
+
+/* never need to touch this */
+
+static void
+_e_smart_init(void)
+{
+ if (_e_smart) return;
+ _e_smart = evas_smart_new(SMART_NAME,
+ _e_smart_add,
+ _e_smart_del,
+ NULL, NULL, NULL, NULL, NULL,
+ _e_smart_move,
+ _e_smart_resize,
+ _e_smart_show,
+ _e_smart_hide,
+ _e_smart_color_set,
+ _e_smart_clip_set,
+ _e_smart_clip_unset,
+ NULL);
+}
+
diff --git a/src/bin/e_livethumb.h b/src/bin/e_livethumb.h
new file mode 100644
index 000000000..1c5d651ad
--- /dev/null
+++ b/src/bin/e_livethumb.h
@@ -0,0 +1,17 @@
+/*
+ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+ */
+#ifdef E_TYPEDEFS
+#else
+#ifndef E_LIVETHUMB_H
+#define E_LIVETHUMB_H
+
+EAPI Evas_Object *e_livethumb_add (Ecore_Evas *ee);
+EAPI Evas *e_livethumb_evas_get (Evas_Object *obj);
+EAPI void e_livethumb_vsize_set (Evas_Object *obj, Evas_Coord w, Evas_Coord h);
+EAPI void e_livethumb_vsize_get (Evas_Object *obj, Evas_Coord *w, Evas_Coord *h);
+EAPI void e_livethumb_thumb_set (Evas_Object *obj, Evas_Object *thumb);
+EAPI Evas_Object *e_livethumb_thumb_get (Evas_Object *obj);
+
+#endif
+#endif
diff --git a/src/bin/e_scrollframe.c b/src/bin/e_scrollframe.c
index d94e5c832..db177ae1f 100644
--- a/src/bin/e_scrollframe.c
+++ b/src/bin/e_scrollframe.c
@@ -205,10 +205,18 @@ e_scrollframe_child_region_show(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Ev
nx = px;
if (x < px) nx = x;
- else if ((x + w) > (px + (cw - mx))) nx = x + w - (cw - mx);
+ else if ((x + w) > (px + (cw - mx)))
+ {
+ nx = x + w - (cw - mx);
+ if (nx > x) nx = x;
+ }
ny = py;
if (y < py) ny = y;
- else if ((y + h) > (py + (ch - my))) ny = y + h - (ch - my);
+ else if ((y + h) > (py + (ch - my)))
+ {
+ ny = y + h - (ch - my);
+ if (ny > y) ny = y;
+ }
if ((nx == px) && (ny == py)) return;
e_scrollframe_child_pos_set(obj, nx, ny);
}
diff --git a/src/bin/e_test.c b/src/bin/e_test.c
index fd73df999..e211937ed 100644
--- a/src/bin/e_test.c
+++ b/src/bin/e_test.c
@@ -429,15 +429,20 @@ _e_test_internal(E_Container *con)
{
E_Dialog *dia;
Evas_Coord mw, mh, vw, vh;
- Evas_Object *o, *o2, *o3;
+ Evas_Object *o, *o2, *o3, *o4;
dia = e_dialog_new(con);
e_dialog_title_set(dia, "A Test Dialog");
o = e_ilist_add(dia->win->evas);
-
- o3 = e_icon_add(dia->win->evas);
- e_icon_file_set(o3, "/home/raster/C/stuff/icons/star_office.png");
+ e_ilist_icon_size_set(o, 80, 48);
+
+ o3 = e_livethumb_add(dia->win->ecore_evas);
+ e_livethumb_vsize_set(o3, 160, 96);
+ o4 = edje_object_add(e_livethumb_evas_get(o3));
+ e_theme_edje_object_set(o4, "base/theme/borders",
+ "widgets/border/default/border");
+ e_livethumb_thumb_set(o3, o4);
e_ilist_append(o, o3, "Item 1", _e_test_sel, NULL, NULL);
o3 = e_icon_add(dia->win->evas);