forked from enlightenment/enlightenment
fix long-standing table box - doesnt expand. not smart - but works. add
scrollframe widget. more fm work SVN revision: 24112
This commit is contained in:
parent
a8c7f5c9f3
commit
27e2f3a0f9
|
@ -163,7 +163,8 @@ e_int_gadcon_config.h \
|
|||
e_confirm_dialog.h \
|
||||
e_int_border_prop.h \
|
||||
e_entry_dialog.h \
|
||||
e_fm.h
|
||||
e_fm.h \
|
||||
e_widget_scrollframe.h
|
||||
|
||||
enlightenment_src = \
|
||||
e_user.c \
|
||||
|
@ -303,6 +304,7 @@ e_confirm_dialog.c \
|
|||
e_int_border_prop.c \
|
||||
e_entry_dialog.c \
|
||||
e_fm.c \
|
||||
e_widget_scrollframe.c \
|
||||
$(ENLIGHTENMENTHEADERS)
|
||||
|
||||
enlightenment_SOURCES = \
|
||||
|
|
|
@ -139,3 +139,4 @@
|
|||
#include "e_int_border_prop.h"
|
||||
#include "e_entry_dialog.h"
|
||||
#include "e_fm.h"
|
||||
#include "e_widget_scrollframe.h"
|
||||
|
|
|
@ -518,6 +518,69 @@ _e_table_smart_reconfigure(E_Smart_Data *sd)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
ex = 0;
|
||||
for (i = 0; i < sd->size.cols; i++) { if (colsx[i]) ex++; }
|
||||
tot = 0;
|
||||
for (i = 0; i < sd->size.cols; i++) tot += cols[i];
|
||||
dif = w - tot;
|
||||
if ((ex > 0) && (dif > 0))
|
||||
{
|
||||
int exl;
|
||||
|
||||
left = dif;
|
||||
exl = ex;
|
||||
for (i = 0; i < sd->size.cols; i++)
|
||||
{
|
||||
if (colsx[i])
|
||||
{
|
||||
if (exl == 1)
|
||||
{
|
||||
cols[i] += left;
|
||||
exl--;
|
||||
left = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
cols[i] += dif / ex;
|
||||
exl--;
|
||||
left -= dif / ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ex = 0;
|
||||
for (i = 0; i < sd->size.rows; i++) { if (rowsx[i]) ex++; }
|
||||
tot = 0;
|
||||
for (i = 0; i < sd->size.rows; i++) tot += rows[i];
|
||||
dif = h - tot;
|
||||
if ((ex > 0) && (dif > 0))
|
||||
{
|
||||
int exl;
|
||||
|
||||
left = dif;
|
||||
exl = ex;
|
||||
for (i = 0; i < sd->size.rows; i++)
|
||||
{
|
||||
if (rowsx[i])
|
||||
{
|
||||
if (exl == 1)
|
||||
{
|
||||
rows[i] += left;
|
||||
exl--;
|
||||
left = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
rows[i] += dif / ex;
|
||||
exl--;
|
||||
left -= dif / ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (l = sd->items; l; l = l->next)
|
||||
{
|
||||
E_Table_Item *ti;
|
||||
|
@ -537,10 +600,10 @@ _e_table_smart_reconfigure(E_Smart_Data *sd)
|
|||
for (i = ti->row; i < (ti->row + ti->rowspan); i++) hh += rows[i];
|
||||
|
||||
ow = ti->min.w;
|
||||
if (ti->expand_w) ow = ww;
|
||||
if (ti->fill_w) ow = ww;
|
||||
if ((ti->max.w >= 0) && (ti->max.w < ow)) ow = ti->max.w;
|
||||
oh = ti->min.h;
|
||||
if (ti->expand_h) oh = hh;
|
||||
if (ti->fill_h) oh = hh;
|
||||
if ((ti->max.h >= 0) && (ti->max.h < oh)) oh = ti->max.h;
|
||||
evas_object_move(obj,
|
||||
xx + (Evas_Coord)(((double)(ww - ow)) * ti->align.x),
|
||||
|
|
|
@ -598,6 +598,12 @@ _e_test_cb_changed(void *data, Evas_Object *obj, void *event_info)
|
|||
else e_widget_disabled_set(data, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_test_cb_favorites_selected(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
printf("FAV CHANGED\n");
|
||||
}
|
||||
|
||||
static void
|
||||
_e_test_cb_selected(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
|
@ -608,42 +614,61 @@ static void
|
|||
_e_test_internal(E_Container *con)
|
||||
{
|
||||
E_Dialog *dia;
|
||||
Evas_Object *o, *o2, *o3;
|
||||
Evas_Object *ofm, *ofm2, *of, *ob, *ot;
|
||||
Evas_Coord mw, mh;
|
||||
E_Fm2_Config fmc;
|
||||
|
||||
dia = e_dialog_new(con);
|
||||
e_dialog_title_set(dia, "A Test Dialog");
|
||||
|
||||
o = e_fm2_add(dia->win->evas);
|
||||
// e_fm2_path_set(o, "~/", "/pix/bg");
|
||||
e_fm2_path_set(o, "~/", "/.e/e/fileman/favorites");
|
||||
/* a table for layout */
|
||||
ot = e_widget_table_add(dia->win->evas, 0);
|
||||
|
||||
o3 = e_widget_list_add(dia->win->evas, 0, 0);
|
||||
|
||||
o2 = e_widget_button_add(dia->win->evas, "Up a directory", NULL,
|
||||
_e_test_cb_button, o, NULL);
|
||||
evas_object_show(o2);
|
||||
e_widget_list_object_append(o3, o2, 1, 0, 0.5);
|
||||
|
||||
evas_object_smart_callback_add(o, "changed", _e_test_cb_changed, o2);
|
||||
evas_object_smart_callback_add(o, "selected", _e_test_cb_selected, NULL);
|
||||
|
||||
evas_object_show(o);
|
||||
o2 = e_scrollframe_add(dia->win->evas);
|
||||
evas_object_show(o2);
|
||||
e_scrollframe_extern_pan_set(o2, o,
|
||||
/* actual files */
|
||||
ofm = e_fm2_add(dia->win->evas);
|
||||
/* FIXME: set config */
|
||||
e_fm2_path_set(ofm, "~/", "/pix/bg");
|
||||
ob = e_widget_button_add(dia->win->evas, "Up a directory", NULL,
|
||||
_e_test_cb_button, ofm, NULL);
|
||||
e_widget_table_object_append(ot, ob, 1, 0, 1, 1, 0, 0, 1, 0);
|
||||
evas_object_show(ob);
|
||||
evas_object_smart_callback_add(ofm, "changed", _e_test_cb_changed, ob);
|
||||
evas_object_smart_callback_add(ofm, "selected", _e_test_cb_selected, NULL);
|
||||
of = e_widget_scrollframe_pan_add(dia->win->evas, ofm,
|
||||
e_fm2_pan_set, e_fm2_pan_get,
|
||||
e_fm2_pan_max_get, e_fm2_pan_child_size_get);
|
||||
e_widget_list_object_append(o3, o2, 1, 1, 0.5);
|
||||
e_widget_min_size_set(of, 128, 128);
|
||||
e_widget_table_object_append(ot, of, 1, 1, 1, 1, 1, 1, 1, 1);
|
||||
evas_object_show(ofm);
|
||||
evas_object_show(of);
|
||||
|
||||
e_dialog_content_set(dia, o3, 128, 128);
|
||||
ofm2 = ofm;
|
||||
|
||||
/* shortcut list */
|
||||
ofm = e_fm2_add(dia->win->evas);
|
||||
/* FIXME: set config */
|
||||
e_fm2_path_set(ofm, "~/", "/.e/e/fileman/favorites");
|
||||
evas_object_smart_callback_add(ofm, "selected", _e_test_cb_favorites_selected, ofm2);
|
||||
of = e_widget_scrollframe_pan_add(dia->win->evas, ofm,
|
||||
e_fm2_pan_set, e_fm2_pan_get,
|
||||
e_fm2_pan_max_get, e_fm2_pan_child_size_get);
|
||||
e_widget_min_size_set(of, 128, 128);
|
||||
e_widget_table_object_append(ot, of, 0, 1, 1, 1, 0, 1, 0, 1);
|
||||
evas_object_show(ofm);
|
||||
evas_object_show(of);
|
||||
|
||||
/* show and pack table */
|
||||
evas_object_show(ot);
|
||||
e_widget_min_size_get(ot, &mw, &mh);
|
||||
e_dialog_content_set(dia, ot, mw, mh);
|
||||
|
||||
/* buttons at the bottom */
|
||||
e_dialog_button_add(dia, "OK", NULL, NULL, NULL);
|
||||
e_dialog_resizable_set(dia, 1);
|
||||
e_win_centered_set(dia->win, 1);
|
||||
e_dialog_show(dia);
|
||||
e_win_resize(dia->win, 400, 300);
|
||||
|
||||
evas_object_focus_set(o, 1);
|
||||
}
|
||||
#else
|
||||
static void
|
||||
|
|
|
@ -19,7 +19,7 @@ e_widget_framelist_add(Evas *evas, char *label, int horiz)
|
|||
{
|
||||
Evas_Object *obj, *o;
|
||||
E_Widget_Data *wd;
|
||||
Evas_Coord mw, mh;
|
||||
Evas_Coord mw = 0, mh = 0;
|
||||
|
||||
obj = e_widget_add(evas);
|
||||
|
||||
|
@ -54,7 +54,7 @@ EAPI void
|
|||
e_widget_framelist_object_append(Evas_Object *obj, Evas_Object *sobj)
|
||||
{
|
||||
E_Widget_Data *wd;
|
||||
Evas_Coord mw, mh;
|
||||
Evas_Coord mw = 0, mh = 0;
|
||||
|
||||
wd = e_widget_data_get(obj);
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ EAPI void
|
|||
e_widget_frametable_object_append(Evas_Object *obj, Evas_Object *sobj, int col, int row, int colspan, int rowspan, int fill_w, int fill_h, int expand_w, int expand_h)
|
||||
{
|
||||
E_Widget_Data *wd;
|
||||
Evas_Coord mw, mh;
|
||||
Evas_Coord mw = 0, mh = 0;
|
||||
|
||||
wd = e_widget_data_get(obj);
|
||||
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||
*/
|
||||
#include "e.h"
|
||||
|
||||
typedef struct _E_Widget_Data E_Widget_Data;
|
||||
struct _E_Widget_Data
|
||||
{
|
||||
Evas_Object *o_scrollframe, *o_child;
|
||||
};
|
||||
|
||||
static void _e_wid_del_hook(Evas_Object *obj);
|
||||
static void _e_wid_focus_hook(Evas_Object *obj);
|
||||
static void _e_wid_focus_steal(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||
|
||||
/* externally accessible functions */
|
||||
EAPI Evas_Object *
|
||||
e_widget_scrollframe_pan_add(Evas *evas, Evas_Object *pan, void (*pan_set) (Evas_Object *obj, Evas_Coord x, Evas_Coord y), void (*pan_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y), void (*pan_max_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y), void (*pan_child_size_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y))
|
||||
{
|
||||
Evas_Object *obj, *o;
|
||||
E_Widget_Data *wd;
|
||||
Evas_Coord mw, mh;
|
||||
|
||||
obj = e_widget_add(evas);
|
||||
|
||||
e_widget_del_hook_set(obj, _e_wid_del_hook);
|
||||
e_widget_focus_hook_set(obj, _e_wid_focus_hook);
|
||||
wd = calloc(1, sizeof(E_Widget_Data));
|
||||
e_widget_data_set(obj, wd);
|
||||
|
||||
o = e_scrollframe_add(evas);
|
||||
wd->o_scrollframe = o;
|
||||
evas_object_show(o);
|
||||
e_widget_sub_object_add(obj, o);
|
||||
e_widget_resize_object_set(obj, o);
|
||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_wid_focus_steal, obj);
|
||||
|
||||
e_scrollframe_extern_pan_set(o, pan, pan_set, pan_get, pan_max_get, pan_child_size_get);
|
||||
evas_object_show(pan);
|
||||
e_widget_sub_object_add(obj, pan);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
/* Private functions */
|
||||
static void
|
||||
_e_wid_del_hook(Evas_Object *obj)
|
||||
{
|
||||
E_Widget_Data *wd;
|
||||
|
||||
wd = e_widget_data_get(obj);
|
||||
free(wd);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_wid_focus_hook(Evas_Object *obj)
|
||||
{
|
||||
E_Widget_Data *wd;
|
||||
|
||||
wd = e_widget_data_get(obj);
|
||||
if (e_widget_focus_get(obj))
|
||||
{
|
||||
edje_object_signal_emit(e_scrollframe_edje_object_get(wd->o_scrollframe), "focus_in", "");
|
||||
evas_object_focus_set(wd->o_scrollframe, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
edje_object_signal_emit(e_scrollframe_edje_object_get(wd->o_scrollframe), "focus_out", "");
|
||||
evas_object_focus_set(wd->o_scrollframe, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_wid_focus_steal(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
e_widget_focus_steal(data);
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||
*/
|
||||
#ifdef E_TYPEDEFS
|
||||
#else
|
||||
#ifndef E_WIDGET_SCROLLFRAME_H
|
||||
#define E_WIDGET_SCROLLFRAME_H
|
||||
|
||||
EAPI Evas_Object *e_widget_scrollframe_pan_add(Evas *evas, Evas_Object *pan, void (*pan_set) (Evas_Object *obj, Evas_Coord x, Evas_Coord y), void (*pan_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y), void (*pan_max_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y), void (*pan_child_size_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y));
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -40,7 +40,7 @@ EAPI void
|
|||
e_widget_table_object_append(Evas_Object *obj, Evas_Object *sobj, int col, int row, int colspan, int rowspan, int fill_w, int fill_h, int expand_w, int expand_h)
|
||||
{
|
||||
E_Widget_Data *wd;
|
||||
Evas_Coord mw, mh;
|
||||
Evas_Coord mw = 0, mh = 0;
|
||||
|
||||
wd = e_widget_data_get(obj);
|
||||
|
||||
|
|
Loading…
Reference in New Issue