本文整理汇总了C++中LLMultiSliderCtrl类的典型用法代码示例。如果您正苦于以下问题:C++ LLMultiSliderCtrl类的具体用法?C++ LLMultiSliderCtrl怎么用?C++ LLMultiSliderCtrl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LLMultiSliderCtrl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: LLFloater
LLFloaterDayCycle::LLFloaterDayCycle() : LLFloater(std::string("Day Cycle Floater"))
{
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_day_cycle_options.xml");
// add the combo boxes
LLComboBox* keyCombo = getChild<LLComboBox>("WLKeyPresets");
if(keyCombo != NULL)
{
std::map<std::string, LLWLParamSet>::iterator mIt =
LLWLParamManager::instance()->mParamList.begin();
for(; mIt != LLWLParamManager::instance()->mParamList.end(); mIt++)
{
if(mIt->second.mInventoryID.isNull())
keyCombo->add(std::string(mIt->first));
}
// set defaults on combo boxes
keyCombo->selectFirstItem();
}
// add the time slider
LLMultiSliderCtrl* sldr = getChild<LLMultiSliderCtrl>("WLTimeSlider");
sldr->addSlider();
// load it up
initCallbacks();
}
示例3: llassert_always
void LLFloaterDayCycle::syncTrack()
{
// if no keys, do nothing
if(sSliderToKey.size() == 0)
{
return;
}
LLMultiSliderCtrl* sldr;
sldr = sDayCycle->getChild<LLMultiSliderCtrl>(
"WLDayCycleKeys");
llassert_always(sSliderToKey.size() == sldr->getValue().size());
LLMultiSliderCtrl* tSldr;
tSldr = sDayCycle->getChild<LLMultiSliderCtrl>(
"WLTimeSlider");
// create a new animation track
LLWLParamManager::getInstance()->mDay.clearKeys();
// add the keys one by one
std::map<std::string, LLWLSkyKey>::iterator mIt = sSliderToKey.begin();
for(; mIt != sSliderToKey.end(); mIt++)
{
LLWLParamManager::getInstance()->mDay.addKey(mIt->second.time / sHoursPerDay,
mIt->second.presetName);
}
// set the param manager's track to the new one
LLWLParamManager::getInstance()->resetAnimator(
tSldr->getCurSliderValue() / sHoursPerDay, false);
LLWLParamManager::getInstance()->mAnimator.update(
LLWLParamManager::getInstance()->mCurParams);
}
示例4: onKeyPresetChanged
void LLFloaterDayCycle::onKeyPresetChanged(LLUICtrl* ctrl, void* userData)
{
// get the time
LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>(
"WLKeyPresets");
LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>(
"WLDayCycleKeys");
// do nothing if no sliders
if(sldr->getValue().size() == 0) {
return;
}
// change the map
std::string newPreset(comboBox->getSelectedValue().asString());
const std::string& curSldr = sldr->getCurSlider();
// if null, don't use
if(curSldr == "") {
return;
}
sSliderToKey[curSldr].presetName = newPreset;
syncTrack();
}
示例5: LLFloater
LLFloaterDayCycle::LLFloaterDayCycle() : LLFloater(std::string("Day Cycle Floater"))
{
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_day_cycle_options.xml");
// add the combo boxes
LLComboBox* keyCombo = getChild<LLComboBox>("WLKeyPresets");
if(keyCombo != NULL)
{
LLWLParamManager::preset_name_list_t local_presets;
LLWLParamManager::instance()->getLocalPresetNames(local_presets);
for (LLWLParamManager::preset_name_list_t::const_iterator it = local_presets.begin(); it != local_presets.end(); ++it)
{
keyCombo->add(*it);
}
// set defaults on combo boxes
keyCombo->selectFirstItem();
}
// add the time slider
LLMultiSliderCtrl* sldr = getChild<LLMultiSliderCtrl>("WLTimeSlider");
sldr->addSlider();
// load it up
initCallbacks();
}
示例6: onEditorGainFocus
// static
void LLMultiSliderCtrl::onEditorGainFocus( LLFocusableElement* caller, void *userdata )
{
LLMultiSliderCtrl* self = (LLMultiSliderCtrl*) userdata;
llassert( caller == self->mEditor );
self->onFocusReceived();
}
示例7: onKeyTimeChanged
void LLFloaterDayCycle::onKeyTimeChanged(LLUICtrl* ctrl, void* userData)
{
// if no keys, skipped
if(sSliderToKey.size() == 0) {
return;
}
LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>(
"WLDayCycleKeys");
LLSpinCtrl* hourSpin = sDayCycle->getChild<LLSpinCtrl>(
"WLCurKeyHour");
LLSpinCtrl* minSpin = sDayCycle->getChild<LLSpinCtrl>(
"WLCurKeyMin");
F32 hour = hourSpin->get();
F32 min = minSpin->get();
F32 val = hour + min / 60.0f;
const std::string& curSldr = sldr->getCurSlider();
sldr->setCurSliderValue(val, TRUE);
F32 time = sldr->getCurSliderValue() / sHoursPerDay;
// now set the key's time in the sliderToKey map
std::string presetName = sSliderToKey[curSldr].presetName;
sSliderToKey[curSldr].time = time;
syncTrack();
}
示例8: onSliderMouseUp
// static
void LLMultiSliderCtrl::onSliderMouseUp(LLUICtrl* caller, void* userdata)
{
LLMultiSliderCtrl* self = (LLMultiSliderCtrl*) userdata;
if( self->mSliderMouseUpCallback )
{
self->mSliderMouseUpCallback( self, self->mCallbackUserData );
}
}
示例9: LLFloater
LLFloaterDayCycle::LLFloaterDayCycle() : LLFloater(std::string("Day Cycle Floater"))
{
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_day_cycle_options.xml");
// add the combo boxes
LLComboBox* keyCombo = getChild<LLComboBox>("WLKeyPresets");
if(keyCombo != NULL)
{
LLWLParamManager::preset_name_list_t local_presets;
LLWLParamManager::getInstance()->getLocalPresetNames(local_presets);
for (LLWLParamManager::preset_name_list_t::const_iterator it = local_presets.begin(); it != local_presets.end(); ++it)
{
keyCombo->add(*it);
}
// set defaults on combo boxes
keyCombo->selectFirstItem();
}
// add the time slider
LLMultiSliderCtrl* sldr = getChild<LLMultiSliderCtrl>("WLTimeSlider");
sldr->addSlider();
// add the combo boxes
LLComboBox* comboBox = getChild<LLComboBox>("DayCyclePresetsCombo");
if(comboBox != NULL) {
LLDayCycleManager::preset_name_list_t day_presets;
LLDayCycleManager::getInstance()->getPresetNames(day_presets);
LLDayCycleManager::preset_name_list_t::const_iterator it;
for(it = day_presets.begin(); it != day_presets.end(); ++it)
{
comboBox->add(*it);
}
// entry for when we're in estate time
comboBox->add(LLStringUtil::null);
// set defaults on combo boxes
//comboBox->selectByValue(LLSD("Default"));
}
// load it up
initCallbacks();
}
示例10: syncSliderTrack
void LLFloaterDayCycle::syncSliderTrack()
{
// clear the slider
LLMultiSliderCtrl* kSldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys");
kSldr->clear();
sSliderToKey.clear();
// add sliders
std::map<F32, LLWLParamKey>::iterator mIt =
LLWLParamManager::getInstance()->mDay.mTimeMap.begin();
for(; mIt != LLWLParamManager::getInstance()->mDay.mTimeMap.end(); mIt++)
{
addSliderKey(mIt->first * sHoursPerDay, mIt->second.name);
}
}
示例11: onTimeSliderMoved
void LLFloaterDayCycle::onTimeSliderMoved(LLUICtrl* ctrl, void* userData)
{
LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>(
"WLTimeSlider");
/// get the slider value
F32 val = sldr->getCurSliderValue() / sHoursPerDay;
// set the value, turn off animation
LLWLParamManager::getInstance()->mAnimator.setDayTime((F64)val);
LLWLParamManager::getInstance()->mAnimator.deactivate();
// then call update once
LLWLParamManager::getInstance()->mAnimator.update(
LLWLParamManager::getInstance()->mCurParams);
}
示例12: deletePreset
void LLFloaterDayCycle::deletePreset(std::string& presetName)
{
LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys");
/// delete any reference
std::map<std::string, LLWLSkyKey>::iterator curr_preset, next_preset;
for(curr_preset = sSliderToKey.begin(); curr_preset != sSliderToKey.end(); curr_preset = next_preset)
{
next_preset = curr_preset;
++next_preset;
if (curr_preset->second.presetName == presetName)
{
sldr->deleteSlider(curr_preset->first);
sSliderToKey.erase(curr_preset);
}
}
}
示例13: onAddKey
void LLFloaterDayCycle::onAddKey(void* userData)
{
LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>(
"WLKeyPresets");
LLMultiSliderCtrl* kSldr = sDayCycle->getChild<LLMultiSliderCtrl>(
"WLDayCycleKeys");
LLMultiSliderCtrl* tSldr = sDayCycle->getChild<LLMultiSliderCtrl>(
"WLTimeSlider");
llassert_always(sSliderToKey.size() == kSldr->getValue().size());
// get the values
std::string newPreset(comboBox->getSelectedValue().asString());
// add the slider key
addSliderKey(tSldr->getCurSliderValue(), newPreset);
syncTrack();
}
示例14: syncSliderTrack
void LLFloaterDayCycle::onLoadDayCycle(void* userData)
{
LLWLParamManager::instance()->mDay.loadDayCycleFromFile("Default.xml");
// sync it all up
syncSliderTrack();
syncMenu();
// set the param manager's track to the new one
LLMultiSliderCtrl* tSldr;
tSldr = sDayCycle->getChild<LLMultiSliderCtrl>(
"WLTimeSlider");
LLWLParamManager::instance()->resetAnimator(
tSldr->getCurSliderValue() / sHoursPerDay, false);
// and draw it
LLWLParamManager::instance()->mAnimator.update(
LLWLParamManager::instance()->mCurParams);
}
示例15: onKeyTimeMoved
void LLFloaterDayCycle::onKeyTimeMoved(LLUICtrl* ctrl, void* userData)
{
LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>("WLKeyPresets");
LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys");
LLSpinCtrl* hourSpin = sDayCycle->getChild<LLSpinCtrl>("WLCurKeyHour");
LLSpinCtrl* minSpin = sDayCycle->getChild<LLSpinCtrl>("WLCurKeyMin");
if(sldr->getValue().size() == 0) {
return;
}
// make sure we have a slider
const std::string& curSldr = sldr->getCurSlider();
if(curSldr == "") {
return;
}
F32 time = sldr->getCurSliderValue();
// check to see if a key exists
std::string presetName = sSliderToKey[curSldr].presetName;
sSliderToKey[curSldr].time = time;
// if it exists, turn on check box
comboBox->selectByValue(presetName);
// now set the spinners
F32 hour = (F32)((S32)time);
F32 min = (time - hour) * 60;
// handle imprecision
if(min >= 59) {
min = 0;
hour += 1;
}
hourSpin->set(hour);
minSpin->set(min);
syncTrack();
}