Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: ui/app_list/app_list_item_view.cc

Issue 11068012: Add new views::LabelButton and LabelButtonBorder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove stray semicolon. Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/views/bubble/bubble_border.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/app_list/app_list_item_view.h" 5 #include "ui/app_list/app_list_item_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "ui/app_list/app_list_item_model.h" 10 #include "ui/app_list/app_list_item_model.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 return *font; 47 return *font;
48 48
49 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 49 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
50 gfx::Font title_font(rb.GetFont(ui::ResourceBundle::BaseFont).GetFontName(), 50 gfx::Font title_font(rb.GetFont(ui::ResourceBundle::BaseFont).GetFontName(),
51 kTitleFontSize); 51 kTitleFontSize);
52 title_font = title_font.DeriveFont(0, gfx::Font::BOLD); 52 title_font = title_font.DeriveFont(0, gfx::Font::BOLD);
53 font = new gfx::Font(title_font); 53 font = new gfx::Font(title_font);
54 return *font; 54 return *font;
55 } 55 }
56 56
57 // An image view that is not interactive.
58 class StaticImageView : public views::ImageView {
59 public:
60 StaticImageView() : ImageView() {
61 }
62
63 private:
64 // views::View overrides:
65 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE {
66 return false;
67 }
68
69 DISALLOW_COPY_AND_ASSIGN(StaticImageView);
70 };
71
72 } // namespace 57 } // namespace
73 58
74 // static 59 // static
75 const char AppListItemView::kViewClassName[] = "ui/app_list/AppListItemView"; 60 const char AppListItemView::kViewClassName[] = "ui/app_list/AppListItemView";
76 61
77 AppListItemView::AppListItemView(AppsGridView* apps_grid_view, 62 AppListItemView::AppListItemView(AppsGridView* apps_grid_view,
78 AppListItemModel* model) 63 AppListItemModel* model)
79 : CustomButton(apps_grid_view), 64 : CustomButton(apps_grid_view),
80 model_(model), 65 model_(model),
81 apps_grid_view_(apps_grid_view), 66 apps_grid_view_(apps_grid_view),
82 icon_(new StaticImageView), 67 icon_(new views::ImageView),
83 title_(new views::Label) { 68 title_(new views::Label) {
69 icon_->set_interactive(false);
70
84 title_->SetBackgroundColor(0); 71 title_->SetBackgroundColor(0);
85 title_->SetAutoColorReadabilityEnabled(false); 72 title_->SetAutoColorReadabilityEnabled(false);
86 title_->SetEnabledColor(kTitleColor); 73 title_->SetEnabledColor(kTitleColor);
87 title_->SetFont(GetTitleFont()); 74 title_->SetFont(GetTitleFont());
88 75
89 const gfx::ShadowValue kIconShadows[] = { 76 const gfx::ShadowValue kIconShadows[] = {
90 gfx::ShadowValue(gfx::Point(0, 2), 2, SkColorSetARGB(0x24, 0, 0, 0)), 77 gfx::ShadowValue(gfx::Point(0, 2), 2, SkColorSetARGB(0x24, 0, 0, 0)),
91 }; 78 };
92 icon_shadows_.assign(kIconShadows, kIconShadows + arraysize(kIconShadows)); 79 icon_shadows_.assign(kIconShadows, kIconShadows + arraysize(kIconShadows));
93 80
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 apps_grid_view_->EndDrag(true); 235 apps_grid_view_->EndDrag(true);
249 } 236 }
250 237
251 bool AppListItemView::OnMouseDragged(const ui::MouseEvent& event) { 238 bool AppListItemView::OnMouseDragged(const ui::MouseEvent& event) {
252 CustomButton::OnMouseDragged(event); 239 CustomButton::OnMouseDragged(event);
253 apps_grid_view_->UpdateDrag(this, event); 240 apps_grid_view_->UpdateDrag(this, event);
254 return true; 241 return true;
255 } 242 }
256 243
257 } // namespace app_list 244 } // namespace app_list
OLDNEW
« no previous file with comments | « no previous file | ui/views/bubble/bubble_border.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698