summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llcombobox.cpp18
-rw-r--r--indra/llui/llcombobox.h5
2 files changed, 22 insertions, 1 deletions
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp
index bcc653a602..5768686659 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -78,6 +78,7 @@ 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");
@@ -97,7 +98,8 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p)
mTextChangedCallback(p.text_changed_callback()),
mListPosition(p.list_position),
mLastSelectedIndex(-1),
- mLabel(p.label)
+ mLabel(p.label),
+ mMouseDownSignal(NULL)
{
// Text label button
@@ -153,6 +155,11 @@ 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));
}
@@ -183,6 +190,7 @@ LLComboBox::~LLComboBox()
// explicitly disconect this signal, since base class destructor might fire top lost
mTopLostSignalConnection.disconnect();
+ delete mMouseDownSignal;
}
@@ -709,6 +717,9 @@ void LLComboBox::hideList()
void LLComboBox::onButtonMouseDown()
{
+ if (mMouseDownSignal)
+ (*mMouseDownSignal)( this, 0 );
+
if (!mList->getVisible())
{
// this might change selection, so do it first
@@ -1183,6 +1194,11 @@ 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 e17d6cdfb4..49a55c98a3 100644
--- a/indra/llui/llcombobox.h
+++ b/indra/llui/llcombobox.h
@@ -78,6 +78,8 @@ public:
text_entry_callback,
text_changed_callback;
+ Optional<CommitCallbackParam> mouse_down_callback;
+
Optional<EPreferredPosition, PreferredPositionValues> list_position;
// components
@@ -207,6 +209,8 @@ 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.
*/
@@ -244,6 +248,7 @@ private:
commit_callback_t mTextChangedCallback;
commit_callback_t mSelectionCallback;
boost::signals2::connection mTopLostSignalConnection;
+ commit_signal_t* mMouseDownSignal;
commit_signal_t mOnReturnSignal;
S32 mLastSelectedIndex;
};