本文整理汇总了C++中Fl_Pack::children方法的典型用法代码示例。如果您正苦于以下问题:C++ Fl_Pack::children方法的具体用法?C++ Fl_Pack::children怎么用?C++ Fl_Pack::children使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fl_Pack
的用法示例。
在下文中一共展示了Fl_Pack::children方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddStructure
void FolderWindow::AddStructure(const char* filename, const int index)
{
Fl_Pack* pack = folderPack;
pack->begin();
int vertPosn = pack->children() * 30 + pack->y();
Fl_Group* group = new Fl_Group(pack->x(), vertPosn, pack->w(), 30);
group->begin();
Fl_Button* label = new Fl_Button(pack->x() + 10, vertPosn, pack->w() - 40, 30, filename);
label->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_LEFT);
label->callback(FolderWindow::ShowFileCallback);
label->user_data((void*)index);
Fl_Button* removeButton = new Fl_Button(pack->x() + pack->w() - 20, vertPosn + 5, 20, 20);
removeButton->callback(FolderWindow::RemoveCallback);
removeButton->user_data((void*)index);
removeButton->label("@1+");
//printf("Added file: %s\n",label->label());
group->resizable(label);
group->end();
pack->end();
folderScroll->redraw();
}
示例2: RemoveCallback
void FolderWindow::RemoveCallback(Fl_Widget* widget, void* userData)
{
FolderWindow* fwindow = (FolderWindow*)(widget->parent()->parent()->parent()->parent());
Fl_Pack* pack = fwindow->folderPack;
for(int i = 0; i < pack->children(); ++i)
{
Fl_Group* tempGroup = (Fl_Group*)pack->child(i);
Fl_Button* childButton = (Fl_Button*)tempGroup->child(1); // <--- here
if (childButton == widget)
{
RNAStructViz* appInstance = RNAStructViz::GetInstance();
const std::vector<DiagramWindow*>& diagrams = appInstance->GetDiagramWindows();
for (unsigned int ui = 0; ui < diagrams.size(); ++ui)
{
if(diagrams[ui]->GetFolderIndex() == fwindow->m_folderIndex)
{
diagrams[ui]->RemoveStructure((intptr_t)userData);
break;
}
}
const std::vector<StatsWindow*>& stats = appInstance->GetStatsWindows();
for (unsigned int ui = 0; ui < stats.size(); ++ui)
{
if(stats[ui]->GetFolderIndex() == fwindow->m_folderIndex)
{
stats[ui]->RemoveStructure((intptr_t)userData);
break;
}
}
Fl_Group* toRemove = (Fl_Group*)pack->child(i); // <--- here
pack->remove(toRemove);
fwindow->folderScroll->redraw();
Fl::delete_widget(toRemove);
appInstance->GetStructureManager()->DecreaseStructCount(
fwindow->m_folderIndex);
appInstance->GetStructureManager()->RemoveStructure((intptr_t)userData);
break;
}
}
}
示例3: AddStructure
void FolderWindow::AddStructure(const char* filename, const int index)
{
Fl_Pack* pack = folderPack;
pack->begin();
int vertPosn = pack->children() * NAVBUTTONS_BHEIGHT; //+ pack->y() + 15;
Fl_Group* group = new Fl_Group(pack->x(), vertPosn, pack->w(), NAVBUTTONS_BHEIGHT);
group->begin();
Fl_Button* label = new Fl_Button(pack->x() + 10, vertPosn, pack->w() - 40, 30, filename);
label->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_LEFT);
label->callback(FolderWindow::ShowFileCallback);
label->user_data((void*)index);
label->labelcolor(GUI_BTEXT_COLOR);
char labelWithIcon[MAX_BUFFER_SIZE];
std::string spaceBuffer = string(" ");
int curLabelLen = 0;
char filePrefix[MAX_BUFFER_SIZE];
size_t fileNameBytes = strlen(filename);
snprintf(filePrefix, MAX_BUFFER_SIZE, "%-.20s%s", filename,
fileNameBytes > MAX_FOLDER_LABEL_CHARS ? "..." : "");
snprintf(labelWithIcon, MAX_BUFFER_SIZE - 1, "@filenew %s%s",
filePrefix, spaceBuffer.substr(0,
MAX(0, MAX_FOLDER_LABEL_CHARS - ((int ) strlen(filePrefix)))).c_str());
//strcat(labelWithIcon, " @|>");
label->copy_label(labelWithIcon);
label->tooltip(filename);
Fl_Button* removeButton = new Fl_Button(pack->x() + pack->w() - 20, vertPosn + 5, 20, 20);
removeButton->callback(FolderWindow::RemoveCallback);
removeButton->user_data((void*)index);
removeButton->label("@1+");
removeButton->labelcolor(GUI_TEXT_COLOR);
group->resizable(label);
group->end();
pack->end();
folderScroll->redraw();
}