本文整理汇总了C++中LLString::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ LLString::empty方法的具体用法?C++ LLString::empty怎么用?C++ LLString::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLString
的用法示例。
在下文中一共展示了LLString::empty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: refresh
void LLPanelRequestTools::refresh()
{
std::string buffer = childGetValue("destination");
LLCtrlListInterface *list = childGetListInterface("destination");
if (!list) return;
list->operateOnAll(LLCtrlListInterface::OP_DELETE);
list->addSimpleElement(SELECTION);
list->addSimpleElement(AGENT_REGION);
for (LLWorld::region_list_t::iterator iter = gWorldp->mActiveRegionList.begin();
iter != gWorldp->mActiveRegionList.end(); ++iter)
{
LLViewerRegion* regionp = *iter;
LLString name = regionp->getName();
//MK
if (RRenabled && gAgent.mRRInterface.mContainsShowloc)
{
name = "(Hidden)";
}
//mk
if (!name.empty())
{
list->addSimpleElement(name);
}
}
if(!buffer.empty())
{
list->selectByValue(buffer);
}
else
{
list->selectByValue(SELECTION);
}
}
示例2:
LLSpeaker::LLSpeaker(const LLUUID& id, const LLString& name, const ESpeakerType type) :
mStatus(LLSpeaker::STATUS_TEXT_ONLY),
mLastSpokeTime(0.f),
mSpeechVolume(0.f),
mHasSpoken(FALSE),
mDotColor(LLColor4::white),
mID(id),
mTyping(FALSE),
mSortIndex(0),
mType(type),
mIsModerator(FALSE),
mModeratorMutedVoice(FALSE),
mModeratorMutedText(FALSE)
{
mHandle.init();
sSpeakers.insert(std::make_pair(mHandle, this));
if (name.empty() && type == SPEAKER_AGENT)
{
lookupName();
}
else
{
mDisplayName = name;
}
gVoiceClient->setUserVolume(id, gMuteListp->getSavedResidentVolume(id));
mActivityTimer.resetWithExpiry(SPEAKER_TIMEOUT);
}
示例3: fromXML
LLView* LLSpinCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
LLString name("spinner");
node->getAttributeString("name", name);
LLString label;
node->getAttributeString("label", label);
LLRect rect;
createRect(node, rect, parent, LLRect());
LLFontGL* font = LLView::selectFont(node);
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 label_width = llmin(40, rect.getWidth() - 40);
node->getAttributeS32("label_width", label_width);
LLUICtrlCallback callback = NULL;
if(label.empty())
{
label.assign( node->getValue() );
}
LLSpinCtrl* spinner = new LLSpinCtrl(name,
rect,
label,
font,
callback,
NULL,
initial_value,
min_value,
max_value,
increment,
"",
label_width);
spinner->setPrecision(precision);
spinner->initFromXML(node, parent);
return spinner;
}
示例4: setImageOverlay
void LLButton::setImageOverlay(const LLString &image_name, LLFontGL::HAlign alignment, const LLColor4& color)
{
if (image_name.empty())
{
mImageOverlay = NULL;
}
else
{
mImageOverlay = LLUI::getUIImageByName(image_name);
mImageOverlayAlignment = alignment;
mImageOverlayColor = color;
}
}
示例5: addImageAttributeToXML
void LLButton::addImageAttributeToXML(LLXMLNodePtr node,
const LLString& image_name,
const LLUUID& image_id,
const LLString& xml_tag_name) const
{
if( !image_name.empty() )
{
node->createChild(xml_tag_name, TRUE)->setStringValue(image_name);
}
else if( image_id != LLUUID::null )
{
node->createChild(xml_tag_name + "_id", TRUE)->setUUIDValue(image_id);
}
}
示例6: setValue
void LLControlGroup::setValue(const LLString& name, const LLSD& val)
{
if (name.empty())
{
return;
}
LLControlBase* control = getControl(name);
if (control)
{
control->set(val);
}
else
{
CONTROL_ERRS << "Invalid control " << name << llendl;
}
}
示例7: handleDragAndDrop
// virtual
BOOL LLPreviewGesture::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
EDragAndDropType cargo_type,
void* cargo_data,
EAcceptance* accept,
LLString& tooltip_msg)
{
BOOL handled = TRUE;
switch(cargo_type)
{
case DAD_ANIMATION:
case DAD_SOUND:
{
// TODO: Don't allow this if you can't transfer the sound/animation
// make a script step
LLInventoryItem* item = (LLInventoryItem*)cargo_data;
if (item
&& gInventory.getItem(item->getUUID()))
{
LLPermissions perm = item->getPermissions();
if (!((perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED))
{
*accept = ACCEPT_NO;
if (tooltip_msg.empty())
{
tooltip_msg.assign("Only animations and sounds\n"
"with unrestricted permissions\n"
"can be added to a gesture.");
}
break;
}
else if (drop)
{
LLScrollListItem* line = NULL;
if (cargo_type == DAD_ANIMATION)
{
line = addStep("Animation");
LLGestureStepAnimation* anim = (LLGestureStepAnimation*)line->getUserdata();
anim->mAnimAssetID = item->getAssetUUID();
anim->mAnimName = item->getName();
}
else if (cargo_type == DAD_SOUND)
{
line = addStep("Sound");
LLGestureStepSound* sound = (LLGestureStepSound*)line->getUserdata();
sound->mSoundAssetID = item->getAssetUUID();
sound->mSoundName = item->getName();
}
updateLabel(line);
mDirty = TRUE;
refresh();
}
*accept = ACCEPT_YES_COPY_MULTI;
}
else
{
// Not in user's inventory means it was in object inventory
*accept = ACCEPT_NO;
}
break;
}
default:
*accept = ACCEPT_NO;
if (tooltip_msg.empty())
{
tooltip_msg.assign("Only animations and sounds\n"
"can be added to a gesture.");
}
break;
}
return handled;
}
示例8: loadFromFile
// Returns number of controls loaded, so 0 if failure
U32 LLControlGroup::loadFromFile(const LLString& filename, BOOL require_declaration, eControlType declare_as)
{
LLString name;
LLXmlTree xml_controls;
if (!xml_controls.parseFile(filename))
{
llwarns << "Unable to open control file " << filename << llendl;
return 0;
}
LLXmlTreeNode* rootp = xml_controls.getRoot();
if (!rootp || !rootp->hasAttribute("version"))
{
llwarns << "No valid settings header found in control file " << filename << llendl;
return 0;
}
U32 item = 0;
U32 validitems = 0;
S32 version;
rootp->getAttributeS32("version", version);
// Check file version
if (version != CURRENT_VERSION)
{
llinfos << filename << " does not appear to be a version " << CURRENT_VERSION << " controls file" << llendl;
return 0;
}
LLXmlTreeNode* child_nodep = rootp->getFirstChild();
while(child_nodep)
{
name = child_nodep->getName();
BOOL declared = controlExists(name);
if (require_declaration && !declared)
{
// Declaration required, but this name not declared.
// Complain about non-empty names.
if (!name.empty())
{
//read in to end of line
llwarns << "LLControlGroup::loadFromFile() : Trying to set \"" << name << "\", setting doesn't exist." << llendl;
}
child_nodep = rootp->getNextChild();
continue;
}
// Got an item. Load it up.
item++;
// If not declared, assume it's a string
if (!declared)
{
switch(declare_as)
{
case TYPE_COL4:
declareColor4(name, LLColor4::white, "", NO_PERSIST);
break;
case TYPE_COL4U:
declareColor4U(name, LLColor4U::white, "", NO_PERSIST);
break;
case TYPE_STRING:
default:
declareString(name, LLString::null, "", NO_PERSIST);
break;
}
}
// Control name has been declared in code.
LLControlBase *control = getControl(name);
llassert(control);
mLoadedSettings.insert(name);
switch(control->mType)
{
case TYPE_F32:
{
F32 initial = 0.f;
child_nodep->getAttributeF32("value", initial);
control->set(initial);
validitems++;
}
break;
case TYPE_S32:
{
S32 initial = 0;
child_nodep->getAttributeS32("value", initial);
control->set(initial);
//.........这里部分代码省略.........
示例9: loadFromFileLegacy
U32 LLControlGroup::loadFromFileLegacy(const LLString& filename, BOOL require_declaration, eControlType declare_as)
{
U32 item = 0;
U32 validitems = 0;
llifstream file;
S32 version;
file.open(filename.c_str()); /*Flawfinder: ignore*/
if (!file)
{
llinfos << "LLControlGroup::loadFromFile unable to open." << llendl;
return 0;
}
// Check file version
LLString name;
file >> name;
file >> version;
if (name != "version" || version != CURRENT_VERSION)
{
llinfos << filename << " does not appear to be a version " << CURRENT_VERSION << " controls file" << llendl;
return 0;
}
while (!file.eof())
{
file >> name;
if (name.empty())
{
continue;
}
if (name.substr(0,2) == "//")
{
// This is a comment.
char buffer[MAX_STRING]; /*Flawfinder: ignore*/
file.getline(buffer, MAX_STRING);
continue;
}
BOOL declared = mNameTable.find(name) != mNameTable.end();
if (require_declaration && !declared)
{
// Declaration required, but this name not declared.
// Complain about non-empty names.
if (!name.empty())
{
//read in to end of line
char buffer[MAX_STRING]; /*Flawfinder: ignore*/
file.getline(buffer, MAX_STRING);
llwarns << "LLControlGroup::loadFromFile() : Trying to set \"" << name << "\", setting doesn't exist." << llendl;
}
continue;
}
// Got an item. Load it up.
item++;
// If not declared, assume it's a string
if (!declared)
{
switch(declare_as)
{
case TYPE_COL4:
declareColor4(name, LLColor4::white, LLString::null, NO_PERSIST);
break;
case TYPE_COL4U:
declareColor4U(name, LLColor4U::white, LLString::null, NO_PERSIST);
break;
case TYPE_STRING:
default:
declareString(name, LLString::null, LLString::null, NO_PERSIST);
break;
}
}
// Control name has been declared in code.
LLControlBase *control = getControl(name);
llassert(control);
mLoadedSettings.insert(name);
switch(control->mType)
{
case TYPE_F32:
{
F32 initial;
file >> initial;
control->set(initial);
validitems++;
}
break;
case TYPE_S32:
{
//.........这里部分代码省略.........
示例10: saveToFile
U32 LLControlGroup::saveToFile(const LLString& filename, BOOL nondefault_only)
{
const char ENDL = '\n';
llinfos << "Saving settings to file: " << filename << llendl;
// place the objects in a temporary container that enforces a sort
// order to ease manual editing of the file
LLLinkedList< LLControlBase > controls;
controls.setInsertBefore( &control_insert_before );
LLString name;
for (ctrl_name_table_t::iterator iter = mNameTable.begin();
iter != mNameTable.end(); iter++)
{
name = iter->first;
if (name.empty())
{
CONTROL_ERRS << "Control with no name found!!!" << llendl;
break;
}
LLControlBase* control = (LLControlBase *)iter->second;
if (!control)
{
llwarns << "Tried to save invalid control: " << name << llendl;
}
if( control && control->mPersist )
{
if (!(nondefault_only && (control->mIsDefault)))
{
controls.addDataSorted( control );
}
else
{
// Debug spam
// llinfos << "Skipping " << control->getName() << llendl;
}
}
}
llofstream file;
file.open(filename.c_str()); /*Flawfinder: ignore*/
if (!file.is_open())
{
// This is a warning because sometime we want to use settings files which can't be written...
llwarns << "LLControlGroup::saveToFile unable to open file for writing" << llendl;
return 0;
}
// Write file version
file << "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\n";
file << "<settings version = \"" << CURRENT_VERSION << "\">\n";
for( LLControlBase* control = controls.getFirstData();
control != NULL;
control = controls.getNextData() )
{
file << "\t<!--" << control->comment() << "-->" << ENDL;
name = control->name();
switch (control->type())
{
case TYPE_U32:
{
file << "\t<" << name << " value=\"" << (U32) control->get().asInteger() << "\"/>\n";
break;
}
case TYPE_S32:
{
file << "\t<" << name << " value=\"" << (S32) control->get().asInteger() << "\"/>\n";
break;
}
case TYPE_F32:
{
file << "\t<" << name << " value=\"" << (F32) control->get().asReal() << "\"/>\n";
break;
}
case TYPE_VEC3:
{
LLVector3 vector(control->get());
file << "\t<" << name << " value=\"" << vector.mV[VX] << " " << vector.mV[VY] << " " << vector.mV[VZ] << "\"/>\n";
break;
}
case TYPE_VEC3D:
{
LLVector3d vector(control->get());
file << "\t<" << name << " value=\"" << vector.mdV[VX] << " " << vector.mdV[VY] << " " << vector.mdV[VZ] << "\"/>\n";
break;
}
case TYPE_RECT:
{
LLRect rect(control->get());
file << "\t<" << name << " value=\"" << rect.mLeft << " " << rect.mBottom << " " << rect.getWidth() << " " << rect.getHeight() << "\"/>\n";
break;
}
case TYPE_COL4:
{
LLColor4 color(control->get());
file << "\t<" << name << " value=\"" << color.mV[VRED] << ", " << color.mV[VGREEN] << ", " << color.mV[VBLUE] << ", " << color.mV[VALPHA] << "\"/>\n";
break;
//.........这里部分代码省略.........
示例11:
void LLButton::setImageDisabledSelected(const LLString &image_name)
{
setImageDisabledSelected(image_name.empty() ? NULL : LLUI::getUIImageByName(image_name));
mImageDisabledSelectedName = image_name;
}
示例12: fromXML
// static
LLView* LLButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
LLString name("button");
node->getAttributeString("name", name);
LLString label = name;
node->getAttributeString("label", label);
LLString label_selected = label;
node->getAttributeString("label_selected", label_selected);
LLFontGL* font = selectFont(node);
LLString image_unselected;
if (node->hasAttribute("image_unselected")) node->getAttributeString("image_unselected",image_unselected);
LLString image_selected;
if (node->hasAttribute("image_selected")) node->getAttributeString("image_selected",image_selected);
LLString image_hover_selected;
if (node->hasAttribute("image_hover_selected")) node->getAttributeString("image_hover_selected",image_hover_selected);
LLString image_hover_unselected;
if (node->hasAttribute("image_hover_unselected")) node->getAttributeString("image_hover_unselected",image_hover_unselected);
LLString image_disabled_selected;
if (node->hasAttribute("image_disabled_selected")) node->getAttributeString("image_disabled_selected",image_disabled_selected);
LLString image_disabled;
if (node->hasAttribute("image_disabled")) node->getAttributeString("image_disabled",image_disabled);
LLString image_overlay;
node->getAttributeString("image_overlay", image_overlay);
LLFontGL::HAlign image_overlay_alignment = LLFontGL::HCENTER;
LLString image_overlay_alignment_string;
if (node->hasAttribute("image_overlay_alignment"))
{
node->getAttributeString("image_overlay_alignment", image_overlay_alignment_string);
image_overlay_alignment = LLFontGL::hAlignFromName(image_overlay_alignment_string);
}
LLButton *button = new LLButton(name,
LLRect(),
image_unselected,
image_selected,
"",
NULL,
parent,
font,
label,
label_selected);
node->getAttributeS32("pad_right", button->mRightHPad);
node->getAttributeS32("pad_left", button->mLeftHPad);
BOOL is_toggle = button->getIsToggle();
node->getAttributeBOOL("toggle", is_toggle);
button->setIsToggle(is_toggle);
if(image_hover_selected != LLString::null) button->setImageHoverSelected(image_hover_selected);
if(image_hover_unselected != LLString::null) button->setImageHoverUnselected(image_hover_unselected);
if(image_disabled_selected != LLString::null) button->setImageDisabledSelected(image_disabled_selected );
if(image_disabled != LLString::null) button->setImageDisabled(image_disabled);
if(image_overlay != LLString::null) button->setImageOverlay(image_overlay, image_overlay_alignment);
if (node->hasAttribute("halign"))
{
LLFontGL::HAlign halign = selectFontHAlign(node);
button->setHAlign(halign);
}
if (node->hasAttribute("scale_image"))
{
BOOL needsScale = FALSE;
node->getAttributeBOOL("scale_image",needsScale);
button->setScaleImage( needsScale );
}
if(label.empty())
{
button->setLabelUnselected(node->getTextContents());
}
if (label_selected.empty())
{
button->setLabelSelected(node->getTextContents());
}
if (node->hasAttribute("help_url"))
{
LLString help_url;
node->getAttributeString("help_url",help_url);
button->setHelpURLCallback(help_url);
}
//.........这里部分代码省略.........
示例13: upload_new_resource
void upload_new_resource(const LLString& src_filename, std::string name,
std::string desc, S32 compression_info,
LLAssetType::EType destination_folder_type,
LLInventoryType::EType inv_type,
U32 next_owner_perm,
const LLString& display_name,
LLAssetStorage::LLStoreAssetCallback callback,
void *userdata)
{
// Generate the temporary UUID.
LLString filename = gDirUtilp->getTempFilename();
LLTransactionID tid;
LLAssetID uuid;
LLStringBase<char>::format_map_t args;
LLString ext = src_filename.substr(src_filename.find_last_of('.'));
LLAssetType::EType asset_type = LLAssetType::AT_NONE;
char error_message[MAX_STRING]; /* Flawfinder: ignore */
error_message[0] = '\0';
LLString temp_str;
BOOL error = FALSE;
if (ext.empty())
{
LLString::size_type offset = filename.find_last_of(gDirUtilp->getDirDelimiter());
if (offset != LLString::npos)
offset++;
LLString short_name = filename.substr(offset);
// No extension
snprintf(error_message, /* Flawfinder: ignore */
MAX_STRING,
"No file extension for the file: '%s'\nPlease make sure the file has a correct file extension",
short_name.c_str());
args["[FILE]"] = short_name;
upload_error(error_message, "NofileExtension", filename, args);
return;
}
else if( LLString::compareInsensitive(ext.c_str(),".bmp") == 0 )
{
asset_type = LLAssetType::AT_TEXTURE;
if (!LLViewerImageList::createUploadFile(src_filename,
filename,
IMG_CODEC_BMP ))
{
snprintf(error_message, MAX_STRING, "Problem with file %s:\n\n%s\n", /* Flawfinder: ignore */
src_filename.c_str(), LLImageBase::getLastError().c_str());
args["[FILE]"] = src_filename;
args["[ERROR]"] = LLImageBase::getLastError();
upload_error(error_message, "ProblemWithFile", filename, args);
return;
}
}
else if( LLString::compareInsensitive(ext.c_str(),".tga") == 0 )
{
asset_type = LLAssetType::AT_TEXTURE;
if (!LLViewerImageList::createUploadFile(src_filename,
filename,
IMG_CODEC_TGA ))
{
snprintf(error_message, MAX_STRING, "Problem with file %s:\n\n%s\n", /* Flawfinder: ignore */
src_filename.c_str(), LLImageBase::getLastError().c_str());
args["[FILE]"] = src_filename;
args["[ERROR]"] = LLImageBase::getLastError();
upload_error(error_message, "ProblemWithFile", filename, args);
return;
}
}
else if( LLString::compareInsensitive(ext.c_str(),".jpg") == 0 || LLString::compareInsensitive(ext.c_str(),".jpeg") == 0)
{
asset_type = LLAssetType::AT_TEXTURE;
if (!LLViewerImageList::createUploadFile(src_filename,
filename,
IMG_CODEC_JPEG ))
{
snprintf(error_message, MAX_STRING, "Problem with file %s:\n\n%s\n", /* Flawfinder: ignore */
src_filename.c_str(), LLImageBase::getLastError().c_str());
args["[FILE]"] = src_filename;
args["[ERROR]"] = LLImageBase::getLastError();
upload_error(error_message, "ProblemWithFile", filename, args);
return;
}
}
else if(LLString::compareInsensitive(ext.c_str(),".wav") == 0)
{
asset_type = LLAssetType::AT_SOUND; // tag it as audio
S32 encode_result = 0;
S32 bitrate = 128;
if (compression_info)
{
bitrate = compression_info;
}
llinfos << "Attempting to encode wav as an ogg file at " << bitrate << "kbps" << llendl;
encode_result = encode_vorbis_file_at(src_filename.c_str(), filename.c_str(), bitrate*1000);
//.........这里部分代码省略.........
示例14: sizeof
//.........这里部分代码省略.........
sendProgress(0, 0, CFSTR("Mounting image..."));
LLFile::mkdir("mnt", 0700);
// NOTE: we could add -private at the end of this command line to keep the image from showing up in the Finder,
// but if our cleanup fails, this makes it much harder for the user to unmount the image.
LLString mountOutput;
FILE* mounter = popen("hdiutil attach SecondLife.dmg -mountpoint mnt", "r"); /* Flawfinder: ignore */
if(mounter == NULL)
{
llinfos << "Failed to mount disk image, exiting."<< llendl;
throw 0;
}
// We need to scan the output from hdiutil to find the device node it uses to attach the disk image.
// If we don't have this information, we can't detach it later.
while(mounter != NULL)
{
size_t len = fread(temp, 1, sizeof(temp)-1, mounter);
temp[len] = 0;
mountOutput.append(temp);
if(len < sizeof(temp)-1)
{
// End of file or error.
if(pclose(mounter) != 0)
{
llinfos << "Failed to mount disk image, exiting."<< llendl;
throw 0;
}
mounter = NULL;
}
}
if(!mountOutput.empty())
{
const char *s = mountOutput.c_str();
char *prefix = "/dev/";
char *sub = strstr(s, prefix);
if(sub != NULL)
{
sub += strlen(prefix); /* Flawfinder: ignore */
sscanf(sub, "%1023s", deviceNode); /* Flawfinder: ignore */
}
}
if(deviceNode[0] != 0)
{
llinfos << "Disk image attached on /dev/" << deviceNode << llendl;
}
else
{
llinfos << "Disk image device node not found!" << llendl;
}
// Get an FSRef to the new application on the disk image
FSRef sourceRef;
FSRef mountRef;
snprintf(temp, sizeof(temp), "%s/mnt", tempDir);
llinfos << "Disk image mount point is: " << temp << llendl;
err = FSPathMakeRef((UInt8 *)temp, &mountRef, NULL);
if(err != noErr)
{
llinfos << "Couldn't make FSRef to disk image mount point." << llendl;
示例15: label_rect
LLSpinCtrl::LLSpinCtrl( const LLString& name, const LLRect& rect, const LLString& label, const LLFontGL* font,
void (*commit_callback)(LLUICtrl*, void*),
void* callback_user_data,
F32 initial_value, F32 min_value, F32 max_value, F32 increment,
const LLString& control_name,
S32 label_width)
:
LLUICtrl(name, rect, TRUE, commit_callback, callback_user_data, FOLLOWS_LEFT | FOLLOWS_TOP ),
mValue( initial_value ),
mInitialValue( initial_value ),
mMaxValue( max_value ),
mMinValue( min_value ),
mIncrement( increment ),
mPrecision( 3 ),
mLabelBox( NULL ),
mTextEnabledColor( LLUI::sColorsGroup->getColor( "LabelTextColor" ) ),
mTextDisabledColor( LLUI::sColorsGroup->getColor( "LabelDisabledColor" ) ),
mbHasBeenSet( FALSE )
{
S32 top = mRect.getHeight();
S32 bottom = top - 2 * SPINCTRL_BTN_HEIGHT;
S32 centered_top = top;
S32 centered_bottom = bottom;
S32 btn_left = 0;
// Label
if( !label.empty() )
{
LLRect label_rect( 0, centered_top, label_width, centered_bottom );
mLabelBox = new LLTextBox( "SpinCtrl Label", label_rect, label.c_str(), font );
addChild(mLabelBox);
btn_left += label_rect.mRight + SPINCTRL_SPACING;
}
S32 btn_right = btn_left + SPINCTRL_BTN_WIDTH;
// Spin buttons
LLRect up_rect( btn_left, top, btn_right, top - SPINCTRL_BTN_HEIGHT );
LLString out_id = "UIImgBtnSpinUpOutUUID";
LLString in_id = "UIImgBtnSpinUpInUUID";
mUpBtn = new LLButton(
"SpinCtrl Up", up_rect,
out_id,
in_id,
"",
&LLSpinCtrl::onUpBtn, this, LLFontGL::sSansSerif );
mUpBtn->setFollowsLeft();
mUpBtn->setFollowsBottom();
mUpBtn->setHeldDownCallback( &LLSpinCtrl::onUpBtn );
mUpBtn->setTabStop(FALSE);
addChild(mUpBtn);
LLRect down_rect( btn_left, top - SPINCTRL_BTN_HEIGHT, btn_right, bottom );
out_id = "UIImgBtnSpinDownOutUUID";
in_id = "UIImgBtnSpinDownInUUID";
mDownBtn = new LLButton(
"SpinCtrl Down", down_rect,
out_id,
in_id,
"",
&LLSpinCtrl::onDownBtn, this, LLFontGL::sSansSerif );
mDownBtn->setFollowsLeft();
mDownBtn->setFollowsBottom();
mDownBtn->setHeldDownCallback( &LLSpinCtrl::onDownBtn );
mDownBtn->setTabStop(FALSE);
addChild(mDownBtn);
LLRect editor_rect( btn_right + 1, centered_top, mRect.getWidth(), centered_bottom );
mEditor = new LLLineEditor( "SpinCtrl Editor", editor_rect, "", font,
MAX_STRING_LENGTH,
&LLSpinCtrl::onEditorCommit, NULL, NULL, this,
&LLLineEditor::prevalidateFloat );
mEditor->setFollowsLeft();
mEditor->setFollowsBottom();
mEditor->setFocusReceivedCallback( &LLSpinCtrl::onEditorGainFocus );
//RN: this seems to be a BAD IDEA, as it makes the editor behavior different when it has focus
// than when it doesn't. Instead, if you always have to double click to select all the text,
// it's easier to understand
//mEditor->setSelectAllonFocusReceived(TRUE);
mEditor->setIgnoreTab(TRUE);
addChild(mEditor);
updateEditor();
setSpanChildren( TRUE );
}