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 "ash/wm/panel_frame_view.h" | 5 #include "ash/wm/panel_frame_view.h" |
6 | 6 |
7 #include "grit/ui_resources.h" | 7 #include "grit/ui_resources.h" |
8 #include "third_party/skia/include/core/SkPaint.h" | 8 #include "third_party/skia/include/core/SkPaint.h" |
9 #include "ui/aura/cursor.h" | 9 #include "ui/aura/cursor.h" |
10 #include "ui/base/animation/throb_animation.h" | 10 #include "ui/base/animation/throb_animation.h" |
11 #include "ui/base/hit_test.h" | 11 #include "ui/base/hit_test.h" |
12 #include "ui/base/resource/resource_bundle.h" | 12 #include "ui/base/resource/resource_bundle.h" |
13 #include "ui/gfx/canvas.h" | 13 #include "ui/gfx/canvas.h" |
14 #include "ui/gfx/image/image.h" | 14 #include "ui/gfx/image/image.h" |
15 #include "ui/views/controls/button/custom_button.h" | 15 #include "ui/views/controls/button/custom_button.h" |
16 #include "ui/views/widget/widget.h" | 16 #include "ui/views/widget/widget.h" |
17 #include "ui/views/widget/widget_delegate.h" | 17 #include "ui/views/widget/widget_delegate.h" |
18 | 18 |
19 namespace ash { | 19 namespace ash { |
20 | 20 |
21 namespace { | 21 namespace { |
22 const int kClientViewPaddingLeft = 0; | 22 const int kClientViewPaddingLeft = 0; |
23 const int kClientViewPaddingRight = 0; | 23 const int kClientViewPaddingRight = 0; |
24 const int kClientViewPaddingBottom = 0; | 24 const int kClientViewPaddingBottom = 0; |
25 const int kSeparatorWidth = 1; | |
25 const SkColor kCaptionColor = SK_ColorGRAY; | 26 const SkColor kCaptionColor = SK_ColorGRAY; |
26 const SkColor kCaptionIconDivisorColor = SkColorSetARGB(0xFF, 0x55, 0x55, 0x55); | 27 const SkColor kCaptionIconDivisorColor = SkColorSetARGB(0xFF, 0x55, 0x55, 0x55); |
27 } | 28 } |
28 | 29 |
29 // Buttons for panel control | 30 // Buttons for panel control |
30 class PanelControlButton : public views::CustomButton { | 31 class PanelControlButton : public views::CustomButton { |
31 public: | 32 public: |
32 PanelControlButton(views::ButtonListener* listener, | 33 PanelControlButton(views::ButtonListener* listener, |
33 const SkBitmap& icon) | 34 const SkBitmap& icon) |
34 : views::CustomButton(listener), | 35 : views::CustomButton(listener), |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 // Overridden from views::View: | 84 // Overridden from views::View: |
84 virtual gfx::Size GetPreferredSize() OVERRIDE { | 85 virtual gfx::Size GetPreferredSize() OVERRIDE { |
85 return gfx::Size(0, close_button_->GetPreferredSize().height()); | 86 return gfx::Size(0, close_button_->GetPreferredSize().height()); |
86 } | 87 } |
87 | 88 |
88 | 89 |
89 private: | 90 private: |
90 // Overridden from views::View: | 91 // Overridden from views::View: |
91 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 92 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { |
92 canvas->FillRect(GetLocalBounds(), kCaptionColor); | 93 canvas->FillRect(GetLocalBounds(), kCaptionColor); |
93 gfx::Rect close_button_bounds = close_button_->bounds(); | 94 gfx::Rect bounds(close_button_->bounds()); |
94 canvas->DrawLine( | 95 canvas->FillRect(gfx::Rect(bounds.x(), bounds.y(), kSeparatorWidth, |
95 gfx::Point(close_button_bounds.x(), close_button_bounds.y()), | 96 bounds.bottom()), kCaptionIconDivisorColor); |
Peter Kasting
2012/03/14 20:23:09
Shouldn't this be bounds.height()? Actually a cle
tfarina
2012/03/14 20:36:37
Done.
| |
96 gfx::Point(close_button_bounds.x(), close_button_bounds.bottom()), | |
97 kCaptionIconDivisorColor); | |
98 } | 97 } |
99 | 98 |
100 virtual void Layout() OVERRIDE { | 99 virtual void Layout() OVERRIDE { |
101 gfx::Size close_ps = close_button_->GetPreferredSize(); | 100 gfx::Size close_ps = close_button_->GetPreferredSize(); |
102 close_button_->SetBoundsRect( | 101 close_button_->SetBoundsRect( |
103 gfx::Rect(width() - close_ps.width(), 0, | 102 gfx::Rect(width() - close_ps.width(), 0, |
104 close_ps.width(), close_ps.height())); | 103 close_ps.width(), close_ps.height())); |
105 } | 104 } |
106 | 105 |
107 // Overriden from views::ButtonListener: | 106 // Overriden from views::ButtonListener: |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
176 const gfx::Rect& client_bounds) const { | 175 const gfx::Rect& client_bounds) const { |
177 gfx::Rect window_bounds = client_bounds; | 176 gfx::Rect window_bounds = client_bounds; |
178 window_bounds.Inset(-kClientViewPaddingLeft, | 177 window_bounds.Inset(-kClientViewPaddingLeft, |
179 -CaptionHeight(), | 178 -CaptionHeight(), |
180 -kClientViewPaddingRight, | 179 -kClientViewPaddingRight, |
181 -kClientViewPaddingBottom); | 180 -kClientViewPaddingBottom); |
182 return window_bounds; | 181 return window_bounds; |
183 } | 182 } |
184 | 183 |
185 } | 184 } |
OLD | NEW |