Added separator item type for menus
This commit is contained in:
parent
bb0d42bbc2
commit
df30d36fe5
@ -116,6 +116,7 @@ public:
|
||||
void Item(int tag, const char* text, VfvCP select, int fmask=M_CLOSE);
|
||||
void Item(int tag, const char* text, int fmask, VfvCP select, gkey hotkey=0);
|
||||
void ItemDesc(const char* text);
|
||||
void ItemSep();
|
||||
void ItemFuncs(VfvCP before, VfvCP after);
|
||||
|
||||
void SetNextItem(int tag);
|
||||
|
@ -294,7 +294,7 @@ extern GWin gwin;
|
||||
#define M_CLOSE 4 // close menu after select func
|
||||
#define M_CLALL 8 // close all menus when selected
|
||||
#define M_CLOSB 16 // close menu before select func
|
||||
|
||||
#define M_SEPAR (32 + M_NOSEL) // item is separator
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Menutype definitions for wmenuend()
|
||||
|
@ -215,6 +215,24 @@ static void disp_item(_item_t *witem,int bar)
|
||||
textend = gwin.cmenu->textpos+strlen(p)-1;
|
||||
wgotoxy(witem->wrow,wcol=witem->wcol);
|
||||
|
||||
// display separators
|
||||
if (witem->fmask & M_SEPAR)
|
||||
{
|
||||
const int &border = gwin.active->border;
|
||||
const int &btype = gwin.active->btype;
|
||||
const int &attr = gwin.active->loattr;
|
||||
vatch line = vcatch(_box_table(btype, 1), attr);
|
||||
|
||||
if (border) *ptr++ = vcatch(_box_table(btype, 9), attr);
|
||||
for (i = 0; i < width; i++) *ptr++ = line;
|
||||
if (border) *ptr = vcatch(_box_table(btype, 10), attr);
|
||||
|
||||
int row = gwin.active->srow + witem->wrow + border;
|
||||
int col = gwin.active->scol + wcol;
|
||||
vputws(row, col, (vatch*)buf, width+2);
|
||||
}
|
||||
else
|
||||
{
|
||||
// display menu item including selection bar
|
||||
for(i=0; i<width; i++) {
|
||||
|
||||
@ -247,6 +265,7 @@ static void disp_item(_item_t *witem,int bar)
|
||||
|
||||
// Display complete buffer
|
||||
wprintws(witem->wrow, wcol, (vatch*)buf, width);
|
||||
}
|
||||
|
||||
// display text description, if one exists
|
||||
if((witem->desc!=NULL) and dispdesc) {
|
||||
|
@ -271,6 +271,14 @@ void GMnu::ItemDesc(const char* text) {
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
void GMnu::ItemSep()
|
||||
{
|
||||
Item(-1, " ", M_SEPAR, NULL, 0);
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
void GMnu::ItemFuncs(VfvCP before, VfvCP after) {
|
||||
|
Reference in New Issue
Block a user