tGtkOptionMenus now work properly with Unicode. - vaccinewars - be a doctor and try to vaccinate the world
(HTM) git clone git://src.adamsgaard.dk/vaccinewars
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit ca392c09d0ad9ec99575b1c1f868087c880b72f9
(DIR) parent ba92a3b5696e2dfeb551f9e03006afa93b9b00d6
(HTM) Author: Ben Webb <ben@salilab.org>
Date: Sat, 31 Aug 2002 17:50:52 +0000
GtkOptionMenus now work properly with Unicode.
Diffstat:
M src/gtkport/gtkport.c | 5 +++--
M src/gtkport/unicodewrap.c | 14 ++++++++++++++
M src/gtkport/unicodewrap.h | 1 +
3 files changed, 18 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/src/gtkport/gtkport.c b/src/gtkport/gtkport.c
t@@ -4700,8 +4700,9 @@ void gtk_option_menu_set_menu(GtkOptionMenu *option_menu, GtkWidget *menu)
for (list = GTK_MENU_SHELL(menu)->children; list;
list = g_slist_next(list)) {
menu_item = GTK_MENU_ITEM(list->data);
- if (menu_item && menu_item->text)
- mySendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)menu_item->text);
+ if (menu_item && menu_item->text) {
+ myComboBox_AddString(hWnd, menu_item->text);
+ }
}
mySendMessage(hWnd, CB_SETCURSEL, (WPARAM)GTK_MENU(menu)->active, 0);
}
(DIR) diff --git a/src/gtkport/unicodewrap.c b/src/gtkport/unicodewrap.c
t@@ -473,4 +473,18 @@ size_t myw32strlen(const char *str)
}
}
+LRESULT myComboBox_AddString(HWND hWnd, LPCTSTR text)
+{
+ LRESULT retval;
+ if (unicode_support) {
+ gunichar2 *w32text;
+ w32text = strtow32(text, -1);
+ retval = SendMessageW(hWnd, CB_ADDSTRING, 0, (LPARAM)w32text);
+ g_free(w32text);
+ } else {
+ retval = SendMessageA(hWnd, CB_ADDSTRING, 0, (LPARAM)text);
+ }
+ return retval;
+}
+
#endif /* CYGWIN */
(DIR) diff --git a/src/gtkport/unicodewrap.h b/src/gtkport/unicodewrap.h
t@@ -66,6 +66,7 @@ BOOL myGetMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin,
LONG myDispatchMessage(CONST MSG *lpmsg);
BOOL myIsDialogMessage(HWND hDlg, LPMSG lpMsg);
size_t myw32strlen(const char *str);
+LRESULT myComboBox_AddString(HWND hWnd, LPCTSTR text);
#endif /* CYGWIN */