本文整理汇总了C++中mygui::Widget::getUserString方法的典型用法代码示例。如果您正苦于以下问题:C++ Widget::getUserString方法的具体用法?C++ Widget::getUserString怎么用?C++ Widget::getUserString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mygui::Widget
的用法示例。
在下文中一共展示了Widget::getUserString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onClickApply
//-------------------------------------------------------------------------------
void MaterialViewer::onClickApply(MyGUI::WidgetPtr)
{
//Update properties.
MyGUI::EnumeratorWidgetPtr iter = mWindow->getEnumerator();
while (iter.next())
{
MyGUI::Widget *widget = iter.current();
if (widget->getUserString("type") == "MaterialProperty")
mMaterialSettings[widget->getUserString("property")] = dynamic_cast<MyGUI::Edit*>(widget)->getOnlyText();
}
MyGUI::ComboBoxPtr list = GlbVar.gui->findWidget<MyGUI::ComboBox>("cmb_materialType");
mMaterialType = list->getItemNameAt(list->getIndexSelected());
//Compile.
compileMaterial();
}
示例2: align
void VBox::align ()
{
unsigned int count = getChildCount ();
size_t v_stretched_count = 0;
int total_height = 0;
int total_width = 0;
std::vector< std::pair<MyGUI::IntSize, bool> > sizes;
for (unsigned int i = 0; i < count; ++i)
{
MyGUI::Widget* w = getChildAt(i);
bool vstretch = w->getUserString ("VStretch") == "true";
v_stretched_count += vstretch;
AutoSizedWidget* aw = dynamic_cast<AutoSizedWidget*>(w);
if (aw)
{
sizes.push_back(std::make_pair(aw->getRequestedSize (), vstretch));
total_height += aw->getRequestedSize ().height;
total_width = std::max(total_width, aw->getRequestedSize ().width);
}
else
{
sizes.push_back (std::make_pair(w->getSize(), vstretch));
total_height += w->getSize().height;
if (!(w->getUserString("HStretch") == "true"))
total_width = std::max(total_width, w->getSize().width);
}
if (i != count-1)
total_height += mSpacing;
}
if (mAutoResize && (total_width+mPadding*2 != getSize().width || total_height+mPadding*2 != getSize().height))
{
setSize(MyGUI::IntSize(total_width+mPadding*2, total_height+mPadding*2));
return;
}
int curY = 0;
for (unsigned int i = 0; i < count; ++i)
{
if (i==0)
curY += mPadding;
MyGUI::Widget* w = getChildAt(i);
bool hstretch = w->getUserString ("HStretch") == "true";
int width = hstretch ? total_width : sizes[i].first.width;
MyGUI::IntCoord widgetCoord;
widgetCoord.top = curY;
widgetCoord.left = mPadding + (getSize().width-mPadding*2 - width) / 2;
int height = sizes[i].second ? sizes[i].first.height + (getSize().height-mPadding*2 - total_height)/v_stretched_count
: sizes[i].first.height;
widgetCoord.height = height;
widgetCoord.width = width;
w->setCoord(widgetCoord);
curY += height;
if (i != count-1)
curY += mSpacing;
}
}
示例3: init
//-------------------------------------------------------------------------------
void MaterialViewer::init()
{
//Create the mesh.
mNode = GlbVar.ogreSmgr->getRootSceneNode()->createChildSceneNode("materialcube-node");
mEntity = GlbVar.ogreSmgr->createEntity("materialcube-entity", "Mesh_Cube.mesh");
mNode->attachObject(mEntity);
//Camera.
mCameraYawNode = GlbVar.ogreSmgr->getRootSceneNode()->createChildSceneNode("materialviewercamera-yawnode");
mCameraPitchNode = mCameraYawNode->createChildSceneNode("materialviewercamera-pitchnode");
mCameraDist = 3;
//Some test settings.
mMaterialType = "BaseNormalMapParallax";
mMaterialSettings["diffuse_tex"] = "WhiteTile1.png";
mMaterialSettings["normal_tex"] = "WhiteTile_NM.png";
mMaterialSettings["glow_tex"] = "WhiteLight_GW.png";
mMaterialSettings["ambient"] = "0.7 0.7 0.7 1";
mMaterialSettings["diffuse"] = "0.9 0.9 0.9 1";
mMaterialSettings["specular"] = "0.8 0.8 0.8 1";
mMaterialSettings["scaleBias"] = "0.04 0.02";
mMaterialSettings["glow_amount"] = "0.5";
//First compile.
compileMaterial();
//Load the layout.
MyGUI::LayoutManager::getInstance().loadLayout("MaterialViewer.layout");
mWindow = GlbVar.gui->findWidget<MyGUI::Window>("win_materialViewer");
//Callbacks.
MyGUI::ButtonPtr button = GlbVar.gui->findWidget<MyGUI::Button>("but_applyMaterial");
button->eventMouseButtonClick += MyGUI::newDelegate(this, &MaterialViewer::onClickApply);
button = GlbVar.gui->findWidget<MyGUI::Button>("but_saveMaterial");
button->eventMouseButtonClick += MyGUI::newDelegate(this, &MaterialViewer::onClickSave);
button = GlbVar.gui->findWidget<MyGUI::Button>("but_createLight");
button->eventMouseButtonClick += MyGUI::newDelegate(this, &MaterialViewer::onClickCreateLight);
//Update the editboxes.
MyGUI::EnumeratorWidgetPtr iter = mWindow->getEnumerator();
while (iter.next())
{
MyGUI::Widget *widget = iter.current();
if (widget->getUserString("type") == "MaterialProperty")
dynamic_cast<MyGUI::Edit*>(widget)->setOnlyText(mMaterialSettings[widget->getUserString("property")]);
}
GlbVar.gui->findWidget<MyGUI::Edit>("edt_lightColour")->setOnlyText("0.7 0.7 0.7");
//Populate the material type list.
MyGUI::ComboBoxPtr list = GlbVar.gui->findWidget<MyGUI::ComboBox>("cmb_materialType");
list->insertItemAt(0, "Base");
list->insertItemAt(1, "BaseNormalMap");
list->insertItemAt(2, "BaseNormalMapParallax");
list->insertItemAt(3, "BaseGlow");
list->insertItemAt(4, "BaseNormalMapGlow");
list->insertItemAt(5, "BaseNormalMapParallaxGlow");
list->insertItemAt(6, "BaseTransparent");
list->setIndexSelected(2);
}