当前位置: 首页>>代码示例>>C++>>正文


C++ LLSliderCtrl::onCommit方法代码示例

本文整理汇总了C++中LLSliderCtrl::onCommit方法的典型用法代码示例。如果您正苦于以下问题:C++ LLSliderCtrl::onCommit方法的具体用法?C++ LLSliderCtrl::onCommit怎么用?C++ LLSliderCtrl::onCommit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LLSliderCtrl的用法示例。


在下文中一共展示了LLSliderCtrl::onCommit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: onSliderCommit

// static
void LLSliderCtrl::onSliderCommit( LLUICtrl* ctrl, const LLSD& userdata )
{
	LLSliderCtrl* self = dynamic_cast<LLSliderCtrl*>(ctrl->getParent());
	if (!self)
		return;

	BOOL success = FALSE;
	F32 saved_val = self->mValue;
	F32 new_val = self->mSlider->getValueF32();

	self->mValue = 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->mValue != saved_val )
		{
			self->setValue( saved_val );
		}
		self->reportInvalidData();		
	}
	self->updateText();
}
开发者ID:Xara,项目名称:Opensource-V2-SL-Viewer,代码行数:31,代码来源:llsliderctrl.cpp

示例2: onEditorCommit

// static
void LLSliderCtrl::onEditorCommit( LLUICtrl* caller, void *userdata )
{
    LLSliderCtrl* self = (LLSliderCtrl*) userdata;
    llassert( caller == self->mEditor );

    BOOL success = FALSE;
    F32 val = self->mValue;
    F32 saved_val = self->mValue;

    std::string text = self->mEditor->getText();
    if( LLLineEditor::postvalidateFloat( text ) )
    {
        LLLocale locale(LLLocale::USER_LOCALE);
        val = (F32) atof( text.c_str() );
        if( self->mSlider->getMinValue() <= val && val <= self->mSlider->getMaxValue() )
        {
            if( self->mValidateCallback )
            {
                self->setValue( val );  // set the value temporarily so that the callback can retrieve it.
                if( self->mValidateCallback( self, self->mCallbackUserData ) )
                {
                    success = TRUE;
                }
            }
            else
            {
                self->setValue( val );
                success = TRUE;
            }
        }
    }

    if( success )
    {
        self->onCommit();
    }
    else
    {
        if( self->getValueF32() != saved_val )
        {
            self->setValue( saved_val );
        }
        self->reportInvalidData();
    }
    self->updateText();
}
开发者ID:wangfeilong321,项目名称:Luna-Viewer,代码行数:47,代码来源:llsliderctrl.cpp

示例3: onEditorCommit

// static
void LLSliderCtrl::onEditorCommit( LLUICtrl* ctrl, const LLSD& userdata )
{
	LLSliderCtrl* self = dynamic_cast<LLSliderCtrl*>(ctrl->getParent());
	if (!self)
		return;

	BOOL success = FALSE;
	F32 val = self->mValue;
	F32 saved_val = self->mValue;

	std::string text = self->mEditor->getText();
	if( LLLineEditor::postvalidateFloat( text ) )
	{
		LLLocale locale(LLLocale::USER_LOCALE);
		val = (F32) atof( text.c_str() );
		if( self->mSlider->getMinValue() <= val && val <= self->mSlider->getMaxValue() )
		{
			self->setValue( 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->getValueF32() != saved_val )
		{
			self->setValue( saved_val );
		}
		self->reportInvalidData();		
	}
	self->updateText();
}
开发者ID:Xara,项目名称:Opensource-V2-SL-Viewer,代码行数:40,代码来源:llsliderctrl.cpp

示例4: onSliderCommit

// static
void LLSliderCtrl::onSliderCommit( LLUICtrl* caller, void *userdata )
{
    LLSliderCtrl* self = (LLSliderCtrl*) userdata;
    llassert( caller == self->mSlider );

    BOOL success = FALSE;
    F32 saved_val = self->mValue;
    F32 new_val = self->mSlider->getValueF32();

    if( self->mValidateCallback )
    {
        self->mValue = new_val;  // set the value temporarily so that the callback can retrieve it.
        if( self->mValidateCallback( self, self->mCallbackUserData ) )
        {
            success = TRUE;
        }
    }
    else
    {
        self->mValue = new_val;
        success = TRUE;
    }

    if( success )
    {
        self->onCommit();
    }
    else
    {
        if( self->mValue != saved_val )
        {
            self->setValue( saved_val );
        }
        self->reportInvalidData();
    }
    self->updateText();
}
开发者ID:wangfeilong321,项目名称:Luna-Viewer,代码行数:38,代码来源:llsliderctrl.cpp


注:本文中的LLSliderCtrl::onCommit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。