diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llfolderview.cpp | 100 | ||||
-rw-r--r-- | indra/newview/llfolderview.h | 5 | ||||
-rw-r--r-- | indra/newview/llplacesinventorypanel.cpp | 17 | ||||
-rw-r--r-- | indra/newview/llplacesinventorypanel.h | 2 |
4 files changed, 124 insertions, 0 deletions
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index b833c611bf..c6135d3bc3 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -1508,10 +1508,26 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) { if (next == last_selected) { + //special case for LLAccordionCtrl + if(notifyParent(LLSD().with("action","select_next")) > 0 )//message was processed + { + clearSelection(); + return TRUE; + } return FALSE; } setSelection( next, FALSE, TRUE ); } + else + { + //special case for LLAccordionCtrl + if(notifyParent(LLSD().with("action","select_next")) > 0 )//message was processed + { + clearSelection(); + return TRUE; + } + return FALSE; + } } scrollToShowSelection(); mSearchString.clear(); @@ -1556,6 +1572,13 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) { if (prev == this) { + // If case we are in accordion tab notify parent to go to the previous accordion + if(notifyParent(LLSD().with("action","select_prev")) > 0 )//message was processed + { + clearSelection(); + return TRUE; + } + return FALSE; } setSelection( prev, FALSE, TRUE ); @@ -2241,6 +2264,83 @@ void LLFolderView::updateRenamerPosition() } } +bool LLFolderView::selectFirstItem() +{ + for (folders_t::iterator iter = mFolders.begin(); + iter != mFolders.end();) + { + LLFolderViewFolder* folder = (*iter ); + if (folder->getVisible()) + { + LLFolderViewItem* itemp = folder->getNextFromChild(0,true); + if(itemp) + setSelection(itemp,FALSE,TRUE); + return true; + } + + } + for(items_t::iterator iit = mItems.begin(); + iit != mItems.end(); ++iit) + { + LLFolderViewItem* itemp = (*iit); + if (itemp->getVisible()) + { + setSelection(itemp,FALSE,TRUE); + return true; + } + } + return false; +} +bool LLFolderView::selectLastItem() +{ + for(items_t::reverse_iterator iit = mItems.rbegin(); + iit != mItems.rend(); ++iit) + { + LLFolderViewItem* itemp = (*iit); + if (itemp->getVisible()) + { + setSelection(itemp,FALSE,TRUE); + return true; + } + } + for (folders_t::reverse_iterator iter = mFolders.rbegin(); + iter != mFolders.rend();) + { + LLFolderViewFolder* folder = (*iter); + if (folder->getVisible()) + { + LLFolderViewItem* itemp = folder->getPreviousFromChild(0,true); + if(itemp) + setSelection(itemp,FALSE,TRUE); + return true; + } + } + return false; +} + + +S32 LLFolderView::notify(const LLSD& info) +{ + if(info.has("action")) + { + std::string str_action = info["action"]; + if(str_action == "select_first") + { + setFocus(true); + selectFirstItem(); + return 1; + + } + else if(str_action == "select_last") + { + setFocus(true); + selectLastItem(); + return 1; + } + } + return 0; +} + ///---------------------------------------------------------------------------- /// Local function definitions diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h index 89e1865e35..56ebdfcf79 100644 --- a/indra/newview/llfolderview.h +++ b/indra/newview/llfolderview.h @@ -266,6 +266,8 @@ public: LLPanel* getParentPanel() { return mParentPanel; } // DEBUG only void dumpSelectionInformation(); + + virtual S32 notify(const LLSD& info) ; private: void updateRenamerPosition(); @@ -278,6 +280,9 @@ protected: void finishRenamingItem( void ); void closeRenamer( void ); + + bool selectFirstItem(); + bool selectLastItem(); protected: LLHandle<LLView> mPopupMenuHandle; diff --git a/indra/newview/llplacesinventorypanel.cpp b/indra/newview/llplacesinventorypanel.cpp index 4de953a59d..8edeebaeeb 100644 --- a/indra/newview/llplacesinventorypanel.cpp +++ b/indra/newview/llplacesinventorypanel.cpp @@ -143,6 +143,23 @@ void LLPlacesInventoryPanel::restoreFolderState() getRootFolder()->scrollToShowSelection(); } +S32 LLPlacesInventoryPanel::notify(const LLSD& info) +{ + if(info.has("action")) + { + std::string str_action = info["action"]; + if(str_action == "select_first") + { + return getRootFolder()->notify(info); + } + else if(str_action == "select_last") + { + return getRootFolder()->notify(info); + } + } + return 0; +} + /************************************************************************/ /* PROTECTED METHODS */ /************************************************************************/ diff --git a/indra/newview/llplacesinventorypanel.h b/indra/newview/llplacesinventorypanel.h index 7b34045d32..86937e7c7f 100644 --- a/indra/newview/llplacesinventorypanel.h +++ b/indra/newview/llplacesinventorypanel.h @@ -57,6 +57,8 @@ public: void saveFolderState(); void restoreFolderState(); + virtual S32 notify(const LLSD& info) ; + private: LLSaveFolderState* mSavedFolderState; }; |