Fix resizing of config_list widget.

Some formatting fixes.


SVN revision: 32986
devs/princeamd/enlightenment-0.17-elive
Christopher Michael 15 years ago
parent 9335742e16
commit 68d332ad0d
  1. 91
      src/bin/e_widget_config_list.c

@ -12,7 +12,6 @@ static void _button_cb_remove(void *data, void *obj);
static void _button_cb_up(void *data, void *obj);
static void _button_cb_down(void *data, void *obj);
static void _list_select_num(E_Widget_Data *wd, int indx);
static void _e_wid_disable_hook(Evas_Object *obj);
static void _e_wid_del_hook(Evas_Object *obj);
@ -21,19 +20,17 @@ struct _E_Widget_Data
/* Current Data */
char *cur_entry;
int cur_enabled;
struct
{
Evas_Object *list; /* Selecting a list entry starts edit*/
Evas_Object *table;
Evas_Object *entry; /* Generic Entry */
Evas_Object *up; /* Move selected list entry up */
Evas_Object *down; /* Move selected list entry down */
Evas_Object *add; /* create and select a new list entry */
Evas_Object *remove; /* remove the selected entry */
}
gui;
} gui;
};
/* Externally accessible functions */
@ -43,7 +40,7 @@ e_widget_config_list_add(Evas *evas, Evas_Object* (*func_entry_add) (Evas *evas,
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_disable_hook_set(obj, _e_wid_disable_hook);
@ -53,39 +50,38 @@ e_widget_config_list_add(Evas *evas, Evas_Object* (*func_entry_add) (Evas *evas,
o = e_widget_table_add(evas, 0);
wd->gui.table = o;
e_widget_sub_object_add(obj, o);
o = e_widget_button_add(evas, _("Add"), NULL, _button_cb_add, wd, obj);
wd->gui.add = o;
e_widget_disabled_set(o, 1);
e_widget_table_object_append(wd->gui.table, o, 0, 1, 1, 1, 1, 1, 1, 1);
e_widget_table_object_append(wd->gui.table, o, 0, 1, 1, 1, 1, 0, 1, 0);
o = e_widget_button_add(evas, _("Remove"), NULL, _button_cb_remove, wd, obj);
wd->gui.remove = o;
e_widget_disabled_set(o, 1);
e_widget_table_object_append(wd->gui.table, o, 1, 1, 1, 1, 1, 1, 1, 1);
e_widget_table_object_append(wd->gui.table, o, 1, 1, 1, 1, 1, 0, 1, 0);
o = e_widget_label_add(evas, label);
e_widget_table_object_append(wd->gui.table, o, 0, 2, 2, 1, 1, 1, 1, 1);
e_widget_table_object_append(wd->gui.table, o, 0, 2, 2, 1, 1, 0, 1, 0);
o = func_entry_add(evas, &(wd->cur_entry), NULL, NULL, NULL);
wd->gui.entry = o;
e_widget_disabled_set(o, 1);
e_widget_min_size_set(o, 100, 25);
e_widget_table_object_append(wd->gui.table, o, 0, 3, 2, 1, 1, 1, 1, 1);
e_widget_table_object_append(wd->gui.table, o, 0, 3, 2, 1, 1, 0, 1, 0);
o = e_widget_button_add(evas, _("Up"), "widget/up_arrow",
_button_cb_up, wd, NULL);
wd->gui.up = o;
e_widget_disabled_set(o, 1);
e_widget_table_object_append(wd->gui.table, o, 0, 4, 1, 1, 1, 1, 1, 1);
e_widget_table_object_append(wd->gui.table, o, 0, 4, 1, 1, 1, 0, 1, 0);
o = e_widget_button_add(evas, _("Down"), "widget/down_arrow",
_button_cb_down, wd, NULL);
wd->gui.down = o;
e_widget_disabled_set(o, 1);
e_widget_table_object_append(wd->gui.table, o, 1, 4, 1, 1, 1, 1, 1, 1);
e_widget_table_object_append(wd->gui.table, o, 1, 4, 1, 1, 1, 0, 1, 0);
o = e_widget_ilist_add(evas, 0, 0, NULL);
wd->gui.list = o;
e_widget_disabled_set(o, 1);
@ -93,7 +89,7 @@ e_widget_config_list_add(Evas *evas, Evas_Object* (*func_entry_add) (Evas *evas,
e_widget_on_change_hook_set(o, _list_cb_change, wd);
e_widget_ilist_go(o);
e_widget_table_object_append(wd->gui.table, o, 0, 5, 2, 1, 1, 1, 1, 1);
e_widget_min_size_get(wd->gui.table, &mw, &mh);
e_widget_min_size_set(obj, mw, mh);
e_widget_resize_object_set(obj, wd->gui.table);
@ -105,7 +101,7 @@ EAPI int
e_widget_config_list_count(Evas_Object *obj)
{
E_Widget_Data *wd;
wd = e_widget_data_get(obj);
return e_widget_ilist_count(wd->gui.list);
}
@ -114,7 +110,7 @@ EAPI void
e_widget_config_list_clear(Evas_Object *obj)
{
E_Widget_Data *wd;
wd = e_widget_data_get(obj);
e_widget_ilist_clear(wd->gui.list);
_list_select_num(wd, -1);
@ -124,7 +120,7 @@ EAPI const char *
e_widget_config_list_nth_get(Evas_Object *obj, int n)
{
E_Widget_Data *wd;
wd = e_widget_data_get(obj);
return e_widget_ilist_nth_label_get(wd->gui.list, n);
}
@ -134,7 +130,7 @@ e_widget_config_list_append(Evas_Object *obj, const char *entry)
{
E_Widget_Data *wd;
int count;
wd = e_widget_data_get(obj);
e_widget_ilist_append(wd->gui.list, NULL, entry, NULL, NULL, NULL);
e_widget_ilist_go(wd->gui.list);
@ -157,11 +153,10 @@ e_widget_config_list_object_append(Evas_Object *obj, Evas_Object *sobj, int col,
static void
_list_cb_change(void *data, Evas_Object *obj)
{
int indx;
E_Widget_Data *wd;
int indx;
wd = data;
if (!wd) return;
if (!(wd = data)) return;
indx = e_widget_ilist_selected_get(wd->gui.list);
_list_select_num(wd, indx);
@ -172,16 +167,14 @@ _button_cb_add(void *data, void *obj)
{
E_Widget_Data *wd;
Evas_Object *o;
o = obj;
wd = data;
if (!o) return;
if (!wd) return;
if (!(wd = data)) return;
if ((wd->cur_entry) && (wd->cur_entry[0]))
{
int i;
/* If it already esists just select the existing one */
for (i = 0; i < e_widget_ilist_count(wd->gui.list); i++)
{
@ -202,22 +195,20 @@ _button_cb_add(void *data, void *obj)
static void
_button_cb_remove(void *data, void *obj)
{
E_Widget_Data *wd;
int indx;
int count;
E_Widget_Data *wd;
wd = data;
if (!wd) return;
if (!(wd = data)) return;
indx = e_widget_ilist_selected_get(wd->gui.list);
count = e_widget_ilist_count(wd->gui.list);
e_widget_ilist_remove_num(wd->gui.list, indx);
e_widget_ilist_go(wd->gui.list);
e_widget_ilist_selected_set(wd->gui.list, indx);
if (count == 1)
_list_select_num(wd, -1);
if (count == 1) _list_select_num(wd, -1);
}
static void
@ -227,9 +218,8 @@ _button_cb_up(void *data, void *obj)
int idx_sel;
const char *label_sel;
const char *label_rep;
wd = data;
if (!wd) return;
if (!(wd = data)) return;
idx_sel = e_widget_ilist_selected_get(wd->gui.list);
@ -249,9 +239,8 @@ _button_cb_down(void *data, void *obj)
int idx_sel;
const char *label_sel;
const char *label_rep;
wd = data;
if (!wd) return;
if (!(wd = data)) return;
idx_sel = e_widget_ilist_selected_get(wd->gui.list);
@ -273,13 +262,13 @@ _list_select_num(E_Widget_Data *wd, int indx)
if (indx >= 0 && !wd->cur_enabled) return;
count = e_widget_ilist_count(wd->gui.list);
if (count == 0 || indx < 0)
if ((count == 0) || (indx < 0))
e_widget_disabled_set(wd->gui.remove, 1);
else
e_widget_disabled_set(wd->gui.remove, 0);
if (count == 1 || indx < 0)
if ((count == 1) || (indx < 0))
{
e_widget_disabled_set(wd->gui.up, 1);
e_widget_disabled_set(wd->gui.down, 1);
@ -289,7 +278,7 @@ _list_select_num(E_Widget_Data *wd, int indx)
e_widget_disabled_set(wd->gui.up, 1);
e_widget_disabled_set(wd->gui.down, 0);
}
else if (indx + 1 == count)
else if ((indx + 1) == count)
{
e_widget_disabled_set(wd->gui.up, 0);
e_widget_disabled_set(wd->gui.down, 1);
@ -309,7 +298,7 @@ _e_wid_del_hook(Evas_Object *obj)
wd = e_widget_data_get(obj);
E_FREE(wd->cur_entry);
free(wd);
E_FREE(wd);
}
static void
@ -319,9 +308,9 @@ _e_wid_disable_hook(Evas_Object *obj)
wd = e_widget_data_get(obj);
if (!wd) return;
wd->cur_enabled = !e_widget_disabled_get(obj);
if (wd->cur_enabled)
{
e_widget_disabled_set(wd->gui.list, 0);

Loading…
Cancel
Save