diff options
Diffstat (limited to 'indra/llui')
| -rw-r--r-- | indra/llui/llflatlistview.cpp | 96 | ||||
| -rw-r--r-- | indra/llui/llflatlistview.h | 6 | ||||
| -rw-r--r-- | indra/llui/llview.h | 2 | 
3 files changed, 71 insertions, 33 deletions
diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index f4a5f1c990..d4c3cfb7b6 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -689,6 +689,17 @@ LLRect LLFlatListView::getSelectedItemsRect()  	return rc;  } +void LLFlatListView::selectFirstItem	() +{ +	selectItemPair(mItemPairs.front(), true); +} + +void LLFlatListView::selectLastItem		() +{ +	selectItemPair(mItemPairs.back(), true); +} + +  // virtual  bool LLFlatListView::selectNextItemPair(bool is_up_direction, bool reset_selection)  { @@ -696,53 +707,53 @@ bool LLFlatListView::selectNextItemPair(bool is_up_direction, bool reset_selecti  	if ( !mItemPairs.size() )  		return false; -	item_pair_t* cur_sel_pair = NULL; +	  	item_pair_t* to_sel_pair = NULL; - +	item_pair_t* cur_sel_pair = NULL;  	if ( mSelectedItemPairs.size() )  	{  		// Take the last selected pair  		cur_sel_pair = mSelectedItemPairs.back(); -	} -	else -	{ -		// If there weren't selected items then choose the first one bases on given direction -		cur_sel_pair = (is_up_direction) ? mItemPairs.back() : mItemPairs.front(); -		// Force selection to first item -		to_sel_pair = cur_sel_pair; -	} - -	// Bases on given direction choose next item to select -	if ( is_up_direction ) -	{ -		// Find current selected item position in mItemPairs list -		pairs_list_t::reverse_iterator sel_it = std::find(mItemPairs.rbegin(), mItemPairs.rend(), cur_sel_pair); - -		for (;++sel_it != mItemPairs.rend();) +		// Bases on given direction choose next item to select +		if ( is_up_direction )  		{ -			// skip invisible items -			if ( (*sel_it)->first->getVisible() ) +			// Find current selected item position in mItemPairs list +			pairs_list_t::reverse_iterator sel_it = std::find(mItemPairs.rbegin(), mItemPairs.rend(), cur_sel_pair); + +			for (;++sel_it != mItemPairs.rend();)  			{ -				to_sel_pair = *sel_it; -				break; +				// skip invisible items +				if ( (*sel_it)->first->getVisible() ) +				{ +					to_sel_pair = *sel_it; +					break; +				}  			}  		} -	} -	else -	{ -		// Find current selected item position in mItemPairs list -		pairs_list_t::iterator sel_it = std::find(mItemPairs.begin(), mItemPairs.end(), cur_sel_pair); - -		for (;++sel_it != mItemPairs.end();) +		else  		{ -			// skip invisible items -			if ( (*sel_it)->first->getVisible() ) +			// Find current selected item position in mItemPairs list +			pairs_list_t::iterator sel_it = std::find(mItemPairs.begin(), mItemPairs.end(), cur_sel_pair); + +			for (;++sel_it != mItemPairs.end();)  			{ -				to_sel_pair = *sel_it; -				break; +				// skip invisible items +				if ( (*sel_it)->first->getVisible() ) +				{ +					to_sel_pair = *sel_it; +					break; +				}  			}  		}  	} +	else +	{ +		// If there weren't selected items then choose the first one bases on given direction +		cur_sel_pair = (is_up_direction) ? mItemPairs.back() : mItemPairs.front(); +		// Force selection to first item +		to_sel_pair = cur_sel_pair; +	} +  	if ( to_sel_pair )  	{ @@ -920,4 +931,23 @@ void LLFlatListView::onFocusLost()  	mSelectedItemsBorder->setVisible(FALSE);  } +//virtual  +void LLFlatListView::notify(const LLSD& info) +{ +	if(info.has("action")) +	{ +		std::string str_action = info["action"]; +		if(str_action == "select_first") +		{ +			setFocus(true); +			selectFirstItem(); +		} +		else if(str_action == "select_last") +		{ +			setFocus(true); +			selectLastItem(); +		} +	} +} +  //EOF diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h index 3867e910c0..9e1e0f90fc 100644 --- a/indra/llui/llflatlistview.h +++ b/indra/llui/llflatlistview.h @@ -279,6 +279,12 @@ public:  	bool updateValue(const LLSD& old_value, const LLSD& new_value); + +	void selectFirstItem	(); +	void selectLastItem		(); + +	virtual void	notify(const LLSD& info) ; +  protected:  	/** Pairs LLpanel representing a single item LLPanel and LLSD associated with it */ diff --git a/indra/llui/llview.h b/indra/llui/llview.h index d485244a05..c611e4c85f 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -514,6 +514,8 @@ public:  	virtual void	notifyParent(const LLSD& info);  	virtual void	notifyChildren(const LLSD& info); +	virtual void	notify(const LLSD& info) {}; +  	static const LLViewDrawContext& getDrawContext();  protected:  | 
