当前位置: 首页>>代码示例>>C++>>正文


C++ Notebook::add方法代码示例

本文整理汇总了C++中Notebook::add方法的典型用法代码示例。如果您正苦于以下问题:C++ Notebook::add方法的具体用法?C++ Notebook::add怎么用?C++ Notebook::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Notebook的用法示例。


在下文中一共展示了Notebook::add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Notebook

PrefsDialog::PrefsDialog( Window *frame, Window *parent ) :
  Dialog( frame, parent, Strings::get( 168 ),
          AWindow::CENTER | AWindow::ISMODAL | AWindow::ADJUSTSIZE,
          0, 0, 500, 365 )
{
  char *namestr = "PrefsDialog";
  name = new char[strlen(namestr)+1];
  strcpy( name, namestr );

  getGraphics()->setDialogFont();

  int margin = 10, fontHeight = Graphics::dialogDesignFontHeight,
      yStart = getClientHeight() - fontHeight*2 - 20,
      interSpace = fontHeight + fontHeight / 2;

  prevUseBigFont = AGraphics::useBigFont;

  Notebook *notebook =
	  new Notebook( this, 0, 50, getClientWidth(), getClientHeight() - 50, 
		              Color::BKGR, 0 );

	asciiDialog = new AsciiDialog( notebook, notebook );
	ascii2Dialog = new Ascii2Dialog( notebook, notebook );
	hexDialog = new HexDialog( notebook, notebook );
	editorDialog = new EditorDialog( notebook, notebook );
	displayDialog = new DisplayDialog( notebook, notebook );
	miscDialog = new MiscDialog( notebook, notebook );

	notebook->add( editorDialog, Strings::get(188) );
	notebook->add( displayDialog, Strings::get(190) );
	notebook->add( asciiDialog, Strings::get(166) );
	notebook->add( ascii2Dialog, Strings::get(209) );
	notebook->add( hexDialog, Strings::get(179) );
	notebook->add( miscDialog, Strings::get(196) );

  OKButton = new Button( this, Strings::get(8), AWindow::ISDEFAULT|ISTABSTOP,
                             10, 10, 70, 30 );
  OKButton->setYMove( FOLLOW );

  cancelButton = new Button( this, Strings::get(9), ISTABSTOP, 90, 10, 70, 30 );
  cancelButton->setYMove( FOLLOW );

	setControlsVisible();
  notebook->setTab( 0 );

  OKButton->addButtonListener( this );
  cancelButton->addButtonListener( this );

  adjustForFontSize();

  // Save/restore window position

  initSize();

  int x = getX(), y = getY(), width = getWidth(), height = getHeight();
  WinProperties::retrieveProperty( name, x, y, width, height );

  setSize( width, height );
  center( x, y );
  setPos( x, y );
}
开发者ID:OS2World,项目名称:APP-EDITOR-Kon,代码行数:61,代码来源:PREFSDLG.CPP

示例2: main

int main() {
    Notebook my;

    my.export_notes("notebook");

    cout << "------------------\n"
        << "Select action:\n"
        << "1) Add note\n"
        << "2) Find note\n"
        << "3) Remove note\n"
        << "4) Show all notes\n"
        << "q) Close notebook\n"
        << "------------------\n";    


    char ans;
    
    ans = cin.get();
    while (((ans < '1') || (ans > '4')) && (ans != 'q')) {
        if (ans != '\n')
            while (cin.get() != '\n');
        cout << "Please, enter correct command: ";
        ans = cin.get();
    }
    while (cin.get() != '\n');
    
    while (tolower(ans) != 'q') {
        switch (ans) {
            case '1' : {
                char name[100] = {};
                cout << "Enter name: ";
                cin.getline(name, 99);
                char phone[100] = {};
                cout << "Enter phone: ";
                cin.getline(phone, 99);
                if (!my.find(name))
                    my.add(name, phone);
                else {
                    cout << "Note " << name << " is already exist, replace? [y/n]: ";
                    char ch;
                    ch = cin.get();
                    ch = tolower(ch);
                    if (ch != '\n')
                        while (cin.get() != '\n');
                    while (ch != 'y' && ch != 'n') {
                        cout << "Enter y or n: ";
                        ch = cin.get();
                        ch = tolower(ch);
                        if (ch != '\n')
                            while (cin.get() != '\n');
                    }

                    if (tolower(ch) == 'y')
                        my.add(name, phone);
                }
                break;
            }
            case '2' : {
                char name[100] = {};
                cout << "Enter name: ";
                cin.getline(name, 99);
                char const * res = my.find(name);
                if (res == nullptr)
                    cout << name << " not found\n";
                else
                    cout << name << ": " << res << endl;
                break;
            }
            case '3' : {
                char name[100] = {};
                cout << "Enter name: ";
                cin.getline(name, 99);
                if (!my.find(name))
                    cout << name << " not found\n";
                else {
                    cout << "Confirm removal " << name << " [y/n]: ";
                    char ch;
                    ch = cin.get();
                    ch = tolower(ch);
                    if (ch != '\n')
                        while (cin.get() != '\n');
                    while (ch != 'y' && ch != 'n') {
                        cout << "Enter y or n: ";
                        ch = cin.get();
                        ch = tolower(ch);
                        if (ch != '\n')
                            while (cin.get() != '\n');
                    }

                    if (tolower(ch) == 'y')
                        my.remove(name);
                    cout << "Removal " << name << " complete\n";
                }
                break;
            }
            case '4' :
                my.show_all();
        }

        cout << "\n------------------\n"
//.........这里部分代码省略.........
开发者ID:DmitrySalnikov,项目名称:Notebook,代码行数:101,代码来源:menu.cpp


注:本文中的Notebook::add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。