groundwork for window port interface change to add_menu

groundwork only - window port interface change

This changes the last parameter for add_menu() from a boolean
to an unsigned int, to allow additional itemflags in future
beyond just the "preselected" that the original boolean offered.

There shouldn't be any functionality changes with this groundwork-only
change, and if there are it is unintentional and should be reported.
This commit is contained in:
nhmall
2019-12-22 18:28:24 -05:00
parent 0f1284f068
commit 308943aea4
54 changed files with 446 additions and 382 deletions

View File

@@ -744,19 +744,19 @@ curses_character_dialog(const char **choices, const char *prompt)
identifier.a_int = (count + 1); /* Must be non-zero */
curses_add_menu(wid, NO_GLYPH, &identifier, curletter, 0,
A_NORMAL, choices[count], FALSE);
A_NORMAL, choices[count], MENU_ITEMFLAGS_NONE);
used_letters[count] = curletter;
}
/* Random Selection */
identifier.a_int = ROLE_RANDOM;
curses_add_menu(wid, NO_GLYPH, &identifier, '*', 0, A_NORMAL, "Random",
FALSE);
MENU_ITEMFLAGS_NONE);
/* Quit prompt */
identifier.a_int = ROLE_NONE;
curses_add_menu(wid, NO_GLYPH, &identifier, 'q', 0, A_NORMAL, "Quit",
FALSE);
MENU_ITEMFLAGS_NONE);
curses_end_menu(wid, prompt);
ret = curses_select_menu(wid, PICK_ONE, &selected);
if (ret == 1) {

View File

@@ -491,7 +491,7 @@ curses_start_menu(winid wid)
/*
add_menu(winid wid, int glyph, const anything identifier,
char accelerator, char groupacc,
int attr, char *str, boolean preselected)
int attr, char *str, unsigned int itemflags)
-- Add a text line str to the given menu window. If identifier
is 0, then the line cannot be selected (e.g. a title).
Otherwise, identifier is the value returned if the line is
@@ -517,14 +517,15 @@ add_menu(winid wid, int glyph, const anything identifier,
The menu commands and aliases take care not to interfere
with the default object class symbols.
-- If you want this choice to be preselected when the
menu is displayed, set preselected to TRUE.
menu is displayed, set bit MENU_ITEMFLAGS_SELECTED.
*/
void
curses_add_menu(winid wid, int glyph, const ANY_P * identifier,
CHAR_P accelerator, CHAR_P group_accel, int attr,
const char *str, BOOLEAN_P presel)
const char *str, unsigned int itemflags)
{
int curses_attr;
boolean presel = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0);
attr &= ~(ATR_URGENT | ATR_NOHISTORY);
curses_attr = curses_convert_attr(attr);

View File

@@ -373,14 +373,17 @@ curses_prev_mesg()
for (count = 0; count < num_messages; ++count) {
mesg = get_msg_line(do_lifo, count);
if (turn != mesg->turn && count != 0) {
curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL, "---", FALSE);
curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL, "---",
MENU_ITEMFLAGS_NONE);
}
curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL, mesg->str, FALSE);
curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL, mesg->str,
MENU_ITEMFLAGS_NONE);
turn = mesg->turn;
}
if (!count)
curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL,
"[No past messages available.]", FALSE);
"[No past messages available.]",
MENU_ITEMFLAGS_NONE);
curses_end_menu(wid, "");
if (!do_lifo)