Enlightenment CVS committal Author : dj2 Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_mvc.c ewl_mvc.h ewl_tree2.c ewl_tree2.h Log Message: - make ewl_mvc clean up after itself - convert tree2 over to ewl_mvc selection code. This should be all of them. =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_mvc.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- ewl_mvc.c 3 Oct 2006 05:52:02 -0000 1.3 +++ ewl_mvc.c 3 Oct 2006 06:09:05 -0000 1.4 @@ -20,6 +20,9 @@ ewl_widget_inherit(EWL_WIDGET(mvc), EWL_MVC_TYPE); ewl_box_orientation_set(EWL_BOX(mvc), EWL_ORIENTATION_VERTICAL); + ewl_callback_append(EWL_WIDGET(mvc), EWL_CALLBACK_DESTROY, + ewl_mvc_cb_destroy, NULL); + DRETURN_INT(TRUE, DLEVEL_STABLE); } @@ -535,6 +538,29 @@ idx = ewl_container_child_index_get(c, w); if (idx > -1 && ewl_mvc_is_selected(EWL_MVC(c), idx)) ewl_mvc_selected_rm(EWL_MVC(c), idx); + + DLEAVE_FUNCTION(DLEVEL_STABLE); +} + +/** + * @internal + * @param w: The wiget to destroy + * @param ev: UNUSED + * @param data: UNUSED + * @return Returns no value + * @brief Cleans up the given widget + */ +void +ewl_mvc_cb_destroy(Ewl_Widget *w, void *ev __UNUSED__, void *data __UNUSED__) +{ + Ewl_MVC *mvc; + + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR("w", w); + + mvc = EWL_MVC(w); + if (mvc->selected.items) + FREE(mvc->selected.items); DLEAVE_FUNCTION(DLEVEL_STABLE); } =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_mvc.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- ewl_mvc.h 3 Oct 2006 05:52:02 -0000 1.3 +++ ewl_mvc.h 3 Oct 2006 06:09:05 -0000 1.4 @@ -90,5 +90,7 @@ void ewl_mvc_cb_child_del(Ewl_Container *c, Ewl_Widget *w, int idx); void ewl_mvc_cb_child_hide(Ewl_Container *c, Ewl_Widget *w); +void ewl_mvc_cb_destroy(Ewl_Widget *w, void *ev, void *data); + #endif =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_tree2.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -3 -r1.33 -r1.34 --- ewl_tree2.c 2 Oct 2006 05:19:24 -0000 1.33 +++ ewl_tree2.c 3 Oct 2006 06:09:05 -0000 1.34 @@ -52,6 +52,9 @@ ewl_widget_appearance_set(EWL_WIDGET(tree), EWL_TREE2_TYPE); ewl_widget_inherit(EWL_WIDGET(tree), EWL_TREE2_TYPE); + ewl_mvc_selected_change_cb_set(EWL_MVC(tree), + ewl_tree2_cb_selected_change); + ewl_object_fill_policy_set(EWL_OBJECT(tree), EWL_FLAG_FILL_SHRINK | EWL_FLAG_FILL_FILL); @@ -261,41 +264,6 @@ } /** - * @param tree: The tree to get the selected cells from - * @return Returns an Ecore_List of cells selected in the tree - * @brief Get the selected cells from the tree - */ -Ecore_List * -ewl_tree2_selected_cells_get(Ewl_Tree2 *tree) -{ - DENTER_FUNCTION(DLEVEL_STABLE); - DCHECK_PARAM_PTR_RET("tree", tree, FALSE); - DCHECK_TYPE_RET("tree", tree, EWL_TREE2_TYPE, FALSE); - - DRETURN_PTR(tree->selected, DLEVEL_STABLE); -} - -/** - * @param tree: The tree to clear the selected cells from - * @return Returns no value. - * @brief Clear the selected cells in the tree - */ -void -ewl_tree2_selected_cells_clear(Ewl_Tree2 *tree) -{ - DENTER_FUNCTION(DLEVEL_STABLE); - DCHECK_PARAM_PTR("tree", tree); - DCHECK_TYPE("tree", tree, EWL_TREE2_TYPE); - - if (tree->mode == EWL_TREE_MODE_NONE) - DRETURN(DLEVEL_STABLE); - - ecore_list_clear(tree->selected); - - DLEAVE_FUNCTION(DLEVEL_STABLE); -} - -/** * @param tree: The tree to get the mode from * @return Returns the current Ewl_Tree_Mode of the tree * @brief Get the mode from the tree @@ -331,13 +299,7 @@ /* if the mode is none then we don't care about the selected list */ if (tree->mode == EWL_TREE_MODE_NONE) { - if (tree->selected) - ecore_list_destroy(tree->selected); - } - else - { - if (!tree->selected) - tree->selected = ecore_list_new(); + ewl_mvc_selected_list_set(EWL_MVC(tree), NULL); } DLEAVE_FUNCTION(DLEVEL_STABLE); @@ -412,7 +374,6 @@ t = EWL_TREE2(w); ecore_list_destroy(t->columns); - if (t->selected) ecore_list_destroy(t->selected); DLEAVE_FUNCTION(DLEVEL_STABLE); } @@ -442,6 +403,7 @@ DRETURN(DLEVEL_STABLE); ewl_tree2_build_tree(tree); + ewl_tree2_cb_selected_change(EWL_MVC(tree)); ewl_mvc_dirty_set(EWL_MVC(tree), FALSE); DLEAVE_FUNCTION(DLEVEL_STABLE); @@ -664,6 +626,19 @@ DLEAVE_FUNCTION(DLEVEL_STABLE); } + +void +ewl_tree2_cb_selected_change(Ewl_MVC *mvc) +{ + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR("mvc", mvc); + DCHECK_TYPE("mvc", mvc, EWL_MVC_TYPE); + + /* XXX handle highlighting here */ + + DLEAVE_FUNCTION(DLEVEL_STABLE); +} + /* * Ewl_Tree2_Column stuff =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_tree2.h,v retrieving revision 1.30 retrieving revision 1.31 diff -u -3 -r1.30 -r1.31 --- ewl_tree2.h 24 Sep 2006 20:26:50 -0000 1.30 +++ ewl_tree2.h 3 Oct 2006 06:09:05 -0000 1.31 @@ -88,9 +88,7 @@ Ewl_Widget *rows; /**< The rows of the tree */ Ecore_List *columns; /**< The tree columns. */ - int *rowcache; /**< Cache of row sizes */ - Ecore_List *selected; /**< The list of selected cells */ Ewl_Tree_Mode mode; /**< The mode of the tree */ @@ -140,9 +138,6 @@ unsigned char visible); unsigned int ewl_tree2_headers_visible_get(Ewl_Tree2 *tree); -Ecore_List *ewl_tree2_selected_cells_get(Ewl_Tree2 *tree); -void ewl_tree2_selected_cells_clear(Ewl_Tree2 *tree); - Ewl_Tree_Mode ewl_tree2_mode_get(Ewl_Tree2 *tree); void ewl_tree2_mode_set(Ewl_Tree2 *tree, Ewl_Tree_Mode mode); @@ -157,6 +152,7 @@ void ewl_tree2_cb_destroy(Ewl_Widget *w, void *ev, void *data); void ewl_tree2_cb_configure(Ewl_Widget *w, void *ev, void *data); void ewl_tree2_cb_column_sort(Ewl_Widget *w, void *ev, void *data); +void ewl_tree2_cb_selected_change(Ewl_MVC *mvc); /* * Ewl_Tree2_Column stuff ------------------------------------------------------------------------- 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