Chromium Code Reviews| Index: ui/app_list/search_result_view.h |
| diff --git a/ui/app_list/search_result_view.h b/ui/app_list/search_result_view.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..cda6682d60fa7d40628211cfef4c7999670ad510 |
| --- /dev/null |
| +++ b/ui/app_list/search_result_view.h |
| @@ -0,0 +1,64 @@ |
| +// 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_RESULT_VIEW_H_ |
| +#define UI_APP_LIST_SEARCH_RESULT_VIEW_H_ |
| +#pragma once |
| + |
| +#include <string> |
| + |
| +#include "base/basictypes.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "ui/views/controls/button/custom_button.h" |
| + |
| +namespace gfx { |
| +class RenderText; |
| +} |
| + |
| +namespace views { |
| +class ImageView; |
| +} |
| + |
| +namespace app_list { |
| + |
| +class SearchResult; |
| + |
| +// SearchResultView displays a SearchResult. |
| +class SearchResultView : public views::CustomButton { |
| + public: |
| + explicit SearchResultView(views::ButtonListener* listener); |
| + virtual ~SearchResultView(); |
| + |
| + // Sets/gets SearchResult displayed by this view. |
| + void SetResult(const SearchResult* result); |
| + const SearchResult* result() const { return result_; } |
| + |
| + void SetSelected(bool selected); |
| + |
| + // Internal class name. |
| + static const char kViewClassName[]; |
|
sky
2012/05/22 22:16:06
constants like this should be first in a section.
xiyuan
2012/05/23 21:25:22
Done.
|
| + |
| + private: |
| + void UpdateTitleText(); |
| + void UpdateDetailsText(); |
| + |
| + // views::View overrides: |
| + virtual std::string GetClassName() const OVERRIDE; |
| + virtual gfx::Size GetPreferredSize() OVERRIDE; |
| + virtual void Layout() OVERRIDE; |
| + virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| + |
| + const SearchResult* result_; |
| + bool selected_; |
|
sky
2012/05/22 22:16:06
Could you instead get the selection from the ListV
xiyuan
2012/05/23 21:25:22
Done.
|
| + |
| + views::ImageView* icon_; // Owned by views hierarchy |
| + scoped_ptr<gfx::RenderText> title_text_; |
| + scoped_ptr<gfx::RenderText> details_text_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SearchResultView); |
| +}; |
| + |
| +} // namespace app_list |
| + |
| +#endif // UI_APP_LIST_SEARCH_RESULT_VIEW_H_ |