PageRenderTime 15ms CodeModel.GetById 2ms app.highlight 8ms RepoModel.GetById 2ms app.codeStats 0ms

/indra/newview/llsearchcombobox.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 104 lines | 29 code | 19 blank | 56 comment | 0 complexity | 3259b4b0546c5eb8f2bc29f849decd35 MD5 | raw file
  1/** 
  2 * @file llsearchcombobox.h
  3 * @brief LLSearchComboBox class definition
  4 *
  5 * $LicenseInfo:firstyear=2009&license=viewerlgpl$
  6 * Second Life Viewer Source Code
  7 * Copyright (C) 2010, Linden Research, Inc.
  8 * 
  9 * This library is free software; you can redistribute it and/or
 10 * modify it under the terms of the GNU Lesser General Public
 11 * License as published by the Free Software Foundation;
 12 * version 2.1 of the License only.
 13 * 
 14 * This library is distributed in the hope that it will be useful,
 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 17 * Lesser General Public License for more details.
 18 * 
 19 * You should have received a copy of the GNU Lesser General Public
 20 * License along with this library; if not, write to the Free Software
 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 22 * 
 23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 24 * $/LicenseInfo$
 25 */
 26
 27#ifndef LL_LLSEARCHCOMBOBOX_H
 28#define LL_LLSEARCHCOMBOBOX_H
 29
 30#include "llcombobox.h"
 31#include "llsearchhistory.h"
 32
 33/**
 34 * Search control with text box for search queries and a drop down list
 35 * with recent queries. Supports text auto-complete and filtering of drop down list
 36 * according to typed text.
 37 */
 38class LLSearchComboBox : public LLComboBox
 39{
 40public:
 41
 42	struct Params :	public LLInitParam::Block<Params, LLComboBox::Params>
 43	{
 44		Optional<LLButton::Params> search_button;
 45		Optional<bool> dropdown_button_visible;
 46
 47		Params();
 48	};
 49
 50	/**
 51	 * Removes an entry from combo box, case insensitive
 52	 */
 53	BOOL remove(const std::string& name);
 54
 55	/**
 56	 * Clears search history
 57	 */
 58	void clearHistory();
 59
 60	/*virtual*/ BOOL handleKeyHere(KEY key, MASK mask);
 61
 62	~LLSearchComboBox();
 63
 64protected:
 65
 66	LLSearchComboBox(const Params&p);
 67	friend class LLUICtrlFactory;
 68
 69	/**
 70	 * Handles typing in text box
 71	 */
 72	void onTextEntry(LLLineEditor* line_editor);
 73
 74	/**
 75	 * Hides drop down list and focuses text box
 76	 */
 77	void hideList();
 78
 79	/**
 80	 * Rebuilds search history, case insensitive
 81	 * If filter is an empty string - whole history will be added to combo box
 82	 * if filter is valid string - only matching entries will be added
 83	 */
 84	virtual void rebuildSearchHistory(const std::string& filter);
 85
 86	/**
 87	 * Callback for prearrange event
 88	 */
 89	void onSearchPrearrange(const LLSD& data);
 90
 91	/**
 92	 * Callback for text box or combo box commit
 93	 */
 94	void onSelectionCommit();
 95
 96	/**
 97	 * Sets focus to text box
 98	 */
 99	void focusTextEntry();
100
101	LLButton* mSearchButton;
102};
103
104#endif //LL_LLSEARCHCOMBOBOX_H