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

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

?? menu.cpp

?? 串行通信編程源碼
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
// ******************************************************************** //
//                                                                      //
//      MENU.CPP                                                        //
//      Copyright (c) 1993, Michael Holmes and Bob Flanders             //
//      C++ Communication Utilities                                     //
//                                                                      //
//      Chapter 7: Receiving a FAX                                      //
//      Last changed in chapter 2                                       //
//                                                                      //
//      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
 *
 * ******************************************************************** */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线国产电影不卡| 国产精品99久久久久久似苏梦涵| 日本亚洲最大的色成网站www| 韩国av一区二区| 色天天综合色天天久久| 91麻豆精品国产91久久久久久| 国产精品女人毛片| 日韩高清不卡一区二区| www.欧美精品一二区| 欧美一区2区视频在线观看| 欧美激情一区二区在线| 男女性色大片免费观看一区二区| 成a人片亚洲日本久久| 欧美一区二区观看视频| 一区二区三区免费观看| 高清不卡在线观看av| 欧美一区二区三区日韩视频| 亚洲色图视频网| 国产成人精品影视| 日韩亚洲欧美成人一区| 国产精品国产a级| 国产精品一级片在线观看| 欧美一级片在线| 亚洲丝袜美腿综合| kk眼镜猥琐国模调教系列一区二区| 欧美一级淫片007| 亚洲曰韩产成在线| 在线视频观看一区| 国产精品入口麻豆九色| 国产九色sp调教91| 精品国产乱码久久久久久牛牛| 日韩国产成人精品| 91精品一区二区三区久久久久久| 亚洲综合免费观看高清完整版在线 | 99久久er热在这里只有精品15| 日韩精品中文字幕一区| 日本伊人色综合网| 欧美高清视频一二三区| 亚洲在线观看免费| 91精彩视频在线观看| 欧美sm美女调教| 国产一区三区三区| 国产午夜精品一区二区三区视频 | 欧美www视频| 久久精品国产99国产| 欧美xxxx老人做受| 国产成人在线视频网站| 国产女人18毛片水真多成人如厕| 国产v综合v亚洲欧| 国产精品电影一区二区| 色婷婷激情一区二区三区| 亚洲国产精品天堂| 69av一区二区三区| 激情综合网av| 国产精品久久国产精麻豆99网站 | 亚洲午夜电影在线观看| 欧美日韩精品一区二区天天拍小说 | 欧美精品一级二级三级| 日本欧美肥老太交大片| 精品成人一区二区三区四区| 激情综合一区二区三区| 亚洲欧美欧美一区二区三区| 欧美专区亚洲专区| 久久国产精品免费| 国产精品视频一二三| 欧美午夜寂寞影院| 国内偷窥港台综合视频在线播放| 久久久久国产精品麻豆| 一本在线高清不卡dvd| 日韩精品福利网| 欧美国产精品v| 欧美日韩国产片| 成人免费视频视频| 日本 国产 欧美色综合| 亚洲国产电影在线观看| 欧美亚洲综合色| 国产精品一区二区在线看| 亚洲乱码国产乱码精品精小说 | 紧缚捆绑精品一区二区| 中文字幕一区二区三区精华液| 欧美精品777| av资源网一区| 美国十次了思思久久精品导航| 国产精品私人影院| 欧美大片一区二区| 色婷婷综合激情| 国产黄色成人av| 日韩国产欧美视频| 亚洲欧美日韩国产手机在线| 精品国产一二三| 91福利在线看| 成人午夜视频福利| 久久99精品国产麻豆不卡| 亚洲一级二级在线| 国产精品无人区| 欧美精品一区二区三区久久久| 91免费版在线| 成人午夜视频在线| 国产毛片精品视频| 蜜桃av噜噜一区| 亚洲成人自拍偷拍| 一色桃子久久精品亚洲| 26uuu亚洲综合色欧美| 欧美男男青年gay1069videost| av在线不卡免费看| 国产不卡免费视频| 久久99久久99精品免视看婷婷 | 国产精品久久久久久久蜜臀| 日韩免费观看2025年上映的电影| 在线观看区一区二| 欧美日韩日本视频| 欧美午夜精品电影| 欧美性色欧美a在线播放| 91免费版在线| 91丨porny丨中文| 91丨九色丨国产丨porny| 成人av电影观看| 99久久亚洲一区二区三区青草| 成人午夜在线播放| 成人av第一页| 福利91精品一区二区三区| 琪琪久久久久日韩精品| 免费在线观看一区二区三区| 日韩专区在线视频| 青青草97国产精品免费观看| 奇米在线7777在线精品| 精品一区二区三区久久| 精品在线一区二区| 国产成人综合在线| 不卡av在线网| 在线免费av一区| 欧美一区二区在线不卡| 久久噜噜亚洲综合| 中文字幕亚洲不卡| 亚洲一区二区三区视频在线 | 中文字幕中文字幕中文字幕亚洲无线| 国产日产欧美精品一区二区三区| 国产视频亚洲色图| 中文字幕日韩一区| 午夜不卡av在线| 老司机精品视频在线| 国产精品亚洲午夜一区二区三区| 成人黄色在线看| 在线观看视频一区| 日韩欧美三级在线| 国产精品成人网| 日韩在线卡一卡二| 国产精品一二二区| 91福利精品视频| 欧美成人一区二区三区在线观看| 精品欧美一区二区久久| 中文字幕一区二区三区精华液| 亚洲一区二区三区影院| 精品在线免费观看| 91久久奴性调教| 在线不卡一区二区| 久久久91精品国产一区二区精品| 亚洲色图另类专区| 久久成人精品无人区| 91美女视频网站| 日韩精品一区二区三区视频在线观看| 国产欧美日产一区| 日日摸夜夜添夜夜添亚洲女人| 丁香另类激情小说| 91精品国产综合久久婷婷香蕉| 国产日产欧美精品一区二区三区| 亚洲午夜私人影院| 风间由美一区二区三区在线观看| 欧美精选在线播放| 亚洲欧美成人一区二区三区| 狠狠色丁香婷综合久久| 欧美美女一区二区在线观看| 久久精品视频在线看| 日本不卡视频在线观看| 色综合久久综合网97色综合| 久久先锋影音av| 亚洲国产精品视频| 9i看片成人免费高清| 日韩精品在线一区| 亚洲午夜激情网页| 色婷婷亚洲婷婷| 中文字幕一区二区三区在线不卡| 国产一区二区三区免费| 欧美日韩一级大片网址| 日韩伦理av电影| 国产a区久久久| 久久久五月婷婷| 久久99精品国产麻豆婷婷洗澡| 欧美人妇做爰xxxⅹ性高电影| 亚洲欧美日本韩国| 99re热这里只有精品免费视频| 国产欧美一区二区三区鸳鸯浴 | 精品国产1区2区3区| 午夜精品aaa| 欧美猛男gaygay网站| 亚洲国产综合在线| 欧美综合天天夜夜久久| 亚洲一区二区不卡免费| 欧美日韩精品一区二区三区四区| 国产在线精品一区二区不卡了|