OLD | NEW |
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/search_result_view.h" | 5 #include "ui/app_list/search_result_view.h" |
6 | 6 |
7 #include "ui/app_list/app_list_constants.h" | 7 #include "ui/app_list/app_list_constants.h" |
8 #include "ui/app_list/search_result.h" | 8 #include "ui/app_list/search_result.h" |
9 #include "ui/app_list/search_result_list_view.h" | 9 #include "ui/app_list/search_result_list_view.h" |
10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 193 |
194 canvas->FillRect(content_rect, kContentsBackgroundColor); | 194 canvas->FillRect(content_rect, kContentsBackgroundColor); |
195 | 195 |
196 bool selected = list_view_->IsResultViewSelected(this); | 196 bool selected = list_view_->IsResultViewSelected(this); |
197 if (selected) { | 197 if (selected) { |
198 canvas->FillRect(content_rect, kSelectedBackgroundColor); | 198 canvas->FillRect(content_rect, kSelectedBackgroundColor); |
199 } else if (state() == BS_HOT || state() == BS_PUSHED) { | 199 } else if (state() == BS_HOT || state() == BS_PUSHED) { |
200 canvas->FillRect(content_rect, kHoverAndPushedColor); | 200 canvas->FillRect(content_rect, kHoverAndPushedColor); |
201 } | 201 } |
202 | 202 |
203 gfx::Rect border_bottom(rect); | 203 gfx::Rect border_bottom = gfx::SubtractRects(rect, content_rect); |
204 border_bottom.Subtract(content_rect); | |
205 canvas->FillRect(border_bottom, | 204 canvas->FillRect(border_bottom, |
206 selected ? kSelectedBorderColor : kBorderColor); | 205 selected ? kSelectedBorderColor : kBorderColor); |
207 | 206 |
208 gfx::Rect text_bounds(rect); | 207 gfx::Rect text_bounds(rect); |
209 text_bounds.set_x(kIconViewWidth); | 208 text_bounds.set_x(kIconViewWidth); |
210 text_bounds.set_width( | 209 text_bounds.set_width( |
211 rect.width() - kIconViewWidth - kTextTrailPadding - | 210 rect.width() - kIconViewWidth - kTextTrailPadding - |
212 action_buttons_.size() * kActionButtonWidth - | 211 action_buttons_.size() * kActionButtonWidth - |
213 (!action_buttons_.empty() ? kActionButtonRightMargin : 0)); | 212 (!action_buttons_.empty() ? kActionButtonRightMargin : 0)); |
214 text_bounds.set_x(GetMirroredXWithWidthInView(text_bounds.x(), | 213 text_bounds.set_x(GetMirroredXWithWidthInView(text_bounds.x(), |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 views::ImageButton* button = action_buttons_[i]; | 300 views::ImageButton* button = action_buttons_[i]; |
302 button->SetImage(views::CustomButton::BS_NORMAL, &icon.base_image); | 301 button->SetImage(views::CustomButton::BS_NORMAL, &icon.base_image); |
303 button->SetImage(views::CustomButton::BS_HOT, &icon.hover_image); | 302 button->SetImage(views::CustomButton::BS_HOT, &icon.hover_image); |
304 button->SetImage(views::CustomButton::BS_PUSHED, &icon.pressed_image); | 303 button->SetImage(views::CustomButton::BS_PUSHED, &icon.pressed_image); |
305 button->SetTooltipText(icon.tooltip_text); | 304 button->SetTooltipText(icon.tooltip_text); |
306 } | 305 } |
307 } | 306 } |
308 } | 307 } |
309 | 308 |
310 } // namespace app_list | 309 } // namespace app_list |
OLD | NEW |