本文整理汇总了C++中BoostPath::leaf方法的典型用法代码示例。如果您正苦于以下问题:C++ BoostPath::leaf方法的具体用法?C++ BoostPath::leaf怎么用?C++ BoostPath::leaf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BoostPath
的用法示例。
在下文中一共展示了BoostPath::leaf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addTabWithText
void ContentPanel::addTabWithText(BoostPath file)
{
PanelRefPtr _NewLeftTabLabelPanel = Panel::createEmpty();
ButtonRefPtr _NewLeftTabLabelCloseButtonRefPtr =
dynamic_pointer_cast<Button>(dynamic_cast<InternalWindow*>(InternalWindow::getClassType().getPrototype())->getTitlebar()->getCloseButton()->shallowCopy());
//ButtonRefPtr _NewLeftTabLabelCloseButtonRefPtr = Button::create();
_NewLeftTabLabelCloseButtonRefPtr->setPreferredSize(Vec2f(100,20));
_NewLeftTabLabelCloseButtonRefPtr->setText("X");
_NewLeftTabLabelCloseButtonRefPtr->addActionListener(&_CloseButtonListener);
LabelRefPtr _NewLeftTabLabelLabel=Label::create();
_NewLeftTabLabelLabel->setText(file.leaf());
_NewLeftTabLabelLabel->setBorders(NULL);
_NewLeftTabLabelLabel->setBackgrounds(NULL);
SpringLayoutRefPtr _NewLeftTabLabelPanelSpringLayout = OSG::SpringLayout::create();
_NewLeftTabLabelPanelSpringLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, _NewLeftTabLabelCloseButtonRefPtr, 2, SpringLayoutConstraints::NORTH_EDGE, _NewLeftTabLabelPanel);
_NewLeftTabLabelPanelSpringLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, _NewLeftTabLabelCloseButtonRefPtr, -2, SpringLayoutConstraints::EAST_EDGE, _NewLeftTabLabelPanel);
_NewLeftTabLabelPanelSpringLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, _NewLeftTabLabelCloseButtonRefPtr, -20, SpringLayoutConstraints::EAST_EDGE, _NewLeftTabLabelPanel);
_NewLeftTabLabelPanelSpringLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, _NewLeftTabLabelCloseButtonRefPtr, -2, SpringLayoutConstraints::SOUTH_EDGE, _NewLeftTabLabelPanel);
_NewLeftTabLabelPanelSpringLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, _NewLeftTabLabelLabel, 2, SpringLayoutConstraints::NORTH_EDGE, _NewLeftTabLabelPanel);
_NewLeftTabLabelPanelSpringLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, _NewLeftTabLabelLabel, -5, SpringLayoutConstraints::WEST_EDGE, _NewLeftTabLabelCloseButtonRefPtr);
_NewLeftTabLabelPanelSpringLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, _NewLeftTabLabelLabel, 2, SpringLayoutConstraints::WEST_EDGE, _NewLeftTabLabelPanel);
_NewLeftTabLabelPanelSpringLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, _NewLeftTabLabelLabel, -2, SpringLayoutConstraints::SOUTH_EDGE, _NewLeftTabLabelPanel);
_NewLeftTabLabelPanel->setPreferredSize(Vec2f(120,20));
_NewLeftTabLabelPanel->pushToChildren(_NewLeftTabLabelLabel);
_NewLeftTabLabelPanel->pushToChildren(_NewLeftTabLabelCloseButtonRefPtr);
_NewLeftTabLabelPanel->setLayout(_NewLeftTabLabelPanelSpringLayout);
std::string sent;
std::string para="";
std::ifstream inputFile((file.string()).c_str());
while(std::getline(inputFile,sent))para+=sent+"\n";
inputFile.close();
TextAreaRefPtr _NewLeftTabTextArea = OSG::TextArea::create();
_NewLeftTabTextArea->setText(para);
_NewLeftTabTextArea->setEditable(true);
ScrollPanelRefPtr _NewLeftTabContent = ScrollPanel::create();
_NewLeftTabContent->setPreferredSize(Vec2f(200,1200));
_NewLeftTabContent->setHorizontalResizePolicy(ScrollPanel::RESIZE_TO_VIEW);
_NewLeftTabContent->setViewComponent(_NewLeftTabTextArea);
PanelRefPtr _NewRightTabLabelPanel = Panel::createEmpty();
ButtonRefPtr _RightTabLabelCloseButtonRefPtr = dynamic_pointer_cast<Button>(dynamic_cast<InternalWindow*>(InternalWindow::getClassType().getPrototype())->getTitlebar()->getCloseButton()->shallowCopy());
_RightTabLabelCloseButtonRefPtr->setPreferredSize(Vec2f(20,10));
_RightTabLabelCloseButtonRefPtr->setText("X");
_RightTabLabelCloseButtonRefPtr->addActionListener(&_CloseButtonListener);
LabelRefPtr _NewRightTabLabel=Label::create();
_NewRightTabLabel->setText(file.leaf());
_NewRightTabLabel->setBorders(NULL);
_NewRightTabLabel->setBackgrounds(NULL);
SpringLayoutRefPtr _NewRightTabLabelPanelSpringLayout = OSG::SpringLayout::create();
_NewRightTabLabelPanelSpringLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, _RightTabLabelCloseButtonRefPtr, 2, SpringLayoutConstraints::NORTH_EDGE, _NewRightTabLabelPanel);
_NewRightTabLabelPanelSpringLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, _RightTabLabelCloseButtonRefPtr, -2, SpringLayoutConstraints::EAST_EDGE, _NewRightTabLabelPanel);
_NewRightTabLabelPanelSpringLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, _RightTabLabelCloseButtonRefPtr, -20, SpringLayoutConstraints::EAST_EDGE, _NewRightTabLabelPanel);
_NewRightTabLabelPanelSpringLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, _RightTabLabelCloseButtonRefPtr, -2, SpringLayoutConstraints::SOUTH_EDGE, _NewRightTabLabelPanel);
_NewRightTabLabelPanelSpringLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, _NewRightTabLabel, 2, SpringLayoutConstraints::NORTH_EDGE, _NewRightTabLabelPanel);
_NewRightTabLabelPanelSpringLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, _NewRightTabLabel, -5, SpringLayoutConstraints::WEST_EDGE, _RightTabLabelCloseButtonRefPtr);
_NewRightTabLabelPanelSpringLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, _NewRightTabLabel, 2, SpringLayoutConstraints::WEST_EDGE, _NewRightTabLabelPanel);
_NewRightTabLabelPanelSpringLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, _NewRightTabLabel, -2, SpringLayoutConstraints::SOUTH_EDGE, _NewRightTabLabelPanel);
_NewRightTabLabelPanel->setPreferredSize(Vec2f(120,20));
_NewRightTabLabelPanel->pushToChildren(_RightTabLabelCloseButtonRefPtr);
_NewRightTabLabelPanel->pushToChildren(_NewRightTabLabel);
_NewRightTabLabelPanel->setLayout(_NewRightTabLabelPanelSpringLayout);
TextAreaRefPtr _NewRightTabTextArea = OSG::TextArea::create();
_NewRightTabTextArea->setText(para);
_NewRightTabTextArea->setEditable(true);
ScrollPanelRefPtr _NewRightTabContent = ScrollPanel::create();
_NewRightTabContent->setPreferredSize(Vec2f(200,1200));
_NewRightTabContent->setHorizontalResizePolicy(ScrollPanel::RESIZE_TO_VIEW);
_NewRightTabContent->setViewComponent(_NewRightTabTextArea);
//.........这里部分代码省略.........