Mercurial > dwindows
comparison gtk/dw.c @ 575:e72f61a8f492
Hopefully fixes an error with wrong indexes in the containers on GTK after
multiple appends.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 10 Feb 2005 09:12:15 +0000 |
parents | 828e6a66c5c5 |
children | fa710b6cbba5 |
comparison
equal
deleted
inserted
replaced
574:70c8a30c254f | 575:e72f61a8f492 |
---|---|
5886 * handle: Handle to the container window (widget). | 5886 * handle: Handle to the container window (widget). |
5887 * rowcount: The number of items to be populated. | 5887 * rowcount: The number of items to be populated. |
5888 */ | 5888 */ |
5889 void *dw_container_alloc(HWND handle, int rowcount) | 5889 void *dw_container_alloc(HWND handle, int rowcount) |
5890 { | 5890 { |
5891 int z, count = 0; | 5891 int z, count = 0, prevrowcount = 0; |
5892 GtkWidget *clist; | 5892 GtkWidget *clist; |
5893 GdkColor *fore, *back; | 5893 GdkColor *fore, *back; |
5894 char **blah; | 5894 char **blah; |
5895 int _locked_by_me = FALSE; | 5895 int _locked_by_me = FALSE; |
5896 | 5896 |
5901 DW_MUTEX_UNLOCK; | 5901 DW_MUTEX_UNLOCK; |
5902 return NULL; | 5902 return NULL; |
5903 } | 5903 } |
5904 | 5904 |
5905 count = (int)gtk_object_get_data(GTK_OBJECT(clist), "_dw_colcount"); | 5905 count = (int)gtk_object_get_data(GTK_OBJECT(clist), "_dw_colcount"); |
5906 prevrowcount = (int)gtk_object_get_data(GTK_OBJECT(clist), "_dw_rowcount"); | |
5906 | 5907 |
5907 if(!count) | 5908 if(!count) |
5908 { | 5909 { |
5909 DW_MUTEX_UNLOCK; | 5910 DW_MUTEX_UNLOCK; |
5910 return NULL; | 5911 return NULL; |
5918 gtk_clist_freeze(GTK_CLIST(clist)); | 5919 gtk_clist_freeze(GTK_CLIST(clist)); |
5919 for(z=0;z<rowcount;z++) | 5920 for(z=0;z<rowcount;z++) |
5920 { | 5921 { |
5921 gtk_clist_append(GTK_CLIST(clist), blah); | 5922 gtk_clist_append(GTK_CLIST(clist), blah); |
5922 if(fore) | 5923 if(fore) |
5923 gtk_clist_set_foreground(GTK_CLIST(clist), z, fore); | 5924 gtk_clist_set_foreground(GTK_CLIST(clist), z + prevrowcount, fore); |
5924 if(back) | 5925 if(back) |
5925 gtk_clist_set_background(GTK_CLIST(clist), z, back); | 5926 gtk_clist_set_background(GTK_CLIST(clist), z + prevrowcount, back); |
5926 } | 5927 } |
5927 gtk_object_set_data(GTK_OBJECT(clist), "_dw_rowcount", (gpointer)rowcount); | 5928 gtk_object_set_data(GTK_OBJECT(clist), "_dw_rowcount", (gpointer)(rowcount + prevrowcount)); |
5928 free(blah); | 5929 free(blah); |
5929 DW_MUTEX_UNLOCK; | 5930 DW_MUTEX_UNLOCK; |
5930 return (void *)handle; | 5931 return (void *)handle; |
5931 } | 5932 } |
5932 | 5933 |