OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "athena/home/minimized_home.h" | 5 #include "athena/home/minimized_home.h" |
6 | 6 |
7 #include "ui/views/background.h" | 7 #include "ui/views/background.h" |
8 #include "ui/views/layout/box_layout.h" | 8 #include "ui/views/layout/box_layout.h" |
9 #include "ui/views/view.h" | 9 #include "ui/views/view.h" |
10 #include "ui/views/widget/widget.h" | 10 #include "ui/views/widget/widget.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 SchedulePaint(); | 32 SchedulePaint(); |
33 } | 33 } |
34 | 34 |
35 // views::View: | 35 // views::View: |
36 virtual gfx::Size GetPreferredSize() const OVERRIDE { | 36 virtual gfx::Size GetPreferredSize() const OVERRIDE { |
37 const int kDragHandleWidth = 80; | 37 const int kDragHandleWidth = 80; |
38 const int kDragHandleHeight = 4; | 38 const int kDragHandleHeight = 4; |
39 return gfx::Size(kDragHandleWidth, kDragHandleHeight); | 39 return gfx::Size(kDragHandleWidth, kDragHandleHeight); |
40 } | 40 } |
41 | 41 |
| 42 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE { |
| 43 if (event.IsLeftMouseButton() && event.GetClickCount() > 1) { |
| 44 delegate_->OnDragUpCompleted(); |
| 45 SetColor(kDragHandleColorNormal); |
| 46 return true; |
| 47 } |
| 48 return false; |
| 49 } |
| 50 |
| 51 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE { |
| 52 SetColor(kDragHandleColorHot); |
| 53 } |
| 54 |
| 55 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE { |
| 56 SetColor(kDragHandleColorNormal); |
| 57 } |
| 58 |
42 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { | 59 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { |
43 SkColor change_color = SK_ColorTRANSPARENT; | 60 SkColor change_color = SK_ColorTRANSPARENT; |
44 if (event->type() == ui::ET_GESTURE_BEGIN && | 61 if (event->type() == ui::ET_GESTURE_BEGIN && |
45 event->details().touch_points() == 1) { | 62 event->details().touch_points() == 1) { |
46 change_color = kDragHandleColorHot; | 63 change_color = kDragHandleColorHot; |
47 } else if (event->type() == ui::ET_GESTURE_END && | 64 } else if (event->type() == ui::ET_GESTURE_END && |
48 event->details().touch_points() == 1) { | 65 event->details().touch_points() == 1) { |
49 change_color = kDragHandleColorNormal; | 66 change_color = kDragHandleColorNormal; |
50 } | 67 } |
51 | 68 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 2, 0); | 108 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 2, 0); |
92 layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); | 109 layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); |
93 content_view->SetLayoutManager(layout); | 110 content_view->SetLayoutManager(layout); |
94 | 111 |
95 views::View* view = new MinimizedHomeView(delegate); | 112 views::View* view = new MinimizedHomeView(delegate); |
96 content_view->AddChildView(view); | 113 content_view->AddChildView(view); |
97 return widget; | 114 return widget; |
98 } | 115 } |
99 | 116 |
100 } // namespace athena | 117 } // namespace athena |
OLD | NEW |