diff options
Diffstat (limited to 'indra/llui/lluiimage.cpp')
-rw-r--r-- | indra/llui/lluiimage.cpp | 64 |
1 files changed, 52 insertions, 12 deletions
diff --git a/indra/llui/lluiimage.cpp b/indra/llui/lluiimage.cpp index 6c1a32722f..8cd6460b66 100644 --- a/indra/llui/lluiimage.cpp +++ b/indra/llui/lluiimage.cpp @@ -39,18 +39,20 @@ #include "lluiimage.h" #include "llui.h" -LLUIImage::LLUIImage(const std::string& name, LLPointer<LLTexture> image) : - mName(name), - mImage(image), - mScaleRegion(0.f, 1.f, 1.f, 0.f), - mClipRegion(0.f, 1.f, 1.f, 0.f), - mUniformScaling(TRUE), - mNoClip(TRUE) +LLUIImage::LLUIImage(const std::string& name, LLPointer<LLTexture> image) +: mName(name), + mImage(image), + mScaleRegion(0.f, 1.f, 1.f, 0.f), + mClipRegion(0.f, 1.f, 1.f, 0.f), + mUniformScaling(TRUE), + mNoClip(TRUE), + mImageLoaded(NULL) { } LLUIImage::~LLUIImage() { + delete mImageLoaded; } void LLUIImage::setClipRegion(const LLRectf& region) @@ -138,17 +140,54 @@ S32 LLUIImage::getTextureHeight() const return mImage->getHeight(0); } +boost::signals2::connection LLUIImage::addLoadedCallback( const image_loaded_signal_t::slot_type& cb ) +{ + if (!mImageLoaded) + { + mImageLoaded = new image_loaded_signal_t(); + } + return mImageLoaded->connect(cb); +} + + +void LLUIImage::onImageLoaded() +{ + if (mImageLoaded) + { + (*mImageLoaded)(); + } +} + + namespace LLInitParam { - LLUIImage* TypedParam<LLUIImage*>::getValueFromBlock() const + void TypedParam<LLUIImage*>::setValueFromBlock() const { + // The keyword "none" is specifically requesting a null image + // do not default to current value. Used to overwrite template images. + if (name() == "none") + { + mData.mValue = NULL; + return; + } + LLUIImage* imagep = LLUI::getUIImage(name()); - if (!imagep) + if (imagep) + { + mData.mValue = imagep; + } + } + + void TypedParam<LLUIImage*>::setBlockFromValue() + { + if (mData.mValue == NULL) + { + name.set("none", false); + } + else { - // default to current value - imagep = mData.mValue; + name.set(mData.mValue->getName(), false); } - return imagep; } @@ -163,3 +202,4 @@ namespace LLInitParam return (a == b); } } + |