本文整理汇总了C++中CControl::setValue方法的典型用法代码示例。如果您正苦于以下问题:C++ CControl::setValue方法的具体用法?C++ CControl::setValue怎么用?C++ CControl::setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CControl
的用法示例。
在下文中一共展示了CControl::setValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: verifyView
//----------------------------------------------------------------------------------------------------
CView* UIFocusSettingsController::verifyView (CView* view, const UIAttributes& attributes, const IUIDescription* description)
{
CControl* control = dynamic_cast<CControl*>(view);
if (control)
{
switch (control->getTag ())
{
case kEnabledTag:
{
bool value = false;
settings->getBooleanAttribute ("enabled", value);
control->setValue (value ? control->getMax () : control->getMin ());
controls[kEnabledTag] = control;
break;
}
case kColorTag:
{
COptionMenu* menu = dynamic_cast<COptionMenu*>(control);
if (menu)
{
controls[kColorTag] = control;
const std::string* current = settings->getAttributeValue ("color");
std::list<const std::string*> names;
editDescription->collectColorNames (names);
names.sort (UIEditController::std__stringCompare);
int32_t index = 0;
for (std::list<const std::string*>::const_iterator it = names.begin (); it != names.end (); it++, index++)
{
menu->addEntry (new CMenuItem ((*it)->c_str ()));
if (current && *current == *(*it))
{
menu->setValue ((float)index);
}
}
}
break;
}
case kWidthTag:
{
controls[kWidthTag] = control;
CTextEdit* edit = dynamic_cast<CTextEdit*>(control);
if (edit)
{
#if VSTGUI_HAS_FUNCTIONAL
edit->setStringToValueFunction (stringToValue);
edit->setValueToStringFunction (valueToString);
#else
edit->setStringToValueProc (stringToValue);
edit->setValueToStringProc (valueToString);
#endif
}
double current = 1.;
settings->getDoubleAttribute ("width", current);
control->setValue ((float)current);
break;
}
}
}
return view;
}
示例2: animationFinished
//-----------------------------------------------------------------------------
void ControlValueAnimation::animationFinished (CView* view, IdStringPtr name, bool wasCanceled)
{
CControl* control = dynamic_cast<CControl*> (view);
if (control)
{
if (!wasCanceled || forceEndValueOnFinish)
control->setValue (endValue);
}
}
示例3: animationTick
//-----------------------------------------------------------------------------
void ControlValueAnimation::animationTick (CView* view, IdStringPtr name, float pos)
{
CControl* control = dynamic_cast<CControl*> (view);
if (control)
{
float value = startValue + (endValue - startValue) * pos;
control->setValue (value);
}
}