Enlightenment CVS committal
Author : leviathan
Project : e17
Module : libs/etk
Dir : e17/libs/etk/src/lib
Modified Files:
etk_combobox.c etk_combobox.h etk_combobox_entry.c
etk_combobox_entry.h
Log Message:
Add the ability to set an individual column's field for comboboxes
===================================================================
RCS file: /cvs/e/e17/libs/etk/src/lib/etk_combobox.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -3 -r1.47 -r1.48
--- etk_combobox.c 2 Apr 2007 20:13:50 -0000 1.47
+++ etk_combobox.c 6 Aug 2007 12:02:40 -0000 1.48
@@ -501,6 +501,52 @@
}
/**
+ * @brief Sets the value of the one column of the combobox item. The current
widgets of item will be destroyed
+ * @param item a combobox item
+ * @param column the column to set the value of
+ * @param value the different widget to attach to the column of the item:
+ * - If the type of the corresponding column is ETK_COMBOBOX_LABEL, the
argument must be a "const char *" @n
+ * - If the type of the corresponding column is ETK_COMBOBOX_IMAGE, the
argument must be an "Etk_Image *" @n
+ * - If the type of the corresponding column is ETK_COMBOBOX_OTHER, the
argument must be an "Etk_Widget *"
+ * @note The new widgets of the item will be automatically shown
+ */
+void etk_combobox_item_field_set(Etk_Combobox_Item *item, int column, void
*value)
+{
+ Etk_Combobox *combobox;
+
+ if (!item || !(combobox = item->combobox) || (column >= combobox->num_cols))
+ return;
+
+ switch (combobox->cols[column]->type)
+ {
+ if (item->widgets[column])
+ etk_object_destroy(ETK_OBJECT(item->widgets[column]));
+
+ case ETK_COMBOBOX_LABEL:
+ item->widgets[column] = etk_label_new((const char *) value);
+ etk_widget_pass_mouse_events_set(item->widgets[column], ETK_TRUE);
+ break;
+ case ETK_COMBOBOX_IMAGE:
+ item->widgets[column] = ETK_WIDGET((Etk_Widget *) value);
+ etk_widget_pass_mouse_events_set(item->widgets[column], ETK_TRUE);
+ break;
+ case ETK_COMBOBOX_OTHER:
+ item->widgets[column] = ETK_WIDGET((Etk_Widget *) value);
+ break;
+ default:
+ item->widgets[column] = NULL;
+ break;
+ }
+ etk_widget_parent_set(item->widgets[column], ETK_WIDGET(item));
+ etk_widget_show(item->widgets[column]);
+
+ if (combobox->active_item == item)
+ etk_combobox_active_item_set(combobox, item);
+}
+
+
+
+/**
* @brief Gets the values of the cells of the combobox item
* @param item a combobox item
* @param ... the location where to store the different values of the cells of
the item:
@@ -566,6 +612,49 @@
etk_widget_show(item->widgets[i]);
}
}
+
+/**
+ * @brief Gets the value of the cell of a column of the combobox item
+ * @param item a combobox item
+ * @param column the column to get the values of
+ * @return The value of the cell as a void pointer that you must cast to the
appropriate type:
+ * - If the type of the corresponding column is ETK_COMBOBOX_LABEL, the
argument must be a "const char **" @n
+ * - If the type of the corresponding column is ETK_COMBOBOX_IMAGE, the
argument must be an "Etk_Image **" @n
+ * - If the type of the corresponding column is ETK_COMBOBOX_OTHER, the
argument must be an "Etk_Widget **"
+ */
+void * etk_combobox_item_field_get(Etk_Combobox_Item *item, int column)
+{
+ Etk_Combobox *combobox;
+
+ if (!item || !(combobox = item->combobox) || (column >= combobox->num_cols))
+ return NULL;
+
+ switch (combobox->cols[column]->type)
+ {
+ case ETK_COMBOBOX_LABEL:
+ {
+ const char *label;
+ label = etk_label_get(ETK_LABEL(item->widgets[column]));
+ return (void *)label;
+ break;
+ }
+ case ETK_COMBOBOX_IMAGE:
+ case ETK_COMBOBOX_OTHER:
+ {
+ Etk_Widget *widget;
+ widget = item->widgets[column];
+ return (void *) widget;
+ break;
+ }
+ default:
+ return NULL;
+ break;
+ }
+// FIXME: are these needed here?
+// etk_widget_parent_set(item->widgets[column], ETK_WIDGET(item));
+// etk_widget_show(item->widgets[column]);
+}
+
/**
* @brief Sets the data associated to the combobox item
===================================================================
RCS file: /cvs/e/e17/libs/etk/src/lib/etk_combobox.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -3 -r1.21 -r1.22
--- etk_combobox.h 27 Jul 2007 16:24:13 -0000 1.21
+++ etk_combobox.h 6 Aug 2007 12:02:40 -0000 1.22
@@ -140,8 +140,10 @@
void etk_combobox_item_fields_set(Etk_Combobox_Item *item, ...);
void etk_combobox_item_fields_set_valist(Etk_Combobox_Item
*item, va_list args);
+void etk_combobox_item_field_set(Etk_Combobox_Item *item, int
column, void *value);
void etk_combobox_item_fields_get(Etk_Combobox_Item *item, ...);
void etk_combobox_item_fields_get_valist(Etk_Combobox_Item
*item, va_list args);
+void * etk_combobox_item_field_get(Etk_Combobox_Item *item, int
column);
void etk_combobox_item_data_set(Etk_Combobox_Item *item, void
*data);
void etk_combobox_item_data_set_full(Etk_Combobox_Item *item,
void *data, void (*free_cb)(void *data));
===================================================================
RCS file: /cvs/e/e17/libs/etk/src/lib/etk_combobox_entry.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- etk_combobox_entry.c 28 Jun 2007 11:05:44 -0000 1.1
+++ etk_combobox_entry.c 6 Aug 2007 12:02:40 -0000 1.2
@@ -483,6 +483,48 @@
}
/**
+ * @brief Sets the value of the cell of one column of the combobox_entry item.
The current widgets of item will be destroyed
+ * @param item a combobox_entry item
+ * @param column the column to set the value of
+ * @param data the value of the column to set:
+ * - If the type of the corresponding column is ETK_COMBOBOX_ENTRY_LABEL, the
argument must be a "const char *" @n
+ * - If the type of the corresponding column is ETK_COMBOBOX_ENTRY_IMAGE, the
argument must be an "Etk_Image *" @n
+ * - If the type of the corresponding column is ETK_COMBOBOX_ENTRY_OTHER, the
argument must be an "Etk_Widget *"
+ * @note The new widgets of the item will be automatically shown
+ */
+void etk_combobox_entry_item_field_set(Etk_Combobox_Entry_Item *item, int
column, void *value)
+{
+ Etk_Combobox_Entry *combobox_entry;
+
+ if (!item || !(combobox_entry = item->combobox_entry) || (column >=
combobox_entry->num_cols))
+ return;
+
+ switch (combobox_entry->cols[column]->type)
+ {
+ if (item->widgets[column])
+ etk_object_destroy(ETK_OBJECT(item->widgets[column]));
+
+ case ETK_COMBOBOX_ENTRY_LABEL:
+ item->widgets[column] = etk_label_new((char *)value);
+ etk_widget_pass_mouse_events_set(item->widgets[column], ETK_TRUE);
+ break;
+ case ETK_COMBOBOX_ENTRY_IMAGE:
+ item->widgets[column] = ETK_WIDGET((Etk_Widget *)value);
+ etk_widget_pass_mouse_events_set(item->widgets[column], ETK_TRUE);
+ break;
+ case ETK_COMBOBOX_ENTRY_OTHER:
+ item->widgets[column] = ETK_WIDGET((Etk_Widget *)value);
+ break;
+ default:
+ item->widgets[column] = NULL;
+ break;
+ }
+ etk_widget_parent_set(item->widgets[column], ETK_WIDGET(item));
+ etk_widget_show(item->widgets[column]);
+}
+
+
+/**
* @brief Gets the values of the cells of the combobox_entry item
* @param item a combobox_entry item
* @param ... the location where to store the different values of the cells of
the item:
@@ -548,6 +590,49 @@
etk_widget_show(item->widgets[i]);
}
}
+
+/**
+ * @brief Gets the value of the cell of a column of the combobox_entry item
+ * @param item a combobox_entry item
+ * @param column the column to get the value of
+ * @return the value of the column as a void pointer that must be cast to the
correct type:
+ * - If the type of the corresponding column is ETK_COMBOBOX_ENTRY_LABEL, the
argument must be a "const char **" @n
+ * - If the type of the corresponding column is ETK_COMBOBOX_ENTRY_IMAGE, the
argument must be an "Etk_Image **" @n
+ * - If the type of the corresponding column is ETK_COMBOBOX_ENTRY_OTHER, the
argument must be an "Etk_Widget **"
+ */
+void * etk_combobox_entry_item_field_get(Etk_Combobox_Entry_Item *item, int
column)
+{
+ Etk_Combobox_Entry *combobox_entry;
+
+ if (!item || !(combobox_entry = item->combobox_entry) || (column >=
combobox_entry->num_cols))
+ return NULL;
+
+ switch (combobox_entry->cols[column]->type)
+ {
+ case ETK_COMBOBOX_ENTRY_LABEL:
+ {
+ const char *label;
+ label = etk_label_get(ETK_LABEL(item->widgets[column]));
+ return (void *)label;
+ break;
+ }
+ case ETK_COMBOBOX_ENTRY_IMAGE:
+ case ETK_COMBOBOX_ENTRY_OTHER:
+ {
+ Etk_Widget *widget;
+ widget = item->widgets[column];
+ return (void *)widget;
+ break;
+ }
+ default:
+ return NULL;
+ break;
+ }
+// FIXME: do we need this?
+// etk_widget_parent_set(item->widgets[column], ETK_WIDGET(item));
+// etk_widget_show(item->widgets[column]);
+}
+
/**
* @brief Sets the data associated to the combobox_entry item
===================================================================
RCS file: /cvs/e/e17/libs/etk/src/lib/etk_combobox_entry.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- etk_combobox_entry.h 27 Jul 2007 16:24:13 -0000 1.2
+++ etk_combobox_entry.h 6 Aug 2007 12:02:40 -0000 1.3
@@ -141,8 +141,10 @@
void etk_combobox_entry_item_fields_set(Etk_Combobox_Entry_Item
*item, ...);
void
etk_combobox_entry_item_fields_set_valist(Etk_Combobox_Entry_Item *item,
va_list args);
+void etk_combobox_entry_item_field_set(Etk_Combobox_Entry_Item
*item, int column, void * value);
void etk_combobox_entry_item_fields_get(Etk_Combobox_Entry_Item
*item, ...);
void
etk_combobox_entry_item_fields_get_valist(Etk_Combobox_Entry_Item *item,
va_list args);
+void * etk_combobox_entry_item_field_get(Etk_Combobox_Entry_Item
*item, int column);
void etk_combobox_entry_item_data_set(Etk_Combobox_Entry_Item
*item, void *data);
void
etk_combobox_entry_item_data_set_full(Etk_Combobox_Entry_Item *item, void
*data, void (*free_cb)(void *data));
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs