int icon_w, icon_h;
Eina_List *items;
Evas_Bool scrollable : 1;
+ Evas_Bool focus_steal : 1;
};
struct _Item
e_widget_data_set(obj, wd);
wd->icon_w = icon_w;
wd->icon_h = icon_h;
+ wd->focus_steal = 1;
o = e_scrollframe_add(evas);
wd->o_base = o;
}
EAPI void
+e_widget_toolbar_item_label_set(Evas_Object *obj, int num, const char *label)
+{
+ E_Widget_Data *wd;
+ Item *it;
+
+ wd = e_widget_data_get(obj);
+ it = eina_list_nth(wd->items, num);
+ if (it)
+ {
+ int mw, mh;
+
+ edje_object_part_text_set(it->o_base, "e.text.label", label);
+ edje_object_size_min_calc(it->o_base, &mw, &mh);
+ e_box_pack_options_set(it->o_base,
+ 1, 1, /* fill */
+ 0, 0, /* expand */
+ 0.5, 0.5, /* align */
+ mw, mh, /* min */
+ 9999, 9999 /* max */
+ );
+ }
+}
+
+EAPI void
e_widget_toolbar_scrollable_set(Evas_Object *obj, Evas_Bool scrollable)
{
E_Widget_Data *wd;
e_widget_min_size_set(obj, mw + (500 - vw), mh + (500 - vh));
}
+EAPI void
+e_widget_toolbar_focus_steal_set(Evas_Object *obj, Evas_Bool steal)
+{
+ E_Widget_Data *wd;
+
+ wd = e_widget_data_get(obj);
+ if (wd->focus_steal == steal) return;
+ if (steal)
+ {
+ evas_object_event_callback_add(e_scrollframe_edje_object_get(wd->o_base),
+ EVAS_CALLBACK_MOUSE_DOWN,
+ _e_wid_focus_steal, obj);
+ wd->focus_steal = 1;
+ }
+ else
+ {
+ evas_object_event_callback_del(e_scrollframe_edje_object_get(wd->o_base),
+ EVAS_CALLBACK_MOUSE_DOWN,
+ _e_wid_focus_steal);
+ wd->focus_steal = 0;
+ }
+}
+
static void
_e_wid_del_hook(Evas_Object *obj)
{
*/
typedef struct _E_Fwin E_Fwin;
+typedef struct _E_Fwin_Page_Info E_Fwin_Page_Info;
typedef struct _E_Fwin_Apps_Dialog E_Fwin_Apps_Dialog;
#define E_FWIN_TYPE 0xE0b0101f
E_Win *win;
E_Zone *zone;
Evas_Object *scrollframe_obj;
+ Evas_Object *tb_obj;
Evas_Object *fm_obj;
Evas_Object *bg_obj;
E_Fwin_Apps_Dialog *fad;
+ Eina_List *page_info;
+ int page_index;
+
Evas_Object *under_obj;
Evas_Object *over_obj;
struct {
unsigned char geom_save_ready : 1;
};
+struct _E_Fwin_Page_Info
+{
+ const char *dev;
+ const char *path;
+
+ struct {
+ Evas_Coord x, y;
+ } scroll;
+
+ int index;
+};
+
struct _E_Fwin_Apps_Dialog
{
E_Dialog *dia;
/* local subsystem prototypes */
static E_Fwin *_e_fwin_new(E_Container *con, const char *dev, const char *path);
static void _e_fwin_free(E_Fwin *fwin);
+static void _e_fwin_page_new(E_Fwin *fwin);
+static E_Fwin_Page_Info *_e_fwin_page_info_new(E_Fwin *fwin);
+static void _e_fwin_cb_page_change(void *data1, void *data2);
static void _e_fwin_cb_delete(E_Win *win);
static void _e_fwin_cb_move(E_Win *win);
static void _e_fwin_cb_resize(E_Win *win);
static void
_e_fwin_free(E_Fwin *fwin)
{
+ E_Fwin_Page_Info *info;
+
if (!fwin) return; //safety
if (fwin->fm_obj) evas_object_del(fwin->fm_obj);
_e_fwin_zone_cb_mouse_down);
}
+
+ EINA_LIST_FREE(fwin->page_info, info)
+ {
+ eina_stringshare_del(info->dev);
+ eina_stringshare_del(info->path);
+ E_FREE(info);
+ }
if (fwin->zone_handler)
ecore_event_handler_del(fwin->zone_handler);
if (fwin->zone_del_handler)
static void
_e_fwin_toolbar_resize(E_Fwin *fwin)
{
+ int tx, ty, tw, th, offset = 0;
int x, y, w, h;
- e_toolbar_position_calc(fwin->tbar);
+ if (fwin->tb_obj)
+ evas_object_geometry_get(fwin->tb_obj, NULL, NULL, NULL, &offset);
w = fwin->win->w;
h = fwin->win->h;
switch (fwin->tbar->gadcon->orient)
{
+ case E_GADCON_ORIENT_HORIZ:
case E_GADCON_ORIENT_TOP:
- x = 0;
- y = fwin->tbar->h;
- h = (h - fwin->tbar->h);
- break;
+ tx = 0;
+ ty = offset;
+ th = 32;
+ tw = w;
+
+ x = 0;
+ y = offset + th;
+ h = (h - offset - th);
+ break;
case E_GADCON_ORIENT_BOTTOM:
- x = 0;
- y = 0;
- h = (h - fwin->tbar->h);
- break;
+ tx = 0;
+ th = 32;
+ tw = w;
+ ty = h - th;
+
+ x = 0;
+ y = offset;
+ h = (h - offset - th);
+ break;
+ case E_GADCON_ORIENT_VERT:
case E_GADCON_ORIENT_LEFT:
- x = (fwin->tbar->x + fwin->tbar->w);
- y = 0;
- w = (w - fwin->tbar->w);
- break;
+ tx = 0;
+ tw = 32;
+ th = h - offset;
+ ty = offset;
+
+ x = (tx + tw);
+ y = offset;
+ w = (w - tw);
+ break;
case E_GADCON_ORIENT_RIGHT:
- x = 0;
- y = 0;
- w = (fwin->win->w - fwin->tbar->w);
- break;
+ ty = offset;
+ tw = 32;
+ tx = w - tw;
+ th = h - offset;
+
+ x = 0;
+ y = offset;
+ w = (w - tw);
+ break;
default:
- return;
+ return;
}
+ e_toolbar_move_resize(fwin->tbar, tx, ty, tw, th);
evas_object_move(fwin->scrollframe_obj, x, y);
evas_object_resize(fwin->scrollframe_obj, w, h);
}
/* fwin callbacks */
static void
+_e_fwin_page_new(E_Fwin *fwin)
+{
+ E_Fwin_Page_Info *info;
+ const char *real;
+
+ if (!fwin->tb_obj)
+ {
+ /* There is no toolbar yet */
+ fwin->tb_obj = e_widget_toolbar_add(evas_object_evas_get(fwin->fm_obj),
+ 48 * e_scale, 48 * e_scale);
+
+ e_widget_toolbar_focus_steal_set(fwin->tb_obj, 0);
+ info = _e_fwin_page_info_new(fwin);
+ real = ecore_file_file_get(e_fm2_real_path_get(fwin->fm_obj));
+ e_widget_toolbar_item_append(fwin->tb_obj, NULL, real,
+ _e_fwin_cb_page_change, fwin, info);
+
+ evas_object_move(fwin->tb_obj, 0, 0);
+ evas_object_show(fwin->tb_obj);
+ }
+
+ info = _e_fwin_page_info_new(fwin);
+ real = ecore_file_file_get(e_fm2_real_path_get(fwin->fm_obj));
+ e_widget_toolbar_item_append(fwin->tb_obj, NULL, real,
+ _e_fwin_cb_page_change, fwin, info);
+ e_widget_toolbar_item_select(fwin->tb_obj, info->index);
+
+ _e_fwin_cb_resize(fwin->win);
+}
+
+static E_Fwin_Page_Info *
+_e_fwin_page_info_new(E_Fwin *fwin)
+{
+ E_Fwin_Page_Info *info;
+ const char *dev, *path;
+
+ e_fm2_path_get(fwin->fm_obj, &dev, &path);
+ info = E_NEW(E_Fwin_Page_Info, 1);
+ info->dev = eina_stringshare_add(dev);
+ info->path = eina_stringshare_add(path);
+ info->index = eina_list_count(fwin->page_info);
+
+ fwin->page_info = eina_list_append(fwin->page_info, info);
+
+ return info;
+}
+
+static void
+_e_fwin_cb_page_change(void *data1, void *data2)
+{
+ E_Fwin *fwin = data1;
+ E_Fwin_Page_Info *info = data2, *prev;
+ Evas_Coord x, y;
+
+ if (!fwin || !info) return;
+ prev = eina_list_nth(fwin->page_info, fwin->page_index);
+ e_scrollframe_child_pos_get(fwin->scrollframe_obj, &x, &y);
+ prev->scroll.x = x;
+ prev->scroll.y = y;
+ fwin->page_index = info->index;
+ e_fm2_path_set(fwin->fm_obj, info->dev, info->path);
+ e_scrollframe_child_pos_set(fwin->scrollframe_obj, x, y);
+}
+
+static void
_e_fwin_cb_delete(E_Win *win)
{
E_Fwin *fwin;
}
if (fwin->win)
{
+ if (fwin->tb_obj)
+ {
+ int height;
+
+ e_widget_min_size_get(fwin->tb_obj, NULL, &height);
+ evas_object_resize(fwin->tb_obj, fwin->win->w, height);
+ }
if (fwin->tbar)
_e_fwin_toolbar_resize(fwin);
else
- evas_object_resize(fwin->scrollframe_obj, fwin->win->w, fwin->win->h);
+ {
+ int offset = 0;
+
+ if (fwin->tb_obj)
+ evas_object_geometry_get(fwin->tb_obj, NULL, NULL, NULL, &offset);
+ evas_object_move(fwin->scrollframe_obj, 0, offset);
+ evas_object_resize(fwin->scrollframe_obj, fwin->win->w, fwin->win->h - offset);
+ }
}
else if (fwin->zone)
evas_object_resize(fwin->scrollframe_obj, fwin->zone->w, fwin->zone->h);
}
e_scrollframe_child_pos_set(fwin->scrollframe_obj, 0, 0);
}
+ if (fwin->tb_obj)
+ {
+ E_Fwin_Page_Info *info;
+ const char *file, *dev, *path;
+
+ e_fm2_path_get(fwin->fm_obj, &dev, &path);
+ info = eina_list_nth(fwin->page_info, fwin->page_index);
+ eina_stringshare_del(info->dev);
+ eina_stringshare_del(info->path);
+ info->dev = eina_stringshare_add(dev);
+ info->path = eina_stringshare_add(path);
+
+ file = ecore_file_file_get(e_fm2_real_path_get(fwin->fm_obj));
+ e_widget_toolbar_item_label_set(fwin->tb_obj, fwin->page_index, file);
+ }
if ((fwin->theme_file) && (ecore_file_exists(fwin->theme_file)))
e_fm2_custom_theme_set(obj, fwin->theme_file);
else
e_fm2_all_sel(fwin->fm_obj);
return;
}
+ if (!strcmp(ev->key, "t"))
+ {
+ _e_fwin_page_new(fwin);
+ return;
+ }
}
}