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/page_switcher.h" | 5 #include "ui/app_list/page_switcher.h" |
6 | 6 |
7 #include "third_party/skia/include/core/SkPath.h" | 7 #include "third_party/skia/include/core/SkPath.h" |
8 #include "ui/app_list/pagination_model.h" | 8 #include "ui/app_list/pagination_model.h" |
9 #include "ui/base/animation/throb_animation.h" | 9 #include "ui/base/animation/throb_animation.h" |
10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
11 #include "ui/views/controls/button/custom_button.h" | 11 #include "ui/views/controls/button/custom_button.h" |
12 #include "ui/views/layout/box_layout.h" | 12 #include "ui/views/layout/box_layout.h" |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 const int kButtonSpacing = 10; | 16 const int kButtonSpacing = 10; |
17 const int kButtonWidth = 60; | 17 const int kButtonWidth = 60; |
18 const int kButtonHeight = 6; | 18 const int kButtonHeight = 6; |
19 const int kButtonHeightPadding = 10; | 19 const int kButtonHeightPadding = 10; |
20 const int kButtonCornerRadius = 2; | 20 const int kButtonCornerRadius = 2; |
21 | 21 |
22 // 0.16 black | 22 const SkColor kHoverColor = SkColorSetRGB(0x6E, 0x6E, 0x6E); |
23 const SkColor kHoverColor = SkColorSetARGB(0x2A, 0x00, 0x00, 0x00); | |
24 | 23 |
25 // 0.2 black | 24 const SkColor kNormalColor = SkColorSetRGB(0xBB, 0xBB, 0xBB); |
26 const SkColor kNormalColor = SkColorSetARGB(0x33, 0x00, 0x00, 0x00); | |
27 | 25 |
28 // 0.33 black | 26 const SkColor kSelectedColor = kHoverColor; |
29 const SkColor kSelectedColor = SkColorSetARGB(0x55, 0x00, 0x00, 0x00); | |
30 | 27 |
31 class PageSwitcherButton : public views::CustomButton { | 28 class PageSwitcherButton : public views::CustomButton { |
32 public: | 29 public: |
33 explicit PageSwitcherButton(views::ButtonListener* listener) | 30 explicit PageSwitcherButton(views::ButtonListener* listener) |
34 : views::CustomButton(listener), | 31 : views::CustomButton(listener), |
35 selected_(false) { | 32 selected_(false) { |
36 } | 33 } |
37 virtual ~PageSwitcherButton() {} | 34 virtual ~PageSwitcherButton() {} |
38 | 35 |
39 void SetSelected(bool selected) { | 36 void SetSelected(bool selected) { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 } | 146 } |
150 | 147 |
151 void PageSwitcher::SelectedPageChanged(int old_selected, int new_selected) { | 148 void PageSwitcher::SelectedPageChanged(int old_selected, int new_selected) { |
152 if (old_selected >= 0 && old_selected < buttons_->child_count()) | 149 if (old_selected >= 0 && old_selected < buttons_->child_count()) |
153 GetButtonByIndex(buttons_, old_selected)->SetSelected(false); | 150 GetButtonByIndex(buttons_, old_selected)->SetSelected(false); |
154 if (new_selected >= 0 && new_selected < buttons_->child_count()) | 151 if (new_selected >= 0 && new_selected < buttons_->child_count()) |
155 GetButtonByIndex(buttons_, new_selected)->SetSelected(true); | 152 GetButtonByIndex(buttons_, new_selected)->SetSelected(true); |
156 } | 153 } |
157 | 154 |
158 } // namespace app_list | 155 } // namespace app_list |
OLD | NEW |