本文整理汇总了C++中MENU类的典型用法代码示例。如果您正苦于以下问题:C++ MENU类的具体用法?C++ MENU怎么用?C++ MENU使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MENU类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ADDITION
void CASSETTE :: ADDITION(void)
{
MENU menu ;
char filename[13], casname[36], ch ;
int cascode, valid ;
do
{
strcpy(filename,menu.CHOICE_MENU()) ;
if (!strcmpi(filename,"FAILED"))
return ;
cascode = LASTCODE(filename) + 1 ;
LINES line ;
line.BOX(10,6,71,21,219) ;
line.LINE_HOR(11,70,10,196) ;
gotoxy(72,1) ;
cout <<"<0>=EXIT" ;
gotoxy(27,8) ;
cout <<"ADDITION OF NEW CASSETTES" ;
gotoxy(20,12) ;
cout <<"Code # " <<cascode ;
do
{
valid = 1 ;
gotoxy(5,25) ; clreol() ;
cout <<"ENTER NAME OF THE CASSETTE" ;
gotoxy(20,14) ;
cout <<" " ;
gotoxy(20,14) ;
cout <<"Name : " ;
gets(casname) ;
if (casname[0] == '0')
return ;
if (strlen(casname) < 1 || strlen(casname) > 35)
{
valid = 0 ;
gotoxy(5,25) ; clreol() ;
cout <<"\7Enter Correctly (Range: 1..35)" ;
getch() ;
}
} while (!valid) ;
gotoxy(5,25) ; clreol() ;
do
{
gotoxy(20,17) ;
cout <<" " ;
gotoxy(20,17) ;
cout <<"Do you want to save (y/n) " ;
ch = getche() ;
ch = toupper(ch) ;
if (ch == '0')
return ;
} while (ch != 'Y' && ch != 'N') ;
if (ch == 'Y')
{
char casstatus='A' ;
int ccode=0 ;
ADD_RECORD(filename,cascode,casname,casstatus,ccode) ;
cascode++ ;
}
do
{
gotoxy(20,19) ;
cout <<" " ;
gotoxy(20,19) ;
cout <<"Do you want to Add more (y/n) " ;
ch = getche() ;
ch = toupper(ch) ;
if (ch == '0')
return ;
} while (ch != 'Y' && ch != 'N') ;
if (ch == 'N')
return ;
} while (ch == 'Y') ;
}
示例2: MODIFICATION
void CASSETTE :: MODIFICATION(void)
{
MENU menu ;
char t1[10], ch, filename[13] ;
int t2, cascode, valid ;
strcpy(filename,menu.CHOICE_MENU()) ;
if (!strcmpi(filename,"FAILED"))
return ;
do
{
valid = 1 ;
do
{
clrscr() ;
gotoxy(72,2) ;
cout <<"<0>=EXIT" ;
gotoxy(5,5) ;
cout <<"Enter code of the Cassette or <ENTER> for help " ;
gets(t1) ;
t2 = atoi(t1) ;
cascode = t2 ;
if (cascode == 0 && strlen(t1) != 0)
return ;
if (strlen(t1) == 0)
DISPLAY_LIST(filename) ;
} while (strlen(t1) == 0) ;
if (!FOUND_CODE(filename,cascode))
{
valid = 0 ;
gotoxy(5,20) ;
cout <<"\7Cassette code not found." ;
getch() ;
}
} while (!valid) ;
clrscr() ;
gotoxy(72,1) ;
cout <<"<0>=EXIT" ;
DISPLAY_RECORD(filename,cascode) ;
do
{
gotoxy(5,12) ; clreol() ;
cout <<"Modify Cassette Name (y/n) " ;
ch = getche() ;
ch = toupper(ch) ;
if (ch == '0')
return ;
} while (ch != 'Y' && ch != 'N') ;
if (ch == 'N')
return ;
char casname[36] ;
do
{
valid = 1 ;
gotoxy(5,25) ; clreol() ;
cout <<"ENTER NAME OF THE CASSETTE" ;
gotoxy(5,15) ; clreol() ;
cout <<"Name : " ;
gets(casname) ;
if (casname[0] == '0')
return ;
if (strlen(casname) < 1 || strlen(casname) > 35)
{
valid = 0 ;
gotoxy(5,25) ; clreol() ;
cout <<"\7Enter Correctly (Range: 1..35)" ;
getch() ;
}
} while (!valid) ;
gotoxy(5,25) ; clreol() ;
do
{
gotoxy(5,17) ; clreol() ;
cout <<"Do you want to save (y/n) " ;
ch = getche() ;
ch = toupper(ch) ;
if (ch == '0')
return ;
} while (ch != 'Y' && ch != 'N') ;
if (ch == 'N')
return ;
int recno ;
recno = RECORDNO(filename,cascode) ;
fstream file ;
file.open(filename, ios::out | ios::ate) ;
strcpy(name,casname) ;
int location ;
location = (recno-1) * sizeof(CASSETTE) ;
file.seekp(location) ;
file.write((char *) this, sizeof(CASSETTE)) ;
file.close() ;
gotoxy(5,20) ;
cout <<"\7Record Modified" ;
gotoxy(5,25) ;
cout <<"Press any key to continue..." ;
getch() ;
}
示例3: ISSUE
void ISSUE_RETURN :: ISSUE(void)
{
MENU menu ;
CUSTOMER cust ;
CASSETTE cas ;
char filename[13] ;
strcpy(filename,menu.CHOICE_MENU()) ;
if (!strcmpi(filename,"FAILED"))
return ;
char t1[10] ;
int t2, cascode, valid ;
do
{
valid = 1 ;
do
{
clrscr() ;
gotoxy(72,2) ;
cout <<"<0>=EXIT" ;
gotoxy(5,5) ;
cout <<"Enter code of the Cassette or <ENTER> for help " ;
gets(t1) ;
t2 = atoi(t1) ;
cascode = t2 ;
if (cascode == 0 && strlen(t1) != 0)
return ;
if (strlen(t1) == 0)
DISPLAY_LIST(filename) ;
} while (strlen(t1) == 0) ;
if (!CASSETTE::FOUND_CODE(filename,cascode))
{
valid = 0 ;
gotoxy(5,20) ;
cout <<"\7Cassette code not found. Kindly choose another." ;
getch() ;
}
if (valid && ISSUED(filename,cascode))
{
valid = 0 ;
gotoxy(5,20) ;
cout <<"\7Cassette already issued. Kindly choose another." ;
getch() ;
}
} while (!valid) ;
clrscr() ;
int ccode ;
ccode = CUSTOMER::LASTCODE() + 1 ;
char custname[26], custphone[10] ;
int d1, m1, y1 ;
struct date d;
getdate(&d);
d1 = d.da_day ;
m1 = d.da_mon ;
y1 = d.da_year ;
gotoxy(5,2) ;
cout <<"Date: " <<d1 <<"/" <<m1 <<"/" <<y1 ;
gotoxy(72,2) ;
cout <<"<0>=EXIT" ;
CASSETTE::DISPLAY_RECORD(filename,cascode) ;
gotoxy(5,10) ;
cout <<"Customer Code # " <<ccode ;
gotoxy(5,12) ;
cout <<"Name : " ;
gotoxy(5,13) ;
cout <<"Phone : " ;
do
{
valid = 1 ;
gotoxy(5,25) ; clreol() ;
cout <<"Enter the name of the Customer" ;
gotoxy(14,12) ; clreol() ;
gets(custname) ;
strupr(custname) ;
if (custname[0] == '0')
return ;
if (strlen(custname) < 1 || strlen(custname) > 25)
{
valid = 0 ;
gotoxy(5,25) ; clreol() ;
cout <<"\7Enter correctly (Range: 1..25)" ;
getch() ;
}
} while (!valid) ;
do
{
valid = 1 ;
gotoxy(5,25) ; clreol() ;
cout <<"Enter Phone no. of the Customer" ;
gotoxy(14,13) ; clreol() ;
gets(custphone) ;
if (custphone[0] == '0')
return ;
if ((strlen(custphone) < 7 && strlen(custphone) > 0) || (strlen(custphone) > 9))
{
valid = 0 ;
gotoxy(5,25) ; clreol() ;
cout <<"\7Enter correctly" ;
getch() ;
}
} while (!valid) ;
//.........这里部分代码省略.........
示例4: main
void main(void)
{
MENU menu ;
menu.MAIN_MENU() ;
}
示例5: btConnect
//.........这里部分代码省略.........
case FR_KEY:
if(bt.state == BT_ST_CONNECTED)
{
bt.disconnect();
}
else
{
bt.connect(bt.device[menuSelected].addr);
}
break;
}
update = 1;
switch(bt.event)
{
case BT_EVENT_DISCOVERY:
debug(STR("dicovery!\r\n"));
break;
case BT_EVENT_SCAN_COMPLETE:
debug(STR("done!\r\n"));
if(bt.state != BT_ST_CONNECTED) bt.scan();
break;
case BT_EVENT_DISCONNECT:
bt.scan();
break;
default:
update = 0;
}
bt.event = BT_EVENT_NULL; // clear event so we don't process it twice
if(first)
{
update = 1;
}
if(key == UP_KEY && menuSelected > 0)
{
menuSelected--;
update = 1;
}
else if(key == DOWN_KEY && menuSelected < menuSize - 1)
{
menuSelected++;
update = 1;
}
if(update)
{
lcd.cls();
if(bt.state == BT_ST_CONNECTED)
{
menu.setTitle(TEXT("Connect"));
lcd.writeStringTiny(18, 20, TEXT("Connected!"));
menu.setBar(TEXT("RETURN"), TEXT("DISCONNECT"));
}
else
{
if(menuSelected > 2)
menuScroll = menuSelected - 2;
menuSize = 0;
for(i = 0; i < bt.devices; i++)
{
if(i >= menuScroll && i <= menuScroll + 4)
{
for(c = 0; c < MENU_NAME_LEN - 1; c++) // Write settings item text //
{
if(bt.device[i].name[c])
lcd.writeChar(3 + c * 6, 8 + 9 * (menuSize - menuScroll), bt.device[i].name[c]);
}
}
menuSize++;
}
if(bt.devices)
{
lcd.drawHighlight(2, 7 + 9 * (menuSelected - menuScroll), 81, 7 + 9 * (menuSelected - menuScroll) + 8);
menu.setBar(TEXT("RETURN"), TEXT("CONNECT"));
}
else
{
lcd.writeStringTiny(6, 20, TEXT("No Devices Found"));
menu.setBar(TEXT("RETURN"), BLANK_STR);
}
menu.setTitle(TEXT("Connect"));
lcd.drawLine(0, 3, 0, 40);
lcd.drawLine(83, 3, 83, 40);
}
lcd.update();
}
return FN_CONTINUE;
}
示例6: menuBack
volatile char menuBack(char key, char first)
{
if(key == FL_KEY)
menu.back();
return FN_CANCEL;
}
示例7: firmwareUpdated
volatile char firmwareUpdated(char key, char first)
{
if(first)
{
uint8_t l, c;
char* text;
char buf[6];
lcd.cls();
menu.setTitle(TEXT("FIRMWARE"));
lcd.writeStringTiny(13, 10, TEXT("Successfully"));
lcd.writeStringTiny(25, 16, TEXT("Updated"));
lcd.writeStringTiny(8, 28, TEXT("Version:"));
uint32_t version = VERSION;
l = 0;
while(version)
{
c = (char)(version % 10);
buf[0] = ((char)(c + '0'));
buf[1] = 0;
text = buf;
l += lcd.measureStringTiny(text) + 1;
lcd.writeStringTiny(75 - l, 28, text);
version -= (uint32_t)c;
version /= 10;
}
menu.setBar(TEXT("RETURN"), BLANK_STR);
lcd.update();
}
switch(key)
{
case FL_KEY:
case LEFT_KEY:
return FN_CANCEL;
}
return FN_CONTINUE;
}
示例8: notYet
volatile char notYet(char key, char first)
{
if(first)
{
lcd.cls();
lcd.writeString(3, 7, TEXT("Sorry, this "));
lcd.writeString(3, 15, TEXT("feature has "));
lcd.writeString(3, 23, TEXT("not yet been "));
lcd.writeString(3, 31, TEXT("implemented "));
menu.setTitle(TEXT("Not Yet"));
menu.setBar(TEXT("RETURN"), BLANK_STR);
lcd.update();
}
if(key)
return FN_CANCEL;
return FN_CONTINUE;
}
示例9: memoryFree
volatile char memoryFree(char key, char first)
{
if(first)
{
unsigned int mem = hardware_freeMemory();
lcd.cls();
lcd.writeString(1, 18, TEXT("Free RAM:"));
/*char x =*/lcd.writeNumber(55, 18, mem, 'U', 'L');
//lcd.writeString(55 + x * 6, 18, TEXT("b"));
menu.setTitle(TEXT("Memory"));
menu.setBar(TEXT("RETURN"), BLANK_STR);
lcd.update();
}
if(key == FL_KEY)
return FN_CANCEL;
return FN_CONTINUE;
}
示例10: event
void Remote::event()
{
switch(bt.event)
{
case BT_EVENT_DISCONNECT:
connected = 0;
break;
case BT_EVENT_CONNECT:
connected = 1;
break;
case BT_EVENT_DATA:
switch(bt.dataId)
{
case REMOTE_STATUS:
if(bt.dataType == REMOTE_TYPE_REQUEST) send(bt.dataId, REMOTE_TYPE_SEND);
if(bt.dataType == REMOTE_TYPE_SEND) memcpy(&status, bt.data, bt.dataSize);
if(bt.dataType == REMOTE_TYPE_SET) memcpy(&status, bt.data, bt.dataSize);
break;
case REMOTE_PROGRAM:
if(bt.dataType == REMOTE_TYPE_REQUEST) send(bt.dataId, REMOTE_TYPE_SEND);
if(bt.dataType == REMOTE_TYPE_SEND) memcpy(¤t, bt.data, bt.dataSize);
if(bt.dataType == REMOTE_TYPE_SET)
{
memcpy((void*)&timer.current, bt.data, bt.dataSize);
menu.refresh();
}
break;
case REMOTE_BATTERY:
if(bt.dataType == REMOTE_TYPE_REQUEST) send(bt.dataId, REMOTE_TYPE_SEND);
if(bt.dataType == REMOTE_TYPE_SEND) memcpy(&battery, bt.data, 1);
if(bt.dataType == REMOTE_TYPE_SET) memcpy(&battery, bt.data, 1);
break;
case REMOTE_START:
if(bt.dataType == REMOTE_TYPE_REQUEST) send(timer.running ? REMOTE_START : REMOTE_STOP, REMOTE_TYPE_SEND);
if(bt.dataType == REMOTE_TYPE_SEND) running = 1;
if(bt.dataType == REMOTE_TYPE_SET) runHandler(FR_KEY, 1);
break;
case REMOTE_STOP:
if(bt.dataType == REMOTE_TYPE_REQUEST) send(timer.running ? REMOTE_START : REMOTE_STOP, REMOTE_TYPE_SEND);
if(bt.dataType == REMOTE_TYPE_SEND) running = 0;
if(bt.dataType == REMOTE_TYPE_SET) timerStop(FR_KEY, 1);
break;
default:
return;
}
bt.event = BT_EVENT_NULL;
break;
}
requestActive = 0;
}
示例11: shutter_addKeyframe
volatile char shutter_addKeyframe(char key, char first)
{
if(timer.current.Keyframes < MAX_KEYFRAMES)
{
if(timer.current.Keyframes < 1)
timer.current.Keyframes = 1;
timer.current.Key[timer.current.Keyframes] = timer.current.Key[timer.current.Keyframes - 1] + 3600;
timer.current.Bulb[timer.current.Keyframes + 1] = timer.current.Bulb[timer.current.Keyframes];
timer.current.Keyframes++;
}
menu.back();
return FN_CANCEL;
}
示例12: updateConditions
void updateConditions()
{
if(timerNotRunning != !timer.running) menu.refresh();
timerNotRunning = !timer.running;
modeTimelapse = (timer.current.Mode & TIMELAPSE);
modeHDR = (timer.current.Mode & HDR);
modeStandard = (!modeHDR && !modeRamp);
modeRamp = (timer.current.Mode & RAMP);
modeRampKeyAdd = (modeRamp && (timer.current.Keyframes < MAX_KEYFRAMES));
modeRampKeyDel = (modeRamp && (timer.current.Keyframes > 1));
bulb1 = timer.current.Keyframes > 1 && modeRamp;
bulb2 = timer.current.Keyframes > 2 && modeRamp;
bulb3 = timer.current.Keyframes > 3 && modeRamp;
bulb4 = timer.current.Keyframes > 4 && modeRamp;
showGap = timer.current.Photos != 1 && modeTimelapse;
showRemoteStart = (remote.connected && !remote.running);
clock.sleepOk = timerNotRunning && !timer.cableIsConnected() && bt.state != BT_ST_CONNECTED && sleepOk;
}
示例13: hardware_off
void hardware_off(void)
{
hardware_flashlight(0);
if(battery_status() == 0)
{
//if(timer.cableIsConnected())
//{
// menu.message(STR("Error: Cable"));
//}
//else
//{
shutter_off();
// Save the current time-lapse settings to nv-mem
timer.saveCurrent();
// If USB is used, detach from the bus
USB_Detach();
// Shutdown bluetooth
bt.disconnect();
bt.sleep();
// Disable all interrupts
cli();
// Shutdown
setHigh(POWER_HOLD_PIN);
FOREVER;
//}
}
else // Plugged in
{
// Charging screen //
clock.sleeping = 1;
menu.spawn((void *) batteryStatus);
}
}
示例14: usbPlug
volatile char usbPlug(char key, char first)
{
static char connected = 0;
if(first || (PTP_Connected != connected) || (PTP_Ready))
{
connected = PTP_Connected;
char exp_name[7];
if(PTP_Connected)
{
if(PTP_Ready)
{
lcd.cls();
lcd.writeString(3, 7, PTP_CameraModel);
if(camera.shutterName(exp_name, camera.shutter))
{
lcd.writeString(3, 15, exp_name);
}
if(camera.apertureName(exp_name, camera.aperture))
{
lcd.writeString(3, 23, TEXT("f"));
lcd.writeString(3+6, 23, exp_name);
}
if(camera.isoName(exp_name, camera.iso))
{
lcd.writeString(3, 31, TEXT("ISO"));
lcd.writeString(3+24, 31, exp_name);
}
menu.setTitle(TEXT("Camera Info"));
menu.setBar(TEXT("RETURN"), TEXT("PHOTO"));
lcd.update();
connectUSBcamera = 1;
}
else
{
lcd.cls();
lcd.writeString(3, 7, TEXT(" Connected! "));
lcd.writeString(3, 15, TEXT(" Retrieving "));
lcd.writeString(3, 23, TEXT(" Device "));
lcd.writeString(3, 31, TEXT(" Info... "));
menu.setTitle(TEXT("Camera Info"));
menu.setBar(TEXT("RETURN"), BLANK_STR);
lcd.update();
connectUSBcamera = 1;
}
}
else
{
lcd.cls();
lcd.writeString(3, 7, TEXT("Plug camera "));
lcd.writeString(3, 15, TEXT("into left USB"));
lcd.writeString(3, 23, TEXT("port... "));
lcd.writeString(3, 31, TEXT(" "));
menu.setTitle(TEXT("Connect USB"));
menu.setBar(TEXT("CANCEL"), BLANK_STR);
lcd.update();
connectUSBcamera = 1;
}
}
if(key == FL_KEY || key == LEFT_KEY)
{
if(!PTP_Connected)
connectUSBcamera = 0;
return FN_CANCEL;
}
else if(key == FR_KEY)
{
if(PTP_Ready) camera.capture();
}
else if(key == UP_KEY)
{
if(PTP_Ready) camera.isoUp(camera.iso);
}
else if(key == DOWN_KEY)
{
if(PTP_Ready) camera.isoDown(camera.iso);
}
return FN_CONTINUE;
}
示例15: cntrl
main (int argc, char **argv, char **envp) {
register c;
if (argc > 2) {
outerr("Usage: deco [dirname]\n",0);
exit (1);
}
outerr("Demos Commander, Copyright (C) 1989-1994 Serge Vakulenko\n",0);
palette = dflt_palette;
EnvInit (envp);
uid = getuid ();
gid = getgid ();
# ifdef GROUPS
gidnum = getgroups (sizeof(gidlist)/sizeof(gidlist[0]), (unsigned int *)gidlist);
# endif
ppid = getppid ();
user = username (uid);
group = groupname (gid);
tty = ttyname (0);
machine = getmachine ();
#if 0
sigign();
#else
signal(SIGTERM, SIG_IGN);
signal(SIGQUIT, SIG_IGN);
signal(SIGINT, SIG_IGN);
# ifdef SIGTSTP
signal(SIGTSTP, SIG_IGN);
# endif
#endif
init ();
// inithome ();
VClear ();
/* init class dir */
if (argc > 1)
// chdir (argv [1]);
left = new dir(argv [1]);
else
left = new dir;
right = new dir;
left->d.basecol = 0;
right->d.basecol = 40;
/*-----------*/
initfile.read();
if (uid == 0)
palette.dimfg = 6;
v.VSetPalette (palette.fg, palette.bg, palette.revfg, palette.revbg,
palette.boldfg, palette.boldbg, palette.boldrevfg, palette.boldrevbg,
palette.dimfg, palette.dimbg, palette.dimrevfg, palette.dimrevbg);
setdir (left, ".");
setdir (right, ".");
left->chdir(left->d.cwd);
cur = left;
draw.draw(cur, left, right);
for (;;) {
if (! cmdreg)
draw.drawcursor(cur);
// cmd.drawcmd(cur, &left, &right);
VSync ();
c = KeyGet ();
if (! cmdreg)
draw.undrawcursor(cur);
switch (c) {
case '+': /* select */
case '-': /* unselect */
if (! cpos && ! cmdreg && ! cur->d.status) {
if (c == '+')
tagall ();
else
untagall ();
draw.draw(cur, left, right);
continue;
}
default:
// if (c>=' ' && c<='~' || c>=0300 && c<=0376) {
// if (cpos || c!=' ')
// cmd.inscmd(c);
// continue;
// }
VBeep ();
continue;
// case cntrl ('V'): /* quote next char */
// cmd.inscmd(quote ());
// continue;
// case cntrl ('J'): /* insert file name */
// if (! cmdreg && ! cur->status)
// cmd.namecmd(cur);
// continue;
// case cntrl ('G'):
// cmd.delcmd();
// continue;
// case meta ('b'): /* backspace */
// if (cpos) {
// cmd.leftcmd();
// cmd.delcmd();
// }
// continue;
case cntrl ('O'): /* set/unset command mode */
case cntrl ('P'): /* set/unset command mode */
switchcmdreg ();
//.........这里部分代码省略.........