亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? menu.cpp

?? 在嵌入時系統uc-osii中實現的串口程序
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
// ******************************************************************** //
//                                                                      //
//      MENU.CPP                                                        //
//      Copyright (c) 1993, Michael Holmes and Bob Flanders             //
//      C++ Communication Utilities                                     //
//                                                                      //
//      This file contains the definition and interface for             //
//      the menu class.                                                 //
//                                                                      //
// ******************************************************************** //



#define ALLOW_ALT   1                       // allow alt key in get_key()
#define NO_ALT      0                       // ..and supress alt key


/* ******************************************************************** *
 *
 *  Globals
 *
 * ******************************************************************** */

int     menu_cn = MIX(WHITE, CYAN),         // default normal menu colors
        menu_cr = MIX(WHITE, BLUE);         // ..and reverse colors

int     NotYet(int c, int r);               // null routine definition
char    get_scan(unsigned char);            // get scan code for character



/* ******************************************************************** *
 *
 *  Menu class definition
 *
 * ******************************************************************** */

class Menu
    {
    public:
        Menu(char *s,                       // create first menu entry
             int  (*f)(int, int) = NotYet,  // ..function to call
             char c = '\0');                // ..special key character
        Menu(Menu *m,                       // add a menu entry to list
             char *s,                       // ..label to add
             int  (*f)(int, int) = NotYet,  // ..function to call
             int  t = 0,                    // ..submenu flag
             char c = '\0');                // ..special key character
        void SetColors(int cn, int cr),     // new norm and rev colors
             Display(int c);                // process a main menu
        Menu *ValidateKey(int c);           // validate key in menu
       ~Menu();                             // destructor

    private:
        void EntryInit(char *s,             // initialize a menu entry
                int  (*f)(int c, int r),    // ..with runtime routine
                char c);                    // ..special key character
        int  DisplayMenu(Menu *n,           // display menu bar
                Window *w),                 // ..highlighting an entry
             DisplaySub(int c, int r),      // process a submenu
             DisplaySubMenu(Menu *n,        // display submenu column
                Window *w),                 // ..and handle keystrokes
             DoMenuAction(Menu *m,          // process menu entry
                int c, int r);              // ..using column and row
        Menu *Find(char c),                 // find entry by char
             *FindAlt(char alt_c),          // find entry by alt char
             *Left(Menu *m),                // find an entry's left
             *Right(Menu *m);               // ..and its right
        int  Count(void),                   // count the entries
             MaxWidth(void);                // find the max width label
        char *item,                         // menu item label
              key,                          // normal selection character
              alt_key;                      // ..and alt selection char
        int  (*fnc)(int c, int r);          // runtime menu entry fnc
        Menu *next,                         // next item pointer
             *sub;                          // submenu pointer
    };



/* ******************************************************************** *
 *
 *  Menu -- build the first menu entry
 *
 * ******************************************************************** */

Menu::Menu(char *s,                         // new menu item
           int  (*f)(int c, int r),         // runtime routine
           char c)                          // special key character
{

EntryInit(s, f, c);                         // initialize new instance

}



/* ******************************************************************** **
 *
 *  Menu -- add an entry to the menu list
 *
 * ******************************************************************** */*

Menu::Menu(Menu *m,                         // menu to chain into
           char *s,                         // new menu item
           int  (*f)(int c, int r),         // runtime routine
           int  t,                          // type, 0 = at same level
                                            //       1 = submenu
           char c)                          // special key character
{

EntryInit(s, f, c);                         // build base instance

if (t)                                      // q. submenu definition?
    m->sub = this;                          // a. yes .. store in parent
 else
    {
    while (m->next)                         // loop thru and ..
        m = m->next;                        // ..then end of the list

    m->next = this;                         // put this at the end
    }
}



/* ******************************************************************** *
 *
 *  EntryInit -- initialize menu entry instance
 *
 * ******************************************************************** */

void Menu::EntryInit(char *s,               // menu label to set up
                     int  (*f)(int, int),   // runtime function
                     char c)                // special key character
{

item = new char[strlen(s) + 1];             // get memory for label
strcpy(item, s);                            // ..and copy into instance

key = c ? c : *s;                           // ASCII selection key
alt_key = get_scan(key);                    // alt selection key
fnc = f ? f : NotYet;                       // runtime function

next = sub = 0;                             // clear forward pointers

}



/* ******************************************************************** *
 *
 *  Display -- display and process a menu at the top of the screen
 *
 * ******************************************************************** */

void    Menu::Display(int c)                // initial keystroke
{
int  col,                                   // offset of selected entry
     k;                                     // keystroke
Menu *m, *n;                                // work menu pointer


NOCURSOR();                                 // no cursor while in menu
Window w(1, 1, 80, 3, menu_cn, menu_cr);    // define menu window
w.Open(double_line);                        // open window

if ((m = ValidateKey(c)) != 0)              // q. find initial selection?
    k = (c == 0x100) ? 0 : CR;              // a. yes .. set up for entry
 else
    {
    m = this;                               // else .. use first entry
    k = 0;                                  // ..in menu and clear key
    }

for (;;)                                    // loop 'til exit requested
    {
    col = DisplayMenu(m, &w);               // display and highlight

    if (NOT k)                              // q. need a new key?
        while ((k = get_key(NO_ALT)) == 0)  // a. yes .. wait for a key
            ;

    switch (k)                              // handle user's keystroke
        {
        case CR:                            // carriage return
            k = DoMenuAction(m, col, 2);    // process menu entry

            if (k < 0)                      // q. need to exit the menu?
                {
                CURSOR();                   // a. yes .. set cursor back
                return;                     // ..to normal and return
                }

            break;                          // else .. wait for next key

        case LEFT:                          // left arrow
            m = Left(m);                    // get entry to the left
            k = 0;                          // clear keystroke
            break;                          // ..then wait for next key

        case RIGHT:                         // right arrow
            m = Right(m);                   // get entry to the right
            k = 0;                          // clear keystroke
            break;                          // ..then wait for next key

        case ESC:                           // escape key
            CURSOR();                       // set cursor back to normal
            return;                         // ..exit loop and return

        default:                            // error case
            if ((n = ValidateKey(k)) != 0)  // q. valid menu key?
                {
                m = n;                      // a. yes .. set up as current
                k = CR;                     // ..and force a <cr>
                }
             else
                {
                printf(BELL);               // else .. ring bell
                k = 0;                      // finally, clear keystroke
                }
        }
    }
}



/* ******************************************************************** *
 *
 *  DisplayMenu -- write out a menu's entries
 *
 * ******************************************************************** */

int     Menu::DisplayMenu(Menu *n,          // entry to highlight
                          Window *w)        // window to display in
{
int  w_offset = 2,                          // offset in menu bar
     s_offset;                              // offset of selected entry
Menu *m = this;                             // work menu pointer


w->GotoXY(1, 1);                            // start from the beginning

for (;;)
    {
    w->Display("  ");                       // put some space out

    if (m == n)                             // q. find entry?
        {
        w->DisplayReverse(m->item);         // a. yes .. highlight it
        s_offset = w_offset;                // ..and save field offset
        }
     else
        w->Display(m->item);                // else .. display normally

    w_offset += strlen(m->item) + 2;        // get offset of next item

    if ((m = m->next) == 0)                 // q. end of list?
        break;                              // a. yes .. exit loop
    }

return(s_offset);                           // return with entry's offset

}



/* ******************************************************************** *
 *
 *  DisplaySub -- display a submenu
 *
 * ******************************************************************** */

int     Menu::DisplaySub(int c, int r)      // upper left coordinates
{
int     k = 0,                              // keystroke
        r_current;                          // current row
Menu   *m = this,                           // current menu entry
       *n;                                  // work menu pointer


Window w(c, r, c + 3 + MaxWidth(),          // define menu window
            r + 2 + Count(),                // ..to hold whole submenu
            menu_cn, menu_cr);              // ..using default colors
w.Open(single_line);                        // open submenu window

for (;;)                                    // loop 'til exit requested
    {
    r_current = DisplaySubMenu(m, &w);      // display and highlight

    if (NOT k)                              // q. need a new key?
        while ((k = get_key(NO_ALT)) == 0)  // a. yes .. wait for a key
            ;

    switch (k)                              // handle user's keystroke
        {
        case CR:                            // carriage return
            k = DoMenuAction(m, c,          // process menu entry
                    r + r_current);

            if (k != 0)                     // q. need to exit the menu?
                return(k);                  // a. yes .. rtn w/keystroke

            break;                          // else .. wait for next key

        case UP:                            // up arrow
            m = Left(m);                    // get entry above this one
            k = 0;                          // clear keystroke
            break;                          // ..then wait for next key

        case DOWN:                          // down arrow
            m = Right(m);                   // get entry beneath
            k = 0;                          // clear keystroke
            break;                          // ..then wait for next key

        case LEFT:                          // left arrow
            return(LEFT);                   // ..then return w/left key

        case RIGHT:                         // right arrow
            return(RIGHT);                  // ..then return w/right key

        case ESC:                           // escape key
            return(0);                      // ..then return one level

        default:                            // error case
            if ((n = ValidateKey(k)) != 0)  // q. valid menu key?
                {
                m = n;                      // a. yes .. set up as current
                k = CR;                     // ..and force a <cr>
                }
             else
                {
                printf(BELL);               // else .. ring bell
                k = 0;                      // finally, clear keystroke
                }
        }
    }
}



/* ******************************************************************** *
 *
 *  DisplaySubMenu -- write out a submenu's entries
 *
 * ******************************************************************** */

int     Menu::DisplaySubMenu(Menu *n,       // entry to highlight

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲激情五月婷婷| 精品粉嫩aⅴ一区二区三区四区| 欧美亚州韩日在线看免费版国语版| 在线成人午夜影院| 中日韩av电影| 老司机午夜精品| 91福利在线观看| 国产日韩欧美精品在线| 日韩综合在线视频| jlzzjlzz国产精品久久| 精品嫩草影院久久| 亚洲一本大道在线| 99久久精品国产一区二区三区| 日韩美一区二区三区| 一区二区三区免费网站| 国产精品综合二区| 91麻豆精品国产91久久久更新时间 | 亚洲va天堂va国产va久| 成人一级视频在线观看| 久久亚洲影视婷婷| 麻豆精品一区二区| 538prom精品视频线放| 一片黄亚洲嫩模| 91亚洲资源网| 最新国产の精品合集bt伙计| 丰满岳乱妇一区二区三区| 91精品国产色综合久久不卡电影| 一区二区三区四区精品在线视频 | 亚洲精品一区二区三区蜜桃下载 | 国产999精品久久久久久| 欧美变态口味重另类| 日本视频中文字幕一区二区三区| 欧美伊人久久大香线蕉综合69 | 欧美精品v国产精品v日韩精品 | 中文字幕欧美三区| 国产精品色眯眯| 国产成人8x视频一区二区| 日韩欧美卡一卡二| 日本亚洲一区二区| 欧美大黄免费观看| 久久精品久久精品| 久久综合狠狠综合| 国产成人在线视频免费播放| 成人97人人超碰人人99| 免费人成黄页网站在线一区二区| 国产成人免费视频一区| 久久国产精品一区二区| 三级一区在线视频先锋| 国产日韩三级在线| 国产精品入口麻豆九色| 日韩电影在线观看网站| 久久久久久99久久久精品网站| 精品视频1区2区3区| 丰满放荡岳乱妇91ww| 欧美视频一区二区在线观看| 亚洲成人动漫av| 欧美一区二区三区在线电影| 美女网站色91| 国产精品热久久久久夜色精品三区| 国产成人免费在线观看不卡| 亚洲欧美一区二区三区极速播放| 色成人在线视频| 美女网站一区二区| 中文字幕欧美日本乱码一线二线 | 亚洲男女一区二区三区| 日本福利一区二区| 日韩成人免费在线| 日本一区二区视频在线观看| 国产一区二区三区黄视频| 午夜欧美在线一二页| 欧美一区二区三区视频免费| 国产精品一区二区三区乱码| 欧美精品一区二区三区蜜桃| 国产欧美综合色| 一区二区三区四区国产精品| 国产美女视频91| 色噜噜狠狠一区二区三区果冻| 26uuu国产日韩综合| 成人app网站| 欧美影院精品一区| 欧美一级理论性理论a| 丁香桃色午夜亚洲一区二区三区| 国产精品污污网站在线观看| 石原莉奈在线亚洲二区| 久久这里只有精品6| 日本电影欧美片| 粉嫩蜜臀av国产精品网站| 亚洲成人动漫在线免费观看| 国产在线精品一区二区夜色| 国产日韩视频一区二区三区| 不卡电影免费在线播放一区| ...av二区三区久久精品| 婷婷国产在线综合| 99久久精品免费看| 亚洲图片欧美色图| 蜜臂av日日欢夜夜爽一区| 欧美人妖巨大在线| 日本三级韩国三级欧美三级| 中文无字幕一区二区三区| 欧美在线一区二区| 国产欧美在线观看一区| 26uuu亚洲| 色狠狠一区二区三区香蕉| 日本不卡123| 亚洲视频资源在线| 91麻豆精品91久久久久久清纯| 久久国内精品视频| 亚洲精品国产一区二区精华液| 欧美亚洲免费在线一区| 麻豆精品视频在线| 日韩二区三区四区| 综合欧美一区二区三区| 精品国产一区二区三区久久久蜜月 | 26uuu国产一区二区三区| 一区二区三区在线播放| 日韩av高清在线观看| 婷婷丁香激情综合| 一区二区三区av电影| 欧美国产日韩在线观看| 在线不卡的av| 成人中文字幕在线| 97久久超碰精品国产| 99久久伊人精品| 欧美国产激情二区三区 | 亚洲va欧美va人人爽午夜| 亚洲色图.com| 国产午夜精品福利| 99riav一区二区三区| 日韩—二三区免费观看av| 亚洲一区视频在线| 日韩欧美123| 久久久国产精品不卡| 国产成人午夜高潮毛片| 亚洲精品视频在线观看免费| 亚洲少妇30p| 日韩国产成人精品| 欧美亚一区二区| 欧美日韩精品二区第二页| 在线播放亚洲一区| 精品国产一区二区三区忘忧草| 久久久美女毛片| 99国产精品久久久久久久久久久| 99v久久综合狠狠综合久久| 在线一区二区三区做爰视频网站| 欧美少妇性性性| 日韩免费观看2025年上映的电影| 久久影院电视剧免费观看| 中文字幕一区二区三区在线不卡| 一区二区三区四区不卡在线 | 精品一区二区三区视频在线观看| 国产乱码精品一品二品| 午夜久久久影院| 狠狠色综合播放一区二区| 99热精品国产| 777午夜精品免费视频| 国产日韩欧美精品在线| 无码av中文一区二区三区桃花岛| 国产中文字幕一区| 欧美亚洲综合一区| 久久久99精品免费观看不卡| 伊人夜夜躁av伊人久久| 韩国精品久久久| 欧美亚洲丝袜传媒另类| 国产精品女同一区二区三区| 水蜜桃久久夜色精品一区的特点| 激情五月激情综合网| 欧美色区777第一页| 日本一区二区三区国色天香| 日韩欧美中文字幕制服| 亚洲欧美日韩成人高清在线一区| 日本91福利区| 在线亚洲高清视频| 国产精品欧美极品| 黑人精品欧美一区二区蜜桃| 精品视频在线免费看| 国产欧美日韩在线看| 日韩av网站在线观看| 91国偷自产一区二区三区观看| 国产肉丝袜一区二区| 日本aⅴ精品一区二区三区| 色哟哟一区二区在线观看| 国产欧美一区二区精品秋霞影院 | 亚洲女与黑人做爰| 国产成人自拍高清视频在线免费播放| 在线成人小视频| 一区二区成人在线| av色综合久久天堂av综合| 久久网站最新地址| 美洲天堂一区二卡三卡四卡视频| 欧美日韩成人在线一区| 亚洲另类中文字| 9人人澡人人爽人人精品| 国产欧美久久久精品影院| 精品一区二区三区香蕉蜜桃| 日韩欧美三级在线| 青青草国产精品亚洲专区无| 在线观看91精品国产入口| 一区二区三区丝袜| 色妞www精品视频| 亚洲麻豆国产自偷在线|