Enlightenment CVS committal
Author : moom
Project : e17
Module : libs/etk
Dir : e17/libs/etk/src/lib
Modified Files:
etk_tree.c etk_tree.h etk_tree_model.c etk_tree_model.h
Log Message:
* [Tree] Chady's patch applied: it adds etk_tree_row_model_fields_set/get().
Thanks :)
===================================================================
RCS file: /cvs/e/e17/libs/etk/src/lib/etk_tree.c,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -3 -r1.84 -r1.85
--- etk_tree.c 26 Jan 2007 23:09:45 -0000 1.84
+++ etk_tree.c 28 Jan 2007 22:57:06 -0000 1.85
@@ -530,6 +530,7 @@
col->models[col->num_models] = model;
model->tree = col->tree;
model->col = col;
+ model->index = col->num_models;
col->num_models++;
}
@@ -1040,7 +1041,7 @@
* @brief Sets the values of the cells of the row
* @param row a row of the tree
* @param emit_signal whether or not the "cell_value_changed" signal should be
emitted on the modified columns.
- * Most of the time, the signal don't need to be emitted (so @a emit_signal
should be ETK_FALSE), except if you have
+ * Most of the time, the signal don't need to be emitted (so @a emit_signal
should be ETK_FALSE), except if you have a
* callback connected on this signal
* @param ... an "Etk_Tree_Col *" followed by the value of the cell,
* then any number of "Etk_Tree_Col *"/Value pairs, and terminated by NULL.
@@ -1062,7 +1063,7 @@
* @brief Sets the values of the cells of the row
* @param row a row of the tree
* @param emit_signal whether or not the "cell_value_changed" signal should be
emitted on the modified columns.
- * Most of the time, the signal don't need to be emitted (so @a emit_signal
should be ETK_FALSE), except if you have
+ * Most of the time, the signal don't need to be emitted (so @a emit_signal
should be ETK_FALSE), except if you have a
* callback connected on this signal
* @param args an "Etk_Tree_Col *" followed by the value of the cell,
* then any number of "Etk_Tree_Col *"/Value pairs, and terminated by NULL.
@@ -1137,6 +1138,104 @@
if (col->models[i]->cell_data_get)
col->models[i]->cell_data_get(col->models[i],
row->cells_data[col->id][i], &args);
}
+ }
+ va_end(args2);
+}
+
+/**
+ * @brief Sets the values of the models of the row
+ * @param row a row of the tree
+ * @param emit_signal whether or not the "cell_value_changed" signal should be
emitted on the modified columns.
+ * Most of the time, the signal don't need to be emitted (so @a emit_signal
should be ETK_FALSE), except if you have a
+ * callback connected on this signal
+ * @param args an "Etk_Tree_Model *" followed by the value of the model, then
any number of
+ * "Etk_Tree_Model *"/Value pairs, and terminated by NULL.
+ * Note that, according to the models, a cell value can use several parameters
+ */
+void etk_tree_row_model_fields_set(Etk_Tree_Row *row, Etk_Bool emit_signal,
...)
+{
+ va_list args;
+
+ if (!row)
+ return;
+
+ va_start(args, emit_signal);
+ etk_tree_row_model_fields_set_valist(row, emit_signal, args);
+ va_end(args);
+}
+
+/**
+ * @brief Sets the values of the models of the row
+ * @param row a row of the tree
+ * @param emit_signal whether or not the "cell_value_changed" signal should be
emitted on the modified columns.
+ * Most of the time, the signal don't need to be emitted (so @a emit_signal
should be ETK_FALSE), except if you have a
+ * callback connected on this signal
+ * @param args an "Etk_Tree_Model *" followed by the value of the model, then
any number of
+ * "Etk_Tree_Model *"/Value pairs, and terminated by NULL.
+ * Note that, according to the models, a cell value can use several parameters
+ */
+void etk_tree_row_model_fields_set_valist(Etk_Tree_Row *row, Etk_Bool
emit_signal, va_list args)
+{
+ Etk_Tree_Model *model;
+ va_list args2;
+
+ if (!row)
+ return;
+
+ va_copy(args2, args);
+ while ((model = va_arg(args2, Etk_Tree_Model *)))
+ {
+ if (model->cell_data_set)
+ model->cell_data_set(model,
row->cells_data[model->col->id][model->index], &args2);
+ if (emit_signal)
+
etk_signal_emit(_etk_tree_col_signals[ETK_TREE_COL_CELL_VALUE_CHANGED],
ETK_OBJECT(model->col), NULL, row);
+ }
+ va_end(args2);
+
+ if (!row->tree->frozen)
+ etk_widget_redraw_queue(ETK_WIDGET(row->tree));
+}
+
+/**
+ * @brief Gets the values of the models of the row
+ * @param row a row of the tree
+ * @param ... an "Etk_Tree_Model *" followed by the location where to store
the value of this model,
+ * then any number of "Etk_Tree_Model *"/Location pairs, and terminated by
NULL.
+ * Note that some models may require several locations to store their value
+ */
+void etk_tree_row_model_fields_get(Etk_Tree_Row *row, ...)
+{
+ va_list args;
+
+ if (!row)
+ return;
+
+ va_start(args, row);
+ etk_tree_row_model_fields_get_valist(row, args);
+ va_end(args);
+}
+
+/**
+ * @brief Gets the values of the models of the row
+ * @param row a row of the tree
+ * @param args an "Etk_Tree_Model *" followed by the location where to store
the value of this model,
+ * then any number of "Etk_Tree_Model *"/Location pairs, and terminated by
NULL.
+ * Note that some models may require several locations to store their value
+ */
+void etk_tree_row_model_fields_get_valist(Etk_Tree_Row *row, va_list args)
+{
+ Etk_Tree_Model *model;
+ va_list args2;
+ int i;
+
+ if (!row)
+ return;
+
+ va_copy(args2, args);
+ while ((model = va_arg(args, Etk_Tree_Model *)))
+ {
+ if (model->cell_data_get)
+ model->cell_data_get(model,
row->cells_data[model->col->id][model->index], &args);
}
va_end(args2);
}
===================================================================
RCS file: /cvs/e/e17/libs/etk/src/lib/etk_tree.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -3 -r1.28 -r1.29
--- etk_tree.h 17 Jan 2007 04:57:05 -0000 1.28
+++ etk_tree.h 28 Jan 2007 22:57:07 -0000 1.29
@@ -207,6 +207,11 @@
void etk_tree_row_fields_get(Etk_Tree_Row *row, ...);
void etk_tree_row_fields_get_valist(Etk_Tree_Row *row, va_list args);
+void etk_tree_row_model_fields_set(Etk_Tree_Row *row, Etk_Bool emit_signal,
...);
+void etk_tree_row_model_fields_set_valist(Etk_Tree_Row *row, Etk_Bool
emit_signal, va_list args);
+void etk_tree_row_model_fields_get(Etk_Tree_Row *row, ...);
+void etk_tree_row_model_fields_get_valist(Etk_Tree_Row *row, va_list args);
+
void etk_tree_row_data_set(Etk_Tree_Row *row, void *data);
void etk_tree_row_data_set_full(Etk_Tree_Row *row, void *data, void
(*free_cb)(void *data));
void *etk_tree_row_data_get(Etk_Tree_Row *row);
===================================================================
RCS file: /cvs/e/e17/libs/etk/src/lib/etk_tree_model.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- etk_tree_model.c 28 Jan 2007 19:30:11 -0000 1.13
+++ etk_tree_model.c 28 Jan 2007 22:57:07 -0000 1.14
@@ -767,7 +767,6 @@
edje_object_message_signal_process(cell_objects[0]);
evas_object_data_set(cell_objects[0], "_Etk_Tree_Model_Checkbox::Row", row);
- evas_object_data_set(cell_objects[0], "_Etk_Tree_Model_Checkbox::Checked",
checked);
edje_object_size_min_get(cell_objects[0], &w, &h);
evas_object_move(cell_objects[0], geometry.x, geometry.y + ((geometry.h -
h) / 2));
evas_object_resize(cell_objects[0], w, h);
@@ -793,13 +792,12 @@
{
Etk_Tree_Model *model;
Etk_Tree_Row *row;
- Etk_Bool *checked;
Evas_Event_Mouse_Up *event;
int ox, oy, ow, oh;
+ Etk_Bool checked;
if (!(model = data) || !model->col || !(event = event_info)
- || !(row = evas_object_data_get(obj, "_Etk_Tree_Model_Checkbox::Row"))
- || !(checked = evas_object_data_get(obj,
"_Etk_Tree_Model_Checkbox::Checked")))
+ || !(row = evas_object_data_get(obj, "_Etk_Tree_Model_Checkbox::Row")))
{
return;
}
@@ -807,11 +805,8 @@
evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
if (ETK_INSIDE(event->canvas.x, event->canvas.y, ox, oy, ow, oh))
{
- *checked = !(*checked);
- etk_signal_emit_by_name("cell_value_changed", ETK_OBJECT(model->col),
NULL, row);
-
- /* Force the redraw the tree */
- etk_widget_redraw_queue(ETK_WIDGET(model->tree));
+ etk_tree_row_model_fields_get(row, model, &checked, NULL);
+ etk_tree_row_model_fields_set(row, ETK_TRUE, model, !checked, NULL);
}
}
===================================================================
RCS file: /cvs/e/e17/libs/etk/src/lib/etk_tree_model.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- etk_tree_model.h 17 Jan 2007 04:57:05 -0000 1.8
+++ etk_tree_model.h 28 Jan 2007 22:57:07 -0000 1.9
@@ -22,6 +22,7 @@
Etk_Tree *tree;
Etk_Tree_Col *col;
int cell_data_size;
+ int index;
void (*model_free)(Etk_Tree_Model *model);
void (*cell_data_init)(Etk_Tree_Model *model, void *cell_data);
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs