Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_APP_LIST_SEARCH_RESULT_VIEW_H_ | |
| 6 #define UI_APP_LIST_SEARCH_RESULT_VIEW_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/basictypes.h" | |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "ui/views/controls/button/custom_button.h" | |
| 14 | |
| 15 namespace gfx { | |
| 16 class RenderText; | |
| 17 } | |
| 18 | |
| 19 namespace views { | |
| 20 class ImageView; | |
| 21 } | |
| 22 | |
| 23 namespace app_list { | |
| 24 | |
| 25 class SearchResult; | |
| 26 | |
| 27 // SearchResultView displays a SearchResult. | |
| 28 class SearchResultView : public views::CustomButton { | |
| 29 public: | |
| 30 explicit SearchResultView(views::ButtonListener* listener); | |
| 31 virtual ~SearchResultView(); | |
| 32 | |
| 33 // Sets/gets SearchResult displayed by this view. | |
| 34 void SetResult(const SearchResult* result); | |
| 35 const SearchResult* result() const { return result_; } | |
| 36 | |
| 37 void SetSelected(bool selected); | |
| 38 | |
| 39 // Internal class name. | |
| 40 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.
| |
| 41 | |
| 42 private: | |
| 43 void UpdateTitleText(); | |
| 44 void UpdateDetailsText(); | |
| 45 | |
| 46 // views::View overrides: | |
| 47 virtual std::string GetClassName() const OVERRIDE; | |
| 48 virtual gfx::Size GetPreferredSize() OVERRIDE; | |
| 49 virtual void Layout() OVERRIDE; | |
| 50 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | |
| 51 | |
| 52 const SearchResult* result_; | |
| 53 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.
| |
| 54 | |
| 55 views::ImageView* icon_; // Owned by views hierarchy | |
| 56 scoped_ptr<gfx::RenderText> title_text_; | |
| 57 scoped_ptr<gfx::RenderText> details_text_; | |
| 58 | |
| 59 DISALLOW_COPY_AND_ASSIGN(SearchResultView); | |
| 60 }; | |
| 61 | |
| 62 } // namespace app_list | |
| 63 | |
| 64 #endif // UI_APP_LIST_SEARCH_RESULT_VIEW_H_ | |
| OLD | NEW |