summaryrefslogtreecommitdiff
path: root/indra/llui/llsearcheditor.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/llsearcheditor.h')
-rw-r--r--indra/llui/llsearcheditor.h86
1 files changed, 43 insertions, 43 deletions
diff --git a/indra/llui/llsearcheditor.h b/indra/llui/llsearcheditor.h
index d8c5093fbf..f5c3b532c4 100644
--- a/indra/llui/llsearcheditor.h
+++ b/indra/llui/llsearcheditor.h
@@ -11,88 +11,88 @@
* Pre-validation (limit which keys can be used)
* Optional line history so previous entries can be recalled by CTRL UP/DOWN
*
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- *
- * Copyright (c) 2001-2009, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
* 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
+ * Copyright (C) 2010, 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.
*
- * 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
+ * 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.
*
- * 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.
+ * 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
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-#ifndef LL_LLSEARCHEDITOR_H
-#define LL_LLSEARCHEDITOR_H
+#ifndef LL_SEARCHEDITOR_H
+#define LL_SEARCHEDITOR_H
#include "lllineeditor.h"
#include "llbutton.h"
-#include <boost/function.hpp>
-
-/*
- * @brief A line editor with a button to clear it and a callback to call on every edit event.
- */
class LLSearchEditor : public LLUICtrl
{
public:
struct Params : public LLInitParam::Block<Params, LLLineEditor::Params>
{
- Optional<boost::function<void(const std::string&, void*)> > search_callback;
-
- Optional<LLButton::Params> clear_search_button;
+ Optional<LLButton::Params> search_button,
+ clear_button;
+ Optional<bool> search_button_visible,
+ clear_button_visible;
+ Optional<commit_callback_t> keystroke_callback;
Params()
- : clear_search_button("clear_search_button")
+ : search_button("search_button"),
+ search_button_visible("search_button_visible"),
+ clear_button("clear_button"),
+ clear_button_visible("clear_button_visible")
{
name = "search_editor";
}
};
+ void setCommitOnFocusLost(BOOL b) { if (mSearchEditor) mSearchEditor->setCommitOnFocusLost(b); }
+
protected:
LLSearchEditor(const Params&);
friend class LLUICtrlFactory;
+
public:
virtual ~LLSearchEditor() {}
/*virtual*/ void draw();
- void setText(const LLStringExplicit &new_text) { mSearchEdit->setText(new_text); }
-
- typedef boost::function<void (const std::string& search_string)> search_callback_t;
- void setSearchCallback(search_callback_t cb) { mSearchCallback = cb; }
+ void setText(const LLStringExplicit &new_text) { mSearchEditor->setText(new_text); }
+ const std::string& getText() const { return mSearchEditor->getText(); }
// LLUICtrl interface
virtual void setValue(const LLSD& value );
virtual LLSD getValue() const;
virtual BOOL setTextArg( const std::string& key, const LLStringExplicit& text );
virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text );
+ virtual void setLabel( const LLStringExplicit &new_label );
virtual void clear();
+ virtual void setFocus( BOOL b );
-private:
- void onSearchEdit(LLLineEditor* caller );
- void onClearSearch(const LLSD& data);
+ void setKeystrokeCallback( commit_callback_t cb ) { mKeystrokeCallback = cb; }
+
+protected:
+ void onClearButtonClick(const LLSD& data);
+ virtual void handleKeystroke();
- LLLineEditor* mSearchEdit;
- LLButton* mClearSearchButton;
- search_callback_t mSearchCallback;
+ commit_callback_t mKeystrokeCallback;
+ LLLineEditor* mSearchEditor;
+ LLButton* mSearchButton;
+ LLButton* mClearButton;
};
-#endif // LL_LLSEARCHEDITOR_H
+#endif // LL_SEARCHEDITOR_H