本文整理汇总了C++中UITree类的典型用法代码示例。如果您正苦于以下问题:C++ UITree类的具体用法?C++ UITree怎么用?C++ UITree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UITree类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: dispatchEvent
void ExampleBrowserWindow::handleEvent(Event *event) {
if(event->getEventType() == "UIEvent") {
if(event->getEventCode() == UIEvent::CLICK_EVENT) {
UITree *node = templateContainer->getRootNode()->getSelectedNode();
ExampleTemplateUserData *data = (ExampleTemplateUserData*)node->getUserData();
if(event->getDispatcher() == okButton && data->type == 1) {
dispatchEvent(new UIEvent(), UIEvent::OK_EVENT);
}
if(event->getDispatcher() == cancelButton) {
dispatchEvent(new UIEvent(), UIEvent::CLOSE_EVENT);
}
}
}
if(event->getEventType() == "UITreeEvent" && event->getEventCode() == UITreeEvent::SELECTED_EVENT) {
if(event->getDispatcher() == templateContainer->getRootNode()) {
UITreeEvent *treeEvent = (UITreeEvent*) event;
ExampleTemplateUserData *data = (ExampleTemplateUserData *)treeEvent->selection->getUserData();
if(data->type == 1)
templateFolder = data->templateFolder;
}
}
UIWindow::handleEvent(event);
}
开发者ID:AmeliaMesdag,项目名称:Polycode,代码行数:26,代码来源:ExampleBrowserWindow.cpp
示例2: setResourcePools
void AssetBrowser::setResourcePools(std::vector<ResourcePool*> pools, int resourceFilter) {
if(this->resourceFilter != resourceFilter) {
assetList->clearList();
}
this->resourceFilter = resourceFilter;
templateContainer->getRootNode()->clearTree();
templateContainer->getRootNode()->setLabelText("Resource pools");
FolderUserData *userData = (FolderUserData*) templateContainer->getRootNode()->getUserData();
if(userData) {
delete userData;
}
templateContainer->getRootNode()->setUserData(NULL);
for(int i=0; i < pools.size(); i++) {
ResourcePool *pool = pools[i];
UITree *newChild = templateContainer->getRootNode()->addTreeChild("folder.png", pool->getName(), (void*)pool);
newChild->setUserData(pool);
}
}
开发者ID:Eaneth,项目名称:Polycode,代码行数:25,代码来源:TextureBrowser.cpp
示例3: setProject
void AssetBrowser::setProject(PolycodeProject *project) {
if(project == currentProject) {
return;
}
templateContainer->getRootNode()->clearTree();
vector<OSFileEntry> templates = OSBasics::parseFolder(project->getRootFolder(), false);
templateContainer->getRootNode()->setLabelText(project->getProjectName());
for(int i=0; i < templates.size(); i++) {
OSFileEntry entry = templates[i];
if(entry.type == OSFileEntry::TYPE_FOLDER) {
UITree *newChild = templateContainer->getRootNode()->addTreeChild("folder.png", entry.name, NULL);
FolderUserData *data = new FolderUserData();
data->type = 0;
data->folderPath = entry.fullPath;
newChild->setUserData(data);
newChild->toggleCollapsed();
parseFolderIntoTree(newChild, entry);
}
}
currentProject = project;
}
开发者ID:adlawren,项目名称:Polycode,代码行数:27,代码来源:TextureBrowser.cpp
示例4: parseOpenNodesIntoEntry
void parseOpenNodesIntoEntry(ObjectEntry *entry, UITree *node, bool addNewNode) {
bool hasOpenNodes = false;
for(int i=0; i < node->getNumTreeChildren(); i++) {
UITree *child = node->getTreeChild(i);
if(!child->isCollapsed()) {
hasOpenNodes = true;
}
}
if(!hasOpenNodes) {
return;
}
ObjectEntry *childNodes = entry;
if(addNewNode) {
childNodes = entry->addChild("child_nodes");
}
for(int i=0; i < node->getNumTreeChildren(); i++) {
UITree *child = node->getTreeChild(i);
if(!child->isCollapsed()) {
ObjectEntry *newEntry = childNodes->addChild("open_node");
newEntry->addChild("name", child->getLabelText());
parseOpenNodesIntoEntry(newEntry, child, true);
}
}
}
开发者ID:carlosmarti,项目名称:Polycode,代码行数:28,代码来源:PolycodeProjectBrowser.cpp
示例5: UIWindow
NewFileWindow::NewFileWindow() : UIWindow(L"Create New File", 580, 280) {
defaultTemplateTree = NULL;
Config *conf = CoreServices::getInstance()->getConfig();
String fontName = conf->getStringValue("Polycode", "uiDefaultFontName");
closeOnEscape = true;
templateContainer = new UITreeContainer("boxIcon.png", L"File Templates", 250, 300-topPadding-padding-padding);
FileTemplateUserData *data = new FileTemplateUserData();
data->type = 0;
templateContainer->getRootNode()->setUserData(data);
addChild(templateContainer);
templateContainer->setPosition(padding,topPadding+padding);
templateContainer->getRootNode()->toggleCollapsed();
templateContainer->getRootNode()->addEventListener(this, UITreeEvent::SELECTED_EVENT);
templateContainer->getRootNode()->addEventListener(this, UITreeEvent::EXECUTED_EVENT);
vector<OSFileEntry> templates = OSBasics::parseFolder(RESOURCE_PATH"FileTemplates", false);
for(int i=0; i < templates.size(); i++) {
OSFileEntry entry = templates[i];
if(entry.type == OSFileEntry::TYPE_FOLDER) {
UITree *newChild = templateContainer->getRootNode()->addTreeChild("folder.png", entry.name, NULL);
FileTemplateUserData *data = new FileTemplateUserData();
data->type = 0;
newChild->setUserData(data);
newChild->toggleCollapsed();
parseTemplatesIntoTree(newChild, entry);
}
}
UILabel *label2 = new UILabel(L"NEW FILE NAME (NO EXTENSION)", 18, "section", Label::ANTIALIAS_FULL);
label2->color.a = 1.0;
label2->getLabel()->setColorForRange(Color(),0, 12);
label2->getLabel()->setColorForRange(Color(0.6, 0.6, 0.6, 1.0),12, 40);
label2->setText("NEW FILE NAME (NO EXTENSION)");
addChild(label2);
label2->setPosition(padding+270, templateContainer->getPosition().y-5);
fileNameInput = new UITextInput(false, 550-padding-210-padding-padding, 12);
addFocusChild(fileNameInput);
fileNameInput->setPosition(label2->getPosition().x, label2->getPosition().y+30);
cancelButton = new UIButton(L"Cancel", 100);
cancelButton->addEventListener(this, UIEvent::CLICK_EVENT);
addFocusChild(cancelButton);
cancelButton->setPosition(600-100-padding-100-10, 265);
okButton = new UIButton(L"Create File", 100);
okButton->addEventListener(this, UIEvent::CLICK_EVENT);
addFocusChild(okButton);
okButton->setPosition(600-100-padding, 265);
}
开发者ID:Censacrof,项目名称:Polycode,代码行数:59,代码来源:NewFileWindow.cpp
示例6: findLastOpenNode
// RECURSIVE HELPER FUNCTIONS
//
// used in KEY_UP tree nav
UITree *UITreeContainer::findLastOpenNode(UITree *tree) {
if (!tree->hasTreeChildren() || tree->isCollapsed())
return tree;
UITree *t = tree->getTreeChild(tree->getNumTreeChildren()-1);
if (t->isCollapsed() || !t->hasTreeChildren())
return t;
else
return findLastOpenNode(t);
}
开发者ID:0x81c,项目名称:Polycode,代码行数:12,代码来源:PolyUITreeContainer.cpp
示例7:
UITree *PolycodeProjectBrowser::nodeHasName(UITree *node, String name) {
for(int i=0; i < node->getNumTreeChildren(); i++) {
UITree *projectChild = node->getTreeChild(i);
if(projectChild->getLabelText() == name) {
return projectChild;
}
}
return NULL;
}
开发者ID:AmeliaMesdag,项目名称:Polycode,代码行数:9,代码来源:PolycodeProjectBrowser.cpp
示例8: removeChild
UITree::~UITree() {
for(int i=0; i < treeChildren.size(); i++) {
UITree *child = treeChildren[i];
removeChild(child);
child->removeEventListener(this, UITreeEvent::NEED_REFRESH_EVENT);
child->removeEventListener(this, UITreeEvent::SELECTED_EVENT);
child->removeEventListener(this, UITreeEvent::EXECUTED_EVENT);
//treeChildren.erase(treeChildren.begin()+i);
delete child;
}
}
开发者ID:meroon,项目名称:Polycode,代码行数:11,代码来源:PolyUITree.cpp
示例9: addProject
void PolycodeProjectBrowser::addProject(PolycodeProject *project) {
UITree *projectTree = treeContainer->getRootNode()->addTreeChild("projectIcon.png", project->getProjectName(), (void*) project);
projectTree->toggleCollapsed();
BrowserUserData *data = new BrowserUserData();
data->type = 3;
data->parentProject = project;
projectTree->setUserData((void*) data) ;
parseFolderIntoNode(projectTree, project->getRootFolder(), project);
}
开发者ID:AmeliaMesdag,项目名称:Polycode,代码行数:11,代码来源:PolycodeProjectBrowser.cpp
示例10: addCurve
void CurveEditor::addCurve(String name, BezierCurve *curve, Color curveColor) {
UITree *newNode = treeContainer->getRootNode()->addTreeChild("Images/curve_icon.png", name);
EditCurve *editCurve = new EditCurve(curve, curveColor);
addChild(editCurve);
editCurve->setPosition(160, 63);
curves.push_back(editCurve);
newNode->setUserData((void*) editCurve);
}
开发者ID:reffle,项目名称:Polycode,代码行数:11,代码来源:PolycodeFrame.cpp
示例11: UIWindow
NewFileWindow::NewFileWindow() : UIWindow(L"Create New File", 480, 280) {
defaultTemplateTree = NULL;
Config *conf = CoreServices::getInstance()->getConfig();
String fontName = conf->getStringValue("Polycode", "uiDefaultFontName");
int fontSize = conf->getNumericValue("Polycode", "uiDefaultFontSize");
closeOnEscape = true;
templateContainer = new UITreeContainer("boxIcon.png", L"File Templates", 200, 300-topPadding-padding-padding);
FileTemplateUserData *data = new FileTemplateUserData();
data->type = 0;
templateContainer->getRootNode()->setUserData(data);
addChild(templateContainer);
templateContainer->setPosition(padding,topPadding+padding);
templateContainer->getRootNode()->toggleCollapsed();
templateContainer->getRootNode()->addEventListener(this, UITreeEvent::SELECTED_EVENT);
vector<OSFileEntry> templates = OSBasics::parseFolder(RESOURCE_PATH"FileTemplates", false);
for(int i=0; i < templates.size(); i++) {
OSFileEntry entry = templates[i];
if(entry.type == OSFileEntry::TYPE_FOLDER) {
UITree *newChild = templateContainer->getRootNode()->addTreeChild("folder.png", entry.name, NULL);
FileTemplateUserData *data = new FileTemplateUserData();
data->type = 0;
newChild->setUserData(data);
newChild->toggleCollapsed();
parseTemplatesIntoTree(newChild, entry);
}
}
ScreenLabel *label2 = new ScreenLabel(L"New File Name (without extension)", fontSize, fontName, Label::ANTIALIAS_FULL);
addChild(label2);
label2->setPosition(padding+220, templateContainer->getPosition().y);
fileNameInput = new UITextInput(false, 500-padding-220-padding-padding, 12);
addChild(fileNameInput);
fileNameInput->setPosition(label2->getPosition().x, label2->getPosition().y+label2->getHeight()+2);
cancelButton = new UIButton(L"Cancel", 100);
cancelButton->addEventListener(this, UIEvent::CLICK_EVENT);
addChild(cancelButton);
cancelButton->setPosition(500-100-padding-100-10, 265);
okButton = new UIButton(L"Create File", 100);
okButton->addEventListener(this, UIEvent::CLICK_EVENT);
addChild(okButton);
okButton->setPosition(500-100-padding, 265);
}
开发者ID:Flapstah,项目名称:Polycode,代码行数:54,代码来源:NewFileWindow.cpp
示例12: removeChild
void UITree::clearTree() {
for(int i=0; i < treeChildren.size(); i++) {
UITree *child = treeChildren[i];
removeChild(child);
child->removeEventListener(this, UITreeEvent::NEED_REFRESH_EVENT);
child->removeEventListener(this, UITreeEvent::SELECTED_EVENT);
child->removeEventListener(this, UITreeEvent::EXECUTED_EVENT);
delete child;
}
treeChildren.clear();
}
开发者ID:Avangelin,项目名称:Polycode,代码行数:11,代码来源:PolyUITree.cpp
示例13: UIWindow
ExampleBrowserWindow::ExampleBrowserWindow() : UIWindow(L"Example Browser", 320, 300){
templateFolder = "";
closeOnEscape = true;
defaultTemplateTree = NULL;
Config *conf = CoreServices::getInstance()->getConfig();
String fontName = conf->getStringValue("Polycode", "uiDefaultFontName");
int fontSize = conf->getNumericValue("Polycode", "uiDefaultFontSize");
templateContainer = new UITreeContainer("boxIcon.png", L"Examples", 300, 300-topPadding-padding-padding- 40);
ExampleTemplateUserData *data = new ExampleTemplateUserData();
data->type = 0;
templateContainer->getRootNode()->setUserData(data);
addChild(templateContainer);
templateContainer->setPosition(padding,topPadding+padding);
templateContainer->getRootNode()->toggleCollapsed();
templateContainer->getRootNode()->addEventListener(this, UITreeEvent::SELECTED_EVENT);
vector<OSFileEntry> templates = OSBasics::parseFolder(RESOURCE_PATH"Standalone/Examples/Lua", false);
for(int i=0; i < templates.size(); i++) {
OSFileEntry entry = templates[i];
if(entry.type == OSFileEntry::TYPE_FOLDER) {
UITree *newChild = templateContainer->getRootNode()->addTreeChild("folder.png", entry.name, NULL);
ExampleTemplateUserData *data = new ExampleTemplateUserData();
data->type = 0;
newChild->setUserData(data);
if(i == 0) {
newChild->toggleCollapsed();
}
parseTemplatesIntoTree(newChild, entry);
}
}
cancelButton = new UIButton(L"Cancel", 100);
cancelButton->addEventListener(this, UIEvent::CLICK_EVENT);
addChild(cancelButton);
cancelButton->setPosition(300-100-padding-80-10, 265);
okButton = new UIButton(L"Open Example", 100);
okButton->addEventListener(this, UIEvent::CLICK_EVENT);
addChild(okButton);
okButton->setPosition(300-80-padding, 265);
}
开发者ID:Flapstah,项目名称:Polycode,代码行数:53,代码来源:ExampleBrowserWindow.cpp
示例14: parseFolderIntoTree
void AssetBrowser::parseFolderIntoTree(UITree *tree, OSFileEntry folder) {
vector<OSFileEntry> templates = OSBasics::parseFolder(folder.fullPath, false);
for(int i=0; i < templates.size(); i++) {
OSFileEntry entry = templates[i];
if(entry.type == OSFileEntry::TYPE_FOLDER) {
UITree *newChild = tree->addTreeChild("folder.png", entry.nameWithoutExtension, NULL);
FolderUserData *data = new FolderUserData();
data->type = 1;
data->folderPath = entry.fullPath;
newChild->setUserData(data);
parseFolderIntoTree(newChild, entry);
}
}
}
开发者ID:adlawren,项目名称:Polycode,代码行数:14,代码来源:TextureBrowser.cpp
示例15: refreshProject
void PolycodeProjectBrowser::refreshProject(PolycodeProject *project) {
UITree *projectTree = treeContainer->getRootNode();
for(int i=0; i < projectTree->getNumTreeChildren(); i++) {
UITree *projectChild = projectTree->getTreeChild(i);
BrowserUserData *userData = (BrowserUserData*)projectChild->getUserData();
if(userData->parentProject == project) {
parseFolderIntoNode(projectChild, project->getRootFolder(), project);
return;
}
}
}
开发者ID:AmeliaMesdag,项目名称:Polycode,代码行数:14,代码来源:PolycodeProjectBrowser.cpp
示例16: parseTemplatesIntoTree
void NewProjectWindow::parseTemplatesIntoTree(UITree *tree, OSFileEntry folder) {
vector<OSFileEntry> templates = OSBasics::parseFolder(folder.fullPath, false);
for(int i=0; i < templates.size(); i++) {
OSFileEntry entry = templates[i];
if(entry.type == OSFileEntry::TYPE_FOLDER) {
UITree *newChild = tree->addTreeChild("templateIcon.png", entry.name, NULL);
TemplateUserData *data = new TemplateUserData();
data->type = 1;
data->templateFolder = entry.fullPath;
newChild->setUserData(data);
if(entry.name == "Empty Project") {
defaultTemplateTree = newChild;
newChild->setSelected();
}
}
}
}
开发者ID:AdamFlores,项目名称:Polycode,代码行数:17,代码来源:NewProjectWindow.cpp
示例17: parseTemplatesIntoTree
void NewFileWindow::parseTemplatesIntoTree(UITree *tree, OSFileEntry folder) {
vector<OSFileEntry> templates = OSBasics::parseFolder(folder.fullPath, false);
for(int i=0; i < templates.size(); i++) {
OSFileEntry entry = templates[i];
if(entry.type != OSFileEntry::TYPE_FOLDER) {
UITree *newChild = tree->addTreeChild("templateIcon.png", entry.nameWithoutExtension, NULL);
FileTemplateUserData *data = new FileTemplateUserData();
data->type = 1;
data->templatePath = entry.fullPath;
newChild->setUserData(data);
if(entry.name == "LUA Source File.lua") {
defaultTemplateTree = newChild;
newChild->setSelected();
}
}
}
}
开发者ID:Flapstah,项目名称:Polycode,代码行数:17,代码来源:NewFileWindow.cpp
示例18: nodeHasName
void PolycodeProjectBrowser::parseFolderIntoNode(UITree *node, String spath, PolycodeProject *parentProject) {
vector<OSFileEntry> files = OSBasics::parseFolder(spath, false);
// check if files got deleted
for(int i=0; i < node->getNumTreeChildren(); i++) {
UITree *projectChild = node->getTreeChild(i);
if(!listHasFileEntry(files, ((BrowserUserData*)projectChild->getUserData())->fileEntry)) {
node->removeTreeChild(projectChild);
}
}
for(int i=0; i < files.size(); i++) {
OSFileEntry entry = files[i];
if(entry.type == OSFileEntry::TYPE_FOLDER) {
UITree *existing = nodeHasName(node, entry.name);
if(!existing) {
BrowserUserData *data = new BrowserUserData();
data->fileEntry = entry;
UITree *newChild = node->addTreeChild("folder.png", entry.name, (void*) data);
data->type = 2;
data->parentProject = parentProject;
parseFolderIntoNode(newChild, entry.fullPath, parentProject);
} else {
parseFolderIntoNode(existing, entry.fullPath, parentProject);
}
} else {
if(!nodeHasName(node, entry.name)) {
BrowserUserData *data = new BrowserUserData();
data->fileEntry = entry;
data->type = 1;
data->parentProject = parentProject;
node->addTreeChild("file.png", entry.name, (void*) data);
}
}
}
}
开发者ID:AmeliaMesdag,项目名称:Polycode,代码行数:37,代码来源:PolycodeProjectBrowser.cpp
示例19: UITree
UITree *UITree::addTreeChild(String icon, String text, void *userData) {
UITree *newTree = new UITree(icon, text, treeWidth, treeOffset+11);
newTree->setUserData(userData);
addChild(newTree);
newTree->setParent(this);
newTree->addEventListener(this, UITreeEvent::NEED_REFRESH_EVENT);
newTree->addEventListener(this, UITreeEvent::SELECTED_EVENT);
newTree->addEventListener(this, UITreeEvent::EXECUTED_EVENT);
newTree->addEventListener(this, UITreeEvent::DRAG_START_EVENT);
treeChildren.push_back(newTree);
refreshTree();
return newTree;
}
开发者ID:Avangelin,项目名称:Polycode,代码行数:13,代码来源:PolyUITree.cpp
示例20: removeProject
void PolycodeProjectBrowser::removeProject(PolycodeProject *project) {
UITree *projectTree = treeContainer->getRootNode();
for(int i=0; i < projectTree->getNumTreeChildren(); i++) {
UITree *projectChild = projectTree->getTreeChild(i);
BrowserUserData *userData = (BrowserUserData*)projectChild->getUserData();
if(userData->parentProject == project) {
projectTree->removeTreeChild(projectChild);
return;
}
}
}
开发者ID:AmeliaMesdag,项目名称:Polycode,代码行数:13,代码来源:PolycodeProjectBrowser.cpp
注:本文中的UITree类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论