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


C++ ListBox::addEntries方法代码示例

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


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

示例1: init

void FileDialog::init(){
  //Directories
  ListBox* dir = new ListBox();
  dir->setPosition(Vector2D(50, 100));
  dir->setSpan(Vector2D(400, 600));
  dir->addEntries(Filesystem::getDirectories(cwd_+SEPARATOR+path_));
  dir->setCbFunc(&changeDir);
  addElement(dir);
  //Files
  ListBox* file = new ListBox();
  file->setPosition(Vector2D(564, 100));
  file->setSpan(Vector2D(400, 600));
  file->addEntries(Filesystem::getFiles(cwd_+SEPARATOR+path_));
  file->setCbFunc(&writeFilename);
  addElement(file);
  //Input field
  InputField* inp = new InputField();
  inp->setOpacity(0.8f);
  inp->setPosition(Vector2D(50, 50));
  inp->setSpan(Vector2D(300,18));
  addUnscaledElement(inp);
  //OK button
  PDButton* ok = new PDButton();
  ok->setPosition(Vector2D(575, 50));
  ok->setSpan(Vector2D(75,18));
  ok->setText("  OK");
  addUnscaledElement(ok);
  //Abort button
  PDButton* abort = new PDButton();
  abort->setPosition(Vector2D(700, 50));
  abort->setSpan(Vector2D(75,18));
  abort->setText(" Abort");
  addUnscaledElement(abort);
}
开发者ID:captain-mayhem,项目名称:captainsengine,代码行数:34,代码来源:filedialog.cpp

示例2: changeDir

//! The change directory callback
void FileDialog::changeDir(GuiElement* elem){
  Dialog* dia = dynamic_cast<Dialog*>(elem->getParent());
  ListBox* dirs = dynamic_cast<ListBox*>(dia->getElement(0));
  string dir = dirs->selectedItem();
  //collapse path when .. is chosen and the situation is appropriate
  if (dir == ".." && path_.length() > 1 && path_[path_.length()-1] != '.'){
    size_t n = path_.find_last_of(SEPARATOR);
    if (n != path_.npos)
      path_.erase(n);
    else
      path_ += ".";
  }
  else
    path_ += SEPARATOR+dir;
  dirs->clear();
  dirs->addEntries(Filesystem::getDirectories(cwd_+SEPARATOR+path_));
  //update file list
  ListBox* files = dynamic_cast<ListBox*>(dia->getElement(1));
  files->clear();
  files->addEntries(Filesystem::getFiles(cwd_+SEPARATOR+path_));
}
开发者ID:captain-mayhem,项目名称:captainsengine,代码行数:22,代码来源:filedialog.cpp


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