Mercurial > dwindows
comparison win/dw.c @ 1749:ff9a51706715
Added optional keypress callback optional utf8 parameter on Windows.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 13 Jun 2012 20:08:41 +0000 |
parents | 535e8c19a13d |
children | 1de7daad85a3 |
comparison
equal
deleted
inserted
replaced
1748:e4fcd1e81f0d | 1749:ff9a51706715 |
---|---|
1963 } | 1963 } |
1964 } | 1964 } |
1965 break; | 1965 break; |
1966 case WM_CHAR: | 1966 case WM_CHAR: |
1967 { | 1967 { |
1968 int (*keypressfunc)(HWND, char, int, int, void *) = tmp->signalfunction; | 1968 int (*keypressfunc)(HWND, char, int, int, void *, char *) = tmp->signalfunction; |
1969 | 1969 |
1970 if(hWnd == tmp->window || _toplevel_window(hWnd) == tmp->window) | 1970 if(hWnd == tmp->window || _toplevel_window(hWnd) == tmp->window) |
1971 { | 1971 { |
1972 int special = 0; | 1972 int special = 0; |
1973 char ch = 0; | 1973 char *utf8 = NULL, ch[2] = {0}; |
1974 | 1974 #ifdef UNICODE |
1975 WCHAR uc[2] = { 0 }; | |
1976 | |
1977 uc[0] = (WCHAR)mp1; | |
1978 utf8 = WideToUTF8(uc); | |
1979 dw_debug("UTF8 %s\n", utf8); | |
1980 #endif | |
1981 | |
1975 if(GetAsyncKeyState(VK_SHIFT) & 0x8000) | 1982 if(GetAsyncKeyState(VK_SHIFT) & 0x8000) |
1976 special |= KC_SHIFT; | 1983 special |= KC_SHIFT; |
1977 if(GetAsyncKeyState(VK_CONTROL) & 0x8000) | 1984 if(GetAsyncKeyState(VK_CONTROL) & 0x8000) |
1978 special |= KC_CTRL; | 1985 special |= KC_CTRL; |
1979 if(mp2 & (1 << 29)) | 1986 if(mp2 & (1 << 29)) |
1980 special |= KC_ALT; | 1987 special |= KC_ALT; |
1981 | 1988 |
1982 if(origmsg == WM_CHAR && mp1 < 128) | 1989 if(origmsg == WM_CHAR && mp1 < 128) |
1983 ch = (char)mp1; | 1990 ch[0] = (char)mp1; |
1984 | 1991 |
1985 result = keypressfunc(tmp->window, ch, (int)mp1, special, tmp->data); | 1992 result = keypressfunc(tmp->window, ch[0], (int)mp1, special, tmp->data, utf8 ? utf8 : ch); |
1986 tmp = NULL; | 1993 tmp = NULL; |
1987 } | 1994 } |
1988 } | 1995 } |
1989 break; | 1996 break; |
1990 case WM_CLOSE: | 1997 case WM_CLOSE: |
8999 ListView_SetExtendedListViewStyle(handle, LVS_EX_FULLROWSELECT | LVS_EX_SUBITEMIMAGES); | 9006 ListView_SetExtendedListViewStyle(handle, LVS_EX_FULLROWSELECT | LVS_EX_SUBITEMIMAGES); |
9000 return DW_ERROR_NONE; | 9007 return DW_ERROR_NONE; |
9001 } | 9008 } |
9002 | 9009 |
9003 /* | 9010 /* |
9004 * Configures the main filesystem columnn title for localization. | 9011 * Configures the main filesystem column title for localization. |
9005 * Parameters: | 9012 * Parameters: |
9006 * handle: Handle to the container to be configured. | 9013 * handle: Handle to the container to be configured. |
9007 * title: The title to be displayed in the main column. | 9014 * title: The title to be displayed in the main column. |
9008 */ | 9015 */ |
9009 void API dw_filesystem_set_column_title(HWND handle, char *title) | 9016 void API dw_filesystem_set_column_title(HWND handle, char *title) |
9010 { | 9017 { |
9011 char *newtitle = strdup(title ? title : ""); | 9018 char *newtitle = strdup(title ? title : ""); |
9012 | 9019 |
9013 dw_window_set_data(handle, "_dw_coltitle", newtitle); | 9020 dw_window_set_data(handle, "_dw_coltitle", newtitle); |
9014 } | 9021 } |
9015 | 9022 |
9016 /* | 9023 /* |
9017 * Sets up the filesystem columns, note: filesystem always has an icon/filename field. | 9024 * Sets up the filesystem columns, note: filesystem always has an icon/filename field. |
9018 * Parameters: | 9025 * Parameters: |
9037 lvc.iSubItem = count; | 9044 lvc.iSubItem = count; |
9038 SendMessage(handle, LVM_INSERTCOLUMN, (WPARAM)0, (LPARAM)&lvc); | 9045 SendMessage(handle, LVM_INSERTCOLUMN, (WPARAM)0, (LPARAM)&lvc); |
9039 dw_container_setup(handle, flags, titles, count, -1); | 9046 dw_container_setup(handle, flags, titles, count, -1); |
9040 if(coltitle) | 9047 if(coltitle) |
9041 { | 9048 { |
9042 dw_window_set_data(handle, "_dw_coltitle", NULL); | 9049 dw_window_set_data(handle, "_dw_coltitle", NULL); |
9043 free(coltitle); | 9050 free(coltitle); |
9044 } | 9051 } |
9045 return DW_ERROR_NONE; | 9052 return DW_ERROR_NONE; |
9046 } | 9053 } |
9047 | 9054 |
9048 /* | 9055 /* |