61 |
BUTTON_TYPE_RADIO |
BUTTON_TYPE_RADIO |
62 |
}; |
}; |
63 |
|
|
64 |
|
/* This structure is based on the one in ../lwlib/lwlib.h, modified |
65 |
|
for Windows. */ |
66 |
typedef struct _widget_value |
typedef struct _widget_value |
67 |
{ |
{ |
68 |
/* name of widget */ |
/* name of widget */ |
71 |
char* value; |
char* value; |
72 |
/* keyboard equivalent. no implications for XtTranslations */ |
/* keyboard equivalent. no implications for XtTranslations */ |
73 |
char* key; |
char* key; |
74 |
/* Help string or null if none. */ |
/* Help string or nil if none. |
75 |
char *help; |
GC finds this string through the frame's menu_bar_vector |
76 |
|
or through menu_items. */ |
77 |
|
Lisp_Object help; |
78 |
/* true if enabled */ |
/* true if enabled */ |
79 |
Boolean enabled; |
Boolean enabled; |
80 |
/* true if selected */ |
/* true if selected */ |
1273 |
abort (); |
abort (); |
1274 |
|
|
1275 |
wv->selected = !NILP (selected); |
wv->selected = !NILP (selected); |
1276 |
if (STRINGP (help)) |
if (!STRINGP (help)) |
1277 |
wv->help = (char *) XSTRING (help)->data; |
help = Qnil; |
1278 |
else |
|
1279 |
wv->help = NULL; |
wv->help = help; |
1280 |
|
|
1281 |
prev_wv = wv; |
prev_wv = wv; |
1282 |
|
|
1731 |
abort (); |
abort (); |
1732 |
|
|
1733 |
wv->selected = !NILP (selected); |
wv->selected = !NILP (selected); |
1734 |
if (STRINGP (help)) |
if (!STRINGP (help)) |
1735 |
wv->help = XSTRING (help)->data; |
help = Qnil; |
1736 |
|
|
1737 |
|
wv->help = help; |
1738 |
|
|
1739 |
prev_wv = wv; |
prev_wv = wv; |
1740 |
|
|
2089 |
else |
else |
2090 |
out_string = wv->name; |
out_string = wv->name; |
2091 |
|
|
2092 |
if (wv->title || wv->call_data == 0) |
if (item != NULL) |
2093 |
|
fuFlags = MF_POPUP; |
2094 |
|
else if (wv->title || wv->call_data == 0) |
2095 |
{ |
{ |
2096 |
/* Only use MF_OWNERDRAW if GetMenuItemInfo is usable, since |
/* Only use MF_OWNERDRAW if GetMenuItemInfo is usable, since |
2097 |
we can't deallocate the memory otherwise. */ |
we can't deallocate the memory otherwise. */ |
2098 |
if (get_menu_item_info) |
if (get_menu_item_info) |
2099 |
{ |
{ |
2100 |
out_string = LocalAlloc (LPTR, strlen (wv->name) + 1); |
out_string = (char *) LocalAlloc (LPTR, strlen (wv->name) + 1); |
2101 |
|
#ifdef MENU_DEBUG |
2102 |
|
DebPrint ("Menu: allocing %ld for owner-draw", info.dwItemData); |
2103 |
|
#endif |
2104 |
strcpy (out_string, wv->name); |
strcpy (out_string, wv->name); |
2105 |
fuFlags = MF_OWNERDRAW | MF_DISABLED; |
fuFlags = MF_OWNERDRAW | MF_DISABLED; |
2106 |
} |
} |
2116 |
fuFlags |= MF_UNCHECKED; |
fuFlags |= MF_UNCHECKED; |
2117 |
} |
} |
2118 |
|
|
|
if (item != NULL) |
|
|
fuFlags = MF_POPUP; |
|
|
|
|
2119 |
return_value = |
return_value = |
2120 |
AppendMenu (menu, |
AppendMenu (menu, |
2121 |
fuFlags, |
fuFlags, |
2132 |
info.cbSize = sizeof (info); |
info.cbSize = sizeof (info); |
2133 |
info.fMask = MIIM_DATA; |
info.fMask = MIIM_DATA; |
2134 |
|
|
2135 |
/* Set help string for menu item. Allocate new memory |
/* Set help string for menu item. Leave it as a Lisp_Object |
2136 |
from the heap for it, since garbage collection can |
until it is ready to be displayed, since GC can happen while |
2137 |
occur while menus are active. */ |
menus are active. */ |
2138 |
if (wv->help) |
if (wv->help) |
2139 |
{ |
info.dwItemData = (DWORD) wv->help; |
|
info.dwItemData |
|
|
= (DWORD) LocalAlloc (LPTR, strlen(wv->help) + 1); |
|
|
strcpy (info.dwItemData, wv->help); |
|
|
} |
|
2140 |
|
|
2141 |
if (wv->button_type == BUTTON_TYPE_RADIO) |
if (wv->button_type == BUTTON_TYPE_RADIO) |
2142 |
{ |
{ |
2217 |
info.fMask = MIIM_DATA; |
info.fMask = MIIM_DATA; |
2218 |
get_menu_item_info (menu, item, FALSE, &info); |
get_menu_item_info (menu, item, FALSE, &info); |
2219 |
|
|
2220 |
help = info.dwItemData ? build_string ((char *)info.dwItemData) : Qnil; |
help = info.dwItemData ? (Lisp_Object) info.dwItemData : Qnil; |
2221 |
} |
} |
2222 |
|
|
2223 |
/* Store the help echo in the keyboard buffer as the X toolkit |
/* Store the help echo in the keyboard buffer as the X toolkit |
2236 |
} |
} |
2237 |
} |
} |
2238 |
|
|
2239 |
/* Free memory used by owner-drawn and help_echo strings. */ |
/* Free memory used by owner-drawn strings. */ |
2240 |
static void |
static void |
2241 |
w32_free_submenu_strings (menu) |
w32_free_submenu_strings (menu) |
2242 |
HMENU menu; |
HMENU menu; |
2247 |
MENUITEMINFO info; |
MENUITEMINFO info; |
2248 |
|
|
2249 |
info.cbSize = sizeof (info); |
info.cbSize = sizeof (info); |
2250 |
info.fMask = MIIM_DATA | MIIM_SUBMENU; |
info.fMask = MIIM_DATA | MIIM_TYPE | MIIM_SUBMENU; |
2251 |
|
|
2252 |
get_menu_item_info (menu, i, TRUE, &info); |
get_menu_item_info (menu, i, TRUE, &info); |
2253 |
|
|
2254 |
/* Both owner-drawn names and help strings are held in dwItemData. */ |
/* Owner-drawn names are held in dwItemData. */ |
2255 |
if (info.dwItemData) |
if ((info.fType & MF_OWNERDRAW) && info.dwItemData) |
2256 |
LocalFree (info.dwItemData); |
{ |
2257 |
|
#ifdef MENU_DEBUG |
2258 |
|
DebPrint ("Menu: freeing %ld for owner-draw", info.dwItemData); |
2259 |
|
#endif |
2260 |
|
LocalFree (info.dwItemData); |
2261 |
|
} |
2262 |
|
|
2263 |
/* Recurse down submenus. */ |
/* Recurse down submenus. */ |
2264 |
if (info.hSubMenu) |
if (info.hSubMenu) |