| 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 class SearchResultListView; |
| 27 |
| 28 // SearchResultView displays a SearchResult. |
| 29 class SearchResultView : public views::CustomButton { |
| 30 public: |
| 31 // Internal class name. |
| 32 static const char kViewClassName[]; |
| 33 |
| 34 SearchResultView(SearchResultListView* list_view, |
| 35 views::ButtonListener* listener); |
| 36 virtual ~SearchResultView(); |
| 37 |
| 38 // Sets/gets SearchResult displayed by this view. |
| 39 void SetResult(const SearchResult* result); |
| 40 const SearchResult* result() const { return result_; } |
| 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 |
| 54 // Parent list view. Owned by views hierarchy. |
| 55 SearchResultListView* list_view_; |
| 56 |
| 57 views::ImageView* icon_; // Owned by views hierarchy |
| 58 scoped_ptr<gfx::RenderText> title_text_; |
| 59 scoped_ptr<gfx::RenderText> details_text_; |
| 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(SearchResultView); |
| 62 }; |
| 63 |
| 64 } // namespace app_list |
| 65 |
| 66 #endif // UI_APP_LIST_SEARCH_RESULT_VIEW_H_ |
| OLD | NEW |