本文整理汇总了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);
}
示例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_));
}