MCPcopy Create free account
hub / github.com/NetHack/NetHack / ghack_menu_window_key

Function ghack_menu_window_key

outdated/win/gnome/gnmenu.c:31–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29static GdkColor color_blue = { 0, 0, 0, 0xffff };
30
31static void
32ghack_menu_window_key(GtkWidget *menuWin, GdkEventKey *event, gpointer data)
33{
34 int i, numRows;
35 menuItem *item;
36 MenuWinType isMenu;
37
38 isMenu = (MenuWinType) GPOINTER_TO_INT(
39 gtk_object_get_data(GTK_OBJECT(menuWin), "isMenu"));
40
41 if (isMenu == MenuMenu) {
42 GtkWidget *clist;
43 gint selection_mode;
44
45 clist = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(menuWin), "clist"));
46 g_assert(clist != NULL);
47 numRows = GPOINTER_TO_INT(
48 gtk_object_get_data(GTK_OBJECT(clist), "numRows"));
49 selection_mode = GPOINTER_TO_INT(
50 gtk_object_get_data(GTK_OBJECT(clist), "selection_mode"));
51 for (i = 0; i <= numRows; ++i) {
52 item = (menuItem *) gtk_clist_get_row_data(GTK_CLIST(clist), i);
53 if (item == NULL)
54 continue;
55 if (!strcmp(item->accelerator, ""))
56 continue;
57
58 if ((!strcmp(item->accelerator, event->string))
59 || ((selection_mode == GTK_SELECTION_MULTIPLE)
60 && (event->keyval == ','))) {
61 if (item->selected) {
62 gtk_clist_unselect_row(GTK_CLIST(clist), item->itemNumber,
63 0);
64 item->selected = FALSE;
65 } else {
66 gtk_clist_select_row(GTK_CLIST(clist), item->itemNumber,
67 0);
68 if (gtk_clist_row_is_visible(GTK_CLIST(clist),
69 item->itemNumber)
70 != GTK_VISIBILITY_FULL)
71 gtk_clist_moveto(GTK_CLIST(clist), item->itemNumber,
72 0, 0.5, 0);
73 item->selected = TRUE;
74 }
75 }
76 }
77 }
78}
79
80static void
81ghack_menu_row_selected(GtkCList *clist, int row, int col, GdkEvent *event)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected