Mercurial > dwindows
comparison win/dw.c @ 105:ad95fc623ff3
Some changes to the container optimization code.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 04 Sep 2002 09:05:19 +0000 |
parents | 2892fe8a023e |
children | 4b6799f3dbbc |
comparison
equal
deleted
inserted
replaced
104:2892fe8a023e | 105:ad95fc623ff3 |
---|---|
43 int main(int argc, char *argv[]); | 43 int main(int argc, char *argv[]); |
44 | 44 |
45 #define ICON_INDEX_LIMIT 200 | 45 #define ICON_INDEX_LIMIT 200 |
46 HICON lookup[200]; | 46 HICON lookup[200]; |
47 HIMAGELIST hSmall = 0, hLarge = 0; | 47 HIMAGELIST hSmall = 0, hLarge = 0; |
48 | |
49 /* Special flag used for internal tracking */ | |
50 #define DW_CFA_RESERVED (1 << 30) | |
48 | 51 |
49 #define THREAD_LIMIT 128 | 52 #define THREAD_LIMIT 128 |
50 COLORREF _foreground[THREAD_LIMIT]; | 53 COLORREF _foreground[THREAD_LIMIT]; |
51 COLORREF _background[THREAD_LIMIT]; | 54 COLORREF _background[THREAD_LIMIT]; |
52 HPEN _hPen[THREAD_LIMIT]; | 55 HPEN _hPen[THREAD_LIMIT]; |
5496 */ | 5499 */ |
5497 int dw_container_setup(HWND handle, unsigned long *flags, char **titles, int count, int separator) | 5500 int dw_container_setup(HWND handle, unsigned long *flags, char **titles, int count, int separator) |
5498 { | 5501 { |
5499 ContainerInfo *cinfo = (ContainerInfo *)GetWindowLong(handle, GWL_USERDATA); | 5502 ContainerInfo *cinfo = (ContainerInfo *)GetWindowLong(handle, GWL_USERDATA); |
5500 int z, l = 0; | 5503 int z, l = 0; |
5501 unsigned long *tempflags = malloc(sizeof(unsigned long) * (count + 2)); | 5504 unsigned long *tempflags = calloc(sizeof(unsigned long), count + 2); |
5502 LV_COLUMN lvc; | 5505 LV_COLUMN lvc; |
5503 | 5506 |
5504 if(separator == -1) | 5507 if(separator == -1) |
5508 { | |
5509 tempflags[0] = DW_CFA_RESERVED; | |
5505 l = 1; | 5510 l = 1; |
5511 } | |
5506 | 5512 |
5507 memcpy(&tempflags[l], flags, sizeof(unsigned long) * count); | 5513 memcpy(&tempflags[l], flags, sizeof(unsigned long) * count); |
5508 tempflags[count + l] = 0; | 5514 tempflags[count + l] = 0; |
5509 cinfo->flags = tempflags; | 5515 cinfo->flags = tempflags; |
5510 cinfo->columns = count + l; | 5516 cinfo->columns = count + l; |
5998 lvc.cchTextMax = 1023; | 6004 lvc.cchTextMax = 1023; |
5999 lvc.pszText = text; | 6005 lvc.pszText = text; |
6000 | 6006 |
6001 if(ListView_GetColumn(handle, z, &lvc)) | 6007 if(ListView_GetColumn(handle, z, &lvc)) |
6002 columns[z] = ListView_GetStringWidth(handle, lvc.pszText); | 6008 columns[z] = ListView_GetStringWidth(handle, lvc.pszText); |
6009 | |
6010 if(flags[z] & DW_CFA_RESERVED) | |
6011 columns[z] += 20; | |
6003 } | 6012 } |
6004 } | 6013 } |
6005 | 6014 |
6006 index = ListView_GetNextItem(handle, -1, LVNI_ALL); | 6015 index = ListView_GetNextItem(handle, -1, LVNI_ALL); |
6007 | 6016 |