ncmenu: add disabled flag to ncmenu_items, draw them grey #1057

pull/1062/head
nick black 4 years ago committed by Nick Black
parent cba2d9684f
commit 7d528dcd6f

@ -158,6 +158,7 @@ typedef struct ncmenu_int_item {
int shortcut_offset; // column offset with desc of shortcut EGC
char* shortdesc; // description of shortcut, can be NULL
int shortdesccols; // columns occupied by shortcut description
bool disabled; // disabled?
} ncmenu_int_item;
typedef struct ncmenu_int_section {
@ -251,10 +252,10 @@ typedef struct tinfo {
char* smkx; // enter keypad transmit mode (keypad_xmit)
char* rmkx; // leave keypad transmit mode (keypad_local)
char* getm; // get mouse events
bool RGBflag; // ti-reported "RGB" flag for 24bpc truecolor
bool CCCflag; // ti-reported "CCC" flag for palette set capability
bool BCEflag; // ti-reported "BCE" flag for erases with background color
bool AMflag; // ti-reported "AM" flag for automatic movement to next line
bool RGBflag; // "RGB" flag for 24bpc truecolor
bool CCCflag; // "CCC" flag for palette set capability
bool BCEflag; // "BCE" flag for erases with background color
bool AMflag; // "AM" flag for automatic movement to next line
char* smcup; // enter alternate mode
char* rmcup; // restore primary mode
} tinfo;

@ -22,6 +22,7 @@ static int
dup_menu_item(ncmenu_int_item* dst, const struct ncmenu_item* src){
#define ALTMOD "Alt+"
#define CTLMOD "Ctrl+"
dst->disabled = false;
if((dst->desc = strdup(src->desc)) == NULL){
return -1;
}
@ -376,6 +377,10 @@ int ncmenu_unroll(ncmenu* n, int sectionidx){
++ypos;
if(sec->items[i].desc){
n->ncp->channels = n->sectionchannels;
// FIXME the user ought be able to configure the disabled channel
if(sec->items[i].disabled){
ncplane_set_fg_rgb(n->ncp, 0xdddddd);
}
if(i == sec->itemselected){
ncplane_set_styles(n->ncp, NCSTYLE_REVERSE);
}else{

Loading…
Cancel
Save