本文整理汇总了C++中LLSliderCtrl::setValue方法的典型用法代码示例。如果您正苦于以下问题:C++ LLSliderCtrl::setValue方法的具体用法?C++ LLSliderCtrl::setValue怎么用?C++ LLSliderCtrl::setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLSliderCtrl
的用法示例。
在下文中一共展示了LLSliderCtrl::setValue方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onHintMaxMouseUp
void LLScrollingPanelParam::onHintMaxMouseUp( void* userdata )
{
LLScrollingPanelParam* self = (LLScrollingPanelParam*) userdata;
F32 elapsed_time = self->mMouseDownTimer.getElapsedTimeF32();
if (isAgentAvatarValid())
{
LLVisualParamHint* hint = self->mHintMax;
if (elapsed_time < PARAM_STEP_TIME_THRESHOLD)
{
// step in direction
F32 current_weight = self->mWearable->getVisualParamWeight( hint->getVisualParam()->getID() );
F32 range = self->mHintMax->getVisualParamWeight() - self->mHintMin->getVisualParamWeight();
// step a fraction in the negative direction
F32 new_weight = current_weight + (range / 10.f);
F32 new_percent = self->weightToPercent(new_weight);
LLSliderCtrl* slider = self->getChild<LLSliderCtrl>("param slider");
if (slider)
{
if (slider->getMinValue() < new_percent
&& new_percent < slider->getMaxValue())
{
self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight, FALSE);
self->mWearable->writeToAvatar();
slider->setValue( self->weightToPercent( new_weight ) );
}
}
}
}
LLVisualParamHint::requestHintUpdates( self->mHintMin, self->mHintMax );
}
示例2: 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();
}
示例3: 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();
}
示例4: postBuild
BOOL LLPanelVolumePulldown::postBuild()
{
// set the initial volume-slider's position to reflect reality
LLSliderCtrl* volslider = getChild<LLSliderCtrl>( "mastervolume" );
volslider->setValue(gSavedSettings.getF32("AudioLevelMaster"));
return LLPanel::postBuild();
}
示例5: 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();
}
示例6: onHintHeldDown
void LLScrollingPanelParam::onHintHeldDown( bool max )
{
LLVisualParamHint* hint = max ? mHintMax : mHintMin;
LLViewerVisualParam* param = hint->getVisualParam();
if(!mWearable || !param)
{
return;
}
F32 current_weight = mWearable->getVisualParamWeight( param->getID() );
if (current_weight != hint->getVisualParamWeight() )
{
const F32 FULL_BLEND_TIME = 2.f;
F32 elapsed_time = mMouseDownTimer.getElapsedTimeF32() - mLastHeldTime;
mLastHeldTime += elapsed_time;
F32 new_weight;
if (current_weight > hint->getVisualParamWeight() )
{
new_weight = current_weight - (elapsed_time / FULL_BLEND_TIME);
}
else
{
new_weight = current_weight + (elapsed_time / FULL_BLEND_TIME);
}
// Make sure we're not taking the slider out of bounds
// (this is where some simple UI limits are stored)
F32 new_percent = weightToPercent(new_weight);
LLSliderCtrl* slider = getChild<LLSliderCtrl>("param slider");
if (slider)
{
if (slider->getMinValue() < new_percent
&& new_percent < slider->getMaxValue())
{
mWearable->setVisualParamWeight(param->getID(), new_weight, FALSE);
mWearable->writeToAvatar();
gAgentAvatarp->updateVisualParams();
slider->setValue( weightToPercent( new_weight ) );
}
}
}
}
示例7: onHintMouseUp
void LLScrollingPanelParam::onHintMouseUp( bool max )
{
F32 elapsed_time = mMouseDownTimer.getElapsedTimeF32();
if (isAgentAvatarValid())
{
LLVisualParamHint* hint = max ? mHintMax : mHintMin;
if (elapsed_time < PARAM_STEP_TIME_THRESHOLD)
{
LLViewerVisualParam* param = hint->getVisualParam();
if(mWearable)
{
// step in direction
F32 current_weight = mWearable->getVisualParamWeight( param->getID() );
F32 range = mHintMax->getVisualParamWeight() - mHintMin->getVisualParamWeight();
//if min, range should be negative.
if(!max)
range *= -1.f;
// step a fraction in the negative direction
F32 new_weight = current_weight + (range / 10.f);
F32 new_percent = weightToPercent(new_weight);
LLSliderCtrl* slider = getChild<LLSliderCtrl>("param slider");
if (slider)
{
if (slider->getMinValue() < new_percent
&& new_percent < slider->getMaxValue())
{
mWearable->setVisualParamWeight(param->getID(), new_weight, FALSE);
mWearable->writeToAvatar();
slider->setValue( weightToPercent( new_weight ) );
}
}
}
}
}
LLVisualParamHint::requestHintUpdates( mHintMin, mHintMax );
}
示例8: LLScrollingPanel
LLScrollingPanelParamBase::LLScrollingPanelParamBase( const std::string& name,
LLViewerJointMesh* mesh, LLViewerVisualParam* param, BOOL allow_modify, LLWearable* wearable, bool bVisualHint, LLRect rect )
: LLScrollingPanel( name, rect ),
mParam(param),
mAllowModify(allow_modify),
mWearable(wearable)
{
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_scrolling_param.xml");
//Set up the slider
LLSliderCtrl *slider = getChild<LLSliderCtrl>("param slider");
//Kill everything that isn't the slider...
if(!bVisualHint)
{
child_list_t to_remove;
child_list_t::const_iterator it;
for (it = getChildList()->begin(); it != getChildList()->end(); it++)
{
if ((*it) != slider && (*it)->getName() != "panel border")
{
to_remove.push_back(*it);
}
}
for (it = to_remove.begin(); it != to_remove.end(); it++)
{
removeChild(*it);
delete (*it);
}
slider->translate(0,/*PARAM_HINT_HEIGHT*/128);
reshape(getRect().getWidth(),getRect().getHeight()-128);
}
slider->setValue(weightToPercent(param->getWeight()));
slider->setLabelArg("[DESC]", param->getDisplayName());
slider->setEnabled(mAllowModify);
slider->setCommitCallback(boost::bind(&LLScrollingPanelParamBase::onSliderMoved, this, _1));
setVisible(FALSE);
setBorderVisible( FALSE );
}
示例9: 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();
}
示例10: syncMenu
void LLFloaterEnvSettings::syncMenu()
{
LLSliderCtrl* sldr;
sldr = getChild<LLSliderCtrl>("EnvTimeSlider");
// sync the clock
F32 val = (F32)LLWLParamManager::instance()->mAnimator.getDayTime();
std::string timeStr = timeToString(val);
LLTextBox* textBox;
textBox = getChild<LLTextBox>("EnvTimeText");
textBox->setValue(timeStr);
// sync time slider which starts at 6 AM
val -= 0.25;
if(val < 0)
{
val++;
}
sldr->setValue(val);
// sync cloud coverage
bool err;
childSetValue("EnvCloudSlider", LLWLParamManager::instance()->mCurParams.getFloat("cloud_shadow", err));
LLWaterParamManager * param_mgr = LLWaterParamManager::instance();
// sync water params
LLColor4 col = param_mgr->getFogColor();
LLColorSwatchCtrl* colCtrl = getChild<LLColorSwatchCtrl>("EnvWaterColor");
col.mV[3] = 1.0f;
colCtrl->set(col);
childSetValue("EnvWaterFogSlider", param_mgr->mFogDensity.mExp);
param_mgr->setDensitySliderValue(param_mgr->mFogDensity.mExp);
// turn off Use Estate Time button if it's already being used
if(LLWLParamManager::instance()->mAnimator.mUseLindenTime)
{
childDisable("EnvUseEstateTimeButton");
} else {
childEnable("EnvUseEstateTimeButton");
}
if(!gPipeline.canUseVertexShaders())
{
childDisable("EnvWaterColor");
childDisable("EnvWaterColorText");
//childDisable("EnvAdvancedWaterButton");
}
else
{
childEnable("EnvWaterColor");
childEnable("EnvWaterColorText");
//childEnable("EnvAdvancedWaterButton");
}
// only allow access to these if they are using windlight
if(!gPipeline.canUseWindLightShaders())
{
childDisable("EnvCloudSlider");
childDisable("EnvCloudText");
//childDisable("EnvAdvancedSkyButton");
}
else
{
childEnable("EnvCloudSlider");
childEnable("EnvCloudText");
//childEnable("EnvAdvancedSkyButton");
}
}