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


C++ LLSpinCtrl::updateEditor方法代码示例

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


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

示例1: onDownBtn

// static
void LLSpinCtrl::onDownBtn( void *userdata )
{
	LLSpinCtrl* self = (LLSpinCtrl*) userdata;

	if( self->getEnabled() )
	{
		F32 val = (F32)self->getValue().asReal() - self->mIncrement;
		val = clamp_precision(val, self->mPrecision);
		val = llmax( val, self->mMinValue );

		if( self->mValidateCallback )
		{
			F32 saved_val = (F32)self->getValue().asReal();
			self->setValue(val);
			if( !self->mValidateCallback( self, self->mCallbackUserData ) )
			{
				self->setValue( saved_val );
				self->reportInvalidData();
				self->updateEditor();
				return;
			}
		}
		else
		{
			self->setValue(val);
		}
		
		self->updateEditor();
		self->onCommit();
	}
}
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:32,代码来源:llspinctrl.cpp

示例2: onUpBtn

// static
void LLSpinCtrl::onUpBtn( void *userdata )
{
	LLSpinCtrl* self = (LLSpinCtrl*) userdata;
	if( self->getEnabled() )
	{
		// use getValue()/setValue() to force reload from/to control
		F32 val = (F32)self->getValue().asReal() + self->mIncrement;
		val = clamp_precision(val, self->mPrecision);
		val = llmin( val, self->mMaxValue );
		
		if( self->mValidateCallback )
		{
			F32 saved_val = (F32)self->getValue().asReal();
			self->setValue(val);
			if( !self->mValidateCallback( self, self->mCallbackUserData ) )
			{
				self->setValue( saved_val );
				self->reportInvalidData();
				self->updateEditor();
				return;
			}
		}
		else
		{
			self->setValue(val);
		}

		self->updateEditor();
		self->onCommit();
	}
}
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:32,代码来源:llspinctrl.cpp

示例3: onDownBtn

// static
void LLSpinCtrl::onDownBtn( void *userdata )
{
	LLSpinCtrl* self = (LLSpinCtrl*) userdata;

	if( self->getEnabled() )
	{
		F32 val = (F32)self->getValue().asReal() - get_increment(self->mIncrement, self->mPrecision);
		val = clamp_precision(val, self->mPrecision);
		val = llmax( val, self->mMinValue );


		if (val < self->mMinValue) val = self->mMinValue;
		if (val > self->mMaxValue) val = self->mMaxValue;

		F32 saved_val = (F32)self->getValue().asReal();
		self->setValue(val);
		if( (self->mValidateCallback 	&& !self->mValidateCallback( self, self->mCallbackUserData ) ) ||
			(self->mValidateSignal		&& !(*(self->mValidateSignal))( self, val ) ))
		{
			self->setValue( saved_val );
			self->reportInvalidData();
			self->updateEditor();
			return;
		}
		
		self->updateEditor();
		self->onCommit();
	}
}
开发者ID:Krazy-Bish-Margie,项目名称:SingularityViewer,代码行数:30,代码来源:llspinctrl.cpp

示例4: onDownBtn

// static
void LLSpinCtrl::onDownBtn( void *userdata )
{
	LLSpinCtrl* self = (LLSpinCtrl*) userdata;

	if( self->getEnabled() )
	{
		F32 inc = self->mIncrement;
		if(gKeyboard->getKeyDown(KEY_CONTROL))inc = inc * 0.10;
		else if(gKeyboard->getKeyDown(KEY_SHIFT))inc = inc * 0.01;
		F32 val = (F32)self->getValue().asReal() - inc;
		val = clamp_precision(val, self->mPrecision);
		val = llmax( val, self->mMinValue );

		if( self->mValidateCallback )
		{
			F32 saved_val = (F32)self->getValue().asReal();
			self->setValue(val);
			if( !self->mValidateCallback( self, self->mCallbackUserData ) )
			{
				self->setValue( saved_val );
				self->reportInvalidData();
				self->updateEditor();
				return;
			}
		}
		else
		{
			self->setValue(val);
		}
		
		self->updateEditor();
		self->onCommit();
	}
}
开发者ID:mmorciegov,项目名称:emeraldviewer,代码行数:35,代码来源:llspinctrl.cpp

示例5: onEditorCommit

void LLSpinCtrl::onEditorCommit( LLUICtrl* caller, void *userdata )
{
	BOOL success = FALSE;
	
	LLSpinCtrl* self = (LLSpinCtrl*) userdata;
	llassert( caller == self->mEditor );

	if( self->mEditor->evaluateFloat() )
	{
		std::string text = self->mEditor->getText();
		
		LLLocale locale(LLLocale::USER_LOCALE);
		F32 val = (F32) atof(text.c_str());

		if (val < self->mMinValue) val = self->mMinValue;
		if (val > self->mMaxValue) val = self->mMaxValue;

		if( self->mValidateCallback )
		{
			F32 saved_val = self->mValue;
			self->mValue = val;
			if( self->mValidateCallback( self, self->mCallbackUserData ) )
			{
				success = TRUE;
				self->onCommit();
			}
			else
			{
				self->mValue = saved_val;
			}
		}
		else
		{
			self->mValue = val;
			self->onCommit();
			success = TRUE;
		}
	}
	else
	{
		// We want to update the editor in case it fails while blanking -- MC
		success = TRUE;
	}

	if( success )
	{
		self->updateEditor();
	}
	else
	{
		self->reportInvalidData();		
	}
}
开发者ID:Beeks,项目名称:Ascent,代码行数:53,代码来源:llspinctrl.cpp

示例6: onEditorCommit

void LLSpinCtrl::onEditorCommit( LLUICtrl* caller, void *userdata )
{
	BOOL success = FALSE;
	
	LLSpinCtrl* self = (LLSpinCtrl*) userdata;
	llassert( caller == self->mEditor );

	std::string text = self->mEditor->getText();
	if( LLLineEditor::postvalidateFloat( text ) )
	{
		LLLocale locale(LLLocale::USER_LOCALE);
		F32 val = (F32) atof(text.c_str());

		if (val < self->mMinValue) val = self->mMinValue;
		if (val > self->mMaxValue) val = self->mMaxValue;

		if( self->mValidateCallback )
		{
			F32 saved_val = self->mValue;
			self->mValue = val;
			if( self->mValidateCallback( self, self->mCallbackUserData ) )
			{
				success = TRUE;
				self->onCommit();
			}
			else
			{
				self->mValue = saved_val;
			}
		}
		else
		{
			self->mValue = val;
			self->onCommit();
			success = TRUE;
		}
	}
	self->updateEditor();

	if( !success )
	{
		self->reportInvalidData();		
	}
}
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:44,代码来源:llspinctrl.cpp


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