/* Menu support for GNU Emacs on the Microsoft W32 API.
Copyright (C) 1986, 1988, 1993, 1994, 1996, 1998, 1999, 2001, 2002,
- 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+ 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
This file is part of GNU Emacs.
extern Lisp_Object QCtoggle, QCradio;
-extern Lisp_Object Voverriding_local_map;
-extern Lisp_Object Voverriding_local_map_menu_flag;
-
extern Lisp_Object Qoverriding_local_map, Qoverriding_terminal_local_map;
extern Lisp_Object Qmenu_bar_update_hook;
#endif
static void utf8to16 (unsigned char *, int, WCHAR *);
+static int fill_in_menu (HMENU, widget_value *);
void w32_free_menu_strings (HWND);
\f
string = AREF (items, i + 1);
if (NILP (string))
break;
- wv->name = (char *) SDATA (string);
+ wv->name = SSDATA (string);
update_submenu_strings (wv->contents);
wv = wv->next;
}
break;
wv = xmalloc_widget_value ();
- wv->name = (char *) SDATA (string);
+ wv->name = SSDATA (string);
wv->value = 0;
wv->enabled = 1;
wv->button_type = BUTTON_TYPE_NONE;
}
pane_string = (NILP (pane_name)
- ? "" : (char *) SDATA (pane_name));
+ ? "" : SSDATA (pane_name));
/* If there is just one top-level pane, put all its items directly
under the top-level menu. */
if (menu_items_n_panes == 1)
prev_wv->next = wv;
else
save_wv->contents = wv;
- wv->name = (char *) SDATA (item_name);
+ wv->name = SSDATA (item_name);
if (!NILP (descrip))
- wv->key = (char *) SDATA (descrip);
+ wv->key = SSDATA (descrip);
wv->value = 0;
/* Use the contents index as call_data, since we are
restricted to 16-bits. */
else if (STRING_MULTIBYTE (title))
title = ENCODE_SYSTEM (title);
- wv_title->name = (char *) SDATA (title);
+ wv_title->name = SSDATA (title);
wv_title->enabled = TRUE;
wv_title->title = TRUE;
wv_title->button_type = BUTTON_TYPE_NONE;
Lisp_Object title, Lisp_Object header,
char **error)
{
- int i, nb_buttons=0;
+ int i, nb_buttons = 0;
char dialog_name[6];
int menu_item_selection;
pane_name = AREF (menu_items, MENU_ITEMS_PANE_NAME);
prefix = AREF (menu_items, MENU_ITEMS_PANE_PREFIX);
pane_string = (NILP (pane_name)
- ? "" : (char *) SDATA (pane_name));
+ ? "" : SSDATA (pane_name));
prev_wv = xmalloc_widget_value ();
prev_wv->value = pane_string;
if (keymaps && !NILP (prefix))
prev_wv->next = wv;
wv->name = (char *) button_names[nb_buttons];
if (!NILP (descrip))
- wv->key = (char *) SDATA (descrip);
- wv->value = (char *) SDATA (item_name);
+ wv->key = SSDATA (descrip);
+ wv->value = SSDATA (item_name);
wv->call_data = (void *) &AREF (menu_items, i);
wv->enabled = !NILP (enable);
wv->help = Qnil;
#endif /* !HAVE_DIALOGS */
\f
-/* Is this item a separator? */
-static int
-name_is_separator (const char *name)
-{
- const char *start = name;
-
- /* Check if name string consists of only dashes ('-'). */
- while (*name == '-') name++;
- /* Separators can also be of the form "--:TripleSuperMegaEtched"
- or "--deep-shadow". We don't implement them yet, se we just treat
- them like normal separators. */
- return (*name == '\0' || start + 2 == name);
-}
-
/* UTF8: 0xxxxxxx, 110xxxxx 10xxxxxx, 1110xxxx, 10xxxxxx, 10xxxxxx */
static void
utf8to16 (unsigned char * src, int len, WCHAR * dest)
int return_value;
size_t nlen, orig_len;
- if (name_is_separator (wv->name))
+ if (menu_separator_name_p (wv->name))
{
fuFlags = MF_SEPARATOR;
out_string = NULL;
}
/* Construct native Windows menu(bar) based on widget_value tree. */
-int
+static int
fill_in_menu (HMENU menu, widget_value *wv)
{
int items_added = 0;
void
globals_of_w32menu (void)
{
- /* See if Get/SetMenuItemInfo functions are available. */
+ /* See if Get/SetMenuItemInfo functions are available. */
HMODULE user32 = GetModuleHandle ("user32.dll");
get_menu_item_info = (GetMenuItemInfoA_Proc) GetProcAddress (user32, "GetMenuItemInfoA");
set_menu_item_info = (SetMenuItemInfoA_Proc) GetProcAddress (user32, "SetMenuItemInfoA");
unicode_append_menu = (AppendMenuW_Proc) GetProcAddress (user32, "AppendMenuW");
unicode_message_box = (MessageBoxW_Proc) GetProcAddress (user32, "MessageBoxW");
}
-
-/* arch-tag: 0eaed431-bb4e-4aac-a527-95a1b4f1fed0
- (do not change this comment) */