summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-02-22 00:05:38 +0200
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-02-22 00:05:38 +0200
commit900c13d361671c35cd5899dc99bbfbc9c5ec2200 (patch)
treec3b66c71bdcd5e6896ef9bad282fdf6c88df85b1 /indra/llui
parent4e31ff1d7e05ff376fc1c66156eb76cccbdd5f38 (diff)
SL-16892 Fix incorrect width of dropdown menus
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llcombobox.cpp29
-rw-r--r--indra/llui/llcombobox.h3
2 files changed, 32 insertions, 0 deletions
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp
index bcc653a602..9ca05a16f3 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -113,6 +113,10 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p)
}
mArrowImage = button_params.image_unselected;
+ if (mArrowImage.notNull())
+ {
+ mImageLoadedConnection = mArrowImage->addLoadedCallback(boost::bind(&LLComboBox::imageLoaded, this));
+ }
mButton = LLUICtrlFactory::create<LLButton>(button_params);
@@ -183,6 +187,7 @@ LLComboBox::~LLComboBox()
// explicitly disconect this signal, since base class destructor might fire top lost
mTopLostSignalConnection.disconnect();
+ mImageLoadedConnection.disconnect();
}
@@ -1074,6 +1079,30 @@ void LLComboBox::onSetHighlight() const
}
}
+void LLComboBox::imageLoaded()
+{
+ static LLUICachedControl<S32> drop_shadow_button("DropShadowButton", 0);
+
+ if (mAllowTextEntry)
+ {
+ LLRect rect = getLocalRect();
+ S32 arrow_width = mArrowImage ? mArrowImage->getWidth() : 0;
+ S32 shadow_size = drop_shadow_button;
+ mButton->setRect(LLRect(getRect().getWidth() - llmax(8, arrow_width) - 2 * shadow_size,
+ rect.mTop, rect.mRight, rect.mBottom));
+ if (mButton->getVisible())
+ {
+ // recalculate field size
+ if (mTextEntry)
+ {
+ LLRect text_entry_rect(0, getRect().getHeight(), getRect().getWidth(), 0);
+ text_entry_rect.mRight -= llmax(8, arrow_width) + 2 * drop_shadow_button;
+ mTextEntry->reshape(text_entry_rect.getWidth(), text_entry_rect.getHeight(), TRUE);
+ }
+ }
+ }
+}
+
//============================================================================
// LLCtrlListInterface functions
diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h
index e17d6cdfb4..cac8850a25 100644
--- a/indra/llui/llcombobox.h
+++ b/indra/llui/llcombobox.h
@@ -105,6 +105,8 @@ protected:
virtual std::string _getSearchText() const;
virtual void onSetHighlight() const;
+ void imageLoaded();
+
public:
// LLView interface
virtual void onFocusLost();
@@ -244,6 +246,7 @@ private:
commit_callback_t mTextChangedCallback;
commit_callback_t mSelectionCallback;
boost::signals2::connection mTopLostSignalConnection;
+ boost::signals2::connection mImageLoadedConnection;
commit_signal_t mOnReturnSignal;
S32 mLastSelectedIndex;
};