Mercurial > dwindows
comparison win/dw.c @ 819:2dd7638a7719
Fix for some dw_container_change_item() misbehavior... was functioning the same as dw_container_set_item().
Also added dw_container_change_row_title() which performs the same task as dw_container_set_row_title() on inserted items.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 26 Mar 2011 12:49:59 +0000 |
parents | 5cca4ebcca9a |
children | 37cdfec6d3fa |
comparison
equal
deleted
inserted
replaced
818:c17634e2b303 | 819:2dd7638a7719 |
---|---|
7679 { | 7679 { |
7680 ContainerInfo *cinfo = (ContainerInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); | 7680 ContainerInfo *cinfo = (ContainerInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); |
7681 ULONG *flags; | 7681 ULONG *flags; |
7682 LV_ITEM lvi; | 7682 LV_ITEM lvi; |
7683 char textbuffer[100], *destptr = textbuffer; | 7683 char textbuffer[100], *destptr = textbuffer; |
7684 int item = (int)dw_window_get_data(handle, "_dw_insertitem"); | 7684 int item = 0; |
7685 | |
7686 if(pointer) | |
7687 { | |
7688 item = (int)dw_window_get_data(handle, "_dw_insertitem"); | |
7689 } | |
7685 | 7690 |
7686 if(!cinfo || !cinfo->flags || !data) | 7691 if(!cinfo || !cinfo->flags || !data) |
7687 return; | 7692 return; |
7688 | 7693 |
7689 flags = cinfo->flags; | 7694 flags = cinfo->flags; |
7858 void API dw_container_set_column_width(HWND handle, int column, int width) | 7863 void API dw_container_set_column_width(HWND handle, int column, int width) |
7859 { | 7864 { |
7860 ListView_SetColumnWidth(handle, column, width); | 7865 ListView_SetColumnWidth(handle, column, width); |
7861 } | 7866 } |
7862 | 7867 |
7863 /* | 7868 /* Internal version that handles both types */ |
7864 * Sets the title of a row in the container. | 7869 void _dw_container_set_row_title(HWND handle, void *pointer, int row, char *title) |
7865 * Parameters: | |
7866 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
7867 * row: Zero based row of data being set. | |
7868 * title: String title of the item. | |
7869 */ | |
7870 void API dw_container_set_row_title(void *pointer, int row, char *title) | |
7871 { | 7870 { |
7872 LV_ITEM lvi; | 7871 LV_ITEM lvi; |
7873 HWND container = (HWND)pointer; | 7872 int item = 0; |
7874 int item = (int)dw_window_get_data(container, "_dw_insertitem"); | 7873 |
7874 if(pointer) | |
7875 { | |
7876 item = (int)dw_window_get_data(handle, "_dw_insertitem"); | |
7877 } | |
7875 | 7878 |
7876 lvi.iItem = row + item; | 7879 lvi.iItem = row + item; |
7877 lvi.iSubItem = 0; | 7880 lvi.iSubItem = 0; |
7878 lvi.mask = LVIF_PARAM; | 7881 lvi.mask = LVIF_PARAM; |
7879 lvi.lParam = (LPARAM)title; | 7882 lvi.lParam = (LPARAM)title; |
7880 | 7883 |
7881 if(!ListView_SetItem(container, &lvi) && lvi.lParam) | 7884 if(!ListView_SetItem(handle, &lvi) && lvi.lParam) |
7882 lvi.lParam = 0; | 7885 lvi.lParam = 0; |
7883 | 7886 |
7887 } | |
7888 | |
7889 /* | |
7890 * Sets the title of a row in the container. | |
7891 * Parameters: | |
7892 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
7893 * row: Zero based row of data being set. | |
7894 * title: String title of the item. | |
7895 */ | |
7896 void API dw_container_set_row_title(void *pointer, int row, char *title) | |
7897 { | |
7898 _dw_container_set_row_title(pointer, pointer, row, title); | |
7899 } | |
7900 | |
7901 /* | |
7902 * Changes the title of a row already inserted in the container. | |
7903 * Parameters: | |
7904 * handle: Handle to the container window (widget). | |
7905 * row: Zero based row of data being set. | |
7906 * title: String title of the item. | |
7907 */ | |
7908 void API dw_container_change_row_title(HWND handle, int row, char *title) | |
7909 { | |
7910 _dw_container_set_row_title(handle, NULL, row, title); | |
7884 } | 7911 } |
7885 | 7912 |
7886 /* | 7913 /* |
7887 * Sets the title of a row in the container. | 7914 * Sets the title of a row in the container. |
7888 * Parameters: | 7915 * Parameters: |