mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-20 03:25:47 +00:00
menu PoC: implement quit item
This commit is contained in:
parent
a7c7b8ff0b
commit
7c249bf9b9
@ -34,6 +34,15 @@ run_menu(struct notcurses* nc, struct ncmenu* ncm){
|
||||
ncmenu_destroy(ncm);
|
||||
ncplane_destroy(selplane);
|
||||
return 0;
|
||||
}else if(keypress == NCKEY_ENTER){ // selected a menu item
|
||||
const char* sel;
|
||||
if( (sel = ncmenu_selected(ncm, &ni)) ){
|
||||
if(strcmp(sel, "Quit") == 0){
|
||||
ncmenu_destroy(ncm);
|
||||
ncplane_destroy(selplane);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ncplane_erase(selplane);
|
||||
@ -71,7 +80,7 @@ int main(void){
|
||||
{ .desc = "Open", .shortcut = { .id = 'o', .ctrl = true, }, },
|
||||
{ .desc = "Close", .shortcut = { .id = 'c', .ctrl = true, }, },
|
||||
{ .desc = NULL, },
|
||||
{ .desc = "Quit", .shortcut = { .id = 'q', .ctrl = true, }, },
|
||||
{ .desc = "Quit", .shortcut = { .id = 'q', }, },
|
||||
};
|
||||
struct ncmenu_item help_items[] = {
|
||||
{ .desc = "About", .shortcut = { .id = 'a', .ctrl = true, }, },
|
||||
|
Loading…
Reference in New Issue
Block a user