diff options
Diffstat (limited to 'indra/llui/llflatlistview.h')
-rw-r--r-- | indra/llui/llflatlistview.h | 143 |
1 files changed, 29 insertions, 114 deletions
diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h index afd0176d98..e3c07e811f 100644 --- a/indra/llui/llflatlistview.h +++ b/indra/llui/llflatlistview.h @@ -1,26 +1,32 @@ /** * @file llflatlistview.h - * @brief LLFlatListView base class and extension to support messages for several cases of an empty list. + * @brief LLFlatListView base class * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. * $/LicenseInfo$ */ @@ -54,7 +60,6 @@ */ class LLFlatListView : public LLScrollContainer, public LLEditMenuHandler { - LOG_CLASS(LLFlatListView); public: /** @@ -100,9 +105,6 @@ public: /** don't allow to deselect all selected items (for mouse events on items only) */ Optional<bool> keep_one_selected; - /** try to keep selection visible after reshape */ - Optional<bool> keep_selection_visible_on_reshape; - /** padding between items */ Optional<U32> item_pad; @@ -112,9 +114,6 @@ public: Params(); }; - // disable traversal when finding widget to hand focus off to - /*virtual*/ BOOL canFocusChildren() const { return FALSE; } - /** * Connects callback to signal called when Return key is pressed. */ @@ -147,19 +146,19 @@ public: * Remove specified item * @return true if the item was removed, false otherwise */ - virtual bool removeItem(LLPanel* item, bool rearrange = true); + virtual bool removeItem(LLPanel* item); /** * Remove an item specified by value * @return true if the item was removed, false otherwise */ - virtual bool removeItemByValue(const LLSD& value, bool rearrange = true); + virtual bool removeItemByValue(const LLSD& value); /** * Remove an item specified by uuid * @return true if the item was removed, false otherwise */ - virtual bool removeItemByUUID(const LLUUID& uuid, bool rearrange = true); + virtual bool removeItemByUUID(const LLUUID& uuid); /** * Get an item by value @@ -260,14 +259,14 @@ public: void setAllowSelection(bool can_select) { mAllowSelection = can_select; } /** Sets flag whether onCommit should be fired if selection was changed */ - // FIXME: this should really be a separate signal, since "Commit" implies explicit user action, and selection changes can happen more indirectly. void setCommitOnSelectionChange(bool b) { mCommitOnSelectionChange = b; } /** Get number of selected items in the list */ U32 numSelected() const {return mSelectedItemPairs.size(); } - /** Get number of (visible) items in the list */ - U32 size(const bool only_visible_items = true) const; + /** Get number of items in the list */ + U32 size() const { return mItemPairs.size(); } + /** Removes all items from the list */ virtual void clear(); @@ -348,7 +347,7 @@ protected: virtual bool isSelected(item_pair_t* item_pair) const; - virtual bool removeItemPair(item_pair_t* item_pair, bool rearrange); + virtual bool removeItemPair(item_pair_t* item_pair); /** * Notify parent about changed size of internal controls with "size_changes" action @@ -412,10 +411,6 @@ private: bool mKeepOneItemSelected; - bool mIsConsecutiveSelection; - - bool mKeepSelectionVisibleOnReshape; - /** All pairs of the list */ pairs_list_t mItemPairs; @@ -435,84 +430,4 @@ private: commit_signal_t mOnReturnSignal; }; -/** - * Extends LLFlatListView functionality to show different messages when there are no items in the - * list depend on whether they are filtered or not. - * - * Class provides one message per case of empty list. - * It also provides protected updateNoItemsMessage() method to be called each time when derived list - * is changed to update base mNoItemsCommentTextbox value. - * - * It is implemented to avoid duplication of this functionality in concrete implementations of the - * lists. It is intended to be used as a base class for lists which should support two different - * messages for empty state. Can be improved to support more than two messages via state-to-message map. - */ -class LLFlatListViewEx : public LLFlatListView -{ - LOG_CLASS(LLFlatListViewEx); -public: - struct Params : public LLInitParam::Block<Params, LLFlatListView::Params> - { - /** - * Contains a message for empty list when it does not contain any items at all. - */ - Optional<std::string> no_items_msg; - - /** - * Contains a message for empty list when its items are removed by filtering. - */ - Optional<std::string> no_filtered_items_msg; - Params(); - }; - - // *WORKAROUND: two methods to overload appropriate Params due to localization issue: - // no_items_msg & no_filtered_items_msg attributes are not defined as translatable in VLT. See EXT-5931 - void setNoItemsMsg(const std::string& msg) { mNoItemsMsg = msg; } - void setNoFilteredItemsMsg(const std::string& msg) { mNoFilteredItemsMsg = msg; } - - bool getForceShowingUnmatchedItems(); - - void setForceShowingUnmatchedItems(bool show); - - /** - * Sets up new filter string and filters the list. - */ - void setFilterSubString(const std::string& filter_str); - - /** - * Filters the list, rearranges and notifies parent about shape changes. - * Derived classes may want to overload rearrangeItems() to exclude repeated separators after filtration. - */ - void filterItems(); - - /** - * Returns true if last call of filterItems() found at least one matching item - */ - bool hasMatchedItems(); - -protected: - LLFlatListViewEx(const Params& p); - - /** - * Applies a message for empty list depend on passed argument. - * - * @param filter_string - if is not empty, message for filtered items will be set, otherwise for - * completely empty list. Value of filter string will be passed as search_term in SLURL. - */ - void updateNoItemsMessage(const std::string& filter_string); - -private: - std::string mNoFilteredItemsMsg; - std::string mNoItemsMsg; - std::string mFilterSubString; - /** - * Show list items that don't match current filter - */ - bool mForceShowingUnmatchedItems; - /** - * True if last call of filterItems() found at least one matching item - */ - bool mHasMatchedItems; -}; - #endif |