Enlightenment CVS committal

Author  : ningerso
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_button.c ewl_button.h ewl_combo.c ewl_filelist_column.c 
        ewl_filelist_icon.c ewl_filelist_list.c ewl_filelist_tree.c 
        ewl_filepicker.c ewl_image.c ewl_image.h ewl_label.c 
        ewl_label.h ewl_list.c ewl_model.h ewl_tree2.c 
        ewl_tree2_view_plain.c ewl_tree2_view_scrolled.c ewl_view.c 
        ewl_view.h 


Log Message:
Next step in the MVC API transition. This will break all existing users of tree2
and other MVC based widgets. Following this there will be one more significant
break in the API for tree2 users.

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_button.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -3 -r1.46 -r1.47
--- ewl_button.c        3 Mar 2007 01:58:19 -0000       1.46
+++ ewl_button.c        23 Mar 2007 22:06:30 -0000      1.47
@@ -13,6 +13,10 @@
        NULL
 };
 
+static Ewl_Widget *ewl_button_view_cb_widget_fetch(void *data, int row,
+                                               int col);
+static Ewl_Widget *ewl_button_view_cb_header_fetch(void *data, int col);
+
 /**
  * @return Returns NULL on failure, a pointer to a new button on success
  * @brief Allocate and initialize a new button
@@ -82,6 +86,50 @@
                                ewl_button_cb_key_down, NULL);
 
        DRETURN_INT(TRUE, DLEVEL_STABLE);
+}
+
+/**
+ * @return Returns a view that can be used to display Ewl_Button widgets
+ * @brief Creates and returns a view to be used by Ewl_Button widgets
+ */
+Ewl_View *
+ewl_button_view_get(void)
+{
+       Ewl_View *view;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       view = ewl_view_new();
+       ewl_view_widget_fetch_set(view, ewl_button_view_cb_widget_fetch);
+       ewl_view_header_fetch_set(view, ewl_button_view_cb_header_fetch);
+
+       DRETURN_PTR(view, DLEVEL_STABLE);
+}
+
+static Ewl_Widget *
+ewl_button_view_cb_widget_fetch(void *data, int row __UNUSED__, int col 
__UNUSED__)
+{
+       Ewl_Widget *button;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       button = ewl_label_new();
+       ewl_button_label_set(EWL_BUTTON(button), data);
+
+       DRETURN_PTR(button, DLEVEL_STABLE);
+}
+
+static Ewl_Widget *
+ewl_button_view_cb_header_fetch(void *data, int col __UNUSED__)
+{
+       Ewl_Widget *button;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       button = ewl_button_new();
+       ewl_button_label_set(EWL_BUTTON(button), data);
+
+       DRETURN_PTR(button, DLEVEL_STABLE);
 }
 
 /**
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_button.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -3 -r1.27 -r1.28
--- ewl_button.h        4 Mar 2007 00:52:01 -0000       1.27
+++ ewl_button.h        23 Mar 2007 22:06:30 -0000      1.28
@@ -3,6 +3,7 @@
 #define EWL_BUTTON_H
 
 #include "ewl_stock.h"
+#include "ewl_view.h"
 
 /**
  * @addtogroup Ewl_Button Ewl_Button: The Basic Button
@@ -60,6 +61,7 @@
 
 Ewl_Widget     *ewl_button_new(void);
 int             ewl_button_init(Ewl_Button *b);
+Ewl_View       *ewl_button_view_get(void);
 
 void            ewl_button_label_set(Ewl_Button *b, const char *l);
 const char     *ewl_button_label_get(Ewl_Button *b);
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_combo.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -3 -r1.50 -r1.51
--- ewl_combo.c 17 Mar 2007 08:55:37 -0000      1.50
+++ ewl_combo.c 23 Mar 2007 22:06:30 -0000      1.51
@@ -316,8 +316,8 @@
                model = idx->sel.model;
                mvc_data = idx->sel.data;
 
-               item = view->construct();
-               view->assign(item, model->fetch(mvc_data, idx->row, 0));
+               item = view->fetch(model->fetch(mvc_data, idx->row, 0),
+                               idx->row, 0);
        }
        else if (view->header_fetch) 
                item = view->header_fetch(ewl_mvc_data_get(mvc), -1);
@@ -417,8 +417,7 @@
                ewl_container_child_append(c, o);
                ewl_widget_show(o);
 
-               item = view->construct();
-               view->assign(item, model->fetch(mvc_data, i, 0));
+               item = view->fetch(model->fetch(mvc_data, i, 0), i, 0);
                ewl_container_child_append(EWL_CONTAINER(o), item);
                ewl_widget_show(item);
        }
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_filelist_column.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -3 -r1.27 -r1.28
--- ewl_filelist_column.c       5 Mar 2007 11:52:54 -0000       1.27
+++ ewl_filelist_column.c       23 Mar 2007 22:06:30 -0000      1.28
@@ -29,6 +29,8 @@
                                                        void *data);
 static void ewl_filelist_column_row_add(Ewl_Filelist *fl, const char *dir, 
                                                char *file, void *data);
+static Ewl_Widget * ewl_filelist_column_view_cb_widget_fetch(void *data,
+                                               int col, int row);
 
 /**
  * @return Returns the Ewl_View needed to display the filelist_column
@@ -42,11 +44,24 @@
        if (!ewl_filelist_column_view)
        {
                ewl_filelist_column_view = ewl_view_new();
-               ewl_view_constructor_set(ewl_filelist_column_view, 
-                                       ewl_filelist_column_new);
+               ewl_view_widget_fetch_set(ewl_filelist_column_view, 
+                                       
ewl_filelist_column_view_cb_widget_fetch);
        }
 
        DRETURN_PTR(ewl_filelist_column_view, DLEVEL_STABLE);
+}
+
+static Ewl_Widget *
+ewl_filelist_column_view_cb_widget_fetch(void *data, int col, int row)
+{
+       Ewl_Widget *list;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       list = ewl_filelist_column_new();
+       ewl_widget_show(list);
+
+       DRETURN_PTR(list, DLEVEL_STABLE);
 }
 
 /**
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_filelist_icon.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- ewl_filelist_icon.c 6 Feb 2007 13:42:17 -0000       1.18
+++ ewl_filelist_icon.c 23 Mar 2007 22:06:30 -0000      1.19
@@ -15,6 +15,8 @@
                                                void *ev, void *data);
 static void ewl_filelist_icon_icon_add(Ewl_Filelist *fl, const char *dir, 
                                                char *file, void *data);
+static Ewl_Widget *ewl_filelist_icon_view_cb_widget_fetch(void *data, int row,
+                                               int col);
 
 /**
  * @return Returns the Ewl_View needed to display the filelist_icon
@@ -28,11 +30,23 @@
        if (!ewl_filelist_icon_view)
        {
                ewl_filelist_icon_view = ewl_view_new();
-               ewl_view_constructor_set(ewl_filelist_icon_view,
-                                               ewl_filelist_icon_new);
+               ewl_view_widget_fetch_set(ewl_filelist_icon_view,
+                                               
ewl_filelist_icon_view_cb_widget_fetch);
        }
 
        DRETURN_PTR(ewl_filelist_icon_view, DLEVEL_STABLE);
+}
+
+static Ewl_Widget *
+ewl_filelist_icon_view_cb_widget_fetch(void *data __UNUSED__, int row 
__UNUSED__, int col __UNUSED__)
+{
+       Ewl_Widget *list;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       list = ewl_filelist_icon_new();
+
+       DRETURN_PTR(list, DLEVEL_STABLE);
 }
 
 /**
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_filelist_list.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- ewl_filelist_list.c 6 Feb 2007 13:42:17 -0000       1.13
+++ ewl_filelist_list.c 23 Mar 2007 22:06:30 -0000      1.14
@@ -16,6 +16,9 @@
 static void ewl_filelist_list_cb_icon_clicked(Ewl_Widget *w, void *ev, 
                                                        void *data);
 
+static Ewl_Widget *ewl_filelist_list_view_cb_widget_fetch(void *data, int row,
+                                                       int col);
+
 /**
  * @return Returns the view for the filelist list
  * @brief Retrieves the Ewl_View needed to use the filelist list view
@@ -28,11 +31,24 @@
        if (!ewl_filelist_list_view)
        {
                ewl_filelist_list_view = ewl_view_new();
-               ewl_view_constructor_set(ewl_filelist_list_view,
-                                               ewl_filelist_list_new);
+               ewl_view_widget_fetch_set(ewl_filelist_list_view,
+                                               
ewl_filelist_list_view_cb_widget_fetch);
        }
 
        DRETURN_PTR(ewl_filelist_list_view, DLEVEL_STABLE);
+}
+
+static Ewl_Widget *
+ewl_filelist_list_view_cb_widget_fetch(void *data __UNUSED__, int row 
__UNUSED__, int col __UNUSED__)
+{
+       Ewl_Widget *list;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       list = ewl_filelist_list_new();
+       ewl_widget_show(list);
+
+       DRETURN_PTR(list, DLEVEL_STABLE);
 }
 
 /**
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_filelist_tree.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- ewl_filelist_tree.c 21 Mar 2007 03:22:55 -0000      1.7
+++ ewl_filelist_tree.c 23 Mar 2007 22:06:30 -0000      1.8
@@ -24,9 +24,13 @@
 
 static Ewl_View *ewl_filelist_tree_view = NULL;
 
+static Ewl_Widget * ewl_filelist_tree_view_widget_fetch(void *data, int row,
+                                               int col);
 static void ewl_filelist_tree_add(Ewl_Filelist *fl, const char *dir, 
                                                char *file, void *data);
 
+static Ewl_Widget *ewl_filelist_tree_cb_widget_fetch(void *data, int row,
+                                               int column);
 static Ewl_Widget *ewl_filelist_tree_cb_header_fetch(void *data, int column);
 
 /* Model callbacks */
@@ -51,13 +55,21 @@
        if (!ewl_filelist_tree_view)
        {
                ewl_filelist_tree_view = ewl_view_new();
-               ewl_view_constructor_set(ewl_filelist_tree_view,
-                                               ewl_filelist_tree_new);
+               ewl_view_widget_fetch_set(ewl_filelist_tree_view,
+                                               
ewl_filelist_tree_view_widget_fetch);
        }
 
        DRETURN_PTR(ewl_filelist_tree_view, DLEVEL_STABLE);
 }
 
+static Ewl_Widget *
+ewl_filelist_tree_view_widget_fetch(void *data __UNUSED__, int row __UNUSED__, 
int col __UNUSED__)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       DRETURN_PTR(NULL, DLEVEL_STABLE);
+}
+
 /**
  * @return Returns a new Ewl_Filelist_Tree widget or NULL on failure
  * @brief Creates a new Ewl_Filelist_Tree widget
@@ -135,8 +147,7 @@
        ewl_widget_show(fl->tree);
 
        view = ewl_view_new();
-       ewl_view_constructor_set(view, ewl_label_new);
-       ewl_view_assign_set(view, EWL_VIEW_ASSIGN(ewl_label_text_set));
+       ewl_view_widget_fetch_set(view, ewl_filelist_tree_cb_widget_fetch);
        ewl_view_header_fetch_set(view, ewl_filelist_tree_cb_header_fetch);
 
        ewl_tree2_column_append(EWL_TREE2(fl->tree), view, TRUE);
@@ -398,11 +409,28 @@
 }
 
 static
+Ewl_Widget *ewl_filelist_tree_cb_widget_fetch(void *data, int row, int column)
+{
+       Ewl_Widget *l;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       l = ewl_label_new();
+       ewl_label_text_set(EWL_LABEL(l), data);
+       ewl_widget_show(l);
+
+       DRETURN_PTR(l, DLEVEL_STABLE);
+}
+
+static
 Ewl_Widget *ewl_filelist_tree_cb_header_fetch(void *data __UNUSED__, int 
column)
 {
        Ewl_Widget *l;
        const char *t;
 
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
        l = ewl_label_new();
        if (column == 0) t = "filename";
        else if (column == 1) t = "size";
@@ -414,7 +442,7 @@
        ewl_label_text_set(EWL_LABEL(l), t);
        ewl_widget_show(l);
 
-       return l;
+       DRETURN_PTR(l, DLEVEL_STABLE);
 }
 
 
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_filepicker.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -3 -r1.29 -r1.30
--- ewl_filepicker.c    21 Mar 2007 03:22:55 -0000      1.29
+++ ewl_filepicker.c    23 Mar 2007 22:06:30 -0000      1.30
@@ -101,9 +101,7 @@
 
        model = ewl_model_ecore_list_get();
 
-       view = ewl_view_new();
-       ewl_view_constructor_set(view, ewl_label_new);
-       ewl_view_assign_set(view, EWL_VIEW_ASSIGN(ewl_label_text_set));
+       view = ewl_label_view_get();
 
        fp->path = ecore_list_new();
 
@@ -157,9 +155,7 @@
        ewl_model_data_fetch_set(model, ewl_filepicker_cb_type_fetch);
        ewl_model_data_count_set(model, ewl_filepicker_cb_type_count);
 
-       view = ewl_view_new();
-       ewl_view_constructor_set(view, ewl_label_new);
-       ewl_view_assign_set(view, EWL_VIEW_ASSIGN(ewl_label_text_set));
+       view = ewl_view_clone(ewl_label_view_get());
        ewl_view_header_fetch_set(view, ewl_filepicker_cb_type_header);
 
        fp->type_combo = ewl_combo_new();
@@ -267,7 +263,7 @@
        old_fl = EWL_FILELIST(fp->file_list);
 
        /* set the new view */
-       fp->file_list = view->construct();
+       fp->file_list = view->fetch(NULL, 0, 0);
        ewl_container_child_append(EWL_CONTAINER(fp->file_list_box),
                                                        fp->file_list);
        ewl_callback_append(EWL_WIDGET(fp->file_list), 
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_image.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -3 -r1.56 -r1.57
--- ewl_image.c 3 Mar 2007 01:58:19 -0000       1.56
+++ ewl_image.c 23 Mar 2007 22:06:30 -0000      1.57
@@ -20,6 +20,9 @@
 static void ewl_image_rotate_180(Ewl_Image *img);
 static void ewl_image_rotate_90(Ewl_Image *img, int cc);
 
+static Ewl_Widget *ewl_image_view_cb_header_fetch(void *data, int col);
+static Ewl_Widget *ewl_image_view_cb_widget_fetch(void *data, int row, int 
col);
+
 /**
  * @return Returns a pointer to a new image widget on success, NULL on failure.
  * @brief Load an image widget with specified image contents
@@ -44,6 +47,50 @@
        }
 
        DRETURN_PTR(EWL_WIDGET(image), DLEVEL_STABLE);
+}
+
+/**
+ * @return Returns a view that can be used to display Ewl_Image widgets
+ * @brief Creates and returns a view to be used by Ewl_Image widgets
+ */
+Ewl_View *
+ewl_image_view_get(void)
+{
+       Ewl_View *view;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       view = ewl_view_new();
+       ewl_view_widget_fetch_set(view, ewl_image_view_cb_widget_fetch);
+       ewl_view_header_fetch_set(view, ewl_image_view_cb_header_fetch);
+
+       DRETURN_PTR(view, DLEVEL_STABLE);
+}
+
+static Ewl_Widget *
+ewl_image_view_cb_widget_fetch(void *data, int row __UNUSED__, int col 
__UNUSED__)
+{
+       Ewl_Widget *image;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       image = ewl_image_new();
+       ewl_image_file_path_set(EWL_IMAGE(image), data);
+
+       DRETURN_PTR(image, DLEVEL_STABLE);
+}
+
+static Ewl_Widget *
+ewl_image_view_cb_header_fetch(void *data, int col __UNUSED__)
+{
+       Ewl_Widget *image;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       image = ewl_image_new();
+       ewl_image_file_path_set(EWL_IMAGE(image), data);
+
+       DRETURN_PTR(image, DLEVEL_STABLE);
 }
 
 /**
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_image.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -3 -r1.35 -r1.36
--- ewl_image.h 4 Mar 2007 01:06:48 -0000       1.35
+++ ewl_image.h 23 Mar 2007 22:06:30 -0000      1.36
@@ -2,6 +2,7 @@
 #ifndef EWL_IMAGE_H
 #define EWL_IMAGE_H
 
+#include "ewl_view.h"
 /**
  * @addtogroup Ewl_Image Ewl_Image: An Image Display Widget
  * Provides a widget for displaying evas loadable images, and edjes.
@@ -97,6 +98,7 @@
 
 Ewl_Widget     *ewl_image_new(void);
 int             ewl_image_init(Ewl_Image *i);
+Ewl_View       *ewl_image_view_get(void);
 
 void            ewl_image_file_set(Ewl_Image *i, const char *im, 
                                                const char *key);
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_label.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- ewl_label.c 7 Mar 2007 00:02:43 -0000       1.23
+++ ewl_label.c 23 Mar 2007 22:06:30 -0000      1.24
@@ -5,6 +5,9 @@
 #include "ewl_macros.h"
 #include "ewl_private.h"
 
+static Ewl_Widget *ewl_label_view_cb_widget_fetch(void *data, int row, int 
col);
+static Ewl_Widget *ewl_label_view_cb_header_fetch(void *data, int col);
+
 /**
  * @return Returns a new Ewl_Widget if successful, NULL on failure
  * @brief Creates a new Ewl_Label widget with the @a text text in it
@@ -101,10 +104,34 @@
        DENTER_FUNCTION(DLEVEL_STABLE);
 
        view = ewl_view_new();
-       ewl_view_constructor_set(view, ewl_label_new);
-       ewl_view_assign_set(view, EWL_VIEW_ASSIGN(ewl_label_text_set));
+       ewl_view_widget_fetch_set(view, ewl_label_view_cb_widget_fetch);
+       ewl_view_header_fetch_set(view, ewl_label_view_cb_header_fetch);
 
        DRETURN_PTR(view, DLEVEL_STABLE);
 }
 
+static Ewl_Widget *
+ewl_label_view_cb_widget_fetch(void *data, int row __UNUSED__, int col 
__UNUSED__)
+{
+       Ewl_Widget *label;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       label = ewl_label_new();
+       ewl_label_text_set(EWL_LABEL(label), data);
+
+       DRETURN_PTR(label, DLEVEL_STABLE);
+}
 
+static Ewl_Widget *
+ewl_label_view_cb_header_fetch(void *data, int col __UNUSED__)
+{
+       Ewl_Widget *label;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       label = ewl_label_new();
+       ewl_label_text_set(EWL_LABEL(label), data);
+
+       DRETURN_PTR(label, DLEVEL_STABLE);
+}
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_label.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- ewl_label.h 4 Mar 2007 00:52:01 -0000       1.19
+++ ewl_label.h 23 Mar 2007 22:06:30 -0000      1.20
@@ -51,6 +51,7 @@
 
 Ewl_Widget     *ewl_label_new(void);
 int             ewl_label_init(Ewl_Label *la);
+Ewl_View       *ewl_label_view_get(void);
 
 void            ewl_label_text_set(Ewl_Label *la, const char *text);
 const char     *ewl_label_text_get(Ewl_Label *la);
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_list.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- ewl_list.c  2 Mar 2007 04:39:46 -0000       1.18
+++ ewl_list.c  23 Mar 2007 22:06:30 -0000      1.19
@@ -99,8 +99,7 @@
        {
                Ewl_Widget *o;
 
-               o = view->construct();
-               view->assign(o, model->fetch(mvc_data, i, 0));
+               o = view->fetch(model->fetch(mvc_data, i, 0), i, 0);
                ewl_widget_show(o);
 
                ewl_container_child_append(EWL_CONTAINER(list), o);
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_model.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- ewl_model.h 21 Mar 2007 03:22:55 -0000      1.20
+++ ewl_model.h 23 Mar 2007 22:06:30 -0000      1.21
@@ -63,6 +63,17 @@
 typedef void *(*Ewl_Model_Expansion_Data_Fetch)(void *data, unsigned int row);
 
 /**
+ * @def EWL_MODEL_DATA_HEADER_FETCH(f)
+ * Model callback to get the header data for a specific column
+ */
+#define EWL_MODEL_DATA_HEADER_FETCH(f) ((Ewl_Model_Data_Header_Fetch)f)
+
+/**
+ * A typedef to shorten the definition of the model_data_header_fetch callback
+ */
+typedef void *(*Ewl_Model_Data_Header_Fetch)(void *data, unsigned int col);
+
+/**
  * @def EWL_MODEL_EXPANSION_MODEL_FETCH(f)
  * Model callback to get the model to use for the expansion point
  */
@@ -100,6 +111,17 @@
 typedef int (*Ewl_Model_Data_Count)(void *data);
 
 /**
+ * @def EWL_MODEL_COLUMN_SORTABLE(f)
+ * Model callback to check if a columns data is sortable
+ */
+#define EWL_MODEL_COLUMN_SORTABLE(f) ((Ewl_Model_Column_Sortable)f)
+
+/**
+ * A typedef to shorten the definition of the model_column_sortable callbacks. 
+ */
+typedef int (*Ewl_Model_Column_Sortable)(void *data, int col);
+
+/**
  * @def EWL_MODEL(model)
  * Typecasts a pointer to an Ewl_Model pointer.
  */
@@ -117,6 +139,9 @@
                Ewl_Model_Expansion_Model_Fetch model; /**< Get expansion model 
*/
        } expansion;
 
+       Ewl_Model_Column_Sortable sortable; /**< Is a column sortable */
+
+       Ewl_Model_Data_Header_Fetch header; /**< Retrieve header data */
        Ewl_Model_Data_Fetch fetch;    /**< Retrieve data for a cell */
        Ewl_Model_Data_Free data_free; /**< Free data passed to view */
        Ewl_Model_Data_Count count;    /**< Count of data items */
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_tree2.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -3 -r1.65 -r1.66
--- ewl_tree2.c 12 Mar 2007 22:36:28 -0000      1.65
+++ ewl_tree2.c 23 Mar 2007 22:06:30 -0000      1.66
@@ -651,7 +651,7 @@
        /* destroy the old view, create a new one and redisplay the tree */
        if (t->rows) ewl_widget_destroy(t->rows);
 
-       t->rows = view->construct();
+       t->rows = view->fetch(NULL, 0, 0);
        ewl_tree2_view_tree2_set(EWL_TREE2_VIEW(t->rows), t);
        ewl_container_child_append(EWL_CONTAINER(t), t->rows);
        ewl_widget_show(t->rows);
@@ -748,8 +748,7 @@
        }
        else
        {
-               child = view->construct();
-               view->assign(child, val);
+               child = view->fetch(val, r, c);
        }
        ewl_container_child_append(EWL_CONTAINER(cell), child);
        ewl_widget_show(child);
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_tree2_view_plain.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- ewl_tree2_view_plain.c      6 Feb 2007 13:42:17 -0000       1.4
+++ ewl_tree2_view_plain.c      23 Mar 2007 22:06:31 -0000      1.5
@@ -5,6 +5,9 @@
 #include "ewl_macros.h"
 #include "ewl_private.h"
 
+static Ewl_Widget *ewl_tree2_view_plain_cb_widget_fetch(void *data, int row,
+                                                       int col);
+
 static Ewl_View *ewl_tree2_view_plain_view = NULL;
 
 /**
@@ -19,11 +22,25 @@
        if (!ewl_tree2_view_plain_view)
        {
                ewl_tree2_view_plain_view = ewl_view_new();
-               ewl_view_constructor_set(ewl_tree2_view_plain_view,
-                                       ewl_tree2_view_plain_new);
+               ewl_view_widget_fetch_set(ewl_tree2_view_plain_view,
+                                       ewl_tree2_view_plain_cb_widget_fetch);
        }
 
        DRETURN_PTR(ewl_tree2_view_plain_view, DLEVEL_STABLE);
+}
+
+static Ewl_Widget *
+ewl_tree2_view_plain_cb_widget_fetch(void *data __UNUSED__, int row __UNUSED__,
+               int col __UNUSED__)
+{
+       Ewl_Widget *plain;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       plain = ewl_tree2_view_plain_new();
+       ewl_widget_show(plain);
+
+       DRETURN_PTR(plain, DLEVEL_STABLE);
 }
 
 /**
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_tree2_view_scrolled.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- ewl_tree2_view_scrolled.c   6 Feb 2007 13:42:17 -0000       1.5
+++ ewl_tree2_view_scrolled.c   23 Mar 2007 22:06:31 -0000      1.6
@@ -8,6 +8,9 @@
 
 static Ewl_View *ewl_tree2_view_scrolled_view = NULL;
 
+static Ewl_Widget * ewl_tree2_view_cb_widget_fetch(void *data, int col,
+                                                       int row);
+
 /**
  * @return Returns the view for this widget
  * @brief Retrieves the view for this widget
@@ -20,11 +23,24 @@
        if (!ewl_tree2_view_scrolled_view)
        {
                ewl_tree2_view_scrolled_view = ewl_view_new();
-               ewl_view_constructor_set(ewl_tree2_view_scrolled_view,
-                                       ewl_tree2_view_scrolled_new);
+               ewl_view_widget_fetch_set(ewl_tree2_view_scrolled_view,
+                                       ewl_tree2_view_cb_widget_fetch);
        }
 
        DRETURN_PTR(ewl_tree2_view_scrolled_view, DLEVEL_STABLE);
+}
+
+static Ewl_Widget *
+ewl_tree2_view_cb_widget_fetch(void *data, int col, int row)
+{
+       Ewl_Widget *tree;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       tree = ewl_tree2_view_scrolled_new();
+       ewl_widget_show(tree);
+
+       DRETURN_PTR(tree, DLEVEL_STABLE);
 }
 
 /**
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_view.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- ewl_view.c  6 Feb 2007 13:42:17 -0000       1.8
+++ ewl_view.c  23 Mar 2007 22:06:31 -0000      1.9
@@ -27,6 +27,31 @@
 }
 
 /**
+ * @param src: An existing view to copy as a basis for a new view
+ * @return Returns a new Ewl_View object on success or NULL on failure
+ * @brief Creates a new Ewl_View object
+ */
+Ewl_View *
+ewl_view_clone(Ewl_View *src)
+{
+       Ewl_View *view;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       view = NEW(Ewl_View, 1);
+       if (!ewl_view_init(view))
+       {
+               FREE(view);
+               DRETURN_PTR(NULL, DLEVEL_STABLE);
+       }
+
+       memcpy(view, src, sizeof(Ewl_View));
+       /* FIXME: Reset reference count once we add that feature */
+
+       DRETURN_PTR(view, DLEVEL_STABLE);
+}
+
+/**
  * @param view: The Ewl_View to initialize
  * @return Returns TRUEE on success or FALSE on failure
  * @brief Initializes an Ewl_View object to default values
@@ -41,18 +66,18 @@
 }
 
 /**
- * @param v: The Ewl_View to set the constructor into
- * @param construct: The Ewl_View_Constructor to set into the view
+ * @param v: The Ewl_View to set the widget fetch callback into
+ * @param fetch: The Ewl_View_Widget_Fetch to set into the view
  * @return Returns no value.
- * @brief This will set the given constructor into the view
+ * @brief This will set the given widget fetch callback into the view
  */
 void
-ewl_view_constructor_set(Ewl_View *v, Ewl_View_Constructor construct)
+ewl_view_widget_fetch_set(Ewl_View *v, Ewl_View_Widget_Fetch fetch)
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("v", v);
 
-       v->construct = construct;
+       v->fetch = fetch;
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -63,76 +88,75 @@
  * none set.
  * @brief Get the constructor set on this view
  */
-Ewl_View_Constructor
-ewl_view_constructor_get(Ewl_View *v)
+Ewl_View_Widget_Fetch
+ewl_view_widget_fetch_get(Ewl_View *v)
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET("v", v, NULL);
 
-       DRETURN_INT(v->construct, DLEVEL_STABLE);
+       DRETURN_INT(v->fetch, DLEVEL_STABLE);
 }
 
 /**
- * @param v: The Ewl_View to set the assignment function into
- * @param assign: The Ewl_View_Assign assignment function to set
+ * @param v: The Ewl_View to set the header_fetch callback on
+ * @param f: The Ewl_View_Header_Fetch callback
  * @return Returns no value.
- * @brief Set the assign pointer on this view
+ * @brief Sets the header fetch callback into the view 
  */
 void
-ewl_view_assign_set(Ewl_View *v, Ewl_View_Assign assign)
+ewl_view_header_fetch_set(Ewl_View *v, Ewl_View_Header_Fetch f)
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("v", v);
 
-       v->assign = assign;
+       v->header_fetch = f;
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
 /**
- * @param v: The Ewl_View to get the assignment function from
- * @return Returns the Ewl_View_Assign set into the Ewl_View or NULL if none
- * set.
- * @brief Get the assign pointer set on this view
+ * @param v: The Ewl_View to get the Ewl_View_Header_Fetch function from
+ * @return Returns the Ewl_View_Header_Fetch callback set on the view, or
+ * NULL on failure.
+ * @brief Gets the header fetch callback from the view
  */
-Ewl_View_Assign
-ewl_view_assign_get(Ewl_View *v)
+Ewl_View_Header_Fetch 
+ewl_view_header_fetch_get(Ewl_View *v)
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET("v", v, NULL);
 
-       DRETURN_INT(v->assign, DLEVEL_STABLE);
+       DRETURN_INT(v->header_fetch, DLEVEL_STABLE);
 }
 
 /**
- * @param v: The Ewl_View to set the header_fetch callback on
- * @param f: The Ewl_View_Header_Fetch callback
+ * @param v: The Ewl_View to set the expansion_view_fetch callback on
+ * @param f: The Ewl_View_Expansion_View_Fetch callback
  * @return Returns no value.
- * @brief Sets the header fetch callback into the view 
+ * @brief Sets the expansion view fetch callback into the view 
  */
 void
-ewl_view_header_fetch_set(Ewl_View *v, Ewl_View_Header_Fetch f)
+ewl_view_expansion_view_fetch_set(Ewl_View *v, Ewl_View_Expansion_View_Fetch f)
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("v", v);
 
-       v->header_fetch = f;
+       v->expansion = f;
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
 /**
- * @param v: The Ewl_View to get the Ewl_View_Header_Fetch function from
- * @return Returns the Ewl_View_Header_Fetch callback set on the view, or
- * NULL on failure.
- * @brief Gets the header fetch callback from the view
+ * @param v: The Ewl_View to get the Ewl_View_Expansion_View_Fetch function 
from
+ * @return Returns the Ewl_View_Expansion_View_Fetch callback set on the view,
+ * or NULL on failure.
+ * @brief Gets the expansion view fetch callback from the view
  */
-Ewl_View_Header_Fetch 
-ewl_view_header_fetch_get(Ewl_View *v)
+Ewl_View_Expansion_View_Fetch
+ewl_view_expansion_view_fetch_get(Ewl_View *v)
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET("v", v, NULL);
 
-       DRETURN_INT(v->header_fetch, DLEVEL_STABLE);
+       DRETURN_INT(v->expansion, DLEVEL_STABLE);
 }
-
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_view.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- ewl_view.h  4 Mar 2007 00:52:01 -0000       1.11
+++ ewl_view.h  23 Mar 2007 22:06:31 -0000      1.12
@@ -12,26 +12,15 @@
  */
 
 /**
- * @def EWL_VIEW_CONSTRUCTOR(f)
+ * @def EWL_VIEW_WIDGET_FETCH(f)
  * View callback for the constructor for a data row
  */
-#define EWL_VIEW_CONSTRUCTOR(f) ((Ewl_View_Constructor)f)
+#define EWL_VIEW_WIDGET_FETCH(f) ((Ewl_View_Widget_Fetch)f)
 
 /**
- * A typedef to shorten the definition of the view_constructor  callbacks. 
+ * A typedef to shorten the definition of the view_widget_fetch callbacks. 
  */
-typedef Ewl_Widget *(*Ewl_View_Constructor)(void);
-
-/**
- * @def EWL_VIEW_ASSIGN(f)
- * View callback to set data into a given widget
- */
-#define EWL_VIEW_ASSIGN(f) ((Ewl_View_Assign)f)
-
-/**
- * A typedef to shorten the definition of the view_assign callbacks. 
- */
-typedef void (*Ewl_View_Assign)(Ewl_Widget *w, void *data);
+typedef Ewl_Widget *(*Ewl_View_Widget_Fetch)(void *data, int row, int col);
 
 /**
  * @def EWL_VIEW_HEADER_GET(f)
@@ -56,26 +45,39 @@
 typedef struct Ewl_View Ewl_View;
 
 /**
+ * @def EWL_VIEW_EXPANSION_VIEW_FETCH(f)
+ * View callback to get a view for expanded data on a row
+ */
+#define EWL_VIEW_EXPANSION_VIEW_FETCH_GET(f) ((Ewl_View_Expansion_View_Fetch)f)
+
+/**
+ * A typedef to shorten the definition of the view_expansion_view_fetch
+ * callbacks. 
+ */
+typedef Ewl_View *(*Ewl_View_Expansion_View_Fetch)(void *data, int column);
+
+/**
  * @brief The view function pointers
  */
 struct Ewl_View
 {
-       Ewl_View_Constructor construct;         /**< Create a widget for 
display */
-       Ewl_View_Assign assign;                 /**< Assign data to a widget */
+       Ewl_View_Widget_Fetch fetch;    /**< Get a new widget for display */
        Ewl_View_Header_Fetch header_fetch;     /**< Get the header for the 
given column */
+       Ewl_View_Expansion_View_Fetch expansion;        /**< Get a view for 
displaying expansion data */
 };
 
 Ewl_View               *ewl_view_new(void);
 int                     ewl_view_init(Ewl_View *view);
+Ewl_View               *ewl_view_clone(Ewl_View *src);
 
-void                    ewl_view_constructor_set(Ewl_View *view, 
Ewl_View_Constructor construct);
-Ewl_View_Constructor    ewl_view_constructor_get(Ewl_View *view);
-
-void                    ewl_view_assign_set(Ewl_View *view, Ewl_View_Assign 
assign);
-Ewl_View_Assign         ewl_view_assign_get(Ewl_View *view);
+void                    ewl_view_widget_fetch_set(Ewl_View *view, 
Ewl_View_Widget_Fetch construct);
+Ewl_View_Widget_Fetch   ewl_view_widget_fetch_get(Ewl_View *view);
 
 void                    ewl_view_header_fetch_set(Ewl_View *v, 
Ewl_View_Header_Fetch f);
 Ewl_View_Header_Fetch   ewl_view_header_fetch_get(Ewl_View *v);
+
+void                    ewl_view_expansion_view_fetch_set(Ewl_View *v, 
Ewl_View_Expansion_View_Fetch f);
+Ewl_View_Expansion_View_Fetch  ewl_view_expansion_view_fetch_get(Ewl_View *v);
 
 /**
  * @}



-------------------------------------------------------------------------
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
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to