本文整理汇总了C++中Style::createFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ Style::createFrame方法的具体用法?C++ Style::createFrame怎么用?C++ Style::createFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Style
的用法示例。
在下文中一共展示了Style::createFrame方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createGraphicsImplementation
void PushButton::createGraphicsImplementation()
{
osg::ref_ptr<osg::Group> group = new osg::Group;
Style* style = (getStyle()!=0) ? getStyle() : Style::instance().get();
float unFocused = 0.92;
float withFocus = 0.97;
osg::Vec4 frameColor(unFocused,unFocused,unFocused,1.0f);
osg::BoundingBox extents(_extents);
bool requiresFrame = (getFrameSettings() && getFrameSettings()->getShape()!=osgUI::FrameSettings::NO_FRAME);
if (requiresFrame)
{
group->addChild(style->createFrame(_extents, getFrameSettings(), frameColor));
extents.xMin() += getFrameSettings()->getLineWidth();
extents.xMax() -= getFrameSettings()->getLineWidth();
extents.yMin() += getFrameSettings()->getLineWidth();
extents.yMax() -= getFrameSettings()->getLineWidth();
}
_buttonSwitch = new osg::Switch;
_buttonSwitch->addChild(style->createPanel(extents, osg::Vec4(unFocused, unFocused,unFocused, 1.0)));
_buttonSwitch->addChild(style->createPanel(extents, osg::Vec4(withFocus,withFocus,withFocus,1.0)));
_buttonSwitch->setSingleChildOn(0);
group->addChild(_buttonSwitch.get());
// create label.
osg::ref_ptr<Node> node = style->createText(extents, getAlignmentSettings(), getTextSettings(), _text);
_textDrawable = dynamic_cast<osgText::Text*>(node.get());
_textDrawable->setDataVariance(osg::Object::DYNAMIC);
group->addChild(_textDrawable.get());
style->setupClipStateSet(_extents, getOrCreateStateSet());
setGraphicsSubgraph(0, group.get());
}
示例2: createGraphicsImplementation
void Popup::createGraphicsImplementation()
{
_transform = new osg::PositionAttitudeTransform;
Style* style = (getStyle()!=0) ? getStyle() : Style::instance().get();
osg::Vec4 dialogBackgroundColor(0.9,0.9,0.9,1.0);
_transform->addChild( style->createPanel(_extents, dialogBackgroundColor) );
bool requiresFrame = (getFrameSettings() && getFrameSettings()->getShape()!=osgUI::FrameSettings::NO_FRAME);
if (requiresFrame) { _transform->addChild(style->createFrame(_extents, getFrameSettings(), dialogBackgroundColor)); }
style->setupDialogStateSet(getOrCreateStateSet());
style->setupClipStateSet(_extents, getOrCreateStateSet());
// render before the subgraph
setGraphicsSubgraph(-1, _transform.get());
// render after the subgraph
setGraphicsSubgraph(1, style->createDepthSetPanel(_extents));
}
示例3: createGraphicsImplementation
void Dialog::createGraphicsImplementation()
{
_group = new osg::Group;
Style* style = (getStyle()!=0) ? getStyle() : Style::instance().get();
float titleHeight = 10.0;
osg::BoundingBox titleBarExtents(_extents.xMin(), _extents.yMax(), _extents.zMin(), _extents.xMax()-titleHeight, _extents.yMax()+titleHeight, _extents.zMin());
osg::BoundingBox closeButtonExtents(_extents.xMax()-titleHeight, _extents.yMax(), _extents.zMin(), _extents.xMax(), _extents.yMax()+titleHeight, _extents.zMin());
osg::Vec4 dialogBackgroundColor(0.84,0.82,0.82,1.0);
osg::Vec4 dialogTitleBackgroundColor(0.5,0.5,1.0,1.0);
_group->addChild( style->createPanel(_extents, dialogBackgroundColor) );
_group->addChild( style->createPanel(titleBarExtents, dialogTitleBackgroundColor) );
osg::BoundingBox dialogWithTitleExtents(_extents);
dialogWithTitleExtents.expandBy(titleBarExtents);
dialogWithTitleExtents.expandBy(closeButtonExtents);
bool requiresFrame = (getFrameSettings() && getFrameSettings()->getShape()!=osgUI::FrameSettings::NO_FRAME);
if (requiresFrame)
{
_group->addChild(style->createFrame(dialogWithTitleExtents, getFrameSettings(), dialogBackgroundColor));
titleBarExtents.xMin() += getFrameSettings()->getLineWidth();
titleBarExtents.yMax() -= getFrameSettings()->getLineWidth();
closeButtonExtents.xMax() -= getFrameSettings()->getLineWidth();
closeButtonExtents.yMax() -= getFrameSettings()->getLineWidth();
}
OSG_NOTICE<<"Dialog::_extents ("<<_extents.xMin()<<", "<<_extents.yMin()<<", "<<_extents.zMin()<<"), ("<<_extents.xMax()<<", "<<_extents.yMax()<<", "<<_extents.zMax()<<")"<<std::endl;
OSG_NOTICE<<"Dialog::titleBarExtents ("<<titleBarExtents.xMin()<<", "<<titleBarExtents.yMin()<<", "<<titleBarExtents.zMin()<<"), ("<<titleBarExtents.xMax()<<", "<<titleBarExtents.yMax()<<", "<<titleBarExtents.zMax()<<")"<<std::endl;
OSG_NOTICE<<"Dialog::dialogWithTitleExtents ("<<dialogWithTitleExtents.xMin()<<", "<<dialogWithTitleExtents.yMin()<<", "<<dialogWithTitleExtents.zMin()<<"), ("<<dialogWithTitleExtents.xMax()<<", "<<dialogWithTitleExtents.yMax()<<", "<<dialogWithTitleExtents.zMax()<<")"<<std::endl;
#if 0
osg::ref_ptr<Node> node = style->createText(titleBarExtents, getAlignmentSettings(), getTextSettings(), _title);
_titleDrawable = dynamic_cast<osgText::Text*>(node.get());
_titleDrawable->setDataVariance(osg::Object::DYNAMIC);
_group->addChild(_titleDrawable.get());
#endif
osg::ref_ptr<PushButton> closeButton = new osgUI::PushButton;
closeButton->setExtents(closeButtonExtents);
closeButton->setText("x");
closeButton->setAlignmentSettings(getAlignmentSettings());
closeButton->setTextSettings(getTextSettings());
//closeButton->setFrameSettings(getFrameSettings());
closeButton->getOrCreateUserDataContainer()->addUserObject(new osgUI::CloseCallback("released", this));
osg::ref_ptr<Label> titleLabel = new osgUI::Label;
titleLabel->setExtents(titleBarExtents);
titleLabel->setText(_title);
titleLabel->setAlignmentSettings(getAlignmentSettings());
titleLabel->setTextSettings(getTextSettings());
titleLabel->setFrameSettings(getFrameSettings());
titleLabel->getOrCreateUserDataContainer()->addUserObject(new osgUI::DragCallback);
_group->addChild(closeButton.get());
_group->addChild(titleLabel.get());
style->setupDialogStateSet(getOrCreateWidgetStateSet(), 5);
style->setupClipStateSet(dialogWithTitleExtents, getOrCreateWidgetStateSet());
// render before the subgraph
setGraphicsSubgraph(-1, _group.get());
// render after the subgraph
setGraphicsSubgraph(1, style->createDepthSetPanel(dialogWithTitleExtents));
}
示例4: createGraphicsImplementation
void ComboBox::createGraphicsImplementation()
{
Style *style = (getStyle() != 0) ? getStyle() : Style::instance().get();
_buttonSwitch = new osg::Switch;
_popup = new osgUI::Popup;
_popup->setVisible(false);
_popup->setFrameSettings(getFrameSettings());
osg::BoundingBox extents(_extents);
osg::ref_ptr<osg::Group> group = new osg::Group;
bool requiresFrame = (getFrameSettings() && getFrameSettings()->getShape() != osgUI::FrameSettings::NO_FRAME);
float frameWidth = 0.0;
float unFocused = 0.92;
float withFocus = 0.97;
osg::Vec4 frameColor(unFocused, unFocused, unFocused, 1.0f);
if (requiresFrame)
{
frameWidth = getFrameSettings()->getLineWidth();
group->addChild(style->createFrame(_extents, getFrameSettings(), frameColor));
extents.xMin() += frameWidth;
extents.xMax() -= frameWidth;
extents.yMin() += frameWidth;
extents.yMax() -= frameWidth;
}
bool itemsHaveColor = false;
for (Items::iterator itr = _items.begin();
itr != _items.end();
++itr)
{
Item *item = itr->get();
if (item->getColor().a() != 0.0f)
{
itemsHaveColor = true; break;
}
}
// work out position of carat.
float h = extents.yMax() - extents.yMin();
float w = h * 0.7;
float minItemWidth = (extents.xMax() - extents.xMin()) * 0.5f;
if (w > minItemWidth)
w = minItemWidth;
float xDivision = extents.xMax() - w;
osg::BoundingBox backgroundExtents = extents;
osg::BoundingBox iconExtents = backgroundExtents;
iconExtents.xMin() = xDivision;
extents.xMax() = xDivision;
if (itemsHaveColor)
{
backgroundExtents.xMin() = xDivision;
}
OSG_NOTICE << "itemsHaveColor = " << itemsHaveColor << std::endl;
// clear background of edit region
_backgroundSwitch = new osg::Switch;
_backgroundSwitch->addChild(style->createPanel(backgroundExtents, osg::Vec4(unFocused, unFocused, unFocused, 1.0)));
_backgroundSwitch->addChild(style->createPanel(backgroundExtents, osg::Vec4(withFocus, withFocus, withFocus, 1.0)));
_backgroundSwitch->setSingleChildOn(0);
// assign carat
group->addChild(_backgroundSwitch.get());
group->addChild(_buttonSwitch.get());
// group->addChild(style->createIcon(iconExtents, "cow.osgt", osg::Vec4(withFocus, withFocus, withFocus,1.0)));
group->addChild(style->createIcon(iconExtents, "Images/osg64.png", osg::Vec4(withFocus, withFocus, withFocus, 1.0)));
if (!_items.empty())
{
float margin = (extents.yMax() - extents.yMin()) * 0.1f;
// float itemWidth = (_extents.xMax()-_extents.xMin()) - 2.0f*frameWidth;
float itemHeight = (_extents.yMax() - _extents.yMin()) - 2.0f * frameWidth;
float popupHeight = (itemHeight) * _items.size() + margin * static_cast<float>(_items.size() - 1) + 2.0f * frameWidth;
float popupTop = _extents.yMin() - frameWidth - margin * 1.0f;
float popupLeft = _extents.xMin();
float popupRight = _extents.xMax();
osg::BoundingBox popupExtents(popupLeft, popupTop - popupHeight, _extents.zMin(), popupRight, popupTop, _extents.zMax());
_popup->setExtents(popupExtents);
osg::BoundingBox popupItemExtents(popupExtents.xMin() + frameWidth, popupTop - frameWidth - itemHeight, popupExtents.zMin(), popupExtents.xMax() - frameWidth, popupTop - frameWidth, popupExtents.zMax());
_popupItemOrigin.set(popupItemExtents.xMin(), popupItemExtents.yMax(), popupExtents.zMin());
_popupItemSize.set(popupItemExtents.xMax() - popupItemExtents.xMin(), -(itemHeight + margin), 0.0);
unsigned int index = 0;
//.........这里部分代码省略.........