Chromium Code Reviews| Index: ui/app_list/search_box_model.h |
| diff --git a/ui/app_list/search_box_model.h b/ui/app_list/search_box_model.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5762f6343e87bb171edcf6262288db7de3c8dbcc |
| --- /dev/null |
| +++ b/ui/app_list/search_box_model.h |
| @@ -0,0 +1,75 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef UI_APP_LIST_SEARCH_BOX_MODEL_H_ |
| +#define UI_APP_LIST_SEARCH_BOX_MODEL_H_ |
| +#pragma once |
| + |
| +#include "base/basictypes.h" |
| +#include "base/observer_list.h" |
| +#include "base/string16.h" |
| +#include "third_party/skia/include/core/SkBitmap.h" |
| +#include "ui/app_list/app_list_export.h" |
| +#include "ui/gfx/selection_model.h" |
| + |
| +namespace app_list { |
| + |
| +class SearchBoxModelObserver; |
| + |
| +// SearchBoxModel consisits of an icon, a hint text, a user text and a selection |
| +// model. The icon is rendered at side of the query edit control. The hint text |
|
sky
2012/05/22 22:16:06
at -> to the
xiyuan
2012/05/23 21:25:22
Done.
|
| +// is used as query edit control's placeholder text and displayed when there is |
| +// no user text in the control. The selection model and the text represents the |
| +// text, cursor position and selected text in edit control. |
| +class APP_LIST_EXPORT SearchBoxModel { |
| + public: |
| + SearchBoxModel(); |
| + ~SearchBoxModel(); |
| + |
| + // Sets the icon on side of edit box. |
| + void SetIcon(const SkBitmap& icon); |
| + |
| + // Sets the hint text to display when there is in input. |
| + void SetHintText(const string16& hint_text); |
| + |
| + // Sets the selection model for the search box's Textfield. |
| + void SetSelectionModel(const gfx::SelectionModel& sel); |
| + |
| + // Sets the text for the search box's Textfield. |
| + void SetText(const string16& text); |
| + |
| + void AddObserver(SearchBoxModelObserver* observer); |
| + void RemoveObserver(SearchBoxModelObserver* observer); |
| + |
| + const SkBitmap& icon() const { |
| + return icon_; |
| + } |
| + |
| + const string16& hint_text() const { |
| + return hint_text_; |
| + } |
| + |
| + const gfx::SelectionModel& selection_model() const { |
| + return selection_model_; |
| + } |
| + |
| + const string16& text() const { |
| + return text_; |
| + } |
| + |
| + private: |
| + SkBitmap icon_; |
|
sky
2012/05/22 22:16:06
Use ImageSkia
xiyuan
2012/05/23 21:25:22
Done.
|
| + string16 hint_text_; |
| + |
| + gfx::SelectionModel selection_model_; |
| + string16 text_; |
| + |
| + ObserverList<SearchBoxModelObserver> observers_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SearchBoxModel); |
| +}; |
| + |
| +} // namespace app_list |
| + |
| +#endif // UI_APP_LIST_SEARCH_BOX_MODEL_H_ |