PageRenderTime 32ms CodeModel.GetById 19ms RepoModel.GetById 0ms 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
Possible License(s): LGPL-2.1
  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. #ifndef LL_LLSEARCHCOMBOBOX_H
  27. #define LL_LLSEARCHCOMBOBOX_H
  28. #include "llcombobox.h"
  29. #include "llsearchhistory.h"
  30. /**
  31. * Search control with text box for search queries and a drop down list
  32. * with recent queries. Supports text auto-complete and filtering of drop down list
  33. * according to typed text.
  34. */
  35. class LLSearchComboBox : public LLComboBox
  36. {
  37. public:
  38. struct Params : public LLInitParam::Block<Params, LLComboBox::Params>
  39. {
  40. Optional<LLButton::Params> search_button;
  41. Optional<bool> dropdown_button_visible;
  42. Params();
  43. };
  44. /**
  45. * Removes an entry from combo box, case insensitive
  46. */
  47. BOOL remove(const std::string& name);
  48. /**
  49. * Clears search history
  50. */
  51. void clearHistory();
  52. /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask);
  53. ~LLSearchComboBox();
  54. protected:
  55. LLSearchComboBox(const Params&p);
  56. friend class LLUICtrlFactory;
  57. /**
  58. * Handles typing in text box
  59. */
  60. void onTextEntry(LLLineEditor* line_editor);
  61. /**
  62. * Hides drop down list and focuses text box
  63. */
  64. void hideList();
  65. /**
  66. * Rebuilds search history, case insensitive
  67. * If filter is an empty string - whole history will be added to combo box
  68. * if filter is valid string - only matching entries will be added
  69. */
  70. virtual void rebuildSearchHistory(const std::string& filter);
  71. /**
  72. * Callback for prearrange event
  73. */
  74. void onSearchPrearrange(const LLSD& data);
  75. /**
  76. * Callback for text box or combo box commit
  77. */
  78. void onSelectionCommit();
  79. /**
  80. * Sets focus to text box
  81. */
  82. void focusTextEntry();
  83. LLButton* mSearchButton;
  84. };
  85. #endif //LL_LLSEARCHCOMBOBOX_H