Mercurial > emacs
comparison src/w32menu.c @ 33971:c33b80a45f6a
(add_menu_item): Reset menu item text when changing type to radio button.
author | Jason Rumney <jasonr@gnu.org> |
---|---|
date | Tue, 28 Nov 2000 20:28:02 +0000 |
parents | c3435dc00ed7 |
children | 77093a87f2de |
comparison
equal
deleted
inserted
replaced
33970:670b73b06a0d | 33971:c33b80a45f6a |
---|---|
43 #endif | 43 #endif |
44 | 44 |
45 #include "dispextern.h" | 45 #include "dispextern.h" |
46 | 46 |
47 #undef HAVE_MULTILINGUAL_MENU | 47 #undef HAVE_MULTILINGUAL_MENU |
48 #undef HAVE_DIALOGS /* NTEMACS_TODO: Implement native dialogs. */ | 48 #undef HAVE_DIALOGS /* TODO: Implement native dialogs. */ |
49 | 49 |
50 /******************************************************************/ | 50 /******************************************************************/ |
51 /* Definitions copied from lwlib.h */ | 51 /* Definitions copied from lwlib.h */ |
52 | 52 |
53 typedef void * XtPointer; | 53 typedef void * XtPointer; |
2031 UINT fuFlags; | 2031 UINT fuFlags; |
2032 char *out_string; | 2032 char *out_string; |
2033 int return_value; | 2033 int return_value; |
2034 | 2034 |
2035 if (name_is_separator (wv->name)) | 2035 if (name_is_separator (wv->name)) |
2036 fuFlags = MF_SEPARATOR; | 2036 { |
2037 fuFlags = MF_SEPARATOR; | |
2038 out_string = NULL; | |
2039 } | |
2037 else | 2040 else |
2038 { | 2041 { |
2039 if (wv->enabled) | 2042 if (wv->enabled) |
2040 fuFlags = MF_STRING; | 2043 fuFlags = MF_STRING; |
2041 else | 2044 else |
2055 { | 2058 { |
2056 #if 0 /* no GC while popup menu is active */ | 2059 #if 0 /* no GC while popup menu is active */ |
2057 out_string = LocalAlloc (0, strlen (wv->name) + 1); | 2060 out_string = LocalAlloc (0, strlen (wv->name) + 1); |
2058 strcpy (out_string, wv->name); | 2061 strcpy (out_string, wv->name); |
2059 #endif | 2062 #endif |
2060 /* NTEMACS_TODO: Why has owner drawing stopped working? */ | 2063 /* TODO: Why has owner-draw stopped working? */ |
2061 fuFlags = /*MF_OWNERDRAW |*/ MF_DISABLED; | 2064 fuFlags |= /*MF_OWNERDRAW |*/ MF_DISABLED; |
2062 } | 2065 } |
2063 | 2066 |
2064 /* Draw radio buttons and tickboxes. */ | 2067 /* Draw radio buttons and tickboxes. */ |
2065 { | 2068 { |
2066 if (wv->selected && (wv->button_type == BUTTON_TYPE_TOGGLE || | 2069 if (wv->selected && (wv->button_type == BUTTON_TYPE_TOGGLE || |
2075 | 2078 |
2076 return_value = | 2079 return_value = |
2077 AppendMenu (menu, | 2080 AppendMenu (menu, |
2078 fuFlags, | 2081 fuFlags, |
2079 item != NULL ? (UINT) item : (UINT) wv->call_data, | 2082 item != NULL ? (UINT) item : (UINT) wv->call_data, |
2080 (fuFlags == MF_SEPARATOR) ? NULL: out_string ); | 2083 out_string ); |
2081 | 2084 |
2082 /* This must be done after the menu item is created. */ | 2085 /* This must be done after the menu item is created. */ |
2083 { | 2086 { |
2084 HMODULE user32 = GetModuleHandle ("user32.dll"); | 2087 HMODULE user32 = GetModuleHandle ("user32.dll"); |
2085 FARPROC set_menu_item_info = GetProcAddress (user32, "SetMenuItemInfoA"); | 2088 FARPROC set_menu_item_info = GetProcAddress (user32, "SetMenuItemInfoA"); |
2097 if (wv->button_type == BUTTON_TYPE_RADIO) | 2100 if (wv->button_type == BUTTON_TYPE_RADIO) |
2098 { | 2101 { |
2099 /* CheckMenuRadioItem allows us to differentiate TOGGLE and | 2102 /* CheckMenuRadioItem allows us to differentiate TOGGLE and |
2100 RADIO items, but is not available on NT 3.51 and earlier. */ | 2103 RADIO items, but is not available on NT 3.51 and earlier. */ |
2101 info.fMask |= MIIM_TYPE | MIIM_STATE; | 2104 info.fMask |= MIIM_TYPE | MIIM_STATE; |
2102 info.fType = MFT_RADIOCHECK; | 2105 info.fType = MFT_RADIOCHECK | MFT_STRING; |
2106 info.dwTypeData = out_string; | |
2103 info.fState = wv->selected ? MFS_CHECKED : MFS_UNCHECKED; | 2107 info.fState = wv->selected ? MFS_CHECKED : MFS_UNCHECKED; |
2104 } | 2108 } |
2109 | |
2105 set_menu_item_info (menu, | 2110 set_menu_item_info (menu, |
2106 item != NULL ? (UINT) item : (UINT) wv->call_data, | 2111 item != NULL ? (UINT) item : (UINT) wv->call_data, |
2107 FALSE, &info); | 2112 FALSE, &info); |
2108 } | 2113 } |
2109 } | 2114 } |
2152 supported on NT 3.51 and earlier, as GetMenuItemInfo is not | 2157 supported on NT 3.51 and earlier, as GetMenuItemInfo is not |
2153 available. */ | 2158 available. */ |
2154 void | 2159 void |
2155 w32_menu_display_help (HMENU menu, UINT item, UINT flags) | 2160 w32_menu_display_help (HMENU menu, UINT item, UINT flags) |
2156 { | 2161 { |
2157 int pane = 0; /* NTEMACS_TODO: Set this to pane number. */ | 2162 int pane = 0; /* TODO: Set this to pane number. */ |
2158 | 2163 |
2159 HMODULE user32 = GetModuleHandle ("user32.dll"); | 2164 HMODULE user32 = GetModuleHandle ("user32.dll"); |
2160 FARPROC get_menu_item_info = GetProcAddress (user32, "GetMenuItemInfoA"); | 2165 FARPROC get_menu_item_info = GetProcAddress (user32, "GetMenuItemInfoA"); |
2161 | 2166 |
2162 if (get_menu_item_info) | 2167 if (get_menu_item_info) |