| 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 #ifndef UI_VIEWS_SHADOW_BORDER_H_ | 5 #ifndef UI_VIEWS_SHADOW_BORDER_H_ |
| 6 #define UI_VIEWS_SHADOW_BORDER_H_ | 6 #define UI_VIEWS_SHADOW_BORDER_H_ |
| 7 | 7 |
| 8 #include "third_party/skia/include/core/SkColor.h" | 8 #include "third_party/skia/include/core/SkColor.h" |
| 9 #include "ui/gfx/shadow_value.h" |
| 9 #include "ui/views/border.h" | 10 #include "ui/views/border.h" |
| 10 #include "ui/views/views_export.h" | 11 #include "ui/views/views_export.h" |
| 11 | 12 |
| 12 namespace views { | 13 namespace views { |
| 13 | 14 |
| 14 // Creates a css box-shadow like border which fades into SK_ColorTRANSPARENT. | 15 // Creates a css box-shadow like border which fades into SK_ColorTRANSPARENT. |
| 15 class VIEWS_EXPORT ShadowBorder : public views::Border { | 16 class VIEWS_EXPORT ShadowBorder : public views::Border { |
| 16 public: | 17 public: |
| 17 ShadowBorder(int blur, | 18 explicit ShadowBorder(const gfx::ShadowValue& shadow); |
| 18 SkColor color, | |
| 19 int vertical_offset, | |
| 20 int horizontal_offset); | |
| 21 ~ShadowBorder() override; | 19 ~ShadowBorder() override; |
| 22 | 20 |
| 23 protected: | 21 protected: |
| 24 // Overridden from views::Border: | 22 // Overridden from views::Border: |
| 25 void Paint(const views::View& view, gfx::Canvas* canvas) override; | 23 void Paint(const views::View& view, gfx::Canvas* canvas) override; |
| 26 gfx::Insets GetInsets() const override; | 24 gfx::Insets GetInsets() const override; |
| 27 gfx::Size GetMinimumSize() const override; | 25 gfx::Size GetMinimumSize() const override; |
| 28 | 26 |
| 29 private: | 27 private: |
| 30 // Blur amount of the shadow in pixels. For details on how blur is defined see | 28 // The shadow value to use for this border. |
| 31 // comments for blur_ in class ShadowValue. | 29 const gfx::ShadowValue shadow_value_; |
| 32 const int blur_; | |
| 33 | 30 |
| 34 // Shadow color. | 31 // The insets of this border. |
| 35 const SkColor color_; | 32 const gfx::Insets insets_; |
| 36 | |
| 37 // Number of pixels to shift shadow to bottom. | |
| 38 const int vertical_offset_; | |
| 39 | |
| 40 // Number of pixels to shift shadow to right. | |
| 41 const int horizontal_offset_; | |
| 42 | 33 |
| 43 DISALLOW_COPY_AND_ASSIGN(ShadowBorder); | 34 DISALLOW_COPY_AND_ASSIGN(ShadowBorder); |
| 44 }; | 35 }; |
| 45 | 36 |
| 46 } // namespace views | 37 } // namespace views |
| 47 | 38 |
| 48 #endif // UI_VIEWS_SHADOW_BORDER_H_ | 39 #endif // UI_VIEWS_SHADOW_BORDER_H_ |
| OLD | NEW |