本文整理汇总了C++中Fl_Tree_Item类的典型用法代码示例。如果您正苦于以下问题:C++ Fl_Tree_Item类的具体用法?C++ Fl_Tree_Item怎么用?C++ Fl_Tree_Item使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Fl_Tree_Item类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mark_file
/*
Name : mark_file()
Purpose: Set the marked attribute in the file metadata record.
Gets the first selected item for the file system tree
widget and looks up the file metadata record.
Input : None.
Output : None.
*/
void Fineline_File_System_Tree::mark_file()
{
Fl_Tree_Item *flti = first_selected_item();
fl_file_record_t *flrec = NULL;
char file_path[FL_PATH_MAX]; // FL_PATH_MAX 2048 is an FLTK constant, Fineline FL_PATH_MAX_LENGTH 4096
string full_path;
if (flti != 0)
{
if (item_pathname(file_path, FL_PATH_MAX, flti) != 0)
{
Fineline_Log::print_log_entry("Fineline_File_System_Tree::mark_file() <ERROR> Could not get tree item path.");
fl_message(" <ERROR> Could not get tree item. ");
return;
}
full_path.append(file_path);
flrec = find_file(full_path);
if (flrec != NULL)
{
flrec->marked = 1;
flti->labelcolor(FL_DARK_GREEN);
flti->labelfont(FL_COURIER_BOLD);
if (flrec->file_type == TSK_FS_META_TYPE_DIR) //If a directory then mark all the files in the directory.
{
mark_children(flti);
}
Fl::awake();
Fineline_Log::print_log_entry("Fineline_File_System_Tree::mark_file() <INFO> marked file.");
}
}
return;
}
开发者ID:sanyaade-g2g-repos,项目名称:fineline-computer-forensics-timeline-tools,代码行数:41,代码来源:Fineline_File_System_Tree.cpp
示例2: populateList
void ModelerUserInterface::populateList(GroupProperty* group, Fl_Tree_Item* parent) {
// Create a tree node for this group.
Fl_Tree_Item* item;
if (parent == NULL) {
// HACK: We have to add and remove a fake list item so that the tree
// control will create a root node to put it under.
m_controlsTree->remove(m_controlsTree->add("You shouldn't see this."));
item = m_controlsTree->root();
item->label(group->getName());
} else {
item = m_controlsTree->add(parent, group->getName());
}
item->user_data(group);
// Examine the group's property list for group properties.
PropertyList* controls = group->getProperties();
for (PropertyList::iterator iter = controls->begin();
iter != controls->end();
iter++) {
// See if it's a GroupProperty by attempting to cast it
GroupProperty* childGroup = dynamic_cast<GroupProperty*>(*iter);
// If it is, add it to the list.
if (childGroup) {
ModelerUserInterface::populateList(childGroup, item);
}
}
}
示例3: addParameter
void onelabGroup::addParameter(onelab::parameter &p)
{
if(!p.getVisible() || CTX::instance()->solver.showInvisibleParameters) return;
bool highlight = false;
Fl_Color c;
if(getFlColor(p.getAttribute("Highlight"), c)) highlight = true;
Fl_Tree_Item *n = _tree->add(p.getName().c_str());
if(!n) return;
n->labelsize(FL_NORMAL_SIZE + 4);
_tree->begin();
int ww = _baseWidth - (n->depth() + 1) * _indent;
ww *= _widgetLabelRatio; // FIXME CHANGE THIS
int hh = n->labelsize() + 4;
Fl_Group *grp = new Fl_Group(1, 1, ww, hh);
Fl_Widget *widget = _addParameterWidget(p, ww, hh, n, highlight, c);
grp->end();
if(!_enableTreeWidgetResize) grp->resizable(0);
_treeWidgets.push_back(grp);
widget->copy_label(p.getShortName().c_str());
std::string help = p.getLabel().size() ? p.getLabel() : p.getShortName();
if(p.getHelp().size()) help += ":\n" + p.getHelp();
widget->copy_tooltip(help.c_str());
n->widget(grp);
_tree->end();
if(p.getAttribute("Closed") == "1" && p.getPath().size()) _tree->close(p.getPath().c_str(), 0);
_tree->redraw();
}
示例4: Fl_Tree_Item
/// Insert a new item into current item's children at a specified position.
Fl_Tree_Item *Fl_Tree_Item::insert(const Fl_Tree_Prefs &prefs, const char *new_label, int pos) {
Fl_Tree_Item *item = new Fl_Tree_Item(prefs);
item->label(new_label);
item->_parent = this;
_children.insert(pos, item);
return(item);
}
示例5: ShowModsGUI
void ShowModsGUI() {
Fl_Double_Window* wind = make_mods_window();
wind->callback([](Fl_Widget* window) {
if(visible_callback) {
visible_callback(false);
}
if(window) {
delete (Fl_Double_Window*)window;
mods_window = nullptr;
}
if(appended_ai_tree) {
Fl_Tree_Item* first = appended_ai_tree->first();
if(first) {
for(int i = 0; i < first->children(); i++) {
delete (int*)(first->child(i)->user_data());
}
}
appended_ai_tree = nullptr;
}
});
wind->show();
visible_callback(true);
}
示例6: updateParameter
void onelabGroup::updateParameter(onelab::number &p)
{
Fl_Tree_Item *n = _tree->find_item(p.getName().c_str());
if(!n) {
addParameter(p);
return;
}
Fl_Group *grp = (Fl_Group *)n->widget();
// enumeration (display choices as value labels, not numbers)
if(p.getChoices().size() &&
p.getChoices().size() == p.getValueLabels().size()){
Fl_Choice *but = (Fl_Choice *)grp->child(0);
//std::vector<Fl_Menu_Item> menu;
//std::map<double, std::string> labels(p.getValueLabels());
//for(std::map<double, std::string>::iterator it = labels.begin();
// it != labels.end(); it++){
// char *str = strdup(it->second.c_str());
// _treeStrings.push_back(str);
// Fl_Menu_Item menuItem = {str, 0, 0, 0, 0};
// if(highlight) menuItem.labelcolor(c);
// menu.push_back(menuItem);
//}
//Fl_Menu_Item it = {0};
//menu.push_back(it);
//but->copy(&menu[0]);
for(unsigned int i = 0; i < p.getChoices().size(); i++){
if(p.getValue() == p.getChoices()[i]){
but->value(i);
break;
}
}
return;
}
// check box (boolean choice)
if(p.getChoices().size() == 2 &&
p.getChoices()[0] == 0 && p.getChoices()[1] == 1){
Fl_Check_Button *but = (Fl_Check_Button *)grp->child(0);
but->value(p.getValue());
return;
}
// non-editable value FIXME
if(p.getReadOnly()){
outputRange *but = (outputRange *)grp->child(0);;
but->value(p.getValue());
but->graph(p.getAttribute("Graph"));
return;
}
// general number input
inputRange *but = (inputRange *)grp->child(0);
but->value(p.getValue());
but->minimum(p.getMin());
but->maximum(p.getMax());
but->step(p.getStep());
but->choices(p.getChoices());
but->loop(p.getAttribute("Loop"));
but->graph(p.getAttribute("Graph"));
}
示例7: treeCallBack
void ResourceWindow::treeCallBack( Fl_Widget* widget, void* data )
{
//LOG("Tree call back....");
Fl_Tree *tree = (Fl_Tree*)widget;
Fl_Tree_Item *item = (Fl_Tree_Item*)tree->callback_item(); // get selected item
ResourceWindow* window = (ResourceWindow*)data;
if (tree->callback_reason() == FL_TREE_REASON_SELECTED)
{
std::stringstream strstr;
strstr << window->getNameFromItem(item);
long specialNameIndex = (long) item->user_data();
if (specialNameIndex == 0) // assume any item with a special name doesn't need an additional label
strstr << "/" << item->label();
SBSelectionManager::getSelectionManager()->select(strstr.str());
}
if (tree->callback_reason() == FL_TREE_REASON_DESELECTED)
{
std::stringstream strstr;
strstr << window->getNameFromItem(item) << "/" << item->label();
//SBSelectionManager::getSelectionManager()->select("");
}
}
示例8: getNameFromItem
std::string ResourceWindow::getNameFromItem(Fl_Tree_Item* item)
{
// find the item just under the root item
std::string subname = "";
Fl_Tree_Item* curItem = item;
int numSubnames = 0;
if (!curItem)
return "";
if (item == resourceTree->root())
return "ROOT";
while (curItem->parent() != resourceTree->root())
{
long specialNameIndex = (long) curItem->user_data();
if (specialNameIndex > 0)
{
subname = "/" + _specialNames[specialNameIndex] + subname;
numSubnames++;
}
curItem = curItem->parent();
}
return getNameFromTree(curItem) + subname;
}
示例9: openTreeItem
void onelabGroup::openTreeItem(const std::string &name)
{
Fl_Tree_Item *n = _tree->find_item(name.c_str());
if(n && n->has_children()){
n->open();
_tree->redraw();
}
}
示例10: TreeCallback
void ModelerUserInterface::TreeCallback(Fl_Tree* tree, void* p) {
if (tree->callback_reason() == FL_TREE_REASON_SELECTED) {
Fl_Tree_Item *item = tree->callback_item();
ModelerUserInterface::getInstance()->pickGroupProperty(
(GroupProperty*) item->user_data());
}
}
示例11: clear
void RtVarsTree::buildTree() {
clear();
if (p_CarState) {
char buffer[64];
buffer[sizeof(buffer)-1] = '\0';
begin();
// Can Values
AnalogMapVarIterator v;
AnalogMapGroupIterator g;
for (g = p_CarState->analog_data.begin(); g != p_CarState->analog_data.end(); g++) {
for (v = (*g).second.begin(); v != (*g).second.end(); v++) {
Fl_Tree_Item *item;
double physical_value;
if ((*v).second.Signedness) {
physical_value = (double)(int32_t)(*v).second.RawValue * (*v).second.Scale + (*v).second.Offset;
} else {
physical_value = (double) (*v).second.RawValue * (*v).second.Scale + (*v).second.Offset;
}
snprintf(buffer, sizeof(buffer)-1, "%s/%s = %lu (%lf%s%s)",
(*g).first.c_str(),
(*v).first.c_str(),
(long unsigned)(*v).second.RawValue,
physical_value,
(*v).second.Units[0] != '\0' ? " " : "",
(*v).second.Units
);
item = add(buffer);
item->user_data((void*)NULL);
printf(">> %s\n", buffer);
}
}
// Pwm Values
PwmMapIterator p;
for (p = p_CarState->pwm_data.begin(); p != p_CarState->pwm_data.end(); p++) {
Fl_Tree_Item *item;
snprintf(buffer, sizeof(buffer)-1, "PWM/%s = %lu of %lu (%.2lf%%)",
(*p).first.c_str(),
(long unsigned)(*p).second.PulseWidth,
(long unsigned)(*p).second.Period,
(long unsigned)(*p).second.Period == 0 ? 0.0 : 100.0 * (*p).second.getIntensity()
);
item = add(buffer);
item->user_data((void*)NULL);
printf(">> %s\n", buffer);
}
end();
}
}
示例12: copy_entity_name_cb
static void copy_entity_name_cb(Fl_Widget*, void *s) {
ObjectTree *self = (ObjectTree*)s;
Fl_Tree_Item *titem = self->first_selected_item();
if(!titem) return;
const char *str = titem->label();
if(str) Fl::copy(str, edelib_strnlen(str, 128), 1);
}
示例13: updatePath
void ResourceWindow::updatePath( Fl_Tree_Item* tree, const std::vector<std::string>& pathList )
{
resourceTree->clear_children(tree);
for (size_t p = 0; p < pathList.size(); p++)
{
Fl_Tree_Item* item = resourceTree->add(tree, pathList[p].c_str());
item->user_data(tree->user_data());
}
}
示例14: addSpecialName
void ResourceWindow::updateCharacter( Fl_Tree_Item* tree, SmartBody::SBCharacter* character )
{
SmartBody::SBCharacter* sbcharacter = dynamic_cast<SmartBody::SBCharacter*>(character);
Fl_Tree_Item* item = resourceTree->add(tree,character->getName().c_str());
item->user_data((void*) addSpecialName(character->getName()));
resourceTree->sortorder(FL_TREE_SORT_NONE);
Fl_Tree_Item* skeletonFolder = resourceTree->add(item,"skeleton");
skeletonFolder->user_data((void*) _reverseSpecialNames["skeleton"]);
SmartBody::SBSkeleton* sbSk = sbcharacter->getSkeleton();
if (sbSk)
{
Fl_Tree_Item* charSkItem = resourceTree->add(skeletonFolder, sbSk->getName().c_str());
}
Fl_Tree_Item* controllerFolder = resourceTree->add(item,"controllers");
controllerFolder->user_data((void*) _reverseSpecialNames["controller"]);
controllerFolder->close();
// add controllers
MeControllerTreeRoot* ctTree = character->ct_tree_p ;
if( ctTree )
{
int n = ctTree->count_controllers();
for (int c = 0; c < n; c++)
{
//LOG( "%s", ctTree->controller(c)->name() );
Fl_Tree_Item* ctrlItem = resourceTree->add(controllerFolder,ctTree->controller(c)->getName().c_str());
// ctrlItem->user_data((void*)ITEM_CONTROLLER);
}
}
/*
// add gesture map
Fl_Tree_Item* gestureFolder = resourceTree->add(item,"gestures");
gestureFolder->user_data((void*)-1);
gestureFolder->close();
// add individual gesture mappings
SmartBody::SBScene* scene = SmartBody::SBScene::getScene();
SBGestureMap* gestureMap = scene->getGestureMapManager()->getGestureMap(sbcharacter->getName());
if (gestureMap)
{
std::string lexeme;
std::string type;
std::string hand;
std::string style;
std::string posture;
gestureMap->getGestureByInfo(lexeme, type, hand, style, posture);
Fl_Tree_Item* gestureItem = resourceTree->add(gestureFolder, lexeme.c_str());
gestureItem->user_data((void*)ITEM_GESTUREMAP);
}
*/
// add NVBG
Fl_Tree_Item* nvbgItem = resourceTree->add(item, "minibrain");
nvbgItem->user_data((void*) _reverseSpecialNames["minibrain"]);
SmartBody::Nvbg* nvbg = character->getNvbg();
if (nvbg)
{
nvbgItem = resourceTree->add(item, nvbg->getName().c_str());
}
}
示例15: sprintf
viewButton *onelabGroup::getViewButton(int num)
{
char tmp[256];
sprintf(tmp, "0Post-processing/View%d", num);
Fl_Tree_Item *n = _tree->find_item(tmp);
if(n){
Fl_Group *grp = (Fl_Group*)n->widget();
return (viewButton*)grp->child(0);
}
return 0;
}