Enlightenment CVS committal Author : dj2 Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/doc/tutorials/widgets Modified Files: ewl_mvc.dox Log Message: - add part of MVC tutorial =================================================================== RCS file: /cvs/e/e17/libs/ewl/doc/tutorials/widgets/ewl_mvc.dox,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- ewl_mvc.dox 26 Feb 2008 04:24:10 -0000 1.1 +++ ewl_mvc.dox 26 Feb 2008 05:49:21 -0000 1.2 @@ -1,4 +1,49 @@ /** * @addtogroup Ewl_MVC * @section mvc_tut Tutorial + * + * The Model-View-Controller (MVC) design pattern is commonly used to separate display, + * data and control code. The MVC concepts are used in Ewl for several widgets + * including Ewl_Tree, Ewl_List and Ewl_Combo. This makes it a lot easier to + * update and store the data for those lists as the Ewl widget doesn't care + * about the internal representation. + * + * @section MVC Concepts + * The basic MVC idea in Ewl is that we don't care what your data is. We don't + * care how it's stored, how it's sorted or when you load it. When your data + * changes you signal the MVC widget as dirty and it will redraw. As the widget is + * re-drawn it will ask you to give it information for each row/column as needed. + * + * This can add a bit of extra work on the application end but provides for a lot of + * flexibility. We've also created a few helper functions to generate common + * models and views for you so you don't necessarily have to create these on your own. + * + * There are two classes, along with the Ewl widget you're interested in, that you + * need to deal with when working with MVC widgets. These are: + * + * * Ewl_Model + * + * * Ewl_View + * + * These classes will provide the pointers to the functions to call when + * the containers require information. + * + * @code + * Ewl_Widget *list; + * Ewl_Model *model; + * Ewl_View *view; + * + * model = ewl_model_ecore_list_get(); + * view = ewl_label_view_get(); + * + * list = ewl_list_new(); + * ewl_mvc_model_set(EWL_MVC(list), model); + * ewl_mvc_view_set(EWL_MVC(list), view); + * ewl_mvc_data_set(EWL_MVC(list), ecore_list_new()); + * @endcode + * + * In this example we're creating a simple Ewl_List widget and using a helper + * method to create a model to work with Ecore_LIst data. In this case our list + * is storing string objects so we can use the provided ewl_label_view_get() to get + * a pre-created view object. */ ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs