Mercurial > dwindows
comparison dwtest.c @ 864:ca01c7d95b80
Added some sanity checks for a couple of problem functions and default optimized container column width to 16 for image columns.
Added a second icon column to the test program to test image column optimization.
The optization needs to be looked further into to see why calculated width of image columns is 0.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 03 Apr 2011 17:24:23 +0000 |
parents | 7331b7c9f1c9 |
children | 39ab47d103c3 |
comparison
equal
deleted
inserted
replaced
863:b405182033a0 | 864:ca01c7d95b80 |
---|---|
585 /* set the details of item 0 to new data */ | 585 /* set the details of item 0 to new data */ |
586 fprintf(stderr,"In cb: container: %x containerinfo: %x icon: %x\n", (int)container, (int)containerinfo, (int)fileicon); | 586 fprintf(stderr,"In cb: container: %x containerinfo: %x icon: %x\n", (int)container, (int)containerinfo, (int)fileicon); |
587 dw_filesystem_change_file(container, 0, "new data", fileicon); | 587 dw_filesystem_change_file(container, 0, "new data", fileicon); |
588 size = 999; | 588 size = 999; |
589 fprintf(stderr,"In cb: container: %x containerinfo: %x icon: %x\n", (int)container, (int)containerinfo, (int)fileicon); | 589 fprintf(stderr,"In cb: container: %x containerinfo: %x icon: %x\n", (int)container, (int)containerinfo, (int)fileicon); |
590 dw_filesystem_change_item(container, 0, 0, &size); | 590 dw_filesystem_change_item(container, 1, 0, &size); |
591 return 0; | 591 return 0; |
592 } | 592 } |
593 | 593 |
594 int DWSIGNAL switch_page_cb( HWND window, unsigned long page_num, void *itemdata ) | 594 int DWSIGNAL switch_page_cb( HWND window, unsigned long page_num, void *itemdata ) |
595 { | 595 { |
804 dw_tree_item_change(tree, t2, "tree folder 2", foldericon ); | 804 dw_tree_item_change(tree, t2, "tree folder 2", foldericon ); |
805 } | 805 } |
806 | 806 |
807 void container_add(void) | 807 void container_add(void) |
808 { | 808 { |
809 char *titles[3]; | 809 char *titles[4]; |
810 char *names[3]; | 810 char *names[3]; |
811 char buffer[100]; | 811 char buffer[100]; |
812 unsigned long flags[3] = { DW_CFA_ULONG | DW_CFA_RIGHT | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR, | 812 unsigned long flags[4] = { DW_CFA_BITMAPORICON | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR, |
813 DW_CFA_TIME | DW_CFA_CENTER | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR, | 813 DW_CFA_ULONG | DW_CFA_RIGHT | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR, |
814 DW_CFA_DATE | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR }; | 814 DW_CFA_TIME | DW_CFA_CENTER | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR, |
815 DW_CFA_DATE | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR }; | |
815 int z; | 816 int z; |
816 CTIME time; | 817 CTIME time; |
817 CDATE date; | 818 CDATE date; |
818 unsigned long size; | 819 unsigned long size; |
819 HICN thisicon; | 820 HICN thisicon; |
828 | 829 |
829 /* and a status area to see whats going on */ | 830 /* and a status area to see whats going on */ |
830 container_status = dw_status_text_new("", 0); | 831 container_status = dw_status_text_new("", 0); |
831 dw_box_pack_start( notebookbox4, container_status, 100, 20, TRUE, FALSE, 1); | 832 dw_box_pack_start( notebookbox4, container_status, 100, 20, TRUE, FALSE, 1); |
832 | 833 |
833 titles[0] = "Size"; | 834 titles[0] = "Type"; |
834 titles[1] = "Time"; | 835 titles[1] = "Size"; |
835 titles[2] = "Date"; | 836 titles[2] = "Time"; |
836 | 837 titles[3] = "Date"; |
837 dw_filesystem_setup(container, flags, titles, 3); | 838 |
839 dw_filesystem_setup(container, flags, titles, 4); | |
838 containerinfo = dw_container_alloc(container, 3); | 840 containerinfo = dw_container_alloc(container, 3); |
839 | 841 |
840 for(z=0;z<3;z++) | 842 for(z=0;z<3;z++) |
841 { | 843 { |
842 names[z] = (char *)malloc( 100 ); | 844 names[z] = (char *)malloc( 100 ); |
846 sprintf(buffer, "Filename %d",z+1); | 848 sprintf(buffer, "Filename %d",z+1); |
847 if (z == 0 ) thisicon = foldericon; | 849 if (z == 0 ) thisicon = foldericon; |
848 else thisicon = fileicon; | 850 else thisicon = fileicon; |
849 fprintf(stderr,"Initial: container: %x containerinfo: %x icon: %x\n", (int)container, (int)containerinfo, (int)thisicon); | 851 fprintf(stderr,"Initial: container: %x containerinfo: %x icon: %x\n", (int)container, (int)containerinfo, (int)thisicon); |
850 dw_filesystem_set_file(container, containerinfo, z, buffer, thisicon); | 852 dw_filesystem_set_file(container, containerinfo, z, buffer, thisicon); |
851 dw_filesystem_set_item(container, containerinfo, 0, z, &size); | 853 dw_filesystem_set_item(container, containerinfo, 0, z, &thisicon); |
854 dw_filesystem_set_item(container, containerinfo, 1, z, &size); | |
852 | 855 |
853 time.seconds = z+10; | 856 time.seconds = z+10; |
854 time.minutes = z+10; | 857 time.minutes = z+10; |
855 time.hours = z+10; | 858 time.hours = z+10; |
856 dw_filesystem_set_item(container, containerinfo, 1, z, &time); | 859 dw_filesystem_set_item(container, containerinfo, 2, z, &time); |
857 | 860 |
858 date.day = z+10; | 861 date.day = z+10; |
859 date.month = z+10; | 862 date.month = z+10; |
860 date.year = z+2000; | 863 date.year = z+2000; |
861 dw_filesystem_set_item(container, containerinfo, 2, z, &date); | 864 dw_filesystem_set_item(container, containerinfo, 3, z, &date); |
862 | 865 |
863 dw_container_set_row_title(containerinfo, z, names[z]); | 866 dw_container_set_row_title(containerinfo, z, names[z]); |
864 } | 867 } |
865 | 868 |
866 dw_container_insert(container, containerinfo, 3); | 869 dw_container_insert(container, containerinfo, 3); |
867 | 870 |
868 containerinfo = dw_container_alloc(container, 1); | 871 containerinfo = dw_container_alloc(container, 1); |
869 dw_filesystem_set_file(container, containerinfo, 0, strdup("Yikes"), foldericon); | 872 dw_filesystem_set_file(container, containerinfo, 0, strdup("Yikes"), foldericon); |
870 size = 324; | 873 size = 324; |
871 dw_filesystem_set_item(container, containerinfo, 0, 0, &size); | 874 dw_filesystem_set_item(container, containerinfo, 0, 0, &foldericon); |
872 dw_filesystem_set_item(container, containerinfo, 1, 0, &time); | 875 dw_filesystem_set_item(container, containerinfo, 1, 0, &size); |
873 dw_filesystem_set_item(container, containerinfo, 2, 0, &date); | 876 dw_filesystem_set_item(container, containerinfo, 2, 0, &time); |
877 dw_filesystem_set_item(container, containerinfo, 3, 0, &date); | |
874 dw_container_set_row_title(containerinfo, 0, strdup("Extra")); | 878 dw_container_set_row_title(containerinfo, 0, strdup("Extra")); |
875 | 879 |
876 dw_container_insert(container, containerinfo, 1); | 880 dw_container_insert(container, containerinfo, 1); |
877 dw_container_optimize(container); | 881 dw_container_optimize(container); |
878 | 882 |