# define D(x) ((void) 0)
#endif
-static void _e_fileman_vscrollbar_drag_cb(Evas_Object *object, double value, void *data);
-static int _e_fileman_reconf_cb(void *data, int type, void *event);
-static int _e_fileman_dir_change_cb(void *data, int type, void *event);
-static int _e_fileman_mouse_wheel_cb(void *data, int type, void *event);
static void _e_fileman_resize_cb(E_Win *win);
static void _e_fileman_delete_cb(E_Win *win);
static void _e_fileman_selector_cb(Evas_Object *object, char *file, void *data);
-static void _e_fileman_vscrollbar_show_cb(void *data, Evas *e, Evas_Object *obj, void *ev);
-static void _e_fileman_vscrollbar_hide_cb(void *data, Evas *e, Evas_Object *obj, void *ev);
static void _e_fileman_free(E_Fileman *fileman);
-
+static void _e_fileman_scroll_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
+static void _e_fileman_scroll_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
+static void _e_fileman_scroll_max_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
+static void _e_fileman_scroll_child_size_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
+
+
E_Fileman *
e_fileman_new(E_Container *con)
{
e_win_name_class_set(fileman->win, "Efm ", "_fileman");
e_win_title_set(fileman->win, dir);
- fileman->main = edje_object_add(fileman->evas);
- e_theme_edje_object_set(fileman->main, "base/theme/fileman/main",
- "fileman/main");
-
- fileman->vscrollbar = e_scrollbar_add(fileman->evas);
- e_scrollbar_direction_set(fileman->vscrollbar, E_SCROLLBAR_VERTICAL);
- e_scrollbar_callback_drag_add(fileman->vscrollbar, _e_fileman_vscrollbar_drag_cb, fileman);
- evas_object_event_callback_add(fileman->vscrollbar, EVAS_CALLBACK_SHOW, _e_fileman_vscrollbar_show_cb, fileman);
- evas_object_event_callback_add(fileman->vscrollbar, EVAS_CALLBACK_HIDE, _e_fileman_vscrollbar_hide_cb, fileman);
-
- e_win_resize_callback_set(fileman->win, _e_fileman_resize_cb);
- e_win_resize(fileman->win, 640, 480);
-
evas_event_freeze(fileman->evas);
-
fileman->smart = e_fm_add(fileman->evas);
e_fm_e_win_set(fileman->smart, fileman->win);
- edje_object_part_swallow(fileman->main, "icon_area", fileman->smart);
-
- ecore_x_dnd_aware_set(fileman->win->evas_win, 1);
-
- fileman->event_handlers = evas_list_append(fileman->event_handlers,
- ecore_event_handler_add(E_EVENT_FM_RECONFIGURE,
- _e_fileman_reconf_cb,
- fileman));
- fileman->event_handlers = evas_list_append(fileman->event_handlers,
- ecore_event_handler_add(E_EVENT_FM_DIRECTORY_CHANGE,
- _e_fileman_dir_change_cb,
- fileman));
+ fileman->main = e_scrollframe_add(fileman->evas);
+ e_scrollframe_custom_theme_set(fileman->main, "base/themes/fileman",
+ "fileman/main");
+ e_scrollframe_extern_pan_set(fileman->main, fileman->smart,
+ _e_fileman_scroll_set,
+ _e_fileman_scroll_get,
+ _e_fileman_scroll_max_get,
+ _e_fileman_scroll_child_size_get);
+
+ e_win_resize_callback_set(fileman->win, _e_fileman_resize_cb);
+ e_win_resize(fileman->win, 400, 400 );
- fileman->event_handlers = evas_list_append(fileman->event_handlers,
- ecore_event_handler_add(ECORE_X_EVENT_MOUSE_WHEEL,
- _e_fileman_mouse_wheel_cb,
- fileman));
+ ecore_x_dnd_aware_set(fileman->win->evas_win, 1);
evas_event_thaw(fileman->evas);
return fileman;
}
+
+static void
+_e_fileman_scroll_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
+{
+ e_fm_scroll_set(obj, x, y);
+}
+
+static void
+_e_fileman_scroll_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y)
+{
+ e_fm_scroll_get(obj, x, y);
+}
+
+static void
+_e_fileman_scroll_max_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y)
+{
+ e_fm_scroll_max_get(obj, x, y);
+}
+
+static void
+_e_fileman_scroll_child_size_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y)
+{
+ e_fm_geometry_virtual_get(obj, x, y);
+}
+
void
e_fileman_selector_enable(E_Fileman *fileman, void (*func)(E_Fileman *fileman, char *file, void *data), void *data)
{
ecore_event_handler_del(fileman->event_handlers->data);
fileman->event_handlers = evas_list_remove_list(fileman->event_handlers, fileman->event_handlers);
}
- evas_object_del(fileman->vscrollbar);
+
evas_object_del(fileman->smart);
evas_object_del(fileman->main);
e_object_del(E_OBJECT(fileman->win));
fileman = win->data;
evas_object_resize(fileman->main, win->w, win->h);
- e_fm_geometry_virtual_get(fileman->smart, &w, &h);
-
- D(("_e_fileman_resize_cb: e_fm_freeze\n"));
- frozen = e_fm_freeze(fileman->smart);
- if (frozen > 1)
- e_fm_thaw(fileman->smart);
-
- if (h > win->h)
- {
- D(("e_fileman_resize_cb: show (%p)\n", fileman));
- edje_object_part_swallow(fileman->main, "vscrollbar", fileman->vscrollbar);
- e_fm_geometry_virtual_get(fileman->smart, &w, &h);
- }
- else
- {
- D(("e_fileman_resize_cb: hide (%p)\n", fileman));
- edje_object_part_unswallow(fileman->main, fileman->vscrollbar);
- evas_object_hide(fileman->vscrollbar);
- }
}
static void
e_object_del(E_OBJECT(fileman));
}
-static void
-_e_fileman_vscrollbar_drag_cb(Evas_Object *object, double value, void *data)
-{
- E_Fileman *fileman;
-
- fileman = data;
- D(("e_fileman_vscrollbar_drag_cb: %f (%p)\n", value, fileman));
- e_fm_scroll_vertical(fileman->smart, value);
-}
-
-static int
-_e_fileman_reconf_cb(void *data, int type, void *event)
-{
- E_Event_Fm_Reconfigure *ev;
- E_Fileman *fileman;
- Evas_Coord w, h;
- int frozen;
-
- if (!data) return 1;
-
- fileman = data;
- ev = event;
-
- D(("_e_fileman_reconf_cb: e_fm_freeze\n"));
- frozen = e_fm_freeze(fileman->smart);
- if (frozen > 1)
- e_fm_thaw(fileman->smart);
-
- if (ev->h > fileman->win->h)
- {
- D(("e_fileman_reconf_cb: show (%p)\n", fileman));
- edje_object_part_swallow(fileman->main, "vscrollbar", fileman->vscrollbar);
- }
- else
- {
- D(("e_fileman_reconf_cb: hide (%p)\n", fileman));
- edje_object_part_unswallow(fileman->main, fileman->vscrollbar);
- evas_object_hide(fileman->vscrollbar);
- }
- return 1;
-}
-
-static int
-_e_fileman_dir_change_cb(void *data, int type, void *event)
-{
- E_Event_Fm_Directory_Change *ev;
- E_Fileman *fileman;
- Evas_Coord w, h;
-
- if (!data) return 1;
-
- fileman = data;
- ev = event;
-
- D(("_e_fileman_dir_change_cb:\n"));
- e_scrollbar_value_set(fileman->vscrollbar, 0.0);
-
- return 1;
-}
-
-static int
-_e_fileman_mouse_wheel_cb(void *data, int type, void *event)
-{
- Ecore_X_Event_Mouse_Wheel *ev;
- E_Fileman *fileman;
- double pos;
-
- ev = event;
- fileman = data;
-
- pos = e_scrollbar_value_get(fileman->vscrollbar);
-
- if (ev->z < 0)
- {
- pos -= 0.05;
- if (pos < 0.0)
- pos = 0.0;
- }
-
- if (ev->z > 0)
- {
- pos += 0.05;
- if (pos > 1.0)
- pos = 1.0;
- }
-
- e_scrollbar_value_set(fileman->vscrollbar, pos);
- e_fm_scroll_vertical(fileman->smart, pos);
- return 1;
-}
-
static void
_e_fileman_selector_cb(Evas_Object *object, char *file, void *data)
{
fileman->selector.func(fileman, file, fileman->selector.data);
//e_object_del(E_OBJECT(fileman));
}
-
-static void
-_e_fileman_vscrollbar_show_cb(void *data, Evas *e, Evas_Object *obj, void *ev)
-{
- E_Fileman *fileman;
-
- fileman = data;
-
- D(("_e_fileman_vscrollbar_show_cb: thaw (%p)\n", fileman));
- e_fm_thaw(fileman->smart);
-}
-
-static void
-_e_fileman_vscrollbar_hide_cb(void *data, Evas *e, Evas_Object *obj, void *ev)
-{
- E_Fileman *fileman;
-
- fileman = data;
-
- D(("_e_fileman_vscrollbar_hide_cb: thaw (%p)\n", fileman));
- e_fm_thaw(fileman->smart);
-}
} icon_info;
struct {
- Evas_Coord w, h;
- } max;
+ Evas_Coord x, y, w, h;
+ } child;
struct {
Evas_List *files;
}
void
-e_fm_scroll_horizontal(Evas_Object *object, double percent)
+e_fm_scroll_set(Evas_Object *object, Evas_Coord x, Evas_Coord y)
{
-
+ E_Fm_Smart_Data *sd;
+
+ sd = evas_object_smart_data_get(object);
+ if (!sd) return NULL;
+
+ if (x > (sd->child.w - sd->w)) x = sd->child.w - sd->w;
+ if (y > (sd->child.h - sd->h)) y = sd->child.h - sd->h;
+ if (x < 0) x = 0;
+ if (y < 0) y = 0;
+ if ((x == sd->child.x) && (y == sd->child.y)) return;
+ sd->child.x = x;
+ sd->child.y = y;
+
+ e_icon_layout_clip_freeze(sd->layout);
+ evas_object_move(sd->layout, sd->x - sd->child.x, sd->y - sd->child.y);
+ e_icon_layout_clip_thaw(sd->layout);
+
+ evas_object_smart_callback_call(sd->object, "changed", NULL);
}
void
-e_fm_scroll_vertical(Evas_Object *object, double percent)
+e_fm_scroll_max_get(Evas_Object *object, Evas_Coord *x, Evas_Coord *y)
{
E_Fm_Smart_Data *sd;
- int offsetpx;
- Evas_Coord x, y, w, h;
-
- if ((!object) || !(sd = evas_object_smart_data_get(object)))
- return;
- if(sd->max.h <= sd->h) return;
+ sd = evas_object_smart_data_get(object);
+ if (!sd) return NULL;
- sd->position = percent;
-
- offsetpx = (percent) * (sd->max.h - sd->h);
+ if (x)
+ {
+ if (sd->w < sd->child.w) *x = sd->child.w - sd->w;
+ else *x = 0;
+ }
+ if (y)
+ {
+ if (sd->h < sd->child.h) *y = sd->child.h - sd->h;
+ else *y = 0;
+ }
+
+}
- evas_object_geometry_get(sd->layout, &x, &y, &w, &h);
- e_icon_layout_clip_freeze(sd->layout);
- evas_object_move(sd->layout, x, sd->y - offsetpx);
- e_icon_layout_clip_thaw(sd->layout);
+void
+e_fm_scroll_get(Evas_Object *object, Evas_Coord *x, Evas_Coord *y)
+{
+ E_Fm_Smart_Data *sd;
+
+ sd = evas_object_smart_data_get(object);
+ if (!sd) return NULL;
+
+ if (x) *x = sd->child.x;
+ if (y) *y = sd->child.y;
}
+
void
e_fm_geometry_virtual_get(Evas_Object *object, Evas_Coord *w, Evas_Coord *h)
{
return;
if(w)
- *w = sd->max.w;
+ *w = sd->child.w;
if(h)
- *h = sd->max.h;
+ *h = sd->child.h;
}
void
sd = evas_object_smart_data_get(object);
if (!sd) return;
- evas_object_move(sd->bg, x, y);
- evas_object_move(sd->clip, x, y);
- evas_object_move(sd->layout, x, y);
-
sd->x = x;
- sd->y = y;
+ sd->y = y;
+
+ evas_object_move(sd->bg, x, y);
+ evas_object_move(sd->clip, x, y);
+ evas_object_move(sd->layout, sd->x - sd->child.x, sd->y - sd->child.y);
}
static void
evas_object_resize(sd->clip, w, h);
evas_object_resize(sd->layout, w, h);
e_icon_layout_width_fix(sd->layout, w);
- e_icon_layout_virtual_size_get(sd->layout, &sd->max.w, &sd->max.h);
+ e_icon_layout_virtual_size_get(sd->layout, &sd->child.w, &sd->child.h);
sd->conf.main->width = w;
sd->conf.main->height = h;
sd->w = w;
sd->h = h;
- if(sd->position > 0.0 && sd->max.h > sd->h)
- e_fm_scroll_vertical(object, sd->position);
- else
- sd->position = 0.0;
-
+ evas_object_smart_callback_call(sd->object, "changed", NULL);
+
if(sd->frozen)
return;
evas_object_geometry_get(sd->layout, NULL, NULL, &w, &h);
ev->object = sd->object;
- ev->w = sd->max.w;
- ev->h = sd->max.h;
+ ev->w = sd->child.w;
+ ev->h = sd->child.h;
ecore_event_add(E_EVENT_FM_RECONFIGURE, ev, NULL, NULL);
}
}
evas_object_geometry_get(sd->layout, NULL, NULL, &w, &h);
ev->object = sd->object;
- ev->w = sd->max.w;
- ev->h = sd->max.h;
+ ev->w = sd->child.w;
+ ev->h = sd->child.h;
ecore_event_add(E_EVENT_FM_RECONFIGURE, ev, NULL, NULL);
}
}
lastmod = E_NEW(char, 128);
strftime(lastmod, 128, "%a %b %d %T %Y", t);
- permissions = E_NEW(char, 128); // todo
+ permissions = E_NEW(char, 128);
snprintf(permissions, 128, "%s", "");
ol = e_widget_list_add(evas, 0, 0);
case E_FILEMAN_CANVAS_ARRANGE_NAME:
sd->files = evas_list_sort(sd->files, evas_list_count(sd->files), _e_fm_files_sort_name_cb);
sd->arrange = E_FILEMAN_CANVAS_ARRANGE_NAME;
- _e_fm_redraw(sd); // no_new
+ _e_fm_redraw(sd);
break;
case E_FILEMAN_CANVAS_ARRANGE_MODTIME:
sd->files = evas_list_sort(sd->files, evas_list_count(sd->files), _e_fm_files_sort_modtime_cb);
sd->arrange = E_FILEMAN_CANVAS_ARRANGE_MODTIME;
- _e_fm_redraw(sd); // no new
+ _e_fm_redraw(sd);
break;
}
}
if (ev)
{
ev->object = sd->object;
- ev->w = sd->max.w;
- ev->h = sd->max.h;
+ ev->w = sd->child.w;
+ ev->h = sd->child.h;
ecore_event_add(E_EVENT_FM_DIRECTORY_CHANGE, ev, NULL, NULL);
}
return;
/* raise reconfigure event */
+ e_icon_layout_virtual_size_get(sd->layout, &sd->child.w, &sd->child.h);
+ evas_object_smart_callback_call(sd->object, "changed", NULL);
+
ev = E_NEW(E_Event_Fm_Reconfigure, 1);
if (ev)
{
- e_icon_layout_virtual_size_get(sd->layout, &sd->max.w, &sd->max.h);
+ e_icon_layout_virtual_size_get(sd->layout, &sd->child.w, &sd->child.h);
ev->object = sd->object;
- ev->w = sd->max.w;
- ev->h = sd->max.h;
+ ev->w = sd->child.w;
+ ev->h = sd->child.h;
ecore_event_add(E_EVENT_FM_RECONFIGURE, ev, NULL, NULL);
}
}
}
}
break;
- }
+ }
}
static void