summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2022-03-02 19:46:48 +0200
committerMnikolenko Productengine <mnikolenko@productengine.com>2022-03-02 19:46:48 +0200
commitf90d17905899d01db76b82b6d647bbecf1c47f23 (patch)
treedba8f9a514a02a9d86fe25c5d0ffccf30a6b754f /indra/llui
parent064f28b290026be0e77cd38de78b06477a9c0876 (diff)
parent97a103255e433629f13e2156aa307ca329cdcfc6 (diff)
Merge branch 'DRTVWR-546' into DRTVWR-539
# Conflicts: # indra/llcommon/tests/llprocess_test.cpp # indra/llui/llcombobox.cpp # indra/llui/llcombobox.h # indra/newview/VIEWER_VERSION.txt # indra/newview/llviewertexturelist.cpp # indra/newview/llvovolume.cpp
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llcombobox.cpp47
-rw-r--r--indra/llui/llcombobox.h8
2 files changed, 33 insertions, 22 deletions
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp
index 5768686659..9ca05a16f3 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -78,7 +78,6 @@ LLComboBox::Params::Params()
combo_button("combo_button"),
combo_list("combo_list"),
combo_editor("combo_editor"),
- mouse_down_callback("mouse_down_callback"),
drop_down_button("drop_down_button")
{
addSynonym(items, "combo_item");
@@ -98,8 +97,7 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p)
mTextChangedCallback(p.text_changed_callback()),
mListPosition(p.list_position),
mLastSelectedIndex(-1),
- mLabel(p.label),
- mMouseDownSignal(NULL)
+ mLabel(p.label)
{
// Text label button
@@ -115,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);
@@ -155,11 +157,6 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p)
createLineEditor(p);
- if (p.mouse_down_callback.isProvided())
- {
- setMouseDownCallback(initCommitCallback(p.mouse_down_callback));
- }
-
mTopLostSignalConnection = setTopLostCallback(boost::bind(&LLComboBox::hideList, this));
}
@@ -190,7 +187,7 @@ LLComboBox::~LLComboBox()
// explicitly disconect this signal, since base class destructor might fire top lost
mTopLostSignalConnection.disconnect();
- delete mMouseDownSignal;
+ mImageLoadedConnection.disconnect();
}
@@ -717,9 +714,6 @@ void LLComboBox::hideList()
void LLComboBox::onButtonMouseDown()
{
- if (mMouseDownSignal)
- (*mMouseDownSignal)( this, 0 );
-
if (!mList->getVisible())
{
// this might change selection, so do it first
@@ -1085,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
@@ -1194,11 +1212,6 @@ BOOL LLComboBox::selectItemRange( S32 first, S32 last )
return mList->selectItemRange(first, last);
}
-boost::signals2::connection LLComboBox::setMouseDownCallback( const commit_signal_t::slot_type& cb )
-{
- if (!mMouseDownSignal) mMouseDownSignal = new commit_signal_t();
- return mMouseDownSignal->connect(cb);
-}
static LLDefaultChildRegistry::Register<LLIconsComboBox> register_icons_combo_box("icons_combo_box");
diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h
index 49a55c98a3..cac8850a25 100644
--- a/indra/llui/llcombobox.h
+++ b/indra/llui/llcombobox.h
@@ -78,8 +78,6 @@ public:
text_entry_callback,
text_changed_callback;
- Optional<CommitCallbackParam> mouse_down_callback;
-
Optional<EPreferredPosition, PreferredPositionValues> list_position;
// components
@@ -107,6 +105,8 @@ protected:
virtual std::string _getSearchText() const;
virtual void onSetHighlight() const;
+ void imageLoaded();
+
public:
// LLView interface
virtual void onFocusLost();
@@ -209,8 +209,6 @@ public:
void setTextEntryCallback( commit_callback_t cb ) { mTextEntryCallback = cb; }
void setTextChangedCallback( commit_callback_t cb ) { mTextChangedCallback = cb; }
- boost::signals2::connection setMouseDownCallback( const commit_signal_t::slot_type& cb );
-
/**
* Connects callback to signal called when Return key is pressed.
*/
@@ -248,7 +246,7 @@ private:
commit_callback_t mTextChangedCallback;
commit_callback_t mSelectionCallback;
boost::signals2::connection mTopLostSignalConnection;
- commit_signal_t* mMouseDownSignal;
+ boost::signals2::connection mImageLoadedConnection;
commit_signal_t mOnReturnSignal;
S32 mLastSelectedIndex;
};