本文整理汇总了C++中LLMultiSliderCtrl::updateText方法的典型用法代码示例。如果您正苦于以下问题:C++ LLMultiSliderCtrl::updateText方法的具体用法?C++ LLMultiSliderCtrl::updateText怎么用?C++ LLMultiSliderCtrl::updateText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLMultiSliderCtrl
的用法示例。
在下文中一共展示了LLMultiSliderCtrl::updateText方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onSliderCommit
// static
void LLMultiSliderCtrl::onSliderCommit(LLUICtrl* ctrl, const LLSD& userdata)
{
LLMultiSliderCtrl* self = dynamic_cast<LLMultiSliderCtrl*>(ctrl->getParent());
if (!self)
return;
BOOL success = FALSE;
F32 saved_val = self->mCurValue;
F32 new_val = self->mMultiSlider->getCurSliderValue();
self->mCurValue = new_val; // set the value temporarily so that the callback can retrieve it.
if( !self->mValidateSignal || (*(self->mValidateSignal))( self, new_val ) )
{
success = TRUE;
}
if( success )
{
self->onCommit();
}
else
{
if( self->mCurValue != saved_val )
{
self->setCurSliderValue( saved_val );
}
self->reportInvalidData();
}
self->updateText();
}
示例2: onEditorCommit
// static
void LLMultiSliderCtrl::onEditorCommit( LLUICtrl* caller, void *userdata )
{
LLMultiSliderCtrl* self = (LLMultiSliderCtrl*) userdata;
llassert( caller == self->mEditor );
BOOL success = FALSE;
F32 val = self->mCurValue;
F32 saved_val = self->mCurValue;
std::string text = self->mEditor->getText();
if( LLLineEditor::postvalidateFloat( text ) )
{
LLLocale locale(LLLocale::USER_LOCALE);
val = (F32) atof( text.c_str() );
if( self->mMultiSlider->getMinValue() <= val && val <= self->mMultiSlider->getMaxValue() )
{
if( self->mValidateCallback )
{
self->setCurSliderValue( val ); // set the value temporarily so that the callback can retrieve it.
if( self->mValidateCallback( self, self->mCallbackUserData ) )
{
success = TRUE;
}
}
else
{
self->setCurSliderValue( val );
success = TRUE;
}
}
}
if( success )
{
self->onCommit();
}
else
{
if( self->getCurSliderValue() != saved_val )
{
self->setCurSliderValue( saved_val );
}
self->reportInvalidData();
}
self->updateText();
}
示例3: onEditorCommit
// static
void LLMultiSliderCtrl::onEditorCommit( LLUICtrl* ctrl, const LLSD& userdata)
{
llassert(ctrl);
if (!ctrl)
return;
LLMultiSliderCtrl* self = dynamic_cast<LLMultiSliderCtrl*>(ctrl->getParent());
llassert(self);
if (!self) // cast failed - wrong type! :O
return;
BOOL success = FALSE;
F32 val = self->mCurValue;
F32 saved_val = self->mCurValue;
std::string text = self->mEditor->getText();
if( LLLineEditor::postvalidateFloat( text ) )
{
LLLocale locale(LLLocale::USER_LOCALE);
val = (F32) atof( text.c_str() );
if( self->mMultiSlider->getMinValue() <= val && val <= self->mMultiSlider->getMaxValue() )
{
self->setCurSliderValue( val ); // set the value temporarily so that the callback can retrieve it.
if( !self->mValidateSignal || (*(self->mValidateSignal))( self, val ) )
{
success = TRUE;
}
}
}
if( success )
{
self->onCommit();
}
else
{
if( self->getCurSliderValue() != saved_val )
{
self->setCurSliderValue( saved_val );
}
self->reportInvalidData();
}
self->updateText();
}
示例4: onSliderCommit
// static
void LLMultiSliderCtrl::onSliderCommit( LLUICtrl* caller, void *userdata )
{
LLMultiSliderCtrl* self = (LLMultiSliderCtrl*) userdata;
//llassert( caller == self->mSlider );
BOOL success = FALSE;
F32 saved_val = self->mCurValue;
F32 new_val = self->mMultiSlider->getCurSliderValue();
if( self->mValidateCallback )
{
self->mCurValue = new_val; // set the value temporarily so that the callback can retrieve it.
if( self->mValidateCallback( self, self->mCallbackUserData ) )
{
success = TRUE;
}
}
else
{
self->mCurValue = new_val;
success = TRUE;
}
if( success )
{
self->onCommit();
}
else
{
if( self->mCurValue != saved_val )
{
self->setCurSliderValue( saved_val );
}
self->reportInvalidData();
}
self->updateText();
}
示例5: fromXML
//.........这里部分代码省略.........
LLRect rect;
createRect(node, rect, parent, LLRect());
LLFontGL* font = LLView::selectFont(node);
// HACK: Font might not be specified.
if (!font)
{
font = LLFontGL::getFontSansSerifSmall();
}
S32 label_width = 0;
node->getAttributeS32("label_width", label_width);
BOOL show_text = TRUE;
node->getAttributeBOOL("show_text", show_text);
BOOL can_edit_text = FALSE;
node->getAttributeBOOL("can_edit_text", can_edit_text);
BOOL allow_overlap = FALSE;
node->getAttributeBOOL("allow_overlap", allow_overlap);
BOOL draw_track = TRUE;
node->getAttributeBOOL("draw_track", draw_track);
BOOL use_triangle = FALSE;
node->getAttributeBOOL("use_triangle", use_triangle);
F32 initial_value = 0.f;
node->getAttributeF32("initial_val", initial_value);
F32 min_value = 0.f;
node->getAttributeF32("min_val", min_value);
F32 max_value = 1.f;
node->getAttributeF32("max_val", max_value);
F32 increment = 0.1f;
node->getAttributeF32("increment", increment);
U32 precision = 3;
node->getAttributeU32("decimal_digits", precision);
S32 max_sliders = 1;
node->getAttributeS32("max_sliders", max_sliders);
S32 text_left = 0;
if (show_text)
{
// calculate the size of the text box (log max_value is number of digits - 1 so plus 1)
if ( max_value )
text_left = font->getWidth(std::string("0")) * ( static_cast < S32 > ( log10 ( max_value ) ) + precision + 1 );
if ( increment < 1.0f )
text_left += font->getWidth(std::string(".")); // (mostly) take account of decimal point in value
if ( min_value < 0.0f || max_value < 0.0f )
text_left += font->getWidth(std::string("-")); // (mostly) take account of minus sign
// padding to make things look nicer
text_left += 8;
}
LLUICtrlCallback callback = NULL;
if (label.empty())
{
label.assign(node->getTextContents());
}
LLMultiSliderCtrl* slider = new LLMultiSliderCtrl(name,
rect,
label,
font,
label_width,
rect.getWidth() - text_left,
show_text,
can_edit_text,
callback,
NULL,
initial_value,
min_value,
max_value,
increment,
max_sliders,
allow_overlap,
draw_track,
use_triangle);
slider->setPrecision(precision);
slider->initFromXML(node, parent);
slider->updateText();
return slider;
}