diff options
Diffstat (limited to 'indra/llui')
| -rw-r--r-- | indra/llui/llcombobox.cpp | 47 | ||||
| -rw-r--r-- | indra/llui/llcombobox.h | 8 | 
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;  }; | 
