Enlightenment CVS committal

Author  : moom16
Project : e17
Module  : proto

Dir     : e17/proto/etk/src/bin


Modified Files:
        etk_tree_test.c 


Log Message:
* Fix the focus system
* A lot of work on the tree (expandable rows, selection, clip, image 
cells...). It still needs some work though
* Clicking on the label of a radio/checkbutton now activates the button



===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/etk/src/bin/etk_tree_test.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- etk_tree_test.c     1 Oct 2005 16:29:45 -0000       1.1
+++ etk_tree_test.c     7 Oct 2005 21:33:42 -0000       1.2
@@ -11,7 +11,11 @@
 {
    static Etk_Widget *win = NULL;
    Etk_Widget *tree;
-   Etk_Tree_Col *col1, *col2, *col3, *col4;
+   Etk_Tree_Col *col1, *col2, *col3;
+   Etk_Tree_Row *row;
+   Etk_Widget *table;
+   Etk_Widget *label;
+   int i;
 
    if (win)
        {
@@ -21,33 +25,66 @@
 
    win = etk_window_new();
    etk_window_title_set(ETK_WINDOW(win), "Etk Tree Test");
-
    etk_signal_connect("delete_event", ETK_OBJECT(win), 
ETK_CALLBACK(_etk_test_tree_window_deleted_cb), win);   
        
+   table = etk_table_new(2, 2, FALSE);
+   etk_container_add(ETK_CONTAINER(win), table);
+
+   label = etk_label_new("<h1>Tree:</h1>");
+   etk_table_attach(ETK_TABLE(table), label, 0, 0, 0, 0, 10, 0, 
ETK_FILL_POLICY_HFILL);
+
+   label = etk_label_new("<h1>List:</h1>");
+   etk_table_attach(ETK_TABLE(table), label, 1, 1, 0, 0, 10, 0, 
ETK_FILL_POLICY_HFILL);
+
+   /* The tree: */
    tree = etk_tree_new();
+   etk_widget_size_request_set(tree, 300, 400);
+   etk_table_attach_defaults(ETK_TABLE(table), tree, 0, 0, 1, 1);
+
+   etk_tree_mode_set(ETK_TREE(tree), ETK_TREE_MODE_TREE);
    col1 = etk_tree_col_new(ETK_TREE(tree), "Column 1", ETK_TREE_COL_TEXT);
    col2 = etk_tree_col_new(ETK_TREE(tree), "Column 2", ETK_TREE_COL_INT);
-   col3 = etk_tree_col_new(ETK_TREE(tree), "Column 3", ETK_TREE_COL_TEXT);
-   col4 = etk_tree_col_new(ETK_TREE(tree), "Column 4", ETK_TREE_COL_DOUBLE);
+   col3 = etk_tree_col_new(ETK_TREE(tree), "Column 3", ETK_TREE_COL_IMAGE);
    etk_tree_build(ETK_TREE(tree));
 
-   etk_tree_append(ETK_TREE(tree), col1, "Row1", col2, 1, col3, "Test1", col4, 
1.0, NULL);
-   etk_tree_append(ETK_TREE(tree), col1, "Row2", col2, 2, col3, "Test2", col4, 
2.0, NULL);
-   etk_tree_append(ETK_TREE(tree), col1, "Row3", col2, 3, col3, "Test3", col4, 
3.0, NULL);
-   etk_tree_append(ETK_TREE(tree), col1, "Row1", col2, 1, col3, "Test4", col4, 
1.0, NULL);
-   etk_tree_append(ETK_TREE(tree), col1, "Row2", col2, 2, col3, "Test5", col4, 
2.0, NULL);
-   etk_tree_append(ETK_TREE(tree), col1, "Row3", col2, 3, col3, "Test6", col4, 
3.0, NULL);
-   etk_tree_append(ETK_TREE(tree), col1, "Row1", col2, 1, col3, "Test7", col4, 
1.0, NULL);
-   etk_tree_append(ETK_TREE(tree), col1, "Row2", col2, 2, col3, "Test8", col4, 
2.0, NULL);
-   etk_tree_append(ETK_TREE(tree), col1, "Row3", col2, 3, col3, "Test9", col4, 
3.0, NULL);
-   etk_tree_append(ETK_TREE(tree), col1, "Row1", col2, 1, col3, "Test10", 
col4, 1.0, NULL);
-   etk_tree_append(ETK_TREE(tree), col1, "Row2", col2, 2, col3, "Test11", 
col4, 2.0, NULL);
-   etk_tree_append(ETK_TREE(tree), col1, "Row3", col2, 3, col3, "Test12", 
col4, 3.0, NULL);
-   etk_tree_append(ETK_TREE(tree), col1, "Row1", col2, 1, col3, "Test13", 
col4, 1.0, NULL);
-   etk_tree_append(ETK_TREE(tree), col1, "Row2", col2, 2, col3, "Test14", 
col4, 2.0, NULL);
-   etk_tree_append(ETK_TREE(tree), col1, "Row3", col2, 3, col3, "Test15", 
col4, 3.0, NULL);
+   etk_tree_freeze(ETK_TREE(tree));
+   for (i = 0; i < 1000; i++)
+   {
+      row = etk_tree_append(ETK_TREE(tree), col1, "Row1", col2, 1, col3, 
"/home/simon/1star.png", NULL);
+      row = etk_tree_append_to_row(row, col1, "Row2", col2, 2, col3, 
"/home/simon/2stars.png", NULL);
+      etk_tree_append_to_row(row, col1, "Row3", col2, 3, col3, 
"/home/simon/3stars.png", NULL);
+   }
+   etk_tree_thaw(ETK_TREE(tree));
+
+
+   /* The list: */
+   tree = etk_tree_new();
+   etk_widget_size_request_set(tree, 300, 400);
+   etk_table_attach_defaults(ETK_TABLE(table), tree, 1, 1, 1, 1);
+
+   etk_tree_multiple_select_set(ETK_TREE(tree), TRUE);
+   col1 = etk_tree_col_new(ETK_TREE(tree), "Column 1", ETK_TREE_COL_TEXT);
+   col2 = etk_tree_col_new(ETK_TREE(tree), "Column 2", ETK_TREE_COL_INT);
+   col3 = etk_tree_col_new(ETK_TREE(tree), "Column 3", ETK_TREE_COL_IMAGE);
+   etk_tree_build(ETK_TREE(tree));
 
-   etk_container_add(ETK_CONTAINER(win), tree);
+   etk_tree_freeze(ETK_TREE(tree));
+   for (i = 0; i < 300; i++)
+   {
+      etk_tree_append(ETK_TREE(tree), col1, "Row1", col2, 1, col3, 
"/home/simon/1star.png", NULL);
+      etk_tree_append(ETK_TREE(tree), col1, "Row2", col2, 2, col3, 
"/home/simon/2stars.png", NULL);
+      etk_tree_append(ETK_TREE(tree), col1, "Row3", col2, 3, col3, 
"/home/simon/3stars.png", NULL);
+      etk_tree_append(ETK_TREE(tree), col1, "Row4", col2, 1, col3, 
"/home/simon/3stars.png", NULL);
+      etk_tree_append(ETK_TREE(tree), col1, "Row5", col2, 2, col3, 
"/home/simon/2stars.png", NULL);
+      etk_tree_append(ETK_TREE(tree), col1, "Row6", col2, 3, col3, 
"/home/simon/1star.png", NULL);
+      etk_tree_append(ETK_TREE(tree), col1, "Row7", col2, 1, col3, 
"/home/simon/1star.png", NULL);
+      etk_tree_append(ETK_TREE(tree), col1, "Row8", col2, 2, col3, 
"/home/simon/2stars.png", NULL);
+      etk_tree_append(ETK_TREE(tree), col1, "Row9", col2, 3, col3, 
"/home/simon/3stars.png", NULL);
+      etk_tree_append(ETK_TREE(tree), col1, "Row10", col2, 1, col3, 
"/home/simon/3stars.png", NULL);
+      etk_tree_append(ETK_TREE(tree), col1, "Row11", col2, 2, col3, 
"/home/simon/2stars.png", NULL);
+      etk_tree_append(ETK_TREE(tree), col1, "Row12", col2, 3, col3, 
"/home/simon/1star.png", NULL);
+   }
+   etk_tree_thaw(ETK_TREE(tree));
    
    etk_widget_show_all(win);
 }




-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to