OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/message_center/views/notification_button.h" | 5 #include "ui/message_center/views/notification_button.h" |
6 | 6 |
7 #include "ui/gfx/canvas.h" | 7 #include "ui/gfx/canvas.h" |
8 #include "ui/message_center/message_center_style.h" | 8 #include "ui/message_center/message_center_style.h" |
9 #include "ui/message_center/views/constants.h" | 9 #include "ui/message_center/views/constants.h" |
10 #include "ui/views/background.h" | 10 #include "ui/views/background.h" |
11 #include "ui/views/border.h" | 11 #include "ui/views/border.h" |
12 #include "ui/views/controls/image_view.h" | 12 #include "ui/views/controls/image_view.h" |
13 #include "ui/views/controls/label.h" | 13 #include "ui/views/controls/label.h" |
14 #include "ui/views/layout/box_layout.h" | 14 #include "ui/views/layout/box_layout.h" |
15 #include "ui/views/painter.h" | 15 #include "ui/views/painter.h" |
16 | 16 |
17 namespace message_center { | 17 namespace message_center { |
18 | 18 |
19 NotificationButton::NotificationButton(views::ButtonListener* listener) | 19 NotificationButton::NotificationButton(views::ButtonListener* listener) |
20 : views::CustomButton(listener), | 20 : views::CustomButton(listener), |
21 icon_(NULL), | 21 icon_(NULL), |
22 title_(NULL), | 22 title_(NULL), |
23 focus_painter_(views::Painter::CreateSolidFocusPainter( | 23 focus_painter_(views::Painter::CreateSolidFocusPainter( |
24 message_center::kFocusBorderColor, | 24 message_center::kFocusBorderColor, |
25 gfx::Insets(1, 2, 2, 2))) { | 25 gfx::Insets(1, 2, 2, 2))) { |
26 set_focusable(true); | 26 SetFocusable(true); |
27 set_request_focus_on_press(false); | 27 set_request_focus_on_press(false); |
28 set_notify_enter_exit_on_child(true); | 28 set_notify_enter_exit_on_child(true); |
29 SetLayoutManager( | 29 SetLayoutManager( |
30 new views::BoxLayout(views::BoxLayout::kHorizontal, | 30 new views::BoxLayout(views::BoxLayout::kHorizontal, |
31 message_center::kButtonHorizontalPadding, | 31 message_center::kButtonHorizontalPadding, |
32 kButtonVecticalPadding, | 32 kButtonVecticalPadding, |
33 message_center::kButtonIconToTitlePadding)); | 33 message_center::kButtonIconToTitlePadding)); |
34 } | 34 } |
35 | 35 |
36 NotificationButton::~NotificationButton() { | 36 NotificationButton::~NotificationButton() { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 void NotificationButton::StateChanged() { | 101 void NotificationButton::StateChanged() { |
102 if (state() == STATE_HOVERED || state() == STATE_PRESSED) { | 102 if (state() == STATE_HOVERED || state() == STATE_PRESSED) { |
103 set_background(views::Background::CreateSolidBackground( | 103 set_background(views::Background::CreateSolidBackground( |
104 message_center::kHoveredButtonBackgroundColor)); | 104 message_center::kHoveredButtonBackgroundColor)); |
105 } else { | 105 } else { |
106 set_background(NULL); | 106 set_background(NULL); |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
110 } // namespace message_center | 110 } // namespace message_center |
OLD | NEW |